arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.00683cond-mat.mtrl-scics.LG
收藏

检验自注意力机制的自旋浴观点:GPT-2变换器的哈密顿量分析

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

Indo-Korea Science and Technology Center (IKST)(印度-韩国科学技术中心);Electronic Materials Research Center(电子材料研究中心)

Satadeep Bhattacharjee, Seung-Cheol Lee

AI总结:

本研究通过分析GPT-2变换器的哈密顿量,验证了自旋浴观点对自注意力机制的解释,发现理论logit间隙与模型实证token排名呈强负相关,证实了因果联系。

摘要:

Huo和Johnson提出的基于物理的框架将大型语言模型(LLMs)的注意力机制建模为相互作用的二体自旋系统,为重复和偏见等现象提供了第一性原理的解释。在此假设基础上,我们从生产级GPT-2模型中提取完整的查询-键权重矩阵,并为每个注意力头推导出相应的有效哈密顿量。从这些哈密顿量中,我们获得了分析相边界和logit间隙标准,这些标准预测了在给定上下文中哪个token应主导下一个token的分布。在144个头和20个事实回忆提示上的系统评估显示,理论logit间隙与模型的实证token排名之间存在强负相关(r≈-0.70,p<10^-3)。针对性的消融进一步显示,抑制与自旋浴预测最一致的头会诱导预期的输出概率变化,证实了因果联系而非偶然关联。总体而言,我们的发现为在生产级模型中提供了自旋浴类比的第一个强实证证据。在本工作中,我们利用了上下文场视角,这为物理基础的可解释性提供了动力,并促进了连接理论凝聚态物理和人工智能的新型生成模型的发展。

英文摘要:

The recently proposed physics-based framework by Huo and Johnson~\cite{huo2024capturing} 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 boundaries 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\approx-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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑