Stagewise and interpretable emergence of inside-outside computation in Transformer-based language models
Abstract
Variability in syntactic structure and parsing ambiguity are fundamental aspects of natural language which modern LLMs have to learn to deal with proficiently. Previous "post-mortem" studies have shown that fully trained Transformers indeed approximate canonical parsing algorithms such as inside-outside, but little is established theoretically about how this is actually learned. Here, we make a first step towards addressing this by studying the learning dynamics in synthetic context-free grammars with variable parse tree topology. The stagewise learning curves are fully interpretable, in the sense that all of the loss stages a) can be computed analytically, and b) can be clearly associated to the representation of a hidden latent tree variable, which allows to lift ambiguity and utilize information from wider contexts. By probing representations, we visualize the emergence of inside-outside computation across depth and during training: while during early stages local (bigram/trigram) information is used and involves only a few initial layers, gradually the Transformer develops an encoder-decoder structure where the most abstract latent information is encoded in the middle, and the latter half of the network is used to progressively refine the final token prediction. This organization of computation is reminiscent of findings in real-world LLMs, and importantly applies here to a synthetic model which allows full analytical control of the data statistics, thus opening the door to theoretical progress.
Create a lesson
Metadata
- Categories
- cs.CL, cond-mat.dis-nn
- Comments
- (Submitted version) 22 pages, 10 figures
Related papers
Grammar Sparsity Sets How Transformers Learn Random Languages
Shared title terminologycs.CLEdgar Andres Hernandez Moreno, Francesco Cagnetta
From Large Language Models to Efficient System One Models via Adaptive Computation
Shared title terminologycs.CLMinh-Anh Nguyen
SMIC: Shared Multiscale Input-Reference Conditioning across Transformer Layers for Natural Language Inference
Shared title terminologycs.CLXin Zhang, Victor S. Sheng
Temporal Context-Aware Spam Detection Using Transformer-Based NLP Models
Shared title terminologycs.CLFariz Zeynalov, Razim Mammadli
How Post-Training Influences Verbalized Algorithmic Computation in Language Models
Shared title terminologycs.CLNiall Dalton
What drives the emergence of symbolic mechanisms in large language models?
Shared title terminologycs.CLMelody Zixuan Li, Taylor Webb