让低秩微调更懂任务上下文,减少遗忘、加快收敛。
Dynamic Context-oriented Decomposition for Task-aware Low-rank Adaptation with Less Forgetting and Faster Convergence
- 根据任务数据动态构建奇异值分解,让适配器具备任务感知能力。
- 在大模型上比LoRA更好,知识遗忘减少,微调速度提升4.5倍。
- 支持保留知识或快速适应新任务,适合需要稳定与高效的场景。
传统低秩适配方法忽略数据上下文,导致微调效果不佳且严重遗忘预训练知识。本文提出上下文感知分解适配(CorDA),通过采样目标任务数据,收集各线性层输入激活的协方差矩阵,并对权重矩阵与其对应协方差矩阵的乘积进行奇异值分解(SVD),将任务特异性信息压缩到主成分中。该设计支持两种模式:知识保持模式(KPM)冻结主成分以保留知识,指令预览模式(IPM)动态调整主成分以更快学习新任务。进一步提出CorDA++,引入反映主成分紧凑性的度量,实现动态协方差选择与动态秩分配策略,为每层选择最具代表性的协方差并优化秩分配。实验表明,CorDA++显著优于CorDA;KPM模式下性能超过LoRA,有效缓解大语言模型与视觉语言模型的知识遗忘;IPM模式收敛速度比QLoRA快4.5倍,在多种场景中均优于强基线方法。本方法已集成至Hugging Face的PEFT库。
原文摘要 · Abstract (English)
Conventional low-rank adaptation methods build adapters without considering data context, leading to sub-optimal fine-tuning performance and severe forgetting of inherent world knowledge. In this paper, we propose context-oriented decomposition adaptation (CorDA), a novel method that initializes adapters in a task-aware manner. Concretely, we develop context-oriented singular value decomposition, where we collect covariance matrices of input activations for each linear layer using sampled data from the target task, and apply SVD to the product of weight matrix and its corresponding covariance matrix. By doing so, the task-specific capability is compacted into the principal components. Thanks to the task awareness, our method enables two optional adaptation modes, knowledge-preserved mode (KPM) and instruction-previewed mode (IPM), providing flexibility to choose between freezing the principal components to preserve their associated knowledge or adapting them to better learn a new task. We further develop CorDA++ by deriving a metric that reflects the compactness of task-specific principal components, and then introducing dynamic covariance selection and dynamic rank allocation strategies based on the same metric. The two strategies provide each layer with the most representative covariance matrix and a proper rank allocation. Experimental results show that CorDA++ outperforms CorDA by a significant margin. CorDA++ in KPM not only achieves better fine-tuning performance than LoRA, but also mitigates the forgetting of pre-trained knowledge in both large language models and vision language models. For IPM, our method exhibits faster convergence, \emph{e.g.,} 4.5x speedup over QLoRA, and improves adaptation performance in various scenarios, outperforming strong baseline methods. Our method has been integrated into the PEFT library developed by Hugging Face.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。