Theoretical Insights into Fine-Tuning Attention Mechanism: Generalization and Optimization
Abstract
Fine-tuning large language models by selectively updating query and value attention weights with customized learning rates improves efficiency and convergence.
Large Language Models (LLMs), built on Transformer architectures, exhibit remarkable generalization across a wide range of tasks. However, fine-tuning these models for specific tasks remains resource-intensive due to their extensive parameterization. In this paper, we explore two remarkable phenomena related to the attention mechanism during the fine-tuning of LLMs (where W_q, W_k, and W_v denote the weights of the query, key, and value layers, respectively). The first phenomenon, termed "Unequal Importance of Attention Matrices", highlights the impact of fine-tuning different weight matrices. It shows that optimizing the W_v matrix yields significantly better performance than optimizing the W_k matrix. Fine-tuning only the W_q and W_v matrices is computationally efficient while delivering results comparable to, or even better than fine-tuning all three matrices (W_q, W_k, and W_v). The second phenomenon,"Attention Matrices with Customized Learning Rate Lead to Better Convergence", emphasizes the importance of assigning distinct learning rates to these matrices. Specifically, a higher learning rate for the W_v matrix compared to W_q and W_k accelerates convergence and improves performance. Building on these insights, we propose a new strategy that improves fine-tuning efficiency in terms of both storage and time. Experimental results on benchmark datasets validate the effectiveness of this approach, supporting our theoretical findings. Our analysis lays the theoretical groundwork for configuring and improving algorithms in LLMs fine-tuning.
Get this paper in your agent:
hf papers read 2410.02247 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 1
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper