[Paper Review] When Vision Transformers Outperform ResNets without Pre-training or Strong Data Augmentations
The paper shows that Vision Transformers and MLP-Mixers trained from scratch can surpass ResNets of similar size when paired with a sharpness-aware optimizer (SAM), without large-scale pre-training or strong augmentations, and analyzes loss landscapes to explain why.
Vision Transformers (ViTs) and MLPs signal further efforts on replacing hand-wired features or inductive biases with general-purpose neural architectures. Existing works empower the models by massive data, such as large-scale pre-training and/or repeated strong data augmentations, and still report optimization-related problems (e.g., sensitivity to initialization and learning rates). Hence, this paper investigates ViTs and MLP-Mixers from the lens of loss geometry, intending to improve the models' data efficiency at training and generalization at inference. Visualization and Hessian reveal extremely sharp local minima of converged models. By promoting smoothness with a recently proposed sharpness-aware optimizer, we substantially improve the accuracy and robustness of ViTs and MLP-Mixers on various tasks spanning supervised, adversarial, contrastive, and transfer learning (e.g., +5.3\% and +11.0\% top-1 accuracy on ImageNet for ViT-B/16 and Mixer-B/16, respectively, with the simple Inception-style preprocessing). We show that the improved smoothness attributes to sparser active neurons in the first few layers. The resultant ViTs outperform ResNets of similar size and throughput when trained from scratch on ImageNet without large-scale pre-training or strong data augmentations. Model checkpoints are available at \url{https://github.com/google-research/vision_transformer}.
Motivation & Objective
- Investigate ViTs and MLP-Mixers trained from scratch to understand optimization and generalization gaps compared to ResNets.
- Analyze loss landscapes and Hessians to characterize sharp minima in convolution-free architectures.
- Evaluate the effect of the sharpness-aware optimizer (SAM) on accuracy, robustness, and training dynamics across tasks.
- Demonstrate that SAM enables competitive or superior performance without large-scale pre-training or strong augmentations.
Proposed method
- Study loss landscapes and Hessian spectra of ViTs and MLP-Mixers at convergence on ImageNet.
- Apply the sharpness-aware minimizer (SAM) to ViTs and MLP-Mixers to encourage flat regions in the loss geometry.
- Compare SAM-trained ViTs/Mixers to ResNets trained from scratch, using the same basic preprocessing, and assess accuracy and robustness.
- Analyze intrinsic model changes with SAM, including Hessian blocks, weight norms, and neuron activation sparsity.
- Visualize attention maps to assess interpretability improvements due to SAM.
Experimental results
Research questions
- RQ1Can ViTs and MLP-Mixers surpass ResNets trained from scratch without pre-training or heavy augmentations using a loss-geometry–aware optimizer?
- RQ2How does SAM affect the loss landscape, Hessian curvature, and trainability of convolution-free architectures?
- RQ3What intrinsic architectural changes accompany SAM (e.g., sparsity, weight norms) and how do they relate to generalization and robustness?
- RQ4How do ViTs and Mixers trained with SAM perform in terms of accuracy and robustness compared to ResNets under ImageNet-R and ImageNet-C?
Key findings
- SAM significantly improves accuracy and robustness of ViTs and MLP-Mixers trained from scratch (e.g., substantial top-1 gains on ImageNet for ViT-B/16 and Mixer-B/16).
- ViTs and MLP-Mixers converge to much sharper local minima without SAM, with large Hessian eigenvalues, but SAM smooths the loss landscape and reduces both average and worst-case curvature.
- SAM leads to sparser active neurons in early layers, especially in MLP-Mixers, which correlates with smoother loss geometry and better generalization.
- ViTs with SAM can outperform ResNets of similar or larger size at comparable throughput when trained from scratch on ImageNet, without large-scale pre-training or strong augmentations.
- SAM improves robustness to corruptions (ImageNet-C) and distribution shifts (ImageNet-R) more than it improves clean accuracy, compared to baseline models.
- SAM enables training ViTs with SGD (momentum) to reach performance close to Adam/SAM combinations, narrowing optimizer gaps.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.