Command Palette
Search for a command to run...
Discrete Representations Strengthen Vision Transformer Robustness
Chengzhi Mao Lu Jiang Mostafa Dehghani Carl Vondrick Rahul Sukthankar Irfan Essa

Abstract
Vision Transformer (ViT) is emerging as the state-of-the-art architecture for image recognition. While recent studies suggest that ViTs are more robust than their convolutional counterparts, our experiments find that ViTs trained on ImageNet are overly reliant on local textures and fail to make adequate use of shape information. ViTs thus have difficulties generalizing to out-of-distribution, real-world data. To address this deficiency, we present a simple and effective architecture modification to ViT's input layer by adding discrete tokens produced by a vector-quantized encoder. Different from the standard continuous pixel tokens, discrete tokens are invariant under small perturbations and contain less information individually, which promote ViTs to learn global information that is invariant. Experimental results demonstrate that adding discrete representation on four architecture variants strengthens ViT robustness by up to 12% across seven ImageNet robustness benchmarks while maintaining the performance on ImageNet.
Code Repositories
Benchmarks
| Benchmark | Methodology | Metrics |
|---|---|---|
| domain-generalization-on-imagenet-c | DiscreteViT | Number of params: 87M mean Corruption Error (mCE): 46.22 |
| domain-generalization-on-imagenet-c | DrViT | mean Corruption Error (mCE): 46.22 |
| domain-generalization-on-imagenet-c | DiscreteViT (Im21k) | Number of params: 87M mean Corruption Error (mCE): 38.74 |
| domain-generalization-on-imagenet-r | DiscreteViT | Top-1 Error Rate: 44.74 |
| domain-generalization-on-imagenet-sketch | DrViT | Top-1 accuracy: 44.72 |
| domain-generalization-on-stylized-imagenet | DiscreteViT | Top 1 Accuracy: 22.19 |
| image-classification-on-imagenet | DiscreteViT | Top 1 Accuracy: 85.07% |
| image-classification-on-objectnet | ViT-B (Discrete 512x512) | Top-1 Accuracy: 46.62 |
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.