[Paper Review] Transformers Generalize Linearly
This paper investigates whether Transformers exhibit an inductive bias toward hierarchical generalization in syntactic sequence-to-sequence tasks, particularly when training data is ambiguous between linear and hierarchical patterns. Despite strong performance on in-distribution data, Transformers consistently fail on out-of-distribution generalization tasks requiring hierarchical structure, showing a pronounced preference for linear generalization—outperforming even recurrent networks in this bias.
Natural language exhibits patterns of hierarchically governed dependencies, in which relations between words are sensitive to syntactic structure rather than linear ordering. While re-current network models often fail to generalize in a hierarchically sensitive way (McCoy et al.,2020) when trained on ambiguous data, the improvement in performance of newer Trans-former language models (Vaswani et al., 2017)on a range of syntactic benchmarks trained on large data sets (Goldberg, 2019; Warstadtet al., 2019) opens the question of whether these models might exhibit hierarchical generalization in the face of impoverished data.In this paper we examine patterns of structural generalization for Transformer sequence-to-sequence models and find that not only do Transformers fail to generalize hierarchically across a wide variety of grammatical mapping tasks, but they exhibit an even stronger preference for linear generalization than comparable recurrent networks
Motivation & Objective
- To determine whether Transformers exhibit an inductive bias toward hierarchical generalization in syntactic sequence-to-sequence tasks.
- To compare the generalization behavior of Transformers with recurrent networks (LSTMs, GRUs) under identical, ambiguous training data.
- To assess whether success on syntactic benchmarks stems from architectural inductive bias or from exposure to large-scale training data.
- To evaluate generalization on out-of-distribution test sets that disambiguate between linear and hierarchical generalization patterns.
- To investigate whether the observed syntactic success of Transformers is due to architectural inductive bias or data-driven pattern learning.
Proposed method
- Designing four English-language transduction tasks with ambiguous training data that allow both linear and hierarchical generalization.
- Creating in-distribution test sets and out-of-distribution generalization (gen) sets to distinguish between linear and hierarchical generalization patterns.
- Training Transformer models (4-headed, 3-layer, 128-dim) and recurrent models (LSTMs, GRUs) with and without attention (additive/multiplicative) on the same data.
- Using a single-layer architecture with 256-dimensional hidden and embedding spaces for recurrent models, and 10 random weight initializations per model type.
- Evaluating models using median accuracy across 10 runs, with metrics focusing on full-sequence accuracy and placement of key elements (e.g., negation markers, reflexive antecedents).
- Categorizing model predictions into reflexive-linear, subject-linear, and hierarchical classes to assess generalization strategy on anaphora tasks.
Experimental results
Research questions
- RQ1Does the Transformer architecture exhibit a bias toward hierarchical generalization when training data is ambiguous between linear and hierarchical patterns?
- RQ2How does the generalization performance of Transformers compare to that of recurrent networks (LSTMs, GRUs) on out-of-distribution syntactic generalization tasks?
- RQ3To what extent do Transformers' successes on syntactic benchmarks stem from architectural inductive bias versus exposure to large-scale training data?
- RQ4Can models trained on ambiguous data correctly generalize to hierarchical structures when the linear pattern is also consistent with training data?
- RQ5What is the relative strength of linear versus hierarchical generalization preferences in different neural architectures?
Key findings
- Transformers achieve near-ceiling performance on in-distribution test sets across all tasks, indicating strong pattern learning from training data.
- On out-of-distribution generalization sets, Transformers uniformly fail, achieving near-zero accuracy on tasks requiring hierarchical generalization (e.g., neg-main, reflexive anaphora).
- All models, including Transformers, overwhelmingly prefer linear generalization strategies (e.g., neg-first, reflexive-linear) on the gen sets, even when hierarchical patterns are the only consistent generalization.
- LSTMs show the highest median hierarchical performance (65.8%) on the reflexive anaphora task, outperforming Transformers and GRUs.
- The preference for linear generalization is consistent across all tasks and model types, with Transformers showing the strongest bias toward linear patterns.
- The results suggest that Transformers' success on syntactic benchmarks is not due to an inherent inductive bias for hierarchical structure, but rather to data-driven pattern learning from massive corpora.
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.