用单次前向传播生成适配器,让大模型高效适应新任务
Generative Adapter: Contextualizing Language Models in Parameters with A Single Forward Pass
- 通过自监督训练生成器,将上下文直接映射为低秩适配器
- 在32K token长文本中提升F1分数63.5%(19.5→31.5)
- 无需微调且计算内存开销降低4倍,适合快速个性化场景
大语言模型通常通过微调或提示来适应新上下文,但存在准确率与计算成本的权衡。本文提出GenerativeAdapter,一种高效适配方法,通过单次前向传播将新上下文映射为低秩适配器,显著降低推理开销且无需微调。适配器生成器通过自监督学习训练,可对冻结的单个模型适配任意新任务。我们在Mistral-7B-Instruct和Llama2-7B-Chat上测试该方法,在三个场景下表现优异:在StreamingQA中,对长达32K tokens的上下文注入知识,F1得分从19.5提升至31.5,改善63.5%;在MetaICL评测中,26个任务平均准确率达44.9,优于基线模型;在MSC任务中,记忆用户信息时计算与内存成本相比完整对话提示降低4倍。结果表明,GenerativeAdapter可广泛适用于各类上下文适配。
原文摘要 · Abstract (English)
Large language models (LMs) are typically adapted to improve performance on new contexts (\eg text prompts that define new tasks or domains) through fine-tuning or prompting. However, there is an accuracy compute tradeoff -- fine-tuning incurs significant training cost and prompting increases inference overhead. We introduce $GenerativeAdapter$, an effective and efficient adaptation method that directly maps new contexts to low-rank LM adapters, thereby significantly reducing inference overhead with no need for finetuning. The adapter generator is trained via self-supervised learning, and can be used to adapt a single frozen LM for any new task simply by mapping the associated task or domain context to a new adapter. We apply $GenerativeAdapter$ to two pretrained LMs (Mistral-7B-Instruct and Llama2-7B-Chat) and evaluate the adapted models in three adaption scenarios: knowledge acquisition from documents, learning from demonstrations, and personalization for users. In StreamingQA, our approach is effective in injecting knowledge into the LM's parameters, achieving a 63.5% improvement in F1 score over the model with supervised fine-tuning (from $19.5$ to $31.5$) for contexts as long as 32K tokens. In the MetaICL in-context learning evaluation, our method achieves an average accuracy of $44.9$ across 26 tasks, outperforming the base model. On MSC, our method proves to be highly competitive in memorizing user information from conversations with a 4x reduction in computation and memory costs compared to prompting with full conversation history. Together, these results suggest that $GenerativeAdapter$ should allow for general adaption to a wide range of different contexts.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。