Skip to main content

Spontaneous Symmetry Breaking in Multi-Head Attention (Part I)

Online saddles, replica phase diagrams, and the statistical–computational gap

Author

Matéo Roinard-Chauvet

Published

November 29, 2026

Multi-head attention is built on a striking symmetry: at initialization, all heads share the same architecture and play interchangeable roles. Yet during training, they spontaneously differentiate—some track syntactic dependencies, others copy tokens, others aggregate semantic context. From a physics perspective, head specialization is a spontaneous symmetry breaking transition.

In this two-part research note, I study this phenomenon in a minimal high-dimensional teacher–student attention model where both equilibrium statistical mechanics and exact training dynamics can be worked out analytically. In Part I, we dissect the online limit (\alpha \to \infty), map out the static equilibrium phase diagram at finite sample complexity (\alpha = N/d), and uncover a sharp statistical–computational gap where standard optimizers get trapped in spurious local minima. Part II will resolve this trapping mechanism out of equilibrium using Dynamical Mean-Field Theory (DMFT).

1. The Phenomenon and a “Hydrogen Atom” Model

When two identical attention heads are trained on data generated by two distinct target mechanisms, learning does not proceed smoothly. Instead, training unfolds in two distinct stages:

  1. Capture on a symmetric plateau: both heads collapse onto the same average direction, driving the loss down quickly—until they hit a metastable plateau where they cannot separate the two targets.
  2. Spontaneous symmetry breaking: after lingering on the plateau, an antisymmetric fluctuation amplifies exponentially. One head locks onto the first target feature, the other onto the second, and the generalization error collapses to zero.

To isolate this mechanism while keeping genuine nonlinear softmax competition across tokens, we define a two-head (H = 2) cross-attention model1. Each input is a sequence of L \ge 2 tokens with i.i.d. keys x_\ell \sim \mathcal{N}(0, I_d) and scalar values v_\ell \sim \mathcal{N}(0, 1). Each student head h \in \{1, 2\} has a trainable query vector w_h \in \mathbb{R}^d and outputs a softmax-weighted average of the values:

1 This vector-parameterized architecture is the minimal setting compatible with the high-dimensional scaling \alpha = N / d = O(1), echoing recent statistical-mechanics analyses of single-location softmax attention (Sagitova et al. 2026; Catteau et al. 2026).

Sagitova, A., O. Duranthon, and L. Zdeborová. 2026. “Specialization of Softmax Attention Heads: Insights from the High-Dimensional Single-Location Model.” arXiv Preprint arXiv:2603.03993.
Catteau, A., O. Duranthon, and L. Zdeborová. 2026. “Attention Head Specialization: Phase Transitions in Sample Complexity.” arXiv Preprint arXiv:2611.26228.

\hat{y}(X, v) = \sum_{h=1}^2 \sum_{\ell=1}^L A_{h,\ell}(X)\, v_\ell, \qquad A_{h,\ell}(X) = \frac{\exp(\beta \lambda_{h,\ell})}{\sum_{m=1}^L \exp(\beta \lambda_{h,m})}, \qquad \lambda_{h,\ell} \equiv \frac{1}{\sqrt{d}} w_h^\top x_\ell.

Targets y(X, v) are generated by a teacher of identical architecture with two orthonormal query vectors w_1^\star, w_2^\star \in \mathbb{R}^d (\frac{1}{d}(w_k^\star)^\top w_{k'}^\star = \delta_{kk'}), trained under squared loss \mathcal{L} = \frac{1}{2}(\hat{y} - y)^2.

By construction, \hat{y} is invariant under swapping the two heads (w_1 \leftrightarrow w_2). All macroscopic physics is captured by the student–teacher overlaps m_{hk} \equiv \frac{1}{d} w_h^\top w_k^\star and student correlations C_{hh'} \equiv \frac{1}{d} w_h^\top w_{h'}, conveniently decomposed into a symmetric overlap m_s and a specialization order parameter \epsilon:

m_s \equiv \frac{1}{4}\sum_{h,k=1}^2 m_{hk}, \qquad \epsilon \equiv \frac{1}{4}\left|m_{11} + m_{22} - m_{12} - m_{21}\right|.

On the symmetric plateau, both heads align with w_1^\star + w_2^\star (\epsilon = 0); perfect specialization corresponds to m_s = \epsilon = 0.5.

NoteWhy L \ge 3 matters (Proof Sketch — PDF Section 1.1 & Appendix A.2)

For L = 2 tokens, the softmax reduces to a sigmoid of w_h^\top(x_1 - x_2), and the constant offset cancels in \hat{y} - y. Up to a scalar factor (v_1 - v_2)/2, the model is mathematically equivalent to a classic two-unit soft committee machine with \tanh activation. Genuine multi-token softmax competition enters only for L \ge 3. See Technical PDF, Section 1.1.

2. The Online Limit: An Unstable Saddle Point

Before introducing finite datasets, consider the online regime (\alpha \to \infty), where every SGD step draws a fresh sample (X^\mu, v^\mu). Because each sample is independent of the current weights, there is no memory kernel: in the high-dimensional limit d \to \infty (with continuous time t = \mu / d), the order parameters (m, C) obey closed deterministic ordinary differential equations (ODEs) (Saad and Solla 1995), shown as the dashed curves in the figure below.

Saad, David, and Sara A. Solla. 1995. “On-Line Learning in Soft Committee Machines.” Physical Review E 52 (4): 4225–43.

Online specialization trajectories (L = 3, \beta = 2.5, d = 1000, \eta = 0.25) from isotropic random initialization. Mean \pm std over 20 PyTorch seeds (solid) compared against the closed high-dimensional ODEs (dashed).

Linearizing the gradient-flow ODEs (\tau = \eta t) around the symmetric plateau w_1 = w_2 = m_s(w_1^\star + w_2^\star) along the antisymmetric direction w_1 - w_2 \propto \epsilon (w_1^\star - w_2^\star) gives \frac{\mathrm{d}\epsilon}{\mathrm{d}\tau} = \gamma\,\epsilon + O(\epsilon^3), with Lyapunov exponent

\gamma = -\frac{\beta^2}{2}\,\mathbb{E}_X\!\left[\operatorname{Cov}_{\bar{A}}\!\left(\delta\bar{A},\, (\Delta\lambda^\star - \langle\Delta\lambda^\star\rangle_{\bar{A}})^2\right)\right] > 0,

where \Delta\lambda^\star_\ell = \lambda^\star_{1,\ell} - \lambda^\star_{2,\ell} measures how strongly the two teachers disagree on token \ell, and \delta\bar{A}_\ell = 2\bar{A}_\ell - (A^\star_{1,\ell} + A^\star_{2,\ell}) is the symmetric head’s attention error. On tokens where the two teachers strongly disagree, the averaged symmetric head underestimates the target attention weight (\delta\bar{A}_\ell < 0). The covariance is therefore negative, forcing \gamma > 0: the symmetric plateau is an unstable saddle point.

From an isotropic random initialization, the initial asymmetry scales as \epsilon(0) \sim O(d^{-1/2}). Exponential growth up to \epsilon \sim O(1) predicts a logarithmic escape time:

\tau_{\mathrm{esc}} \approx \frac{\ln d}{2\gamma} \quad \Longrightarrow \quad N_{\mathrm{esc}} = d \cdot \frac{\tau_{\mathrm{esc}}}{\eta} \sim d \ln d.

Logarithmic escape-time scaling across dimensions d \in \{100, \dots, 3200\} (100 seeds per d, \eta = 0.1, L = 3, \beta = 2.5). The empirical WLS slope (1.03 \pm 0.07) slightly exceeds the idealized zero-noise gradient-flow value 1/(2\gamma) = 0.77 due to orthogonal-norm renormalization along the plateau.
NoteProof Sketch — Online ODEs & Finite-\eta Renormalization (PDF Sections 1.2–1.4 & Appendices A–B)

Integrating out the Gaussian values v_\ell via Wick’s theorem yields closed equations for \dot{m} and \dot{C}, including an O(\eta^2) SGD diffusion term that survives as d \to \infty. On the plateau, residual orthogonal weight norm (C_{11} - 2m_s^2 > 0) softens the softmax instability and reduces the effective \gamma(\eta), quantitatively accounting for the difference between the idealized slope 0.77 and the empirical slope 1.03 \pm 0.07. Full derivations are in Technical PDF, Sections 1.2–1.4.

This sets our baseline: in one-pass online learning, specialization requires N \sim d \ln d samples. Can reusing a finite dataset of size N = \alpha d (\alpha = O(1)) break the symmetry at finite sample complexity?

3. Equilibrium at Finite \alpha: Replicas and Phase Diagram

We now fix a quenched training set \mathcal{D} of N = \alpha d examples and consider the global minimizers of the L_2-regularized empirical risk:

\mathcal{H}(W; \mathcal{D}) = \frac{1}{2}\sum_{\mu=1}^N \Delta_\mu(W)^2 + \frac{\rho}{2}\sum_{h=1}^2 \|w_h\|^2.

In the zero-temperature limit (\beta_{\mathrm{th}} \to \infty) of the Gibbs measure Z(\mathcal{D}) = \int \mathrm{d}W\, e^{-\beta_{\mathrm{th}}\mathcal{H}(W;\mathcal{D})}, a replica-symmetric (RS) calculation (Aubin et al. 2018) reduces the high-dimensional optimization problem to six scalar order parameters (m_\pm, S_\pm, V_\pm) in the symmetric/antisymmetric eigenbasis e_\pm = \frac{1}{\sqrt{2}}(1, \pm 1)^\top:

Aubin, Benjamin, Antoine Maillard, Jean Barbier, Florent Krzakala, Nicolas Macris, and Lenka Zdeborová. 2018. “The Committee Machine: Computational to Statistical Gaps in Learning a Two-Layers Neural Network.” Advances in Neural Information Processing Systems (NeurIPS) 31.
  • m_+ = 2 m_s and m_- = 2\epsilon track alignment with the teacher subspace;
  • S_\pm = S_{11} \pm S_{12} measure the variance of the weights orthogonal to the teacher subspace (S \equiv q - mm^\top);
  • V_\pm are the static susceptibilities governing how strongly local fields adjust to a training sample via a Moreau envelope.
NoteProof Sketch — RS Free Energy & Two Instabilities (PDF Sections 2.1–2.3 & Appendices C–D)

Linearizing the RS saddle-point equations around the symmetric branch (m_- = S_- = 0) uncovers two distinct instabilities:

  1. Specialization (m_- \neq 0): triggered when \alpha \gamma_{\mathrm{eff}}(\alpha, \rho) > \rho. In the weak-coupling limit V_- \to 0, \gamma_{\mathrm{eff}} reduces identically to the online Lyapunov exponent \gamma of Section 2.
  2. Orthogonal noise decorrelation (S_- > 0): even before \epsilon lifts off, the two heads can decorrelate within the subspace orthogonal to the teacher to reduce the cross-term 2 A_1^\top A_2 in the training loss.

Complete derivations and the implicitly stabilized Picard solver are detailed in Technical PDF, Sections 2.1–2.4.

Softmax Selectivity \beta

Use the slider below to slice through the static RS phase diagram at fixed L = 3 and \rho = 0.05. Watch how \epsilon(\alpha) lifts off continuously from zero (a second-order phase transition), preceded by a universal ridge of orthogonal noise decorrelation S_-(\alpha) > 0.

Collecting all \beta slices yields the global 2D static phase diagram below. Three structural features stand out: (i) the transition remains continuous even in the sharp-softmax regime (\beta = 4.5); (ii) specialization is easiest around an optimal selectivity \beta \in [2, 3]; and (iii) an intermediate decorrelated pocket (S_- > 0, \epsilon \le 0.02) systematically precedes specialization.

2D static RS phase diagram in the (\alpha, \beta) plane (L = 3, \rho = 0.05), showing equilibrium specialization \epsilon, the orthogonal decorrelation ridge S_-, the three-phase map, and continuous 1D slices.

From Committee Machine (L = 2) to Multi-Token Attention (L = 10)

What happens as we increase the sequence length L beyond the soft-committee limit (L = 2)? Select different values of L below. As L grows, two orthogonal teachers attend to increasingly disjoint tokens: the misspecification error of a symmetric student swells into a sharp double-descent (interpolation) peak around \alpha \approx 1.7 on the symmetric branch, while head specialization sharpens into an abrupt cliff accompanied by a large spike in S_-.

4. Bimodal Trapping and the Statistical–Computational Gap

At our reference point (L = 3, \beta = 2.5, \rho = 0.05), replica theory predicts that the specialized phase becomes globally favorable very early, reaching macroscopic onset (\epsilon \ge 0.02) at \alpha_{\mathrm{stat}} \approx 0.85.

Does a real numerical optimizer actually find this global minimum? To test this, we minimize the finite-dimensional empirical risk (d = 500, 15 independent seeds per \alpha) with L-BFGS (strong_wolfe line search) under two different initializations. Toggle between the two tabs below:

RS theory vs. finite-d ERM (d = 500, 15 seeds, individual runs in scatter) from an isotropic random initialization. Across \alpha \in \lbrack 2, 7 \rbrack, non-convexity splits the runs bimodally between specialized solutions and spurious local minima trapped near the symmetric branch.

RS theory vs. finite-d ERM (d = 500, 15 seeds) from an informed initialization inside the teacher basin (W(0) = 0.8\,W^\star + \text{noise}). Every single seed collapses tightly onto the RS curves across the entire range \alpha \in \lbrack 0.5, 10 \rbrack.

The contrast is striking:

  • From an informed initialization, all 15 finite-d runs fall right on top of the RS predictions for (m_s, \epsilon), f_{\mathrm{ERM}}, and \mathcal{E}_g. This validates the RS description of the global minimum and rules out strong replica-symmetry-breaking effects in this regime.
  • From an isotropic random initialization, however, the optimizer only matches the RS global minimum at both ends (\alpha \le 1.0 and \alpha \ge 10). Across the wide intermediate window \alpha \in [2,\, 7], the seed scatter splits bimodally: some runs escape to the specialized branch, while many remain stuck in spurious local minima with training loss strictly above f_{\mathrm{ERM}} and high generalization error.

Equilibrium statistical mechanics tells us where the global minimum sits, and confirms that it exists already at \alpha_{\mathrm{stat}} \approx 0.85. It cannot tell us why gradient-based algorithms stall across \alpha \in [2, 7], how fast they slow down, or whether stochastic noise can help them escape.

To answer those questions, we need to leave equilibrium altogether and track the exact non-equilibrium training trajectories in high dimension—the subject of Part II: Dynamical Mean-Field Theory, Critical Slowing Down, and the Role of Noise.

Citation

BibTeX citation:
@online{roinard-chauvet2026,
  author = {Roinard-Chauvet, Matéo},
  title = {Spontaneous {Symmetry} {Breaking} in {Multi-Head} {Attention}
    {(Part} {I)}},
  date = {2026-11-29},
  url = {https://mateoroinard.fr/posts/01-attention-specialization-statics/},
  langid = {../../en}
}
For attribution, please cite this work as:
Roinard-Chauvet, Matéo. 2026. “Spontaneous Symmetry Breaking in Multi-Head Attention (Part I).” November 29. https://mateoroinard.fr/posts/01-attention-specialization-statics/.