TL;DR
This paper introduces a dynamic spatial sparsification framework that accelerates both Vision Transformers (ViTs) and Convolutional Neural Networks (CNNs) by pruning or downscaling uninformative image regions on the fly. By leveraging a novel dual-path routing strategy for hierarchical models, the approach slashes computational costs (FLOPs) by up to 35% while maintaining spatial structure and keeping accuracy drops within a negligible 0.5%.
What Problem Does This Paper Address?
Modern deep learning models for computer vision are notoriously power-hungry and computationally expensive. While mainstream acceleration techniques typically focus on channel pruning (removing redundant filters), they often ignore a fundamental truth about visual data: spatial redundancy. In any given image, only a fraction of the pixels contain the core information needed for classification or detection—the rest is just background noise (like a clear blue sky behind a flying bird).
Previous attempts to exploit spatial sparsity have relied on rigid rectangular cropping or custom sparse convolutions. Rigid cropping fails when informative regions are scattered across the frame, and unstructured sparse convolutions are notoriously difficult to optimize on standard hardware. Furthermore, simply dropping uninformative pixels or tokens breaks hierarchical architectures (like CNNs or Swin Transformers) that rely on a fixed grid structure for operations like convolutions and downsampling.
The authors tackle this challenge by designing a data-dependent, unstructured spatial sparsification framework that works seamlessly across both isotropic Vision Transformers and structured, hierarchical networks.
Methods
The authors propose two distinct strategies depending on the underlying network architecture:
1. DynamicViT (For Isotropic Vision Transformers)
Because standard ViTs treat an image as a sequence of independent patch tokens, they can naturally handle variable sequence lengths. The authors insert a lightweight prediction module between transformer blocks to estimate an importance score for each token.
To train this end-to-end, they utilize the Gumbel-Softmax trick to sample a binary decision mask differentiably. During training, rather than physically discarding tokens (which would break parallel batch computing), they apply an attention masking strategy to completely eliminate the influence of pruned tokens. During inference, the uninformative tokens are dropped entirely to maximize speed.
2. DynamicCNN & DynamicSwin (For Hierarchical Models)
For networks like ConvNeXt or Swin Transformer, dropping spatial locations outright breaks structure-sensitive operations like convolutions and shifted windows. To circumvent this, the authors introduce Asymmetric Computation with Fast and Slow Paths.
The prediction module splits the feature map into informative and uninformative regions. Informative regions take the slow path (the standard, computationally heavy Feed-Forward Network). Uninformative regions are routed through a fast path (a highly lightweight linear projection). Finally, the features from both paths are reassembled into their original spatial grid positions, preserving the exact tensor structure required for subsequent layers.
Datasets
The framework was evaluated across three major benchmarks:
- ImageNet-1k: For image classification.
- ADE20k: For semantic segmentation (dense prediction).
- COCO 2017: For object detection and instance segmentation.
Key Insights and Ideas
- Asymmetric Computation Preserves Structure: You don't have to completely delete data to save compute. Processing "boring" parts of an image with a cheaper mathematical operation allows you to maintain the rigid tensor shapes that GPUs and hardware accelerators love, while still unlocking massive computational savings.
- Orthogonality to Channel Pruning: Spatial sparsification operates on an entirely different axis than channel pruning. The authors demonstrate this by applying their method to AutoFormer (a network architecture search baseline optimized for channel efficiency), showing that the model can be further compressed spatially without hitting a performance ceiling.
- Hierarchical Pruning Mimics Human Attention: Visualizations reveal that the prediction modules progressively filter out background details layer-by-layer, gradually focusing the network's internal representation strictly onto the primary object.
Key Results
- Vision Transformers: On ImageNet, DynamicViT reduced FLOPs by 31% to 35% and improved actual hardware throughput by over 40%, with an accuracy drop of less than 0.5% across DeiT and LV-ViT backbones.
- Hierarchical Models: DynamicCNN (built on ConvNeXt) and DynamicSwin achieved over 20% FLOP reductions with zero accuracy loss, and over 30% FLOP reductions with a negligible 0.5% drop.
- Downstream Tasks: When applied to dense prediction tasks, the framework reduced backbone FLOPs by 22% on ADE20k and 15% on COCO with virtually no penalty to mIoU or AP scores, proving that the reassembly mechanism successfully preserves fine-grained spatial details.
Limitations and Future Work
While the theoretical FLOP reductions are substantial across the board, the authors note that the actual hardware throughput speedup for hierarchical models (13% to 23%) lags behind their theoretical FLOP savings (over 20%). This discrepancy exists because the custom "split and reassemble" operations are not yet fully optimized at the low-level CUDA/hardware layer. The authors point to fully optimizing these routing operations for modern hardware as a primary direction for future engineering work.
Summary updated