atlas

Research map / Architectures and efficiency / Attention and transformers

How Transformers Learn Structured Data: Insights From Hierarchical Filtering

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Introduces a filtered hierarchical tree-based data model with exact Belief Propagation inference and shows that encoder-only transformers trained on root classification and masked language modeling approximate BP, learning longer-range correlations sequentially and implementing BP-like computation across layers.

Problem

Understanding how transformers implement and learn optimal inference on hierarchically structured sequences, where correlations span different length scales.

Approach

A tunable filtered hierarchical tree model of sequences (log-normal transition tensor, filtering parameter k truncating hierarchy) gives access to exact BP marginals, allowing calibrated comparison of transformer outputs with the exact algorithm, attention-map analysis, and layer-wise probing of ancestor information.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Train an encoder-only transformer on root classificationVanilla encoder-only transformer · Root classification on hierarchical sequencesaccuracyHelped
Train an encoder-only transformer with masked language modelingVanilla encoder-only transformer · Masked language modeling on hierarchical sequencesaccuracyHelped
Use MLM pretraining before root-classification fine-tuningTransformer encoder · Root classification on fully hierarchical datalabeled training samples required for optimal inferenceHelped
Use more attention layers (ablation)Transformer on root classification · Unfiltered hierarchical datasample efficiencyHelped
Reduce attention layers from 4 to 3 (ablation)Transformer on root classification · Unfiltered hierarchical dataaccuracyNo clear effect
Reduce attention layers to 1 (ablation)Transformer on root classification · Unfiltered hierarchical datasample efficiencyHurt
Use a single feed-forward layer instead of attention for fully filtered data (ablation)Transformer on root classification · Fully filtered hierarchical datainference accuracyNo clear effect
Train on full hierarchy and test on data with different filtering levelsTransformer trained on k_train=0 data · Root classification, filtered test dataaccuracyMixed
Train on fully hierarchical data for longerTransformer on root classification · Root classification during trainingalignment with BP predictionsHelped
Train on fully hierarchical data for longerTransformer on masked language modeling · Masked language modeling during trainingalignment with BP predictionsHelped
Use fewer attention layers than tree depth (ablation)Transformer on root classification · Unfiltered hierarchical dataaccuracyMixed
Train the model on filtered rather than fully hierarchical data (ablation)Transformer encoder · Attention maps on masked language modelingalignment with the hierarchical correlation structureMixed

Surprising findings

Limitations

Experimental setup

Datasets: synthetic hierarchical tree-generated sequences

Benchmarks: synthetic root classification accuracy synthetic masked language modeling accuracy

Metrics: accuracy Kullback-Leibler divergence Spearman correlation prediction match

Baselines: Belief Propagation oracle (BP_k)

Builds on: Random Hierarchy Model probabilistic context-free grammars inside-outside algorithm transformer encoder

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy