cs.LGOct 12, 2026

On the Statistical Mechanics of Attention

Authors: Jerry Yao-Chieh Hu, Yu-An Chen, Maojiang Su, Han Liu

Organizations: Center for Foundation Models and Generative AI, Northwestern University Department of Computer Science, Northwestern University · Department of Computer Science, College of Connected Computing, Vanderbilt University · Department of Physics, National Taiwan University · Department of Statistics and Data Science, Northwestern University

Abstract

We revisit the statistical mechanics of Transformer attention via modern Hopfield models. We present a free-energy formalism to characterize parameter regimes and critical thresholds for robust attention inference. The resulting free-energy landscape incorporates randomness in query states and attention weights. Attention then emerges as the equation of motion of the corresponding statistical-mechanical system (i.e., modern Hopfield model) through the standard free-energy minimization principle. This allows us to identify first-order phase transitions in attention between glassy and robust-inference phases. We further extend to attentions with stochastic queries and keys. Together, our results provide a rigorous statistical-mechanics framework for characterizing phase structure and inference reliability across a family of Transformer attention mechanisms.

Figures & tables

Appendix figures & tables12 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Softmax-Free Attention in Spiking Transformers as the Zero-Temperature Limit of Two-Level Systems

    Oct 11, 2026Roberto C. Sotero, Pouya Taghipour, Jose M. Sanchez-BornotSpiking TransformersAttention Mechanisms

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

    Jun 10, 2026Itay Lavie, Kirsten Fischer, Andrey Lekov +3Softmax AttentionPhase Transitions

  3. Attention as In-Context Empirical Bayes: A Two-Stage View via Particle Dynamics

    May 28, 2026Matthew Smart, Soumya Ganguly, Nilava Metya +2Self-AttentionEmpirical Bayes