用可控环境验证了Transformer如何实现贝叶斯推理。
The Bayesian Geometry of Transformer Attention
- 构建贝叶斯风洞,让真实后验可计算且不依赖记忆。
- 小规模Transformer误差仅10^-3~10^-4比特,远超MLP。
- 注意力机制通过几何设计实现贝叶斯更新,适合模型解释研究。
Transformer在上下文中常表现出贝叶斯推理特征,但因真实数据缺乏解析后验且大模型混淆推理与记忆,难以严格验证。本文构建‘贝叶斯风洞’——真后验已知且记忆不可能的受控环境。在该环境下,小型Transformer以10^{-3}至10^{-4}比特精度复现贝叶斯后验,而容量相当的MLP则差几个数量级,确立了架构差异。在双任务(双射消除与隐马尔可夫模型状态追踪)中,Transformer通过一致的几何机制实现贝叶斯推理:残差流作为信念载体,前馈网络执行后验更新,注意力提供内容寻址路由。几何诊断显示正交键基、渐进查询-键对齐及由后验熵参数化的低维值流形。训练中该流形展开而注意力模式保持稳定,呈现‘帧精度解耦’现象,与近期梯度分析预测一致。结果表明,分层注意力通过几何设计实现贝叶斯推理,解释了为何需注意力且扁平架构失败。贝叶斯风洞为连接小型可验证系统与大模型推理现象提供了机制基础。
原文摘要 · Abstract (English)
Transformers often appear to perform Bayesian reasoning in context, but verifying this rigorously has been impossible: natural data lack analytic posteriors, and large models conflate reasoning with memorization. We address this by constructing \emph{Bayesian wind tunnels} -- controlled environments where the true posterior is known in closed form and memorization is provably impossible. In these settings, small transformers reproduce Bayesian posteriors with $10^{-3}$-$10^{-4}$ bit accuracy, while capacity-matched MLPs fail by orders of magnitude, establishing a clear architectural separation. Across two tasks -- bijection elimination and Hidden Markov Model (HMM) state tracking -- we find that transformers implement Bayesian inference through a consistent geometric mechanism: residual streams serve as the belief substrate, feed-forward networks perform the posterior update, and attention provides content-addressable routing. Geometric diagnostics reveal orthogonal key bases, progressive query-key alignment, and a low-dimensional value manifold parameterized by posterior entropy. During training this manifold unfurls while attention patterns remain stable, a \emph{frame-precision dissociation} predicted by recent gradient analyses. Taken together, these results demonstrate that hierarchical attention realizes Bayesian inference by geometric design, explaining both the necessity of attention and the failure of flat architectures. Bayesian wind tunnels provide a foundation for mechanistically connecting small, verifiable systems to reasoning phenomena observed in large language models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。