Phase Transitions in Attention: A Bayesian Theory of Copy Head Emergence

Itay Lavie, Kirsten Fischer, Andrey Lekov, Frederic Van Maele, Zohar Ringel +1 more
6/10/2026
stat.MLcond-mat.dis-nncs.LG

No confident code implementation found for this paper.

Abstract

Attention is the key mechanism underlying in-context learning in transformers, and attention patterns have been observed empirically to emerge abruptly during training. We present a Bayesian theory of feature learning in attention; we then focus on how the copy subcircuit in the first layer of an induction head is learned by analyzing a single-layer softmax attention network trained on a copy task. We derive a closed-form posterior over the attention matrix and reduce it to a low-dimensional order parameter space. This reduction reveals a phase transition in the amount of training data, which we verify using both Bayesian sampling and standard training with Adam. We contrast our results with linear attention and find that softmax attention exhibits a \emph{first-order phase transition} while in linear attention an initial \emph{second-order phase transition} is followed by a smooth, continuous evolution toward the structured attention pattern (\emph{crossover}). Our work provides a first-principles theoretical account of the abrupt emergence of the copy subcircuit, reminiscent of the one observed in training large language models.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{lavie2026phase,
  title  = {Phase Transitions in Attention: A Bayesian Theory of Copy Head Emergence},
  author = {Itay Lavie and Kirsten Fischer and Andrey Lekov and Frederic Van Maele and Zohar Ringel and Moritz Helias},
  year   = {2026},
  eprint = {2606.12058},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.12058v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.12058.svg)](https://codeofpaper.com/paper/2606.12058)

Discussion