Research & Papers

New theory explains abrupt emergence of copy heads in transformers

Researchers derived a Bayesian theory revealing first-order phase transitions in attention...

Deep Dive

A new preprint on arXiv (arXiv:2606.12058) from Itay Lavie and co-authors presents a Bayesian theory that explains why certain attention patterns, particularly copy heads, emerge abruptly during transformer training. The work focuses on the first layer of an induction head—a subcircuit critical for in-context learning—using a single-layer softmax attention network trained on a simple copy task. By deriving a closed-form posterior over the attention matrix, the team reduces the learning dynamics to a low-dimensional order parameter space, where they identify a clear phase transition driven by the amount of training data.

The key finding is that softmax attention exhibits a first-order phase transition—meaning the structured copy pattern appears suddenly once enough data is seen. In contrast, linear attention shows a second-order phase transition that then evolves smoothly (a crossover) into the final pattern. These theoretical predictions are verified both via Bayesian sampling and standard Adam optimization, offering a first-principles explanation of the abrupt pattern emergence observed empirically in large language models. The work bridges statistical mechanics and deep learning, providing a rigorous foundation for understanding how attention heads specialize during training.

Key Points
  • Bayesian theory predicts a first-order phase transition for softmax attention in copy tasks
  • Linear attention shows only a second-order transition followed by gradual crossover
  • Theoretical predictions validated via both Bayesian sampling and standard Adam training

Why It Matters

Provides a mathematical explanation for sudden emergence of inductive capabilities in transformers, guiding future architecture design.

📬 Get the top 10 AI stories daily