arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.17222cs.CL
收藏

上下文感知提示微调:利用对抗方法推进上下文学习

Context-aware Prompt Tuning: Advancing In-Context Learning with Adversarial Methods

Technion(以色列理工学院)

Tsachi Blau, Moshe Kimhi, Yonatan Belinkov, Alexander Bronstein, Chaim Baskin

AI总结:

本文提出上下文感知提示微调CPT,结合ICL、PT与对抗攻击思想,通过迭代优化上下文嵌入并最小化损失,在少样本分类任务上提升多种LLM的准确率。

摘要:

微调大型语言模型(LLMs)通常涉及更新至少数十亿个参数。一种更具参数效率的方法是提示微调(Prompt Tuning, PT),它只更新少量可学习token;与之不同,上下文学习(In-Context Learning, ICL)通过仅在输入中包含示例而不进行任何训练来使模型适应新任务。当应用基于优化的方法(如微调和PT)进行少样本学习时,模型会专门适应少量训练示例,而ICL则保持模型不变。这一区别使得传统学习方法更容易过拟合;相比之下,ICL对少样本场景不那么敏感。虽然ICL不容易过拟合,但它并未充分提取训练示例中存在的信息。本文引入了上下文感知提示微调(Context-aware Prompt Tuning, CPT),这是一种受ICL、PT和对抗攻击启发的方法。我们基于ICL在输入前拼接示例的策略,但通过类似PT的学习扩展了这一策略,通过迭代优化来细化上下文嵌入,以从训练示例中提取更深层的见解。我们仔细修改特定的上下文token,并考虑输入和输出格式的独特结构。受对抗攻击启发,我们根据上下文中存在的标签调整输入,重点是最小化而非最大化损失。此外,我们应用投影梯度下降算法使token嵌入保持接近其原始值,假设用户提供的数据本身具有价值。我们的方法已被证明在使用多种LLM模型的多个分类任务上取得了优越的准确率。

英文摘要:

Fine-tuning Large Language Models (LLMs) typically involves updating at least a few billions of parameters. A more parameter-efficient approach is Prompt Tuning (PT), which updates only a few learnable tokens, and differently, In-Context Learning (ICL) adapts the model to a new task by simply including examples in the input without any training. When applying optimization-based methods, such as fine-tuning and PT for few-shot learning, the model is specifically adapted to the small set of training examples, whereas ICL leaves the model unchanged. This distinction makes traditional learning methods more prone to overfitting; in contrast, ICL is less sensitive to the few-shot scenario. While ICL is not prone to overfitting, it does not fully extract the information that exists in the training examples. This work introduces Context-aware Prompt Tuning (CPT), a method inspired by ICL, PT, and adversarial attacks. We build on the ICL strategy of concatenating examples before the input, but we extend this by PT-like learning, refining the context embedding through iterative optimization to extract deeper insights from the training examples. We carefully modify specific context tokens, considering the unique structure of input and output formats. Inspired by adversarial attacks, we adjust the input based on the labels present in the context, focusing on minimizing, rather than maximizing, the loss. Moreover, we apply a projected gradient descent algorithm to keep token embeddings close to their original values, under the assumption that the user-provided data is inherently valuable. Our method has been shown to achieve superior accuracy across multiple classification tasks using various LLM models.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑