Overview
Researchers have developed the Dynamic Hybrid Vision Transformer (DHVT), a new architecture that allows Vision Transformers (ViTs) to match or beat Convolutional Neural Networks (CNNs) even when training on small datasets from scratch. By introducing "head tokens" and hybrid convolutional structures, DHVT overcomes the traditional "data-hungry" nature of transformers, achieving state-of-the-art results on benchmarks like CIFAR-100 and ImageNet-1K.
The Problem: Data-Hungry Transformers
Vision Transformers (ViTs) are powerful, but they have a well-known "hunger" for data. While standard CNNs have built-in inductive biases—like "locality" (pixels near each other are related)—vanilla ViTs have to learn these relationships from scratch.
On massive datasets like JFT-300M, ViTs eventually learn these patterns and outperform CNNs. However, when trained on small datasets (like CIFAR-100) or even medium ones (ImageNet-1K) without pre-training, ViTs typically fall flat. This paper identifies two specific weaknesses in ViTs that cause this gap:
- Spatial Relevance: ViTs struggle to capture fine-grained, local features in early layers.
- Diverse Channel Representation: In low-data regimes, the different "heads" in a transformer don't learn strong enough individual representations to contribute to a robust final classification.
Methods: The DHVT Architecture
The authors propose the Dynamic Hybrid Vision Transformer (DHVT) to address these shortcomings. It introduces three main architectural innovations:
- Sequential Overlapping Patch Embedding (SOPE): Instead of the standard ViT approach of cutting an image into non-overlapping "patches" (which loses fine-grained edge info), SOPE uses a series of convolutions to create overlapping patches. This preserves local spatial context from the very first step.
- Dynamic Aggregation Feed Forward (DAFF): The authors modified the standard MLP (Multi-Layer Perceptron) block. They integrated depth-wise convolutions to capture neighboring features and used a "Squeeze-and-Excitation" style mechanism where patch tokens help re-calibrate the "class token" (the token used for final prediction).
- Head Tokens: This is the most novel contribution. In standard Multi-Head Self-Attention (MHSA), each "head" works in a silo. The authors created "head tokens" by segmenting and projecting input tokens. These head tokens are concatenated with the sequence, allowing different channel groups (heads) to interact and share information, leading to a more "integral" representation of the object.
Key Insights
- Hybrid is Healthy: The paper reinforces the idea that "pure" transformers aren't always optimal. By strategically placing convolutions in the embedding and MLP stages, you can "force" the model to respect spatial locality without sacrificing the global modeling power of attention.
- Breaking the Silos: The "Head Token" insight is particularly clever. By allowing attention heads to communicate, the model can fuse "weak" representations from individual heads into a "strong" collective representation—a crucial advantage when there isn't enough data for each head to become an expert on its own.
- Positional Info via Conv: The authors found that their convolutional structures (SOPE and DAFF) actually provide enough implicit positional information that the model can perform well even if you remove the explicit "absolute positional embeddings" typically required by transformers.
Key Results
DHVT effectively eliminated the performance gap between CNNs and ViTs on small data across multiple benchmarks:
- CIFAR-100: DHVT-S achieved 85.68% accuracy with 22.8M parameters, significantly outperforming standard ViTs (like DeiT-S at 66.55%) and strong CNNs (like Res2NeXt-29 at 83.44%).
- ImageNet-1K: When trained from scratch, DHVT-S reached 82.3% accuracy, which is state-of-the-art for non-hierarchical vision transformers of that size.
- DomainNet: On the "Sketch" dataset, DHVT-S outperformed ResNet-50 by over 1.2% (68.72% vs 67.45%), proving its robustness in specialized domains that differ significantly from natural photos.
Limitations and Future Work
The primary limitation acknowledged by the authors is computational cost. While DHVT is highly accurate, the use of smaller patch sizes (e.g., patch size 2 vs. 4) causes the computational complexity to rise quadratically. This makes the model slower to train and run than some simpler counterparts.
Future work may involve optimizing these hybrid structures to maintain high accuracy while reducing the GFLOPs (computational overhead), perhaps by exploring more efficient window-based attention or pruning mechanisms.
Summary updated