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

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Atad, Ido Andrew, Zimerman, Itamar, Katz, Shahar, Wolf, Lior
Formato: Preprint
Publicado: 2026
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866911398870646784
author Atad, Ido Andrew
Zimerman, Itamar
Katz, Shahar
Wolf, Lior
author_facet Atad, Ido Andrew
Zimerman, Itamar
Katz, Shahar
Wolf, Lior
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2601_17958
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle TensorLens: End-to-End Transformer Analysis via High-Order Attention Tensors
Atad, Ido Andrew
Zimerman, Itamar
Katz, Shahar
Wolf, Lior
Machine Learning
I.2.6; I.2.7
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.
title TensorLens: End-to-End Transformer Analysis via High-Order Attention Tensors
topic Machine Learning
I.2.6; I.2.7
url https://arxiv.org/abs/2601.17958