Navigation menu
Training Vision Transformers to Focus: Emergence of Spatial Attention Head Specialization
Training Vision Transformers to Focus: Emergence of Spatial Attention Head Specialization
Yuji Nozawa, Yu-Chieh Lin, Youyang Ng
2026-11-10▲ 4arXiv 2611.11890v1Hugging FaceCode
AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.
TL;DR
The paper adds inside-focus and outside-focus losses to self-supervised ViT training to steer attention toward image regions, producing spatially specialized attention heads and improved dense-prediction performance.
Problem
Self-supervised ViT models such as DINO can learn visual representations without labels, but the paper states they typically lack a focusing mechanism during training. Consequently, learned perceptual representations are often ambiguous or overly similar across attention heads. This limits discriminative capacity and interpretability, especially for dense tasks such as segmentation.
Method
The paper introduces two visual focusing losses, called region-to-focus correspondence, or ReFoCo, for self-supervised ViT training. The inside-focus loss aligns the model's focus on local image regions with cropped images of those regions. The outside-focus loss associates partially masked images with focus on regions outside the masked parts, inspired by weakly supervised masked-image learning. The method uses PHS to select attention heads that produce the largest attention-map outputs within a region of interest and emphasizes their outputs in the last attention layer. Training replaces the DINOv2 loss with a weighted combination of DINO, inside-focus, outside-focus, iBOT, and KoLeo losses.
Results
- For ViT-B/16-Reg and ViT-g/16-Reg, adding both focusing losses improved zero-shot segmentation metrics on ImageNet-Seg and PASCAL VOC relative to DINOv2. §4.9
- Combining the inside-focus and outside-focus losses outperformed the original DINOv2 model on unsupervised object discovery on VOC07, VOC12, and COCO. §4.7
- The combined-loss model shows lower ImageNet-1k classification performance than DINOv2 in k-NN and linear probing. §4.7
- The entropy analysis reports lower mean per-head entropy for the combined-loss model than DINOv2, while head-averaged entropy is reported as 0.9166 versus 0.9265. §D.6
- With loss weights of 0.05 for both focusing losses, zero-shot segmentation on ImageNet-Seg improved over the 0,0 setting, while increasing weights to 0.1 slightly degraded performance. §D.3
- Applying PHS to the third-to-last attention block preserved high zero-shot segmentation performance while reducing classification gaps relative to the original DINOv2 model to 0.7% for k-NN and 0.4% for linear probing. §D.8
Limitations
- The paper states that it does not allow explicit control over where each attention head focuses, because focus regions are determined implicitly during training.
- It states that it is not possible to know in advance which regions each attention head will focus on until after training.
- The method increases training time.
- The paper states a trade-off between classification performance and improvements in zero-shot segmentation, object discovery, and FOIR tasks.
Key points
- The paper identifies ambiguity and similarity of perceptual representations in current self-supervised ViT models as limiting interpretability. §1
- ReFoCo uses two losses: the inside-focus loss aligns focus on local regions with cropped images of those regions, and the outside-focus loss uses partially masked images to focus outside masked parts. §1
- PHS selects heads with the largest attention-map outputs within the ROI and replaces head_i with scaled or zeroed head_i HS in the last attention layer. §3
- A random box b_x is shared by both losses, so training requires only images and no ground-truth object positions. §4.2
- DINOv2 with registers is selected as the baseline training method after comparing attention maps from DeiT III, CLIP, DINOv2, and DINOv2 with registers. §4.1
- The paper reports that the combined losses improve zero-shot segmentation, unsupervised object discovery, and multi-object image retrieval while producing clearer attention maps. §1
- Loss weights of 0.05 for each focusing loss perform better than 0.1 in segmentation, and the paper states that balancing the visual focusing loss and the DINO loss is crucial. §D.3
- Entropy analysis is presented as quantitative evidence of spatial specialization and diversity across attention heads. §D.6
Mind map
Sign In
Choose a method to continue
By signing in, you agree to our Terms and Privacy Policy

