arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.17837cs.LGcs.AI
收藏

Transformer归一化层与语义子空间的独立性

Transformer Normalisation Layers and the Independence of Semantic Subspaces

University of Manchester(曼彻斯特大学);Aalto University(阿尔托大学);Idiap Research Institute(Idiap研究所);National Biomarker Centre, CRUK-MI, University of Manchester(英国癌症研究中心曼彻斯特研究所国家生物标志物中心(曼彻斯特大学))

Stephen Menary, Samuel Kaski, Andre Freitas

AI总结:

本研究发现Pre-Norm归一化层会破坏transformers语义子空间的独立性,导致circuit collapse现象,并提出QKV-Norm作为替代方案,虽在分布内表现相当但分布外性能较差。

摘要:

近期研究表明,transformers可以通过内部执行称为circuits的计算图来解决上下文推理任务。Circuits通常利用注意力机制从表示的子空间中逻辑匹配信息,例如使用位置序列来识别前一个token。在本研究中,我们将语义子空间视为潜在表示中任何能够完全决定注意力分布的独立子空间。我们表明,Pre-Norm——最先进的transformers所使用的归一化层放置方式——会破坏这种能力,除非模型学习到一种正交球体的严格表示结构。这是因为它会导致线性子空间通过共同的归一化因子产生干扰。在理论上,我们通过将这种干扰建模为query/key/value向量$L_2$范数上的随机噪声来分析circuit稳定性,预测当稀疏注意力转移到不同token时会出现circuit collapse现象。在实验中,我们研究了为数学加法训练的现实模型的敏感性,观察到当范数被人工扰动$\lesssim$10%时,circuit collapse的发生率为1%。我们将Pre-Norm与QKV-Norm进行对比,后者将归一化放置在注意力头的线性算子之后。理论上这放松了表示约束。实验中我们观察到在分布内性能相当,但在分布外性能较差。

英文摘要:

Recent works have shown that transformers can solve contextual reasoning tasks by internally executing computational graphs called circuits. Circuits often use attention to logically match information from subspaces of the representation, e.g. using position-in-sequence to identify the previous token. In this work, we consider a semantic subspace to be any independent subspace of the latent representation that can fully determine an attention distribution. We show that Pre-Norm, the placement of normalisation layer used by state-of-the-art transformers, violates this ability unless the model learns a strict representation structure of orthogonal spheres. This is because it causes linear subspaces to interfere through their common normalisation factor. Theoretically, we analyse circuit stability by modelling this interference as random noise on the $L_2$-norms of the query/key/value vectors, predicting a phenomenon of circuit collapse when sparse-attention shifts to a different token. Empirically, we investigate the sensitivity of real-world models trained for mathematical addition, observing a 1% rate of circuit collapse when the norms are artificially perturbed by $\lesssim$10%. We contrast Pre-Norm with QKV-Norm, which places normalisation after the attention head's linear operators. Theoretically this relaxes the representational constraints. Empirically we observe comparable in-distribution but worse out-of-distribution performance.

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

↑