让大模型一次微调就能搞定多任务,性能接近专用微调。
You Only Fine-tune Once: Many-Shot In-Context Fine-Tuning for Large Language Models
- 将多个任务示例同时用于微调,每个答案都作为训练目标。
- 在分类、问答等任务上表现接近专用微调,且减少灾难性遗忘。
- 适合需要快速适配多任务又不想反复微调的场景。
大型语言模型具备出色的上下文学习能力,可无需任务专属微调即处理多个下游任务。近期研究显示,如Mistral 7B、Gemma 7B和Llama-3 8B等中等规模模型可通过一次性少样本上下文微调实现多任务处理,但仍落后于专用微调。本文提出一种新方法——多示例上下文微调(ManyICL),通过将上下文中的每个答案都设为监督目标,扩展了上下文学习至多示例设置,显著缩小性能差距。该方法有效解决长序列处理效率低的问题,实验表明其在分类、摘要、问答、自然语言推理及数学任务上均优于零/少样本微调,接近专用微调性能,并显著缓解了零/少样本微调中的灾难性遗忘问题。代码将在发表后公开。
原文摘要 · Abstract (English)
Large language models (LLMs) possess a remarkable ability to perform in-context learning (ICL), which enables them to handle multiple downstream tasks simultaneously without requiring task-specific fine-tuning. Recent studies have shown that even moderately sized LLMs, such as Mistral 7B, Gemma 7B and Llama-3 8B, can achieve ICL through few-shot in-context fine-tuning of all tasks at once. However, this approach still lags behind dedicated fine-tuning, where a separate model is trained for each individual task. In this paper, we propose a novel approach, Many-Shot In-Context Fine-tuning (ManyICL), which significantly narrows this performance gap by extending the principles of ICL to a many-shot setting. To unlock the full potential of ManyICL and address the inherent inefficiency of processing long sequences with numerous in-context examples, we propose a novel training objective. Instead of solely predicting the final answer, our approach treats every answer within the context as a supervised training target. This effectively shifts the role of many-shot examples from prompts to targets for autoregressive learning. Through extensive experiments on diverse downstream tasks, including classification, summarization, question answering, natural language inference, and math, we demonstrate that ManyICL substantially outperforms zero/few-shot fine-tuning and approaches the performance of dedicated fine-tuning. Furthermore, ManyICL significantly mitigates catastrophic forgetting issues observed in zero/few-shot fine-tuning. The code will be made publicly available upon publication.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。