TL;DR
JetViT introduces a cost-effective post-training framework that converts heavy, full-attention Vision Transformers (ViTs) into efficient hybrid-attention models. By strategically replacing redundant full-attention blocks with lightweight linear and window attention, JetViT achieves up to a 1.79× throughput increase and a 44.81% latency reduction on high-resolution images without sacrificing accuracy.
What Problem Does This Paper Address?
Vision Transformers (ViTs) have become the backbone of state-of-the-art computer vision, especially for large-scale foundation models like DINOv3 and DepthAnythingV2. However, standard self-attention suffers from quadratic computational and memory complexity ($O(N^2)$) relative to the image resolution. When processing high-resolution images (e.g., 2K or higher), inference becomes painfully slow and memory-intensive.
While researchers have proposed efficient attention variants (like linear or window-based attention), training these architectures from scratch is computationally prohibitive and requires massive, often proprietary, web-scale datasets. JetViT addresses this bottleneck by accelerating already trained full-attention foundation models post-training, bypassing the need for costly pre-training from scratch.
Methods
The authors propose Post-Training Attention Search (PTAS), a framework that inherits weights from a pre-trained full-attention model and optimizes its architecture through three main steps:
- JetViT Linear Attention Block: Standard linear attention often drops in accuracy. To fix this, the authors introduce Squeeze Dynamic Convolution. Instead of generating a unique convolution kernel for every single token (which adds massive overhead), it generates a single dynamic kernel based on global features pooled from the value matrix ($V$), sharing it across all tokens.
- Linear and Window-Attention Search: The framework constructs a supernetwork to find the optimal combination of Linear Attention (LA) for global modeling and Window Attention (WA) for local modeling, using distillation from the full-attention teacher model.
- Full-Attention Placement: To close the remaining accuracy gap, a second search phase selectively reintroduces a minimal number of original full-attention (FA) blocks back into the network.
Crucially, unlike prior methods that randomly initialize attention matrices during conversion, JetViT inherits all attention weights ($W_Q, W_K, W_V, W_O$) from the base model, which dramatically accelerates convergence and preserves performance.
Datasets
The framework was trained and evaluated using a mixture of diverse, widely used open-source datasets:
- Pre-training/Distillation: SA1B, ImageNet21K, BDD100K, Google Landmarks, Places365, Pexels, Cityscapes, and COCO.
- Downstream Evaluation: Cityscapes and ADE20K (for semantic segmentation); DIODE, Sintel, Cityscapes, and the DA2K benchmark (for monocular depth estimation).
Key Insights and Ideas
- Two Full-Attention Blocks Are All You Need: Remarkably, the authors found that retaining just two full-attention blocks in a 24-layer network is sufficient to fully recover the teacher model's original accuracy.
- Full Weight Inheritance is Mandatory: Inheriting the attention weights rather than just the MLP weights yields a substantial +3% mIoU improvement on semantic segmentation tasks, proving that pre-trained attention maps contain critical structural knowledge that shouldn't be discarded.
- Task-Dependent Attention Placement: The optimal position for the remaining full-attention blocks depends heavily on how the backbone features are used. For depth estimation (which pulls features from intermediate layers), middle-to-deep layers are critical. For semantic segmentation (which uses the final layer), the very end of the network requires full attention.
Key Results
Tested on an NVIDIA H100 GPU, JetViT delivers massive efficiency gains while maintaining identical accuracy to its full-attention counterparts:
- DepthAnythingV2 (Giant): Achieves a 1.79× increase in throughput and a 44.81% reduction in latency at $1022 \times 2044\text{px}$ resolution.
- DINOv3 (7B): Provides a 1.47× throughput speedup and a 30.21% latency reduction at $1024 \times 2048\text{px}$ resolution.
- Low Search Cost: The entire Post-Training Attention Search requires only $\sim 1/68$ of the original pre-training cost for the DINOv3-7B model, making it highly accessible.
Limitations and Future Work
While JetViT demonstrates impressive wall-clock speedups, the authors note that their linear-attention blocks are currently implemented entirely in native PyTorch without custom CUDA kernel optimizations. Writing tailored hardware kernels for Squeeze Dynamic Convolution could unlock even more substantial hardware acceleration. Additionally, because the framework relies on a pre-trained teacher, its performance ceiling remains inherently bounded by the quality of the initial foundation model.
Summary updated