arXiv:2410.17222cs.CL2024-10被引 4

通过对抗思想优化提示词,让大模型更好利用少样本示例。

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

  • 在输入上下文前添加可学习提示词,迭代优化以提取深层信息。
  • 在多个分类任务上超越传统提示调优和上下文学习方法。
  • 适合追求高效少样本学习的AI研究者与工程师。

微调大语言模型通常需更新数十亿参数,而提示调优(PT)仅更新少量可学习标记,无需训练即可实现上下文学习(ICL),即通过在输入中加入示例来适应新任务。传统方法易过拟合,而ICL虽抗过拟合但未充分利用示例信息。本文提出上下文感知提示调优(CPT),融合ICL、PT与对抗攻击思想:保留将示例拼接至输入的策略,但引入类似PT的迭代优化,通过调整特定上下文标记,深入挖掘训练示例中的信息。受对抗攻击启发,基于上下文标签最小化损失,并采用投影梯度下降算法,确保提示词嵌入贴近原始值,以保护用户数据价值。实验表明,该方法在多种分类任务中显著提升不同规模大模型的准确率。

原文摘要 · Abstract (English)

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.

提示调优少样本学习对抗学习大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。