揭示大型语言模型中的奇异缺陷
Demystifying Singular Defects in Large Language Models
AI总结:
本文揭示了大型语言模型中高范数 token 的奇异缺陷成因,通过逐层奇异方向和负特征值等理论分析与实证验证,提出了新的分析框架,并展示了其在量化改进和 LLM 签名设计中的应用。
摘要:
已知大型 transformer 模型会产生高范数 token。在视觉 transformer(ViTs)中,此类 token 已通过层线性近似的奇异向量进行了数学建模。然而,在大型语言模型(LLMs)中,高范数 token 的根本原因在很大程度上仍未被探索,且其与 ViTs 不同的属性需要一个新的分析框架。本文提供了理论见解并在一系列近期模型中进行了实证验证,得出以下观察:i) 逐层奇异方向预测了 LLMs 中 token 范数的突然爆炸。ii) 层的负特征值解释了其突然衰减。iii) 导致高范数 token 的计算路径在初始 token 和非初始 token 之间存在差异。iv) 高范数 token 由近似相应模块的矩阵的右前导奇异向量触发。我们展示了这些发现的两个实际应用:量化方案的改进和 LLM 签名的设计。我们的发现不仅推进了对 LLMs 中奇异缺陷的理解,还为其应用开辟了新途径。我们期望这项工作能激发对 LLMs 内部机制的进一步研究。代码发布于 https://github.com/haoqiwang/singular_defect。
英文摘要:
Large transformer models are known to produce high-norm tokens. In vision transformers (ViTs), such tokens have been mathematically modeled through the singular vectors of the linear approximations of layers. However, in large language models (LLMs), the underlying causes of high-norm tokens remain largely unexplored, and their different properties from those of ViTs require a new analysis framework. In this paper, we provide both theoretical insights and empirical validation across a range of recent models, leading to the following observations: i) The layer-wise singular direction predicts the abrupt explosion of token norms in LLMs. ii) The negative eigenvalues of a layer explain its sudden decay. iii) The computational pathways leading to high-norm tokens differ between initial and noninitial tokens. iv) High-norm tokens are triggered by the right leading singular vector of the matrix approximating the corresponding modules. We showcase two practical applications of these findings: the improvement of quantization schemes and the design of LLM signatures. Our findings not only advance the understanding of singular defects in LLMs but also open new avenues for their application. We expect that this work will stimulate further research into the internal mechanisms of LLMs. Code is released at https://github.com/haoqiwang/singular_defect.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。