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上微调耗时不到一小时。具体而言,我们采用一组可学习的适应提示,并将它们预置在更高的变形器层的输入文本令牌之前。然后,提出了一种带有零门控的零初始化注意力机制,该机制自适应地将新的指令提示注入LLaMA中,同时有效地保留其预训练的知识。通过高效的训练,LLaMA-Adapter生成高质量的响应,与完全微调了7B参数的Alpaca相当。此外,我们的方法可以简单地扩展到多模式输入,例如图像,以获取基于图像的LLaMA,在ScienceQA上实现了优越的推理能力。我们在https://github.com/ZrrSkywalker/LLaMA-Adapter上发布了我们的代码。

0
下载
关闭预览

相关内容

百篇论文纵览大型语言模型最新研究进展
专知会员服务
69+阅读 · 2023年3月31日
【CVPR 2022】视觉提示调整(VPT),Vision Prompt Tuning
专知会员服务
29+阅读 · 2022年3月12日
预训练语言模型fine-tuning近期进展概述
专知会员服务
37+阅读 · 2021年4月9日
IJCAI 2022 | 使用陈述句进行视觉问答的Prompt Tuning
文本+视觉,多篇 Visual/Video BERT 论文介绍
AI科技评论
21+阅读 · 2019年8月30日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Hierarchically Structured Meta-learning
CreateAMind
24+阅读 · 2019年5月22日
基于PyTorch/TorchText的自然语言处理库
专知
27+阅读 · 2019年4月22日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 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会员
相关基金
国家自然科学基金
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会员