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 input text tokens at higher transformer layers. Then, a zero-init attention mechanism with zero gating is proposed, which adaptively injects the new instructional cues into LLaMA, while effectively preserves its pre-trained knowledge. With efficient training, LLaMA-Adapter generates high-quality responses, comparable to Alpaca with fully fine-tuned 7B parameters. Furthermore, our approach can be simply extended to multi-modal input, e.g., images, for image-conditioned LLaMA, which achieves superior reasoning capacity on ScienceQA. We release our code at https://github.com/ZrrSkywalker/LLaMA-Adapter.


翻译:我们提出LLaMA-Adapter——一种轻量级适配方法,可高效地将LLaMA微调为指令跟随模型。采用52K条自指导演示数据后,LLaMA-Adapter仅需在冻结的LLaMA 7B模型上引入1.2M可学习参数,且可在8块A100 GPU上以不到一小时完成微调。具体而言,我们采用一组可学习的适配提示,将其拼接到高层Transformer层的输入文本令牌前。随后提出一种配备零门控机制的零初始化注意力机制,在自适应地将新指令线索注入LLaMA的同时,有效保留其预训练知识。通过高效训练,LLaMA-Adapter生成的高质量响应可与完全微调7B参数的Alpaca模型相媲美。此外,本方法可简单扩展至多模态输入(如图像),实现图像条件化LLaMA,在ScienceQA上展现出卓越的推理能力。相关代码已开源至https://github.com/ZrrSkywalker/LLaMA-Adapter。

0
下载
关闭预览

相关内容

百篇论文纵览大型语言模型最新研究进展
专知会员服务
70+阅读 · 2023年3月31日
【CVPR 2022】视觉提示调整(VPT),Vision Prompt Tuning
专知会员服务
32+阅读 · 2022年3月12日
预训练语言模型fine-tuning近期进展概述
专知会员服务
40+阅读 · 2021年4月9日
IJCAI 2022 | 使用陈述句进行视觉问答的Prompt Tuning
文本+视觉,多篇 Visual/Video BERT 论文介绍
AI科技评论
22+阅读 · 2019年8月30日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
基于PyTorch/TorchText的自然语言处理库
专知
28+阅读 · 2019年4月22日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
Arxiv
20+阅读 · 2021年9月21日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
6+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
4+阅读 · 6月17日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员