Abstract
Vision Transformers (ViTs) have emerged as a powerful alternative to Convolutional Neural Networks (CNNs), yet they lack the inherent inductive biases that guide CNN learning. This study provides a comprehensive analysis of how different supervision paradigms—explicit supervision, contrastive self-supervision, and reconstruction-based self-supervision—shape the internal logic of ViTs. By examining attention mechanisms ("How"), feature representations ("What"), and downstream task performance ("Why"), we demonstrate that the training objective fundamentally dictates the model's focus. Key findings include the emergence of "offset local attention" across all models, the development of sparse repeating patterns in supervised models, and the object-centric nature of contrastive models. Our results indicate that the optimal layer for downstream tasks varies by objective, challenging the convention of using only the final layer's representations.
Introduction
Vision Transformers (ViTs) have rapidly become the go-to architecture for computer vision, often outperforming traditional CNNs. However, unlike CNNs, which have a built-in "inductive bias" (such as looking at local neighborhoods), ViTs are a blank slate. They can attend to any part of an image at any time. This flexibility raises a critical question: How does the way we "teach" a ViT—the supervision method—change what it actually learns? While supervised models are known for high classification accuracy, the internal differences between self-supervised methods like DINO (contrastive) or MAE (reconstruction) remain poorly understood.
Methods: The How, What, and Why Framework
To address this, we conduct a "cross-cutting analysis" across three domains:
- How (Attention): We analyze information flow through Multi-Headed Attention (MHA) using Aligned Aggregated Attention Maps (AAAMs) to visualize whether heads focus locally, globally, or at specific offsets.
- What (Features): We use Centered Kernel Alignment (CKA) to measure representation similarity across models and layers, alongside unsupervised clustering to evaluate feature "purity" at object and part levels.
- Why (Downstream Tasks): We evaluate models without fine-tuning on tasks including k-NN classification, image retrieval, video object segmentation (DAVIS), and keypoint correspondence (SPair-71k).
We compare six representative models: Explicitly supervised (FS, CLIP), Contrastive self-supervised (DINO, MoCo-v3), and Reconstruction-based self-supervised (MAE, BEiT).
Key Insights: How Supervision Shapes Attention
Our analysis reveals that the training objective profoundly impacts the evolution of attention maps across the transformer's layers.
The Discovery of "Offset Local Attention"
A surprising commonality across all ViTs, regardless of training, is the "invention" of heads that look at tokens exactly one step away (up, down, left, or right). Since ViTs lack convolutions, they independently learn to create their own spatial shift operators to understand local structure.
Divergent Late-Layer Behaviors
As information progresses through the network, the attention maps diverge based on supervision:
- Supervised Models (FS and CLIP): In later layers, attention maps devolve into "Sparse Repeating Patterns." These patterns appear noisy but are consistent across images, suggesting the model uses these layers as an internal scratchpad for final classification logic once the image structure is "solved."
- Contrastive Models (DINO and MoCo): These models naturally learn "Object Centered Blobs," making them inherently superior for segmentation tasks.
- Reconstruction Models (MAE and BEiT): The final layers act like decoders, spreading information back out to reconstruct pixels. Consequently, their middle layers are often more useful for downstream tasks than their final outputs.
Feature Similarity and Downstream Performance
Despite having completely different loss functions, MAE (reconstruction) learns features surprisingly similar to DINO (contrastive), suggesting a "natural" representation of visual information that ViTs converge toward.
In terms of performance, Fully Supervised (FS) models dominate global classification (e.g., ImageNet), but contrastive models like DINO are superior for dense, localized tasks like video segmentation. For identifying specific object parts, contrastive methods and reconstruction-based BEiT often outperform CLIP, which remains focused on high-level image-text alignment. A major takeaway is that there is no "best" layer; for local tasks like keypoint matching, mid-to-late layers often significantly outperform the final output layer.
Conclusion
This study demonstrates that supervision is not just a means to an end but a fundamental architect of a model's internal logic. The discovery of "Offset Local Attention" suggests that future ViT architectures could be improved by explicitly baking in these learned spatial biases. Furthermore, the varying utility of different layers across tasks highlights the importance of selecting representations based on the specific requirements of the downstream application.
Summary updated