arXiv:2601.17958cs.LG2026-01ACL被引 1

用高阶注意力张量统一建模Transformer全流程计算。

TensorLens: End-to-End Transformer Analysis via High-Order Attention Tensors

  • 提出高阶注意力交互张量,整合所有层与组件的全局计算
  • 实验证明其表示能力优于传统注意力聚合方法
  • 适合关注模型可解释性与整体行为分析的研究者

注意力矩阵是Transformer研究的核心,广泛应用于可解释性、可视化、操作与蒸馏等任务。然而,现有分析多聚焦单个注意力头或层,未能捕捉模型整体行为。尽管已有工作通过平均或矩阵乘法扩展注意力至多头,或引入归一化、前馈网络等模块,但尚缺乏能完整表征所有Transformer块的统一框架。本文提出TensorLens,一种新型公式,将整个Transformer建模为一个输入相关的线性算子,由高阶注意力-交互张量表达。该张量联合编码注意力、前馈网络、激活函数、归一化及残差连接,提供理论一致且表达力强的模型计算表示。理论严谨,实验验证表明其表示能力超越现有注意力聚合方法。实验还证明该注意力张量可作为构建可解释性工具的强大基础。代码已作为补充材料附上。

原文摘要 · Abstract (English)

Attention matrices are fundamental to transformer research, supporting a broad range of applications including interpretability, visualization, manipulation, and distillation. Yet, most existing analyses focus on individual attention heads or layers, failing to account for the model's global behavior. While prior efforts have extended attention formulations across multiple heads via averaging and matrix multiplications or incorporated components such as normalization and FFNs, a unified and complete representation that encapsulates all transformer blocks is still lacking. We address this gap by introducing TensorLens, a novel formulation that captures the entire transformer as a single, input-dependent linear operator expressed through a high-order attention-interaction tensor. This tensor jointly encodes attention, FFNs, activations, normalizations, and residual connections, offering a theoretically coherent and expressive linear representation of the model's computation. TensorLens is theoretically grounded and our empirical validation shows that it yields richer representations than previous attention-aggregation methods. Our experiments demonstrate that the attention tensor can serve as a powerful foundation for developing tools aimed at interpretability and model understanding. Our code is attached as a supplementary.

Transformer可解释性注意力机制张量建模

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