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

The recently proposed physics-based framework by Huo and Johnson [arXiv:2504.04600]. models the attention mechanism of large language models 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 gaps and the model's empirical token rankings (r≈-0.70, p<10^{-3}). 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. Taken together, our findings provide the first strong empirical evidence for the spin-bath analogy in a production-grade model. In this work, we utilize the context-field lens, which provides physics-grounded interpretability and motivates the development of novel generative models bridging theoretical condensed-matter physics and artificial intelligence.

Authors

Institutions

Publication Details

Journal
Physical review. E
Published
2026-01-06
DOI
https://doi.org/10.1103/rkyb-d7d2
Primary Topic
Quantum many-body systems
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

Anonymous, Seung-Cheol Lee
Physical review. E
Quantum many-body systems
article

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

Anonymous, Seung-Cheol Lee
article en

Abstract

The recently proposed physics-based framework by Huo and Johnson [arXiv:2504.04600]. models the attention mechanism of large language models 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 gaps and the model's empirical token rankings (r≈-0.70, p<10^{-3}). 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. Taken together, our findings provide the first strong empirical evidence for the spin-bath analogy in a production-grade model. In this work, we utilize the context-field lens, which provides physics-grounded interpretability and motivates the development of novel generative models bridging theoretical condensed-matter physics and artificial intelligence.

Physical review. EVol. 113(1)
Korea Institute of Science and Technology (KR)
Openalex Percentile: Top 94%
Quantum many-body systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.