TensorLens: 高次アテンションテンソルによるエンドツーエンドTransformer解析
TensorLens: End-to-End Transformer Analysis via High-Order Attention Tensors
January 25, 2026
著者: Ido Andrew Atad, Itamar Zimerman, Shahar Katz, Lior Wolf
cs.AI
要旨
注意行列は、解釈可能性、可視化、操作、蒸留など幅広い応用を支える、トランスフォーマー研究の基盤である。しかし、既存の分析のほとんどは個々の注意ヘッドや層に焦点を当てており、モデルの大域的な挙動を考慮できていない。先行研究では、平均化や行列乗算による複数ヘッドへの注意の定式化の拡張、あるいは正規化やFFNなどの構成要素の組み込みが試みられているが、全てのトランスフォーマーブロックを包含する統合的かつ完全な表現は依然として不足している。我々はこのギャップを埋めるため、高次注意相互作用テンソルを通じて表現される、単一の入力依存線形演算子としてトランスフォーマー全体を捉える新たな定式化「TensorLens」を提案する。このテンソルは、注意、FFN、活性化関数、正規化、残差接続を統合的に符号化し、モデルの計算を理論的に首尾一貫した表現力豊かな線形表現として提供する。TensorLensは理論的に裏付けられており、実証検証により、従来の注意集約手法よりも豊かな表現を生み出すことが示されている。実験により、この注意テンソルが解釈可能性とモデル理解を目的としたツール開発の強力な基盤となり得ることが実証された。コードは補足資料として添付されている。
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.