Introduction
Vision Transformers (ViT) have significantly advanced computer vision, yet they often face a "data tax" and a "compute tax." Standard ViTs lack the inductive biases—such as locality and translation equivariance—that make Convolutional Neural Networks (CNNs) effective, necessitating massive datasets for pre-training. Furthermore, global self-attention is computationally expensive for high-resolution images.
The Nested Hierarchical Transformer (NesT) addresses these limitations by nesting standard transformer blocks and connecting them through a simple, convolution-based aggregation function. This approach achieves state-of-the-art accuracy while remaining remarkably data-efficient—performing well even on small datasets like CIFAR—and introduces a novel "tree-traversal" method for interpreting model decisions.
Architecture and Methods
The core innovation of NesT is its hierarchical nesting strategy. Instead of a single global transformer, the model processes small, non-overlapping image blocks independently using canonical transformer layers.
- Hierarchical Nesting: The model begins with numerous small blocks. As the network deepens, groups of four spatially adjacent blocks are merged into a single larger block, creating a tree-like hierarchy.
- Block Aggregation: To facilitate communication between blocks, NesT employs a "Block Aggregation" step. Features are "unblocked" into a 2D image plane, processed via a $3 \times 3$ convolution and max pooling, and then "re-blocked" for the next level. This introduces spatial priors and local information exchange without altering the core self-attention mechanism.
- GradCAT (Gradient-based Class-Aware Tree-traversal): The hierarchical structure allows for a unique interpretability method. By tracing classification decisions from the root down to the leaf patches, researchers can visualize exactly which image regions contribute to a specific prediction.
Key Insights
- The Image Plane Advantage: Performing aggregation on the holistic image plane (rather than just token sequences) naturally introduces spatial priors that transformers typically lack.
- Decoupling Learning and Abstraction: Transformer layers focus on local feature learning, while aggregation layers handle global abstraction. This separation enhances both convergence speed and interpretability.
- Efficiency and Convergence: NesT-B reaches 82.3% accuracy on ImageNet in 100 epochs, significantly faster than many contemporary models that require 300 epochs to reach similar performance.
Experimental Results
NesT demonstrates superior performance across various benchmarks:
- ImageNet Accuracy: NesT-B achieves 83.8% Top-1 accuracy on ImageNet-1K with 68M parameters, outperforming the original ViT and Swin Transformer at similar scales.
- Data Efficiency: On CIFAR-10, a compact NesT (6M parameters) achieved 96% accuracy trained from scratch. This is a significant win, as standard transformers typically struggle on small datasets without extensive pre-training.
- Generative Performance: The Transposed NesT decoder is 8 times faster than previous state-of-the-art transformer generators while producing higher-quality images.
- Interpretability: NesT CAM (Class Activation Mapping) provides cleaner, more localized visualizations compared to ResNet or DeiT, effectively identifying semantically relevant features (e.g., the head of a bird) while ignoring background noise.
Conclusion
NesT simplifies the hierarchical vision transformer by moving complexity out of the attention mechanism and into a simple spatial aggregation function. This results in a model that is easier to implement, faster to train, and more interpretable. Future work involves extending this nested hierarchy to non-grid domains like video and natural language processing, where hierarchical relationships are equally vital.
Summary updated