Abstract
Conventional wisdom suggests that pre-training Vision Transformers (ViTs) on large-scale datasets succeeds by building a robust library of visual features. This paper challenges that assumption, proposing that the primary value of pre-training lies in the attention patterns—the "routing instructions" that dictate how information flows between tokens. Through a series of experiments involving "Attention Transfer," we demonstrate that a model initialized from scratch can match the performance of full-weight fine-tuning simply by inheriting these routing patterns. This finding suggests that visual features are surprisingly replaceable, while the spatial communication logic is the true engine of ViT performance.
Introduction: Features vs. Routing
In computer vision, the standard paradigm involves pre-training a model on a massive dataset (e.g., ImageNet-21K) and fine-tuning its weights for a specific downstream task. It has long been assumed that this process works because the model learns a hierarchy of features—edges, textures, and object parts.
However, the architecture of Vision Transformers (ViTs) provides a unique opportunity to decouple this process. ViTs explicitly separate inter-token communication (the Attention mechanism) from intra-token computation (the MLP blocks). This separation raises a fundamental question: Is the success of pre-training driven by the what (the features processed in MLPs) or the where (the routing logic in attention maps)? If we discard the pre-trained features but retain the routing instructions, can a model still achieve state-of-the-art performance?
Methodology: Isolating the Routing Logic
To test the "routing hypothesis," the researchers introduced two primary methods for transferring knowledge from a pre-trained teacher to a student model:
- Attention Copy: This serves as a scientific probe. During the forward pass, the student model (initialized randomly) literally "copy-pastes" the attention maps from a frozen, pre-trained teacher. This isolates the effect of the attention patterns, forcing the student to learn its own features from scratch while using the teacher's communication map.
- Attention Distillation: A more practical implementation where the student is trained to predict the teacher's attention maps using a cross-entropy loss. Unlike standard knowledge distillation, which focuses on final outputs or feature vectors, this method focuses exclusively on the softmax(QKᵀ) matrix—the map of which patches interact with one another.
Key Insights and Experimental Results
1. Routing is Sufficient for Parity
The most significant finding is that Attention Distillation can match the performance of standard full-weight fine-tuning. On a ViT-L architecture pre-trained with Masked Autoencoders (MAE), the distilled student achieved 85.7% top-1 accuracy on ImageNet-1K—identical to the performance of a fully fine-tuned model. This suggests that as long as the model knows how to route information, it can successfully learn the necessary features during the fine-tuning phase.
2. Feature Diversity and Ensembling
Because the student model learns its own features from scratch while following the teacher’s routing, the resulting features are fundamentally different from those of the teacher. This diversity is highly beneficial; ensembling an attention-transferred model with a traditionally fine-tuned model resulted in a significant accuracy boost of +0.6%. This indicates that the two models "see" the world differently despite using the same routing logic.
3. The Importance of High-Level Routing
The study found that transferring attention maps from the later layers of the Transformer is significantly more beneficial than transferring early layers. This suggests that while models can easily learn low-level features (like edges and colors) independently, they struggle to learn the high-level "hierarchy" of how to combine those features without the guidance provided by pre-training.
4. Flexibility via Queries (Q)
Interestingly, transferring only the "Queries" ($Q$) from the teacher sometimes outperformed transferring the full attention map. This provides the student with the teacher's "intent" (what it is looking for) while allowing the student the flexibility to adapt its "Keys" ($K$) to the specific nuances of the new task.
Generalization and Robustness
The effectiveness of attention transfer is not limited to classification. In the ViTDet framework for object detection on COCO, attention transfer recovered the majority of the gains typically provided by full pre-training. The method also scaled consistently across model sizes (ViT-B to ViT-H) and various pre-training regimes, including MoCo-v3 and FLIP.
However, the study noted certain limitations regarding distribution shifts. When the downstream data (e.g., iNaturalist) differs significantly from the pre-training data (ImageNet), the frozen teacher's routing maps can become sub-optimal. Furthermore, while attention transfer matches in-distribution accuracy, it does not fully replicate the out-of-distribution (OOD) robustness that comes with transferring all pre-trained weights.
Conclusion
This research shifts our understanding of why Vision Transformers benefit from pre-training. By demonstrating that attention patterns are the most critical component of the pre-trained knowledge, the authors open new doors for model compression, ensembling, and architectural design. The "secret sauce" of the ViT is not just the features it learns, but the sophisticated way it learns to route information across the image.
Summary updated