Transformer残差流中推理的几何学
研究论文 · 2026/10/01
Transformer语言模型通过连续的残差更新构建预测,但其表示如何变得特定于最终结果仍不清楚。我们通过将中间残差状态与其自身的最终状态以及其他上下文的最终状态经验库进行比较来研究这一过程。在六个预训练语言模型中,自身端点早期就比平均替代端点更受偏好,而许多个体端点仍然更接近。这些竞争集通常随深度缩小,但其成员变化,且存活的端点不一定变得更相似。因此,方向对齐和端点排名可以改善,而到最终状态的欧几里得距离变化很小。我们开发了一个简单的高维模型,分离了范数、对齐和端点几何的作用,展示了逐渐的方向变化如何导致竞争的急剧减少。我们还证明,在欧几里得或余弦距离下,朝向自身端点的直线路径不会引入新的竞争者;因此观察到的进入表明偏离了直线收敛。最后,在所有研究的模型中,与较低排名输出标记相关的端点往往在余弦距离上更远,将残差几何与输出组织联系起来。总之,这些发现描述了Transformer推理过程中几何特异性的增加,并解释了为什么距离、竞争者数量和存活端点的集中度提供了该过程的不同视角。
该研究深入探究了Transformer推理过程中残差流几何特异性的形成机制,结合实证分析与理论模型,揭示了距离、竞争和方向对齐等不同视角下的动态变化,对理解语言模型内部表示演化具有重要价值。
Transformer language models build predictions through successive residual updates, but how their representations become specific to an eventual outcome remains unclear. We study this process by comparing intermediate residual states with their own final states and an empirical bank of final states from other contexts. Across six pretrained language models, the own endpoint becomes preferable to the average alternative early, while many individual endpoints remain closer. These competing sets generally shrink with depth, but their membership changes and their surviving endpoints need not become more similar to one another. Directional alignment and endpoint rank can therefore improve while Euclidean distance to the final state changes little. We develop a simple high-dimensional model that separates the roles of norm, alignment, and endpoint geometry, showing how gradual directional changes can produce sharp reductions in competition. We also prove that a straight path toward the own endpoint cannot introduce new competitors under either Euclidean or cosine distance; observed entries thus establish departures from straight-line convergence. Finally, endpoints associated with lower-ranked output tokens tend to lie farther away in cosine distance across all studied models, connecting residual geometry to output organization. Together, these findings characterize increasing geometric specificity during transformer inference and explain why distance, competitor count, and concentration of the surviving endpoints provide distinct views of that process.