Interpreting vision transformers via residual replacement model
Organizations: Yonsei University
Abstract
How do vision transformers (ViTs) represent and process the world? This paper addresses this long-standing question through the first systematic analysis of 6.6K features across all layers, extracted via sparse autoencoders, and by introducing the residual replacement model, which replaces ViT computations with interpretable features in the residual stream. Our analysis reveals not only a feature evolution from low-level patterns to high-level semantics, but also how ViTs encode curves and spatial positions through specialized feature types. The residual replacement model scalably produces a faithful yet parsimonious circuit for human-scale interpretability by significantly simplifying the original computations. As a result, this framework enables intuitive understanding of ViT mechanisms. Finally, we demonstrate the utility of our framework in debiasing spurious correlations.
Figures & tables
| Faithfulness (%) | 1 - Completeness (%) | Causality (%) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Unit | Strategy | ViT | DINOv2 | CLIP | ViT | DINOv2 | CLIP | ViT | DINOv2 | CLIP | |
| 1 | Neuron | Random Circuit | 24.9 | 24.7 | 25.0 | 81.0 | 82.6 | 87.7 | - | - | - |
| 2 | Naïve Circuit | 23.0 | 25.8 | 29.2 | 95.2 | 94.9 | 97.1 | - | - | - | |
| 3 | + Edge-based Discovery | 26.3 | 26.7 | 30.2 | 92.4 | 93.7 | 97.1 | - | - | - | |
| 4 | + Gradient Correction | 61.4 | 42.8 | 32.4 | 94.2 | 94.4 | 95.4 | - | - | - | |
| 5 | Feature | Random Circuit | 30.2 | 27.5 | 27.0 | 78.1 | 90.1 | 84.4 | 35.6 | 33.9 | 31.1 |
| Accuracy | mAUC | |
|---|---|---|
| Original ViT | 0.849 | 0.854 |
| Intervened ViT | 0.848 | 0.904 |
| SpuFix (Upper bound) | 0.848 | 0.917 |
Appendix figures & tables40 assets
Supplementary material from the paper’s appendix.
Appendix
| Faithfulness (%) | 1 - Completeness (%) | |||||
|---|---|---|---|---|---|---|
| Rule | ViT | DINOv2 | CLIP | ViT | DINOv2 | CLIP |
| top- | 94.1 | 85.1 | 82.3 | 99.6 | 99.8 | 99.7 |
| top- | 95.0 | 85.4 | 82.9 | 99.7 | 99.7 | 99.7 |
| threshold | 93.6 | 84.6 | 82.2 | 99.6 | 99.8 | 99.7 |
| Faithfulness (%) | 1 - Completeness (%) | Causality (%) | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Strategy | ViT | DINOv2 | CLIP | ViT | DINOv2 | CLIP | ViT | DINOv2 | CLIP |
| Random | 30.2 | 27.5 | 27.0 | 78.1 | 90.1 | 84.4 | 35.6 | 33.9 | 31.1 |
| CLA | 56.3 | 41.3 | 36.7 | 92.5 | 93.8 | 93.5 | 57.2 | 54.8 | 55.1 |
| Ours | 94.1 | 85.1 | 82.3 | 99.6 | 99.8 | 99.7 | 54.5 | 54.8 | 53.8 |
Transformer Interpretability
Transformer interpretability studies how attention, feed-forward layers, and hidden representations support model predictions and behavior.
See all 336 papers