Lune

ICML2026顶会

How Transformers Represent Hierarchies: A Local-to-Global Mechanism

Zhiling Zhou, Tianhao Wang, Zhuoran Yang

问 Lune

摘要

Large language models built on autoregressive Transformers excel at next-token prediction, but it is unclear how their internal computations capture the latent hierarchical dependencies that often underlie language. We study this question in a controlled formal-language setting based on probabilistic context-free grammars (PCFGs), where sequences are generated by a latent hierarchical process. Empirically, standard autoregressive Transformers can be trained to accurately match the grammar-induced next-token distribution. Using probing analyses, we find that Transformer hidden states contain information used by classical parsing algorithms. Moreover, this information emerges through a layer-wise progression, revealing a local-to-global mechanism: early layers accumulate local patterns, while later layers aggregate them into a compact summary for next-token prediction. Complementing these empirical findings, we provide an explicit construction of Transformers that can parse binary PCFGs with depth logarithmic in the grammar's sequence length. Surprisingly, trained Transformers in this setting exhibit prediction behavior and internal representations that closely mirror our construction. Together, our results offer a mechanistic account of how Transformers integrate hierarchical parsing with autoregressive generation, enabling them to closely approximate the grammar-induced next-token distribution. Code is available at our GitHub repository.

问 Lune

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

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

可以从这些问题问起

Lune 可以查阅

全文 · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination Mitigation 引用了 Progress measures for grokking via mechanistic interpretability
  • Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Tracking 引用了 Progress measures for grokking via mechanistic interpretability
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

它引用的 Paper17

  1. Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity TrackingNikhil Prakash, Tamar Rott Shaham, Tal Haklay, Yonatan Belinkov 等ICLR 2024 · 113 次引用
  2. Transformers, parallel computation, and logarithmic depthClayton Sanford, Daniel Hsu, Matus TelgarskyICML 2024 · 64 次引用
  3. Progress measures for grokking via mechanistic interpretabilityNeel Nanda, Lawrence Chan, Tom Lieberum, Jess Smith 等ICLR 2023 · 54 次引用
  4. In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination MitigationShiqi Chen, Miao Xiong, Junteng Liu, Zhengxuan Wu 等ICML 2024 · 49 次引用
  5. Neural Networks and the Chomsky HierarchyGrégoire Delétang, Anian Ruoss, Jordi Grau-Moya, Tim Genewein 等ICLR 2023 · 45 次引用

相关 Paper

  1. Deep networks learn to parse uniform-depth context-free languages from local statisticsJack T. Parley, Francesco Cagnetta, Matthieu WyartICML 2026 · 4 次引用
  2. Towards a theory of how the structure of language is acquired by deep neural networksFrancesco Cagnetta, Matthieu WyartNeurIPS 2024 · 33 次引用
  3. Token-wise Decomposition of Autoregressive Language Model Hidden States for Analyzing Model PredictionsByung-Doh Oh, William SchulerACL 2023 · 1 次引用
  4. Unraveling Syntax: Language Modeling and the Substructure of GrammarsLaura Ying Schulz, Daniel Mitropolsky, Tomaso A PoggioICML 2026 · 5 次引用
  5. Approximating CKY with TransformersGhazal Khalighinejad, Ollie Liu, Sam WisemanEMNLP Findings 2023
黄昏的海面,两侧是细线勾勒的悬崖