WAVE: Weight Template for Adaptive Initialization of Variable-sized Models

Fu Feng, Yucheng Xie, Jing Wang, Xin Geng

Abstract

The growing complexity of model parameters underscores the significance of pre-trained models. However, deployment constraints often necessitate models of varying sizes, exposing limitations in the conventional pre-training and fine-tuning paradigm, particularly when target model sizes are incompatible with pre-trained ones. To address this challenge, we propose WAVE, a novel approach that reformulates variable-sized model initialization from a multi-task perspective, where initializing each model size is treated as a distinct task. WAVE employs shared, size-agnostic weight templates alongside size-specific weight scalers to achieve consistent initialization across various model sizes. These weight templates, constructed within the Learngene framework, integrate knowledge from pre-trained models through a distillation process constrained by Kronecker-based rules. Target models are then initialized by concatenating and weighting these templates, with adaptive connection rules established by lightweight weight scalers, whose parameters are learned from minimal training data. Extensive experiments demonstrate the efficiency of WAVE, achieving state-of-the-art performance in initializing models of various depth and width. The knowledge encapsulated in weight templates is also task-agnostic, allowing for seamless transfer across diverse downstream datasets.

Introduction

The "pre-train then fine-tune" paradigm is the bedrock of modern AI, yet it suffers from inherent rigidity. Pre-trained models like ViT-B are typically released in fixed sizes, posing significant challenges when deployment environments—such as mobile devices or edge sensors—require specific architectures to meet strict latency or memory constraints. When target model sizes are incompatible with available pre-trained weights, researchers often resort to sub-optimal weight selection or computationally expensive knowledge distillation.

WAVE (Weight Templates for Adaptive Initialization) offers a flexible and efficient alternative. By treating the initialization of different model sizes as a multi-task learning problem, WAVE enables the initialization of Vision Transformers (ViTs) of arbitrary depth and width using shared, size-agnostic "weight templates." This approach achieves state-of-the-art performance while drastically reducing training costs.

Methodology

The WAVE framework centers on the concept of "learngenes"—the essential structural knowledge of a model—and utilizes two primary components to adapt this knowledge to variable sizes:

  1. Weight Templates ($T$): These are shared, fixed-size matrices that capture size-agnostic knowledge distilled from a large "ancestry" model.
  2. Weight Scalers ($S$): These are lightweight, trainable parameters unique to each target model size.
  3. Kronecker-based Reconstruction: To adapt templates to target dimensions, WAVE utilizes the Kronecker product: $W = \sum T \otimes S$. This mathematical operation allows a fixed template to be "stretched" or "compressed" to fit any target architecture without losing structural integrity or patterns.

The process involves two distinct stages. First, in the Integration stage, knowledge is distilled from a pre-trained model into the templates. Second, in the Initialization stage, the templates are frozen, and only the tiny scalers (often comprising only a few thousand parameters) are trained on a small subset of data to establish the optimal connection rules for the specific target model.

The WAVE framework: (a) Integrating knowledge from a pre-trained model into weight templates via distillation, and (b) Initializing variable-sized downstream models using weight scalers and Kronecker-based expansion.

Experimental Results

WAVE was evaluated using ImageNet-1K for knowledge integration and seven diverse downstream datasets (including CIFAR, CUB-200, and Oxford Flowers) for transferability. The results demonstrate that WAVE consistently outperforms other state-of-the-art initialization methods, such as Mimetic Init and LiGO, across various model depths and widths.

WAVE provides massive computational efficiency gains. A WAVE-initialized model trained for just 10 epochs often matches or exceeds the performance of a model trained from scratch for 150 epochs, representing up to a 15x reduction in total training cost. Furthermore, WAVE-initialized models exhibit a "structural instinct," showing more focused attention on relevant image features even before extensive training, compared to the noisy attention of randomly initialized models.

Performance analysis of WAVE: (a) Accuracy comparison across different model configurations, (b) Total training epochs saved compared to direct pre-training, and (c) Faster convergence rates for various DeiT model sizes.

Conclusion

WAVE effectively addresses the rigidity of standard pre-trained models by providing a scalable, task-agnostic initialization method for variable-sized Transformers. By leveraging Kronecker-based weight templates, it enables rapid deployment of optimized models across diverse hardware constraints. While currently tailored for the MSA and MLP blocks of Transformers, future research could extend this template-based approach to other architectures like CNNs or State-Space models.

Summary updated

BibTeX
@inproceedings{feng2025wave,
  author = {Fu Feng and Yucheng Xie and Jing Wang and Xin Geng},
  title = {{WAVE: Weight Template for Adaptive Initialization of Variable-sized Models}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.00454},
}
Figure