Testing the spin-bath view of self-attention: A Hamiltonian analysis of GPT-2 Transformer

Bhattacharjee, Satadeep, Lee, Seung-Cheol

–arXiv.org Artificial Intelligence 

Satadeep Bhattacharjee1 and Seung-Cheol Lee2 1 Indo-Korea Science and Technology Center (IKST), Bangalore, India 2 Electronic Materials Research Center, Korea Institute of Science & Technology, Korea (Dated: January 1, 2026) The recently proposed physics-based framework by Huo and Johnson [1] models the attention mechanism of Large Language Models (LLMs) as an interacting two-body spin system, offering a first-principles explanation for phenomena like repetition and bias. Building on this hypothesis, we extract the complete Query-Key weight matrices from a production-grade GPT-2 model and derive the corresponding effective Hamiltonian for every attention head. From these Hamiltonians we obtain analytic phase boundary and logit gap criteria that predict which token should dominate the next-token distribution for a given context. A systematic evaluation on 144 heads across 20 factual-recall prompts reveals a strong negative correlation between the theoretical logit 3gaps and the model's empirical token rankings (r 0.70, p < 10). Targeted ablations further show that suppressing the heads most aligned with the spin-bath predictions induces the anticipated shifts in output probabilities, confirming a causal link rather than a coincidental association.