The Challenge of Scaling Vision Transformers
Pre-trained Vision Transformers (ViTs) are the backbone of modern computer vision, but they typically rely on a fixed architecture. In the real world, deployment environments vary wildly—a cloud server has vastly different compute and memory capabilities compared to an edge device like a Raspberry Pi.
To fit ViTs onto smaller devices, researchers usually rely on model compression (such as pruning or quantization) or Knowledge Distillation (KD). The glaring issue with these methods is a lack of flexibility: if you need ten different model sizes for ten different devices, you have to run the expensive training or distillation process ten separate times.
To tackle this inefficiency, this paper asks a fundamental question: Can we incrementally decompose a large model into basic components that can be mixed and matched to build models of any size on the fly? The result is a "train once, deploy anywhere" approach that slashes the computational cost of generating multiple model sizes by up to 80x while matching or beating traditional compression techniques.
The Decomposition-Recomposition Strategy
Inspired by calculus—specifically how complex functions can be approximated by linearly combining basic polynomials (like Taylor or Chebyshev series)—the authors propose a novel Decomposition-Recomposition strategy.
- Decomposition: Instead of treating a ViT layer's weights as a single monolithic matrix, the authors assume the weights can be expressed as a linear combination of $N$ basic components, termed learngenes. The coefficients for this combination are predefined using the first-kind Chebyshev polynomial.
- Incremental Training: The learngenes are trained iteratively via Knowledge Distillation on ImageNet-1K. The model trains the first learngene, freezes it, adds the second learngene, trains that, and continues this process incrementally.
- Recomposition: To deploy a model to a specific device, an engineer simply chooses a desired network depth ($L$ layers) and a number of learngenes ($k$). The predefined polynomial formulas are used to instantly initialize the new model's weights.
- Fine-Tuning: The recomposed model is then fine-tuned on downstream tasks in one of two ways:
- "w/o const" (Without Constraint): The recomposed weights serve as a starting initialization, and all layers are updated independently.
- "w/ const" (With Constraint): The mathematical relationship is maintained during training. The network only updates the parameters of the $k$ learngenes, drastically reducing the number of trainable parameters.
Key Insights
- Neural Network Weights Have a Linear Trend: By applying Principal Component Analysis (PCA) to a well-trained ViT, the authors discovered that the parameters across layers exhibit an approximately linear, non-decreasing trend. This empirical finding is what makes polynomial decomposition viable for neural networks.
- Learngenes Act Like Biological Genes: Visualizing the learngenes reveals a fascinating hierarchy. Learngene 1 focuses on basic shapes and contours. Learngene 2 picks up textures and colors. Later learngenes focus on highly specific, fine-grained details.
- Decoupling Depth from Parameter Count: By using the "w/ const" training method, a deep (e.g., 12-layer) network can be initialized using only 1 or 2 learngenes. This allows the model to benefit from the architectural depth of a large transformer while maintaining the memory footprint of a tiny one.
Performance and Results
The recomposed models were evaluated across 9 diverse datasets, including CIFAR-10/100, Tiny-ImageNet, and Food-101, yielding impressive results:
- Massive Training Efficiency: Generating 144 different model configurations (combinations of 1-12 layers and 1-12 learngenes) took only 800 epochs total. Doing this with standard Knowledge Distillation would require approximately 43,200 epochs.
- High Accuracy: The fully decomposed model (using all 12 learngenes) achieves 83.70% accuracy on ImageNet-1K, matching the performance of a standard, monolithically trained DeiT-Base model.
- Extreme Memory Savings: Using the "w/ const" method, a 12-layer ViT initialized with 2 learngenes requires only 14.3 MB of memory, compared to 86 MB for standard fine-tuning. Despite being ~6x smaller, it only drops about 1% in accuracy on the Food-101 dataset (89.34% vs 90.44%).
- Beating Baselines: Recomposed models consistently outperformed standard pre-trained models (DeiT-Tiny, DeiT-Small) and compressed models (Mini-DeiT, Efficient-ViT) at similar parameter counts across the downstream tasks.
Limitations and Future Directions
While the method is heavily inspired by calculus and works beautifully in practice, the authors note a lack of rigorous theoretical proof explaining why neural network weights can be so effectively modeled by Chebyshev polynomials. Additionally, while the "w/o const" fine-tuning method sometimes yields slightly higher accuracy, it consumes significantly more memory when the requested layers exceed the number of learngenes used.
Establishing formal theoretical bounds for this decomposition and applying the "learngene" concept to Large Language Models (LLMs) or multimodal architectures represent highly promising next steps for this research.
Summary updated