LLaMA-Adapter:基于零初始化注意力的语言模型高效微调
计算机视觉与模式识别
2024-09-20 v3 人工智能
计算与语言
机器学习
多媒体
摘要
我们提出 LLaMA-Adapter,一种轻量级适配方法,用于将 LLaMA 高效微调为指令跟随模型。使用 52K 自指令演示,LLaMA-Adapter 仅在冻结的 LLaMA 7B 模型上引入 1.2M 可学习参数,并在 8 块 A100 GPU 上微调不到一小时。具体而言,我们采用一组可学习适配提示,并将其前置到较高 transformer 层的词 token 前。然后,提出带零门控的零初始化注意力机制,将新指令线索自适应注入 LLaMA,同时有效保留其预训练知识。通过我们的高效训练,LLaMA-Adapter 可生成高质量回复,可与全参数微调 7B 的 Alpaca 媲美。除语言指令外,我们的方法可简单扩展至多模态指令,用于学习图像条件的 LLaMA 模型,在 ScienceQA 和 COCO Caption 基准上取得优越推理性能。此外,我们还在传统视觉与语言任务上评估了零初始化注意力机制微调其他预训练模型(ViT、RoBERTa)的能力,展示了我们方法的优越泛化能力。代码发布于 https://github.com/OpenGVLab/LLaMA-Adapter。
引用
@article{arxiv.2303.16199,
title = {LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attention},
author = {Renrui Zhang and Jiaming Han and Chris Liu and Peng Gao and Aojun Zhou and Xiangfei Hu and Shilin Yan and Pan Lu and Hongsheng Li and Yu Qiao},
journal= {arXiv preprint arXiv:2303.16199},
year = {2024}
}
备注
Accepted by ICLR 2024. Code is available at https://github.com/OpenGVLab/LLaMA-Adapter