Interpreting Vision Transformers Through Attention Analysis and Layer-Wise Probing

Juan Manuel Hernandez, Mariana Fernandez-Espinosa, Oscar Loch, Denis Parra, Diego Gomez-ZaraNeurIPS 2026 Education Track 2026

TL;DR

Vision Transformers (ViTs) are notoriously hard to intuit because their computations are spread across dozens of layers and high-dimensional representations. This paper introduces an interactive web-based educational tool that lets learners peek inside a live ViT as it classifies images, connecting the model's actual math to visual attention maps and layer-by-layer prediction readouts.

What Problem Does This Paper Address?

If you have ever tried to understand how a Vision Transformer "sees" an image, you have likely hit a wall. Unlike traditional convolutional neural networks that process images through localized filters, ViTs chop an image into patches and pass them through a maze of self-attention layers.

While tools like attention maps look intuitive on the surface, they often hide how they were generated and what they can actually tell us about a model's decision. For students and newcomers to computer vision, the gap between reading equations about Multi-Head Self-Attention and understanding what happens during a forward pass is huge. The authors set out to build a guided, interactive walkthrough that bridges this gap—without dumbing down the underlying model or relying on pre-computed, canned animations.

Methods

The authors built an interactive web platform (vit-explainer.vercel.app/demo) centered on a clever architectural choice. Standard ViTs use hundreds of image patches, which makes visualizing every single token interaction overwhelming. Instead, the authors use FlexiViT-Large configured at a $96 \times 96$ resolution with $32 \times 32$ pixel patches.

This setup yields just 9 patch tokens plus 1 class token, resulting in a clean, fully inspectable $10 \times 10$ attention matrix—while still running a real, pretrained 24-layer, 16-head ImageNet-1k classifier. Everything runs via live inference, meaning learners can even upload their own images and watch the real model react.

The platform pairs this live forward pass with two complementary interpretability techniques:

  • Attention-based analysis: Learners can inspect how tokens attend to one another across different heads and layers, and map those weights directly back to regions of the input image.
  • Layer-wise probing (Logit Lens): By applying the model's final classification head to intermediate class-token states, learners can watch how evidence for different classes evolves—or flips—across the depth of the network.

To round out the educational experience, the tool includes a 28-step guided walkthrough, a free-exploration mode, a knowledge-check quiz with instructor guidance, an orientation video, and open-source code.

Datasets

No new datasets or benchmarks are introduced in this paper. The platform uses a model pretrained on ImageNet-1k and supports live inference on custom images uploaded by users.

Key Insights and Ideas

  • Small grids make big concepts visible: By shrinking the input to 9 patches instead of hundreds, learners can see the entire $10 \times 10$ attention matrix at once without losing the authentic behavior of a deep, 24-layer pretrained transformer.
  • Interpretability needs guardrails: A major theme of the resource is teaching learners what these visualizations cannot do. The authors explicitly emphasize that attention maps and Logit Lens readouts are observations of internal behavior—not complete, causal explanations of why a model made a final prediction.
  • Connecting math to visuals: Rather than treating interpretability as a separate, post-hoc step, the 28-step walkthrough ties every visualization directly to the underlying ViT computation that produced it.

Key Results

The authors conducted a preliminary evaluation with 6 users and found strong early signs of usability and clarity:

  • High usability: The platform scored a mean System Usability Scale (SUS) score of 90.4, well above the standard 68-point benchmark.
  • Low cognitive load: Using an item adapted from the NASA-TLX, participants reported a low perceived mental demand of 2.2 on a 1–7 scale.
  • Qualitative takeaway: Users most frequently noted that the patch-level attention visualizations finally made Multi-Head Self-Attention click, turning an abstract textbook concept into something directly observable.

Limitations and Future Work

The authors note that the interpretability methods themselves—attention maps and layer-wise probing—have inherent limitations as explanations of model behavior, and their tool is specifically designed to teach learners to recognize those boundaries. Beyond the preliminary 6-user evaluation, future work and broader classroom deployments are not discussed in the paper.

Summary updated

BibTeX
@inproceedings{hernandez2026interpreting,
  author = {Juan Manuel Hernandez and Mariana Fernandez-Espinosa and Oscar Loch and Denis Parra and Diego Gomez-Zara},
  title = {{Interpreting Vision Transformers Through Attention Analysis and Layer-Wise Probing}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=FfO1OoG9Lm},
}
Figure