Copy the Same, Distill the Difference: Initializing Linear Vision Transformers
Huaiyuan Qin, Muli Yang, Gabriel James Goenawan, Shiqi Huang, Min Kass Chong, Wahyu Wiratama, Peng Hu, Chen Gong, Wu Liu, Xi Peng, Chun Jian Ho, Hongyuan Zhu
Read on arXiv →Key claim
MLP weights can be effectively transferred between attention types.
In plain English
Imagine you're building a computer vision model that needs to process images efficiently. You might consider using Vision Transformers (ViTs), which have become popular for their ability to handle complex visual tasks. However, a challenge arises when trying to make these models more efficient: the traditional Softmax attention mechanism can be computationally expensive, and newer linear attention methods promise to reduce this cost. The problem is that while linear ViTs are designed to be more efficient, they often struggle to match the performance of their Softmax counterparts, especially when initialized from scratch. This is what's called the initialization problem, where starting from random weights can lead to suboptimal performance.
To address this, the authors propose a method for transferring knowledge from Softmax ViTs to linear ViTs. They find that while the attention weights themselves are not directly transferable, the underlying learned representations in the MLP layers can be copied effectively. By distilling the attention behavior from Softmax models and combining it with the transferred MLP weights, linear ViTs can significantly improve their performance, even surpassing the original Softmax models in some cases. This approach not only enhances the efficiency of linear ViTs but also provides insights into how to leverage pre-trained weights across different model architectures, making it a valuable strategy for builders looking to optimize their vision models.
The work provides a new perspective on transferring weights between different attention mechanisms.
The findings are supported by consistent results across various models and datasets.
Deep reliability assessment
The methodology supports the claim that MLP weights can be effectively transferred by copying, while attention weights require distillation. The claim that linear ViTs can surpass Softmax ones may be overclaimed without broader empirical evidence.
Reproducibility
No open source code or dataset is mentioned in the paper.
Key figure
Figure 1 illustrates the concept of transferring pre-trained Softmax weights to linear ViTs, highlighting the ineffectiveness of copying attention weights and the effectiveness of copying MLP weights.
