[Paper Review] Can RNNs learn Recursive Nested Subject-Verb Agreements?
This paper investigates whether recurrent neural networks (RNNs) can learn recursive nested subject-verb agreement, a syntactic challenge requiring long-range dependencies and hierarchical structure. Through systematic experiments on various RNN architectures—including LSTMs, GRUs, ON-LSTMs, stack-RNNs, and stack-LSTMs—it demonstrates that standard RNNs fail to generalize beyond training distribution, while stack-based models show limited success in capturing recursive dependencies, especially with increased depth and spacing.
One of the fundamental principles of contemporary linguistics states that language processing requires the ability to extract recursively nested tree structures. However, it remains unclear whether and how this code could be implemented in neural circuits. Recent advances in Recurrent Neural Networks (RNNs), which achieve near-human performance in some language tasks, provide a compelling model to address such questions. Here, we present a new framework to study recursive processing in RNNs, using subject-verb agreement as a probe into the representations of the neural network. We trained six distinct types of RNNs on a simplified probabilistic context-free grammar designed to independently manipulate the length of a sentence and the depth of its syntactic tree. All RNNs generalized to subject-verb dependencies longer than those seen during training. However, none systematically generalized to deeper tree structures, even those with a structural bias towards learning nested tree (i.e., stack-RNNs). In addition, our analyses revealed primacy and recency effects in the generalization patterns of LSTM-based models, showing that these models tend to perform well on the outer- and innermost parts of a center-embedded tree structure, but poorly on its middle levels. Finally, probing the internal states of the model during the processing of sentences with nested tree structures, we found a complex encoding of grammatical agreement information (e.g. grammatical number), in which all the information for multiple words nouns was carried by a single unit. Taken together, these results indicate how neural networks may extract bounded nested tree structures, without learning a systematic recursive rule.
Motivation & Objective
- To evaluate whether recurrent neural networks can learn recursive, nested subject-verb agreement in synthetic syntactic structures.
- To assess generalization capabilities of different RNN architectures beyond the training distribution in terms of depth and spacing.
- To investigate the role of architectural inductive biases—such as stack-based memory or chunked computation—in enabling learning of hierarchical syntactic dependencies.
- To determine whether models trained on varying probabilities of singular/plural subjects can generalize to longer or more complex recursive structures.
Proposed method
- Synthetic datasets were generated with controlled probabilities (p1, p2) for singular/plural subjects, varying depth (d) and spacing (s) between subjects and verbs.
- Multiple RNN architectures were trained: standard LSTMs, GRUs, ON-LSTMs, stack-RNNs, and stack-LSTMs, with hyperparameters systematically varied across layers, hidden units, embedding size, and dropout.
- Models were trained for 20 epochs (3 for stack models) using ADAM optimizer with a fixed learning rate of 1e-3 and early stopping based on validation perplexity.
- Performance was evaluated on number-agreement tasks, measuring accuracy per verb in sentences with increasing depth and spacing.
- Cell dynamics and PCA analysis were used to examine internal representations, particularly to detect counter-like or hierarchical state patterns.
- Test perplexity and accuracy matrices were visualized across different (d, s) combinations to assess generalization beyond training distribution.
Experimental results
Research questions
- RQ1Can standard RNNs like LSTMs and GRUs generalize to recursive subject-verb agreement beyond the maximum depth and spacing seen during training?
- RQ2Do architectural innovations such as stack-RNNs or ON-LSTMs improve generalization on recursive syntactic dependencies compared to standard RNNs?
- RQ3How do varying training data distributions (p1, p2) affect model performance and generalization on unseen (d, s) combinations?
- RQ4Do internal cell states of trained models exhibit dynamics consistent with counting or tracking recursive dependencies?
- RQ5To what extent do attention or memory mechanisms in ON-LSTMs and stack-based models support the learning of hierarchical syntactic structures?
Key findings
- Standard LSTMs and GRUs failed to generalize to recursive structures beyond the maximum depth and spacing seen during training, achieving near-zero accuracy on unseen (d, s) combinations.
- ON-LSTMs showed improved performance over standard LSTMs, particularly in handling longer spacing, but still failed to generalize to deeper recursive structures.
- Stack-RNNs and stack-LSTMs demonstrated the strongest generalization, achieving non-trivial accuracy on deeper structures (d=3) and longer spacing (s=12), though performance dropped significantly beyond training limits.
- PCA analysis of cell states revealed counter-like dynamics in successful models, suggesting they learn to track the number of nested dependencies through state evolution.
- The optimal model was selected based on validation perplexity, and results showed that models trained on balanced data (p1=p2=0.5) generalized better than those trained on skewed distributions.
- Visualizations of cell dynamics indicated that successful models encoded subject number and nesting depth through distinct, stable state patterns across time steps.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.