Lune

AAAI2022顶会

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

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 4 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • In-Context Learning Dynamics with Random Binary Sequences 引用了 Language Models are Few-Shot Learners
  • Mechanistically analyzing the effects of fine-tuning on procedurally defined tasks 引用了 Language Models are Few-Shot Learners
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper4

  1. Mechanistically analyzing the effects of fine-tuning on procedurally defined tasksSamyak Jain, Robert Kirk, Ekdeep Singh Lubana, Robert P. Dick 等ICLR 2024 · 108 次引用
  2. Everyone's Preference Changes Differently: A Weighted Multi-Interest Model For RetrievalHui Shi, Yupeng Gu, Yitong Zhou, Bo Zhao 等ICML 2023 · 15 次引用
  3. In-Context Learning Dynamics with Random Binary SequencesEric J. Bigelow, Ekdeep Singh Lubana, Robert P. Dick, Hidenori Tanaka 等ICLR 2024 · 13 次引用
  4. 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

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. RNNs can generate bounded hierarchical languages with optimal memoryJohn Hewitt, Michael Hahn, Surya Ganguli, Percy Liang 等EMNLP 2020 · 1 次引用

相关 Paper

  1. Stack Attention: Improving the Ability of Transformers to Model Hierarchical PatternsBrian DuSell, David ChiangICLR 2024 · 15 次引用
  2. Recursive Transformer: Boosting Reasoning Ability with State StackKechi Zhang, Ge Li, Jia Li, Huangzhao Zhang 等NeurIPS 2025 · 1 次引用
  3. On the Ability and Limitations of Transformers to Recognize Formal LanguagesSatwik Bhattamishra, Kabir Ahuja, Navin GoyalEMNLP 2020 · 7 次引用
  4. Context-free Recognition with TransformersSelim Jerad, Anej Svete, Sophie Hao, Ryan Cotterell 等ICML 2026 · 3 次引用
  5. How Transformers Represent Hierarchies: A Local-to-Global MechanismZhiling Zhou, Tianhao Wang, Zhuoran YangICML 2026
黄昏的海面,两侧是细线勾勒的悬崖