Lune

ICML2025Top-tier venue

How Transformers Learn Structured Data: Insights From Hierarchical Filtering

Jerome Garnier-Brun, Marc Mézard, Emanuele Moscato, Luca Saglietti

Abstract

Understanding the learning process and the embedded computation in transformers is becoming a central goal for the development of interpretable AI. In the present study, we introduce a hierarchical filtering procedure for data models of sequences on trees, allowing us to handtune the range of positional correlations in the data. Leveraging this controlled setting, we provide evidence that vanilla encoder-only transformers can approximate the exact inference algorithm when trained on root classification and masked language modeling tasks, and study how this computation is discovered and implemented. We find that correlations at larger distances, corresponding to increasing layers of the hierarchy, are sequentially included by the network during training. By comparing attention maps from models trained with varying degrees of filtering and by probing the different encoder levels, we find clear evidence of a reconstruction of correlations on successive length scales corresponding to the various levels of the hierarchy, which we relate to a plausible implementation of the exact inference algorithm within the same architecture.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

9 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • A distributional simplicity bias in the learning dynamics of transformers cites Neural networks trained with SGD learn distributions of increasing complexity
  • A distributional simplicity bias in the learning dynamics of transformers cites Towards a theory of how the structure of language is acquired by deep neural networks
  • Towards a theory of how the structure of language is acquired by deep neural networks cites A distributional simplicity bias in the learning dynamics of transformers
  • Biased Generalization in Diffusion Models cites Neural networks trained with SGD learn distributions of increasing complexity
  • Biased Generalization in Diffusion Models cites A theory of learning data statistics in diffusion models, from easy to hard
  • Biased Generalization in Diffusion Models cites Probing the Latent Hierarchical Structure of Data via Diffusion Models
  • A theory of learning data statistics in diffusion models, from easy to hard cites A distributional simplicity bias in the learning dynamics of transformers
  • A theory of learning data statistics in diffusion models, from easy to hard cites Neural networks trained with SGD learn distributions of increasing complexity
  • Probing the Latent Hierarchical Structure of Data via Diffusion Models cites Towards a theory of how the structure of language is acquired by deep neural networks
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers9

  1. A distributional simplicity bias in the learning dynamics of transformersRiccardo Rende, Federica Gerace, Alessandro Laio, Sebastian GoldtNeurIPS 2024 · 30 citations
  2. Biased Generalization in Diffusion ModelsLuca Saglietti, Luca Biggio, Jerome Garnier-Brun, Davide Beltrame et al.ICML 2026 · 2 citations
  3. On the Bias of Next-Token Predictors Toward Systematically Inefficient Reasoning: A Shortest-Path Case StudyRiccardo Alberghi, Elizaveta Demyanenko, Luca Biggio, Luca SagliettiNeurIPS 2025 · 2 citations
  4. A theory of learning data statistics in diffusion models, from easy to hardLorenzo Bardone, Claudia Merger, Sebastian GoldtICML 2026
  5. Probing the Latent Hierarchical Structure of Data via Diffusion ModelsAntonio Sclocchi, Alessandro Favero, Noam Itzhak Levi, Matthieu WyartICLR 2025

Builds on10

  1. Thinking Like TransformersGail Weiss, Yoav Goldberg, Eran YahavICML 2021 · 183 citations
  2. The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural NetworksZiqian Zhong, Ziming Liu, Max Tegmark, Jacob AndreasNeurIPS 2023 · 181 citations
  3. Neural networks trained with SGD learn distributions of increasing complexityMaria Refinetti, Alessandro Ingrosso, Sebastian GoldtICML 2023 · 58 citations
  4. Towards a theory of how the structure of language is acquired by deep neural networksFrancesco Cagnetta, Matthieu WyartNeurIPS 2024 · 33 citations
  5. A distributional simplicity bias in the learning dynamics of transformersRiccardo Rende, Federica Gerace, Alessandro Laio, Sebastian GoldtNeurIPS 2024 · 30 citations

Related papers

  1. Theoretical Analysis of Hierarchical Language Recognition and Generation by Transformers without Positional EncodingDaichi Hayakawa, Issei SatoACL 2025
  2. Characterizing intrinsic compositionality in transformers with Tree ProjectionsShikhar Murty, Pratyusha Sharma, Jacob Andreas, Christopher D. ManningICLR 2023 · 13 citations
  3. How Transformers Represent Hierarchies: A Local-to-Global MechanismZhiling Zhou, Tianhao Wang, Zhuoran YangICML 2026
  4. Algorithmic Capabilities of Random TransformersZiqian Zhong, Jacob AndreasNeurIPS 2024 · 23 citations
  5. Internal Planning in Language Models: Characterizing Horizon and Branch AwarenessMuhammed Ustaomeroglu, Baris Askin, Gauri Joshi, Carlee Joe-Wong et al.ICLR 2026
Dusk over the sea between two cliffs drawn in fine vertical lines