Introduction
While Transformers have revolutionized natural language processing, they possess an inherent "flat" architectural bias. Human language, by contrast, is fundamentally recursive, characterized by nested clauses and hierarchical phrase structures. Standard self-attention mechanisms lack an explicit way to track this hierarchical state, often struggling with "long-tail" recursive structures—such as complex center-embedding—and requiring massive datasets to learn basic syntactic rules.
Previous attempts to introduce structural bias often relied on "hard" constraints, such as masking, or complex decoding procedures that compromised the model's parallelizability. This paper introduces Pushdown Layers, a novel drop-in replacement for standard self-attention that equips Transformers with an explicit, stack-based memory without sacrificing efficiency.
The Pushdown Layer Architecture
The core innovation of the Pushdown Layer is the integration of a pushdown automaton's logic into the attention mechanism. This is achieved through three primary components:
- The Stack Tape: A dynamic record of the "depth" of every token within an incremental parse. For example, in the phrase "[The dog] is...", the tokens "The" and "dog" are assigned a specific depth within their noun phrase constituent.
- The Attachment Head: As the model processes a new token, this head makes a probabilistic decision to either "shift" (initiating a new constituent) or "reduce" (merging the token with an existing constituent), mimicking a stack-based computer.
- Depth-Modulated Attention: The depths from the stack tape are mapped to depth embeddings and added to the attention keys. This allows the model to "softly" bias its attention, learning to ignore tokens in "closed" constituents or focus on the heads of nested phrases.
Because the stack tape can be pre-computed from parsed data during training, the model remains highly parallelizable, maintaining the core advantage of the Transformer architecture.
Experimental Setup
The researchers evaluated Pushdown Layers across a diverse set of benchmarks:
- Dyck Languages: Synthetic datasets of nested brackets to test pure recursive processing.
- BLLIP-LG & WikiTrees: Standard and newly introduced corpora for sentence-level language modeling, the latter providing 100 million tokens with "silver" constituency parses.
- BLIMP & SG Test Suites: Benchmarks designed to measure linguistic phenomena like subject-verb agreement and center embedding.
- GLUE: Evaluation of downstream task performance, including sentiment analysis (SST5) and natural language inference (RTE).
Results and Key Insights
Pushdown-LMs demonstrate significant improvements in both sample efficiency and syntactic generalization. A Pushdown Transformer trained on only 10 million tokens can outperform a standard Transformer trained on 40 million tokens on syntactic tasks, representing a 3–5x gain in efficiency.
Key findings include:
- Syntactic Generalization: On Dyck languages with deeper nesting than seen during training, Pushdown-LMs improved accuracy by over 25% compared to baselines.
- Attention "Skipping": Analysis shows the model successfully learns to ignore distractor words (e.g., a plural noun between a singular subject and verb), a common failure mode for standard Transformers.
- Internal Parsing: The model's internal attachment decisions are remarkably accurate, achieving a 95.3 F1 score on unlabeled parsing for the Penn Treebank (PTB).
Limitations and Future Work
Despite its success, the current implementation depends on "silver" parses from external parsers during training, which may limit its application in low-resource languages. Additionally, storing depth embeddings increases the memory footprint relative to standard self-attention. Future research aims to develop unsupervised Pushdown Layers, allowing the model to induce hierarchical structures without external supervision.
Summary updated