arXiv:2505.17010cs.LGcs.AI2025-05NeurIPS被引 10

从贝叶斯视角解析提示词优化,揭示其局限与突破路径

Understanding Prompt Tuning and In-Context Learning via Meta-Learning

  • 将提示词视为对预训练模型的贝叶斯条件推断,实现快速上下文适应
  • 软提示通过实值向量调控激活,效果优于传统硬标记提示
  • 理论揭示仅靠提示无法突破的限制,需结合权重微调才可解决

提示是将预训练模型适配到目标任务的主要方式。除了人工构造提示,文献中提出了多种提示优化方法,但大多基于经验,缺乏对提示本质的深入理解。本文从贝叶斯视角出发,阐明最优提示可通过条件化元训练神经网络的贝叶斯预测来实现,该模型在预训练分布上表现出快速的上下文适应能力。理论上可界定最优提示是否可行的任务场景。实验在LSTM和Transformer上验证了前缀提示的不同版本及权重微调方法,结果表明:软提示(即超出词汇表的实值向量序列)能通过调控激活实现高效提示,甚至适用于未训练模型,其机制超越了贝叶斯理论的抽象解释。

原文摘要 · Abstract (English)

Prompting is one of the main ways to adapt a pretrained model to target tasks. Besides manually constructing prompts, many prompt optimization methods have been proposed in the literature. Method development is mainly empirically driven, with less emphasis on a conceptual understanding of prompting. In this paper we discuss how optimal prompting can be understood through a Bayesian view, which also implies some fundamental limitations of prompting that can only be overcome by tuning weights. The paper explains in detail how meta-trained neural networks behave as Bayesian predictors over the pretraining distribution, whose hallmark feature is rapid in-context adaptation. Optimal prompting can be studied formally as conditioning these Bayesian predictors, yielding criteria for target tasks where optimal prompting is and is not possible. We support the theory with educational experiments on LSTMs and Transformers, where we compare different versions of prefix-tuning and different weight-tuning methods. We also confirm that soft prefixes, which are sequences of real-valued vectors outside the token alphabet, can lead to very effective prompts for trained and even untrained networks by manipulating activations in ways that are not achievable by hard tokens. This adds an important mechanistic aspect beyond the conceptual Bayesian theory.

提示工程贝叶斯学习元学习软提示

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