In Part I, we used equilibrium statistical mechanics to map out the static phase diagram of our minimal two-head cross-attention model. The replica-symmetric (RS) calculation predicted a continuous specialization transition lifting off at very low sample complexity (\alpha_{\mathrm{stat}} \approx 0.85 for L = 3, \beta = 2.5, \rho = 0.05). Yet when we ran L-BFGS from an isotropic random initialization at d = 500, runs split bimodally across \alpha \in [2, 7], with many trajectories trapped in spurious local minima far above the global minimum.
Equilibrium thermodynamics cannot explain this statistical–computational gap because it only probes the bottom of the landscape, ignoring how gradient-based algorithms actually move through it. In Part II, we leave equilibrium behind and derive the exact high-dimensional training trajectories via Dynamical Mean-Field Theory (DMFT). This explains why specialization stalls across \alpha \in [1.5, 5.5], clarifies the distinct roles of weight decay \rho and softmax selectivity \beta, and reveals why neither isotropic Langevin noise nor constant-step mini-batch SGD closes the gap in high dimension.
1. Out of Equilibrium: DMFT Intuition
When training on a fixed (quenched) dataset \mathcal{D} of size N = \alpha d, gradient flow reuses the same samples at every time step:
where g_{h,\ell}^\mu = \beta\,\Delta^\mu A_{h,\ell}^\mu(v_\ell^\mu - z_h^\mu) is the local attention force and \eta_h(t) is optional thermal white noise of variance 2T. Because the weights at time t depend on all past gradients from the same samples, the dynamics is fundamentally non-Markovian.
Remarkably, unlike static equilibrium theory, dynamics does not require the replica trick. Within the Martin–Siggia–Rose–Janssen–De Dominicis (MSRJD) path-integral formalism (Mignacco et al. 2020), causality ensures that for any realization of the dataset \mathcal{D}, the microscopic ODE has a unique trajectory, so the dynamical generating functional is identically normalized: Z_{\mathrm{dyn}}(\mathcal{D}) = 1. One can therefore average directly over the disorder \mathcal{D} without taking n \to 0.
Mignacco, Francesca, Florent Krzakala, Pierfrancesco Urbani, and Lenka Zdeborová. 2020. “Dynamical Mean-Field Theory for Stochastic Gradient Descent in Gaussian Mixture Classification.”Advances in Neural Information Processing Systems (NeurIPS) 33.
In the d \to \infty limit, the coupled system of d weight coordinates and N = \alpha d samples decouples into two mutually coupled effective processes:
A single typical weight coordinatew_a(t) (in the symmetric/antisymmetric eigenbasis a \in \{+, -\}) driven by a signal drift, colored quenched-sample noise \xi_a(t), and a causal memory kernelM_a(t, s) encoding how past weights imprint on present gradients through the dataset.
A single typical training sample whose local field \lambda_{a,\ell}(t) differs from an unseen test (cavity) field \omega_{a,\ell}(t) by the cumulative causal reaction of its own past gradients—governed by a nonlinear Volterra equation:
Compare this to the static Moreau envelope of Part I (\tilde{\lambda}_{\mathrm{prox}} = \omega - V g): the static susceptibility V is promoted to a causal two-time response function R_a(t, s). Crucially, because R_a(t, s) = 0 for s \ge t, the Volterra equation marches forward in time with no inner non-convex optimization (Gerbelot et al. 2024)1: discretizing gradient flow with explicit Euler step \Delta t yields algebraically exact discrete DMFT equations where the memory kernel M_{n,m}^{(a)} is computed by exact tangent propagation of the 6 \times 6 softmax Jacobian on GPU—avoiding any ill-conditioned matrix inversion.].
Gerbelot, Cédric, Emanuele Troiani, Francesca Mignacco, Florent Krzakala, and Lenka Zdeborová. 2024. “Rigorous Dynamical Mean-Field Theory for Stochastic Gradient Descent Methods.”SIAM Journal on Mathematics of Data Science 6 (2): 400–427.
1 This causality also makes the numerical solver exact in discrete time: discretizing gradient flow with explicit Euler step \Delta t yields algebraically exact discrete DMFT equations where the memory kernel M_{n,m}^{(a)} is computed by exact tangent propagation of the 6 \times 6 softmax Jacobian on GPU—avoiding any ill-conditioned matrix inversion.
The DMFT equations rigorously unify both theories from Part I as exact limiting cases:
Online limit (\alpha \to \infty, rescaled time \tau = \alpha t): the Volterra reaction integral, colored noise \hat{B}, and retarded memory vanish as O(\alpha^{-1}), recovering the deterministic online ODEs of Part I identically.
Equilibrium limit (t, s \to \infty, then T \to 0): whenever the dynamics relaxes to an ergodic state obeying the fluctuation–dissipation theorem R(\tau) = -\frac{1}{T}\partial_\tau C(\tau)\,\Theta(\tau), the integrated response identifies with V = \int_0^\infty R(\tau)\,\mathrm{d}\tau and the DMFT system reduces term-by-term to the static RS equations.
2. Exact Trajectories and Non-Equilibrium Memory Kernels
To validate our discrete-time DMFT solver (M_{\mathrm{MC}} = 8000 with \mathbb{Z}_2-antithetic sampling), we compare its predictions directly against full-batch explicit-Euler gradient descent at d = 1000 (10 seeds, \epsilon_0 = 0.05, \sigma_0 = 0.5) across the three regimes uncovered in Part I. Switch between the tabs below:
Cross-validation of DMFT (solid) vs. finite-d gradient descent at d = 1000 (dashed, mean \pm std over 10 seeds) in the easy specialized regime (\alpha = 10.0, \Delta t = 0.025). Both \mathcal{E}_{\mathrm{train}} and \mathcal{E}_g drop to 0.004.
Cross-validation of DMFT vs. finite-d gradient descent (d = 1000, 10 seeds) inside the critical slowing-down regime (\alpha = 4.0, \Delta t = 0.04). Rapid interpolation of \mathcal{E}_{\mathrm{train}} \to 0.01 starves the gradient signal, stalling \epsilon(t) and leaving \mathcal{E}_g on a plateau near 0.08.
Cross-validation of DMFT vs. finite-d gradient descent (d = 1000, 10 seeds) below the specialization threshold (\alpha = 1.0, \Delta t = 0.05). Training loss collapses to 0.007 while generalization remains high (\mathcal{E}_g \approx 0.24) and \epsilon(t) decays slowly.
The quantitative match is tight across all three regimes—even capturing the sharp short-time dip in C_+(t, t) and peak in C_-(t, t) around t \approx 0.05. At \alpha = 4.0, the middle tab directly exposes the microscopic trapping mechanism: rapid interpolation of the N = 4d quenched samples shrinks the residuals \Delta^\mu, starving the antisymmetric mode of the gradient signal required to complete specialization.
Inspecting the antisymmetric two-time kernels at \alpha = 4.0 reveals a classic non-equilibrium signature of this slowing down:
Two-time functions of the antisymmetric sector at \alpha = 4.0: correlation C_-(t, s), causal response R_-(t, s), strictly retarded memory density M_-^{\mathrm{ret}}(t, s) (s < t, diagonal masked), and instantaneous friction \Gamma_-(t) = -M_{n,n}^{(-)}.
Two features stand out in these kernels:
Aging-like slowing down in R_-(t, s): the response is strictly causal (R_- = 0 for s \ge t), and its decay width in t - s broadens noticeably as the waiting time s increases—a direct breakdown of time-translation invariance.
Anti-friction followed by positive Onsager memory: splitting M_-(t, s) = -\Gamma_-(t)\,\delta(t-s) + M_-^{\mathrm{ret}}(t, s)\,\Theta(t-s) shows that the instantaneous friction starts negative (\Gamma_-(0) \approx -0.78, reflecting initial local instability) before quickly turning positive (\Gamma_- \approx 1.1), trailed by a positive retarded Onsager reaction band.
3. Critical Slowing Down and Hyperparameter Trade-Offs
To measure the dynamical instability threshold from a quasi-isotropic initialization (\epsilon_0 = 10^{-3}) without Monte-Carlo symmetry-breaking bias, we run an unbiased \mathbb{Z}_2-antithetic DMFT sweep across 16 values of \alpha \in [0.6, 10.0] (averaged over 3 MC seeds at M_{\mathrm{MC}} = 4000) and extract the effective linear growth rate \gamma_{\mathrm{dyn}}(\alpha) on a common physical window t \in [0.8, 1.98]:
Unbiased DMFT \alpha-sweep from quasi-isotropic initialization (\epsilon_0 = 10^{-3}, L = 3, \beta = 2.5, \rho = 0.05): evolution of \ln(|\epsilon(t)|/\epsilon_0), effective growth rate \gamma_{\mathrm{dyn}}(\alpha) vs. the static RS onset (\alpha_{\mathrm{stat}} \approx 0.85), and macroscopic state reached at t = 1.98.
This resolves the puzzle from Part I:
The linear growth rate \gamma_{\mathrm{dyn}}(\alpha) crosses zero around \alpha \approx 1.3\text{--}1.4—slightly above the static RS onset \alpha_{\mathrm{stat}} \approx 0.85, because the initial orthogonal variance C_-(0, 0) = \sigma_0^2 = 0.25 and early interpolation damp the antisymmetric mode.
More importantly, across the wide intermediate window \alpha \in [1.5, 5.5], \ln(|\epsilon(t)|/\epsilon_0) flattens rapidly at later times as training residuals vanish. Strong exponential takeoff only emerges for \alpha \gtrsim 6. Combined with finite-d dataset fluctuations competing against this weak drift, this critical slowing down directly explains the bimodal ERM trapping observed over \alpha \in [2, 7] in Part I.
Dynamical \alpha-Sweep
Slide \alpha from the interpolation phase (\alpha = 0.6) through the sluggish critical-slowing-down window (\alpha \in [1.5, 5.5]) up to rapid specialization (\alpha = 10). The faint gray curves show the full family of trajectories for context.
Inside the critical zone (\alpha = 4.0, \epsilon_0 = 0.05), the two key hyperparameters act in qualitatively opposite ways:
Weight decay \rho mediates a clean trade-off: increasing \rho \in [0.005, 0.25] monotonically slows specialization (\epsilon(T) drops from 0.202 to 0.158) through the restoring force -\rho m_-, yet simultaneously improves generalization (\mathcal{E}_g(T) falls from 0.082 to 0.069) by suppressing orthogonal overfitting (S_\pm).
Softmax inverse temperature \beta exhibits a sharp bell-shaped optimum around \beta \in [2.5, 3.0] (\epsilon(T) \approx 0.192). Overly soft attention (\beta = 1.0) weakens the nonlinear instability coupling (\propto \beta^2) so specialization stalls, while overly sharp attention (\beta = 4.5) triggers rapid early movement followed by premature saturation as softmax derivatives vanish (A_{h,\ell} \to \{0, 1\}).
Use the tabs below to inspect both sweeps against the reference trajectory (\rho = 0.05, \beta = 2.5, dashed):
4. Can Stochastic Noise Break the Trap? Langevin vs. Mini-Batch SGD
Faced with critical slowing down across \alpha \in [1.5, 5.5], a natural instinct from low-dimensional physics is to inject noise to escape the plateau. We compare two fundamentally different noise mechanisms at matched physical time t = n\Delta t (\epsilon_0 = 0.05, T_{\max} = 4.0):
Isotropic thermal noise (DMFT Langevin, T > 0): in low dimensions, thermal agitation helps cross barriers. In high dimension (d \to \infty), however, isotropic white noise injects a fraction (d - 2)/d \to 1 of its variance into the subspace orthogonal to the 2D teacher plane. Instead of kicking the heads apart, it inflates weight norms C_\pm, dilutes the useful gradient, and monotonically raises the generalization error floor \mathcal{E}_g(t)2.
Anisotropic mini-batch SGD noise (d = 500, 60 seeds, B/N \in \{1.0, 0.25, 0.1, 0.05\}): because mini-batch fluctuations are aligned with the data-driven gradient directions (Mignacco and Urbani 2022), small batches (B/N = 0.05) deliver a clear short-time transient boost (t \in [0.2, 1.5]), especially deep in the slowing-down window (\alpha = 2.5). At longer times (t \to 4), however, constant-step SGD noise widens seed variance, loses its lead at \alpha = 4.0, and leaves \mathcal{E}_g(t) noticeably elevated.
2 Direct finite-d Langevin checks at \alpha = 2.5 confirm this geometric effect: at d = 500, \epsilon(T) decreases with T, whereas at low dimension d = 50, the O(T/d) noise projection onto the teacher plane produces a modest rise in |\epsilon(T)|—though orthogonal variance still inflates \mathcal{E}_g sharply.
Mignacco, Francesca, and Pierfrancesco Urbani. 2022. “The Effective Noise of Stochastic Gradient Descent.”Journal of Statistical Mechanics: Theory and Experiment 2022 (8): 083405.
Langevin Temperature T vs. Mini-Batch Fraction B/N
Compare exact high-dimensional DMFT Langevin trajectories against finite-d mini-batch SGD (mean \pm 1\sigma band over 60 seeds) inside the slowing-down window:
Combining Parts I and II gives a complete analytical and numerical picture of head specialization in our minimal cross-attention model (L = 3, \beta = 2.5, \rho = 0.05):
Regime / Theory
Core Tool
Threshold / Scale
Key Phenomenology
Online \alpha \to \infty
Closed ODEs, linear stability
N_{\mathrm{esc}} \sim \dfrac{d\ln d}{2\eta\gamma}
Unstable symmetric plateau (\gamma > 0), logarithmic escape time
Finally, the contrast uncovered in Section 4 opens a concrete question for future work: at constant learning rate, anisotropic mini-batch noise gives a real early boost to symmetry breaking but pays a late-time generalization penalty. Can an optimal learning-rate (or batch-size) schedule \eta(t) exploit anisotropic noise early to trigger specialization, then anneal it away to settle cleanly into the specialized basin? Beyond schedules, generalizing this DMFT framework to H > 2 heads and bilinear matrix queries Q_h \in \mathbb{R}^{d \times d} (\alpha = N / d^2) offers a direct path toward sequential specialization cascades in deeper attention layers.
Citation
BibTeX citation:
@online{roinard-chauvet2026,
author = {Roinard-Chauvet, Matéo},
title = {Spontaneous {Symmetry} {Breaking} in {Multi-Head} {Attention}
{(Part} {II)}},
date = {2026-11-30},
url = {https://mateoroinard.fr/posts/02-attention-specialization-dmft/},
langid = {../../en}
}