vix.ing · top · new · best · stats · spec

How transformers learn structured data: insights from hierarchical filtering

2024/08/27 by Jérôme Garnier-Brun, Marc Mézard, Garnier-Brun, Jerome +5 · 6 citations
Engineering · #Computation and Language (cs.CL) #Disordered Systems and Neural Networks (cond-mat.dis-nn) #Energy Load and Power Forecasting #FOS: Computer and information sciences #FOS: Physical sciences #Machine Learning (cs.LG) #Statistical Mechanics (cond-mat.stat-mech)

paper · pdf · doi:10.48550/arxiv.2408.15138

openalex publication_date 2024/08/27 · openalex created_date 2025/10/10 · openalex updated_date 2026/07/28

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 hand-tune 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.

Cited by

Related