Abstract
Recent advances of Transformers have brought new trust to computer vision tasks. However, on small dataset, Transformers is hard to train and has lower performance than convolutional neural networks. We make vision transformers as data-efficient as convolutional neural networks by introducing multi-focal attention bias. Inspired by the attention distance in a well-trained ViT, we constrain the self-attention of ViT to have multi-scale localized receptive field. The size of receptive field is adaptable during training so that optimal configuration can be learned. We provide empirical evidence that proper constrain of receptive field can reduce the amount of training data for vision transformers. On Cifar100, our ViT-P Base model achieves the state-of-the-art accuracy (83.16%) trained from scratch. We also perform analysis on ImageNet to show our method does not lose accuracy on large data sets.
Introduction
Vision Transformers (ViTs) have revolutionized computer vision, yet they remain notoriously "data-hungry." Unlike Convolutional Neural Networks (CNNs), which possess an inherent inductive bias for locality, standard ViTs utilize global self-attention from the outset. While this allows for long-range modeling, it makes training on small datasets (e.g., CIFAR-100) exceptionally difficult. ViT-P addresses this by introducing multi-focal attention bias, providing a "local head start" that bridges the data-efficiency gap.
The Locality Deficit in Small-Data ViTs
The primary challenge for ViTs on limited data is their failure to develop local receptive fields in early layers. By analyzing Mean Attention Distance (MAD), researchers found that ViTs trained on massive datasets (like ImageNet-21k) naturally learn to focus on local features early in the network. However, when trained on small datasets, this behavior never emerges.
As shown in Figure 1, the high MAD across all layers in the CIFAR-100 model indicates a lack of local focus, which correlates with lower performance compared to CNNs.
Methodology: Multi-Focal Attention Bias
ViT-P modifies the standard self-attention mechanism by adding a learnable Focal Attention Bias ($B$):
$$Attention(Q, K, V) = Softmax\left(\frac{QK^T}{\sqrt{d_k}} + B\right)V$$
Multi-scale Receptive Field Attention (MRFA)
Instead of a uniform window size, ViT-P distributes diverse window sizes across heads in the same layer (MRFA-W). This allows the model to capture features at multiple scales simultaneously.
Learnable De-suppression
At initialization, the bias $B$ acts as a soft mask, penalizing tokens outside a specific $w \times w$ window. Crucially, this bias is learnable. By applying weight decay, the suppression of distant tokens gradually drifts toward zero during training. This "de-suppression" mechanism allows the network to autonomously transition from local to global attention as it encounters more data, ensuring it isn't permanently restricted by its initial local prior.
Experimental Results
ViT-P was evaluated on CIFAR-10/100 and ImageNet-1k to test both data efficiency and scalability.
- CIFAR-100 SOTA: ViT-P Base achieved 83.16% accuracy when trained from scratch, outperforming highly optimized models like Swin-B (78.45%) and NesT-B (82.56%).
- CIFAR-10: The model reached 97.20% accuracy, a significant jump from the standard ViT-Base (94.02%).
- Scalability: On ImageNet-1k, ViT-P achieved 82.1% accuracy, demonstrating that the local initialization does not penalize performance when data is plentiful.
Conclusion
ViT-P demonstrates that the "data hunger" of Transformers is largely an optimization challenge that can be mitigated with proper inductive priors. By initializing with locality and allowing the model to "unlock" global reasoning through training, ViT-P achieves state-of-the-art data efficiency without sacrificing the long-term potential of the Transformer architecture.
Summary updated