arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2303.16199cs.CVcs.AIcs.CLcs.LGcs.MM
收藏

LLaMA-Adapter:基于零初始化注意力机制的高效语言模型微调方法

LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attention

CUHK(香港中文大学);Shanghai Artificial Intelligence Laboratory(上海人工智能实验室);University of California, Los Angeles(加利福尼亚大学洛杉矶分校);CPII of InnoHK(香港创新科技署CPII机构)

Renrui Zhang, Jiaming Han, Chris Liu, Peng Gao, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Yu Qiao

AI总结:

提出LLaMA-Adapter,通过零初始化注意力机制和1.2M可学习参数高效微调LLaMA,实现与Alpaca相当的指令遵循性能,并支持多模态扩展。

摘要:

我们提出了LLaMA-Adapter,一种轻量级的适配方法,用于高效地将LLaMA微调为指令遵循模型。使用52K条自指导演示,LLaMA-Adapter仅在冻结的LLaMA 7B模型上引入了1.2M个可学习参数,并且在8块A100 GPU上微调耗时不到一小时。具体而言,我们采用一组可学习的适配提示,并将它们前置到较高Transformer层的词元之前。然后,提出了一种带有零门控的零初始化注意力机制,该机制自适应地将新的指令线索注入LLaMA,同时有效保留其预训练知识。凭借我们的高效训练,LLaMA-Adapter能够生成高质量响应,与完全微调7B参数的Alpaca相当。除了语言指令,我们的方法可以简单地扩展到多模态指令,以学习图像条件下的LLaMA模型,在ScienceQA和COCO Caption基准上取得了优异的推理性能。此外,我们还评估了零初始化注意力机制在传统视觉和语言任务上微调其他预训练模型(ViT、RoBERTa)的效果,证明了我们方法的卓越泛化能力。代码已发布在https://github.com/OpenGVLab/LLaMA-Adapter。

英文摘要:

We present LLaMA-Adapter, a lightweight adaption method to efficiently fine-tune LLaMA into an instruction-following model. Using 52K self-instruct demonstrations, LLaMA-Adapter only introduces 1.2M learnable parameters upon the frozen LLaMA 7B model, and costs less than one hour for fine-tuning on 8 A100 GPUs. Specifically, we adopt a set of learnable adaption prompts, and prepend them to the word tokens at higher transformer layers. Then, a zero-initialized attention mechanism with zero gating is proposed, which adaptively injects the new instructional cues into LLaMA, while effectively preserves its pre-trained knowledge. With our efficient training, LLaMA-Adapter can generate high-quality responses, comparable to Alpaca with fully fine-tuned 7B parameters. Besides language commands, our approach can be simply extended to multi-modal instructions for learning image-conditioned LLaMA model, which achieves superior reasoning performance on ScienceQA and COCO Caption benchmarks. Furthermore, we also evaluate the zero-initialized attention mechanism for fine-tuning other pre-trained models (ViT, RoBERTa) on traditional vision and language tasks, demonstrating the superior generalization capacity of our approach. Code is released at https://github.com/OpenGVLab/LLaMA-Adapter.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑