Towards Better Modeling Hierarchical Structure for Self-Attention with Ordered Neurons

Jie Hao, Xing Wang, Shuming Shi, Jinfeng Zhang, Zhaopeng Tu

Abstract

Self-Attention Networks (SANs) have revolutionized natural language processing but often struggle to capture the inherent hierarchical structure of language. This paper investigates the integration of Ordered Neurons LSTM (ON-LSTM) into SAN architectures to provide a structural inductive bias. We propose a cascaded encoder that combines the sequential, tree-like modeling of ON-LSTM with the global attention of SANs. Our results demonstrate significant improvements in machine translation performance and syntactic understanding, particularly as sentence complexity increases.

Introduction

Language is not merely a sequence of tokens; it is a nested hierarchy of phrases and clauses. While the Transformer's self-attention mechanism excels at capturing long-range dependencies, it lacks an explicit mechanism for modeling this hierarchical structure. Previous research has shown that hybrid models combining Recurrent Neural Networks (RNNs) and SANs outperform pure architectures, yet the underlying reasons for this success have remained under-explored. This work hypothesizes that RNNs provide the necessary structural foundation that SANs lack.

Methodology

The authors introduce a Cascaded Encoder designed to prioritize structural modeling through several key enhancements:

  1. ON-LSTM Integration: Unlike standard LSTMs, ON-LSTMs use a specialized gating mechanism to update neurons at different frequencies. High-ranking neurons track long-term, high-level structures (like sentence-level themes), while low-ranking neurons track short-term, low-level details.
  2. Stacking Strategy: Empirical testing revealed that stacking SANs on top of ON-LSTM layers is the most effective configuration. This allows the model to extract structural features before applying global attention.
  3. Short-Cut Connections: To preserve structural information throughout the network, the outputs of the ON-LSTM and SAN layers are explicitly summed: $\mathbf{\hat{H}} = \mathbf{H}_{ON-LSTM}^K + \mathbf{H}_{SANs}^L$.

Experimental Results

The proposed architecture was evaluated on the WMT14 English-German translation task. The hybrid model demonstrated superior performance across both "Base" and "Big" configurations.

Table 1: BLEU scores for various encoder architectures on WMT14 En-De.

As shown in the table above, the Hybrid Model with short-cut connections achieved a BLEU score of 28.37 in the base setting and 29.30 in the big setting, consistently outperforming vanilla SAN and LSTM baselines. Notably, the hybrid model with fewer layers (3L ON-LSTM + 3L SANs) outperformed deeper individual models, suggesting that architectural bias is more critical than raw parameter count.

Analysis of Structural Understanding

To verify if the performance gains stem from better hierarchical modeling, the authors tested the model on logical inference tasks involving nested operators (and, or, not).

Figure 1: Accuracy vs. Number of Logical Operators for different model architectures.

The results in Figure 1 highlight a critical difference: while vanilla SANs experience a sharp decline in accuracy as the number of logical operators increases, the hybrid model maintains significantly higher performance. This suggests that the hybrid architecture truly "understands" the underlying nested logic rather than simply memorizing surface patterns. Furthermore, in syntactic probing tasks (SentEval), the hybrid model outperformed vanilla SANs by over 13 points on average (74.36 vs 60.66), proving it captures much richer structural information.

Conclusion

This study confirms that the primary benefit of hybrid SAN-RNN models is their ability to capture hierarchical context. By using ON-LSTM as a foundation, the attention mechanism can operate on "structure-aware" representations. Future work will explore integrating ordered neuron concepts directly into the self-attention mechanism to eliminate the sequential bottleneck of recurrent layers while retaining their structural benefits.

Summary updated

BibTeX
@inproceedings{hao2019towards,
  author = {Jie Hao and Xing Wang and Shuming Shi and Jinfeng Zhang and Zhaopeng Tu},
  title = {{Towards Better Modeling Hierarchical Structure for Self-Attention with Ordered Neurons}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2019},
  url = {https://openreview.net/forum?id=tldxAOU8Wf},
}
Figure