Learning Bounded Context-Free-Grammar via LSTM and the Transformer: Difference and the Explanations
Hui Shi, Sicun Gao, Yuandong Tian, Xinyun Chen, Jishen Zhao
摘要
Long Short-Term Memory (LSTM) and Transformers are two popular neural architectures used in natural language processing tasks. Theoretical results show that both are Turingcomplete and can represent any context-free languages (CFLs). In practice, it is often observed that the Transformer models have better representation power than the LSTM. But the reason is barely understood. We study such practical differences between LSTM and the Transformer and propose an explanation based on their latent space decomposition patterns. To achieve this goal, we introduce an oracle training paradigm, which forces the decomposition of the latent representation of LSTM and the Transformer, and supervises with the transitions of the corresponding Pushdown Automaton (PDA) of the CFL. With the forced decomposition, we show that the performance upper bounds of LSTM and the Transformer in learning CFL are close: both of them can simulate a stack and perform stack operation along with state transitions. However, the absence of forced decomposition leads to the failure of LSTM models to capture the stack and stack operations, while having a marginal impact on the Transformer model. Lastly, we connect the experiment on the prototypical PDA to a real-world parsing task to re-verify the conclusions. 1
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper4
- Mechanistically analyzing the effects of fine-tuning on procedurally defined tasksSamyak Jain, Robert Kirk, Ekdeep Singh Lubana, Robert P. Dick 等ICLR 2024 · 被引用 108 次
- Everyone's Preference Changes Differently: A Weighted Multi-Interest Model For RetrievalHui Shi, Yupeng Gu, Yitong Zhou, Bo Zhao 等ICML 2023 · 被引用 15 次
- In-Context Learning Dynamics with Random Binary SequencesEric J. Bigelow, Ekdeep Singh Lubana, Robert P. Dick, Hidenori Tanaka 等ICLR 2024 · 被引用 13 次
- Fine-tuning vs. In-context Learning in Large Language Models: A Formal Language Learning PerspectiveBishwamittra Ghosh, Soumi Das, Till Speicher, Qinyuan Wu 等ACL 2026
它引用的顶会 Paper2
相关 Paper
- Stack Attention: Improving the Ability of Transformers to Model Hierarchical PatternsBrian DuSell, David ChiangICLR 2024 · 被引用 15 次
- Recursive Transformer: Boosting Reasoning Ability with State StackKechi Zhang, Ge Li, Jia Li, Huangzhao Zhang 等NeurIPS 2025 · 被引用 1 次
- On the Ability and Limitations of Transformers to Recognize Formal LanguagesSatwik Bhattamishra, Kabir Ahuja, Navin GoyalEMNLP 2020 · 被引用 7 次
- Context-free Recognition with TransformersSelim Jerad, Anej Svete, Sophie Hao, Ryan Cotterell 等ICML 2026 · 被引用 3 次
- How Transformers Represent Hierarchies: A Local-to-Global MechanismZhiling Zhou, Tianhao Wang, Zhuoran YangICML 2026
