arXiv:2505.24293cs.LGcs.AI2025-05被引 2

将大模型推理转化为可解释的线性映射,精度误差小于10^{-13}。

Equivalent Linear Mappings of Large Language Models

  • 通过解耦梯度计算,提取输入依赖的线性变换,构建等效线性系统。
  • 在双精度下重建输出嵌入,相对误差低于10^{-13},无需额外训练。
  • 揭示模型在低维子空间中运行,可解码出可解释的语义概念。

尽管在Transformer可解释性方面取得进展,大型语言模型(LLMs)的计算机制仍是一个根本挑战。许多方法分析隐藏表示,但对这些表示如何生成缺乏理解。本文将给定输入序列的LLM推理映射为一个等效且可解释的线性系统,在双精度浮点下重建预测输出嵌入的相对误差低于10^{-13},无需额外训练。我们利用Transformer中每个操作(门控激活、注意力、归一化)均可表示为A(x)·x的特性,其中A(x)是输入依赖的线性变换,x保持线性路径。通过战略性地从输入序列的梯度计算中分离组件,并在推理时冻结A(x)项,使雅可比矩阵产生等效线性映射。该分离后的雅可比矩阵对每个输入标记使用单一线性算子,已在Qwen 3、Gemma 3和Llama 3上验证,最高至Qwen 3 14B。这些线性表示表明LLM在极低维子空间中运行,奇异向量可解码为可解释的语义概念。每个中间输出的计算也具有线性等价形式,我们分析了各层及其注意力与多层感知机模块的线性表示如何构建预测,并将其用作控制算子,向无关文本插入语义概念。尽管全局非线性,LLM仍可通过等效线性表示揭示下一个词预测过程中的低维语义结构。

原文摘要 · Abstract (English)

Despite significant progress in transformer interpretability, an understanding of the computational mechanisms of large language models (LLMs) remains a fundamental challenge. Many approaches interpret a network's hidden representations but remain agnostic about how those representations are generated. We address this by mapping LLM inference for a given input sequence to an equivalent and interpretable linear system which reconstructs the predicted output embedding with relative error below $10^{-13}$ at double floating-point precision, requiring no additional model training. We exploit a property of transformers wherein every operation (gated activations, attention, and normalization) can be expressed as $A(x) \cdot x$, where $A(x)$ represents an input-dependent linear transform and $x$ preserves the linear pathway. To expose this linear structure, we strategically detach components of the gradient computation with respect to an input sequence, freezing the $A(x)$ terms at their values computed during inference, such that the Jacobian yields an equivalent linear mapping. This detached Jacobian of the model reconstructs the output with one linear operator per input token, which is shown for Qwen 3, Gemma 3 and Llama 3, up to Qwen 3 14B. These linear representations demonstrate that LLMs operate in extremely low-dimensional subspaces where the singular vectors can be decoded to interpretable semantic concepts. The computation for each intermediate output also has a linear equivalent, and we examine how the linear representations of individual layers and their attention and multilayer perceptron modules build predictions, and use these as steering operators to insert semantic concepts into unrelated text. Despite their global nonlinearity, LLMs can be interpreted through equivalent linear representations that reveal low-dimensional semantic structures in the next-token prediction process.

可解释性线性映射大模型分析语义解码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。