通过方向分解解耦Transformer中的表示演化
研究论文 · 2026/09/16
Transformer 表示通过学到的加性变换演化,这些变换要么保持当前方向,要么改变方向。我们将这种演化视为功能几何,把学习到的更新分解为平行和垂直分量。在预训练模型中,我们发现除残差恒等路径外,还存在大量平行分量。随后我们在两个空间应用该分解:相对于隐藏状态的注意力与 MLP 更新,以及相对于当前 token 值的注意力值聚合。定向编辑揭示出强烈的空间依赖不对称性:排除自身的值空间平行操作比残差空间和垂直对应操作显著更稳健,在保留直接自身消息的同时仅缩放非自身聚合。同一分解还给出了压缩诱导更新误差的分量解析描述:垂直误差比平行误差更清晰地区分压缩方法。大量实验进一步表明,在从头预训练期间进行全聚合平行抑制可降低验证损失轨迹并提升下游平均性能,其中值空间变体最强。这些结果将表示几何与编辑稳健性、压缩诊断和训练时干预联系起来。代码见 https://github.com/Shwai-He/Transformer-Geometry。
该研究提出了一种新的表示几何分解方法,不仅揭示了 Transformer 内部表示演化的结构,还将其与模型编辑、压缩诊断和训练干预等实际应用直接关联,具有理论和实践双重价值。
Transformer representations evolve through learned additive transformations that either preserve their current direction or redirect it. We study this evolution as a functional geometry, decomposing learned updates into parallel and perpendicular components. Across pretrained models, we find substantial parallel components beyond the residual identity path. We then apply the decomposition in two spaces: to attention and MLP updates relative to the hidden state, and to attention value aggregation relative to the current token's value. Targeted edits reveal a strongly space-dependent asymmetry: exclude-self value-space parallel manipulation is markedly more robust than residual-space and perpendicular counterparts, preserving the direct self message while scaling only the non-self aggregate. The same decomposition gives a component-resolved description of compression-induced update error: perpendicular error separates compression methods more clearly than parallel error. Extensive experiments further demonstrate that full-aggregate parallel suppression during from-scratch pretraining lowers validation-loss trajectories and improves downstream averages, with the value-space variant strongest. Together, these results connect representation geometry to editing robustness, compression diagnosis, and training-time intervention. Code is available in the https://github.com/Shwai-He/Transformer-Geometry{project repository}.