Gradient Dynamics of Attention: How Cross-Entropy Sculpts Bayesian Manifolds
Not on the map. Why?
Abstract (arXiv)
Transformers empirically perform precise probabilistic reasoning in carefully constructed ``Bayesian wind tunnels'' and in large-scale language models, yet the mechanisms by which gradient-based learning creates the required internal geometry remain opaque. We provide a complete first-order analysis of how cross-entropy training reshapes attention scores and value vectors in a transformer attention head. Our core result is an advantage-based routing law for attention scores, [ fracpartial Lpartial sij = αijbigl(bij-mathbbEαi[b]bigr), qquad bij := ui^top vj, ] coupled with a responsibility-weighted update for values, [ Delta vj = -ηsumi αij ui, ] where ui is the upstream gradient at position i and αij are attention weights. These equations induce a positive feedback loop in which routing and content specialize together: queries route more strongly to values that are above-average for their error signal, and those values are pulled toward the queries that use them. We show that this coupled specialization behaves like a two-timescale EM procedure: attention weights implement an E-step (soft responsibilities), while values implement an M-step (responsibility-weighted prototype updates), with queries and keys adjusting the hypothesis frame. Through controlled simulations, including a sticky Markov-chain task where we compare a closed-form EM-style update to standard SGD, we demonstrate that the same gradient dynamics that minimize cross-entropy also sculpt the low-dimensional manifolds identified in our companion work as implementing Bayesian inference. This yields a unified picture in which optimization (gradient flow) gives rise to geometry (Bayesian manifolds), which in turn supports function (in-context probabilistic reasoning).
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 3 of its 18 references that are in the map. First posted on arXiv 27 Dec 2025.
Builds on
3 of 18 references.
References · 3
Built on by
Citing papers per year: 2025: 1; 2026: 5.
6 papers.
- 2026Position: agentic AI orchestration should be Bayes-consistentcited by 3
- 2026Mechanistic Tomography: Designed Measurement for Control-Oriented Interpretabilitycited by 2
- 2025Gradient Descent as Implicit EM in Distance-Based Neural Modelscited by 1
- 2026Transformer as an Euler Discretization of Score-based Variational Flowcited by 0
- 2026Bayesian Wind Tunnels for Model Selectioncited by 0
- 2026Don't Drop Dropout: Optimizing Layer Sparsity for Efficient LLM Training and Inferencecited by 0
- 2026Don't Drop Dropout: Optimizing Layer Sparsity for Efficient LLM Training and Inference4 Sep 2026
- 2026Mechanistic Tomography: Designed Measurement for Control-Oriented Interpretability19 Aug 2026
- 2026Bayesian Wind Tunnels for Model Selection1 Jul 2026
- 2026Position: agentic AI orchestration should be Bayes-consistent1 May 2026
- 2026Transformer as an Euler Discretization of Score-based Variational Flow26 Apr 2026
- 2025Gradient Descent as Implicit EM in Distance-Based Neural Models31 Dec 2025