Abstract
Training vision transformer networks on small datasets poses challenges. In contrast, convolutional neural networks (CNNs) can achieve state-of-the-art performance by leveraging their architectural inductive bias. In this paper, we investigate whether this inductive bias can be reinterpreted as an initialization bias within a vision transformer network. Our approach is motivated by the finding that random impulse filters can achieve almost comparable performance to learned filters in CNNs. We introduce a novel initialization strategy for transformer networks that can achieve comparable performance to CNNs on small datasets while preserving its architectural flexibility.
Introduction
Vision Transformers (ViTs) have revolutionized computer vision, yet they suffer from a significant "data hunger" problem. Unlike Convolutional Neural Networks (CNNs), which possess an inherent inductive bias toward spatial locality (the assumption that nearby pixels are related), ViTs are "blank slates" that must learn spatial relationships from scratch. This typically necessitates massive datasets like ImageNet or JFT-300M. When trained on smaller datasets such as CIFAR-10, standard ViTs often underperform compared to simple CNNs. While existing solutions involve extensive pre-training or architectural modifications, this work explores whether convolutional benefits can be achieved solely through weight initialization.
Methods: Impulse Filter Initialization
The proposed method, Impulse Filter Initialization, is inspired by the observation that models like ConvMixer can perform effectively even with random, unlearned filters, provided channel mixing is trained.
The core strategy involves several key steps:
- The Impulse Insight: Demonstrating that a convolutional matrix (specifically a random impulse filter) can be mathematically approximated by a SoftMax attention matrix.
- Targeting Locality: Standard random initialization leads to "random permutation" attention maps where pixels look at other pixels haphazardly. Instead, Query ($Q$) and Key ($K$) matrices are initialized to mimic random impulse convolution filters.
- Pre-initialization Optimization: A rapid optimization step (taking only seconds) minimizes the Mean Squared Error (MSE) between the resulting attention map and a target impulse filter.
- Attention Balancing: A hyperparameter ($\alpha$) balances attention between input data and positional encodings, allowing the model to leverage convolutional bias more effectively during early training stages.
Experimental Results
The researchers evaluated the method on standard benchmarks for data-efficient learning: CIFAR-10, CIFAR-100, SVHN, and Tiny ImageNet. The Impulse initialization consistently outperformed both standard random initialization and the recent "Mimetic" initialization.
- Accuracy Improvements: On CIFAR-100, Impulse initialization achieved 68.78% accuracy, a significant jump over the 64.16% achieved by standard random initialization.
- Weight Freezing Stress Test: In a test where spatial mixing weights were frozen, the Impulse method outperformed random initialization by 26-29% in accuracy.
- Convergence: Training curves indicate that models using impulse filters converge significantly faster than those using traditional initialization methods.
Discussion and Key Insights
This research suggests that "inductive bias" can be treated as an "initialization bias." By guiding the model toward a good solution at the start of training, we maintain the flexibility of the Transformer architecture while gaining the data efficiency of CNNs. Standard random initialization fails because it creates haphazard attention maps; in contrast, random impulse filters provide a diverse, linearly independent basis for feature extraction. The authors found that a small amount of input-dependent information ($\alpha = 0.1$) combined with impulse initialization provides the best results.
Limitations and Future Work
While promising, the method is sensitive to hyperparameters like the scale of self-attention ($\sigma$) and weight normalization ($\eta$). Future work will focus on automating this tuning and integrating the impulse filter strategy more seamlessly into standard ViT architectures. Additionally, further theoretical exploration is needed to determine the optimal distribution of these filters across different attention heads and layers.
Summary updated