Abstract: Recent work has shown that recurrent neural networks (RNNs) can implicitly capture and exploit hierarchical information when trained to solve common natural language processing tasks such as language modeling and neural machine translation. In contrast, the ability to model structured data with non-recurrent neural networks has received little attention despite their success in many NLP tasks. In this work, we compare the two architectures—recurrent versus non-recurrent—with respect to their ability to model hierarchical structure and find that recurrency is indeed important for this purpose.
Introduction
While non-recurrent models like the Transformer have become the gold standard for speed and performance in NLP, they may lack a crucial ingredient: recurrency. Human language is fundamentally hierarchical, composed of nested structures like clauses and phrases. This paper investigates whether the lack of a recurrent connection hinders a model's ability to implicitly learn these hierarchical structures by comparing LSTMs against "Fully Attentional Networks" (FANs).
Architectural Comparison
The researchers conducted a head-to-head comparison between two distinct architectures:
- LSTM (Long Short-Term Memory): A recurrent model that updates a summary vector at each time step. To access information from the past, it must pass it through recursive operations, creating a computational bottleneck that forces the model to learn structured representations.
- FAN (Fully Attentional Network): A non-recurrent model (specifically the Transformer encoder) that uses self-attention. It can access any previous state in $O(1)$ operations, providing "perfect memory" without recursive compression.
Experimental Methodology
The models were evaluated on two tasks designed to probe structural understanding:
- Subject-Verb Agreement: Predicting the correct number (singular/plural) of a verb based on its subject in English sentences. This task often includes "attractors" (nouns of the opposite number) to test the model's syntactic robustness.
- Logical Inference: An artificial language task requiring the prediction of logical relationships (e.g., entailment) between nested formulas, testing semantic nesting capabilities.
Key Results and Insights
The Power of the Recurrent Bottleneck
Counter-intuitively, the LSTM's need to compress information into a single vector serves as a strength. This pressure forces the model to prioritize and structure syntactic information. In contrast, while FANs have direct access to every word, they are more easily distracted by attractors. For example, in the sentence "The keys to the cabinet are...", a FAN is more likely than an LSTM to incorrectly link the verb to "cabinet" instead of "keys."
Performance and Generalization
As shown in Figure 5, LSTMs consistently outperformed FANs across both tasks. The performance gap widened significantly as the distance between the subject and verb increased and as the number of attractor nouns grew. Furthermore, LSTMs demonstrated a superior ability to generalize to higher complexity; when tested on deeply nested logical formulas far beyond those seen during training, LSTMs maintained much higher accuracy than FANs.
Conclusion
These findings suggest that for tasks where hierarchical structure is the primary challenge, recurrency is a key model property that should not be sacrificed for efficiency. While Transformers excel in global reach and parallelization, the inductive bias provided by recurrent connections remains vital for capturing the inherent hierarchy of language. Future research may explore hybrid architectures that integrate this recurrent bias into attentional models.
Summary updated