Abstract
Vision Transformers (ViTs) are powerful but resource-intensive, making on-device training on edge hardware like smartphones or IoT devices challenging due to high activation memory requirements. We present Block Selective Reprogramming (BSR), a framework that enables efficient ViT fine-tuning by combining selective block training with attention-based token dropping. BSR achieves up to a 5.47× reduction in memory and a 2.43× training speedup with minimal impact on accuracy, making it feasible to train state-of-the-art models on devices with as little as 1GB of RAM.
Introduction
The deployment of Vision Transformers (ViTs) on edge devices is often limited by the memory overhead associated with training. Unlike inference, training requires storing intermediate activations for backpropagation. In ViTs, non-linear layers such as Softmax and GELU necessitate storing inputs even when weights are frozen, leading to "activation dominance." Existing methods like partial fine-tuning or residual modules often fail to provide a satisfactory trade-off between memory savings, training speed, and final accuracy.
Methodology: Block Selective Reprogramming
BSR addresses these challenges through three integrated strategies:
- Selective Block Fine-tuning: Instead of training the entire network or just the final layers, BSR identifies a small subset of blocks distributed uniformly across the network's depth. This approach captures multi-scale features more effectively than traditional "head-only" fine-tuning.
- Attention-Based Token Dropping: Leveraging the self-attention scores from frozen layers, BSR identifies and removes "uninformative" image patches (tokens) as data progresses through the network. This reduction in sequence length directly lowers the memory footprint of subsequent trainable blocks.
- Gradient Flow Optimization: By freezing the majority of blocks and terminating gradient propagation at the first trainable block, BSR eliminates the need to store activations for the initial layers.
Experimental Results
The authors evaluated BSR on standard benchmarks (CIFAR-10/100) and specialized downstream tasks (Flowers-102, Oxford-IIIT Pets). On a ViT-B model, BSR demonstrated a 5.47× reduction in memory usage, enabling training on a Raspberry Pi 3 with only 1GB of RAM.
Key findings include:
- Efficiency: BSR provides a 2.43× speedup over full fine-tuning.
- Accuracy: The accuracy drop is negligible (e.g., 98.3% vs 98.98% on CIFAR-10).
- Scalability: BSR is effective even for Mixture-of-Expert (MoE) models, reducing memory by 2.32×.
Conclusion
Block Selective Reprogramming (BSR) provides a robust solution for on-device ViT training. By focusing on activation memory—the primary bottleneck—and utilizing pre-trained attention maps for token pruning, BSR makes sophisticated vision models accessible to resource-constrained hardware. Future work will explore its application in dense prediction tasks and its synergy with model quantization.
Summary updated