TensorLens: End-to-End-Transformer-Analyse mittels hochgradiger Aufmerksamkeitstensoren
TensorLens: End-to-End Transformer Analysis via High-Order Attention Tensors
January 25, 2026
papers.authors: Ido Andrew Atad, Itamar Zimerman, Shahar Katz, Lior Wolf
cs.AI
papers.abstract
Aufmerksamkeitsmatrizen sind grundlegend für die Transformer-Forschung und unterstützen eine breite Palette von Anwendungen, einschließlich Interpretierbarkeit, Visualisierung, Manipulation und Destillation. Dennoch konzentrieren sich die meisten bestehenden Analysen auf einzelne Aufmerksamkeitsköpfe oder -schichten und berücksichtigen nicht das globale Verhalten des Modells. Während frühere Arbeiten Aufmerksamkeitsformulierungen über mehrere Köpfe hinweg durch Mittelwertbildung und Matrixmultiplikationen erweitert oder Komponenten wie Normalisierung und FFNs einbezogen haben, fehlt es nach wie vor an einer einheitlichen und vollständigen Repräsentation, die alle Transformer-Blöcke umfasst. Wir schließen diese Lücke durch die Einführung von TensorLens, einer neuartigen Formulierung, die den gesamten Transformer als einen einzigen, eingabeabhängigen linearen Operator erfasst, der durch einen höhergradigen Aufmerksamkeits-Interaktions-Tensor ausgedrückt wird. Dieser Tensor kodiert gemeinsam Aufmerksamkeit, FFNs, Aktivierungen, Normalisierungen und Residualverbindungen und bietet somit eine theoretisch kohärente und ausdrucksstarke lineare Repräsentation der Modellberechnung. TensorLens ist theoretisch fundiert, und unsere empirische Validierung zeigt, dass es reichhaltigere Repräsentationen liefert als bisherige Aufmerksamkeitsaggregationsmethoden. Unsere Experimente belegen, dass der Aufmerksamkeitstensor als leistungsstarke Grundlage für die Entwicklung von Werkzeugen zur Interpretierbarkeit und Modellverständnis dienen kann. Unser Code ist als Supplement beigefügt.
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.