arXiv:2409.13697cs.CLcs.AI2024-09被引 5

将提示词固化到大模型权重中,实现更稳定、可迭代的智能行为改进。

Prompt Baking

  • 通过最小化概率分布差异,将自然语言提示转换为模型权重更新
  • 烘焙思维链提示后,零样本推理在多个基准上性能提升
  • 支持持续迭代优化,适用于需要长期记忆与稳定人格的AI应用

改变大语言模型行为的两种主要方式是提示和权重更新(如微调)。提示简单有效,通过自然语言明确指定期望变化;而权重更新则能提供更丰富且持久的行为改变,通过大规模数据训练隐式定义。本文提出一种将提示‘烘焙’进模型权重的技术。该方法将提示 $u$ 和初始权重 $θ$ 转换为新权重 $θ_u$,使得烘焙后的模型 $P_{θ_u}(ullet)$ 的行为与原提示模型 $P_θ(ullet | u)$ 一致。数学上,最小化两者间的 KL 散度。实验表明,提示可高效转化为权重更新:烘焙思维链提示显著提升 GSM8K、ASDiv、MBPP、ARC-Easy、ARC-Challenge 及 CommonsenseQA 的零样本表现;烘焙新闻标题可直接更新模型知识;烘焙指令与角色设定可缓解长序列中的‘提示遗忘’问题。早期停止烘焙生成‘半烘焙’模型,实现提示强度的连续调节。烘焙模型仍对后续提示和烘焙保持敏感,包括使用已烘焙提示进行重提示。令人意外的是,重提示后模型在指令遵循、数学推理和编码任务上进一步提升。将重提示与重烘焙推向极致,形成一种迭代自提升机制,称为‘提示追逐’,初步结果显示指令遵循能力有显著增长。最后,讨论了该技术在人工智能安全、持续模型更新、基于大模型代理的实时学习能力增强以及生成更稳定的人格化智能体方面的意义。

原文摘要 · Abstract (English)

Two primary ways to change LLM behavior are prompting and weight updates (e.g., fine-tuning). Prompting LLMs is simple and effective, specifying the desired changes explicitly in natural language, whereas weight updates provide more expressive and permanent behavior changes, specified implicitly via training on large datasets. We present a technique for "baking" prompts into the weights of an LLM. Prompt Baking converts a prompt $u$ and initial weights $θ$ to a new set of weights $θ_u$ such that new "baked" LLM behaves like the original prompted LLM. Mathematically, we minimize the KL divergence between $P_θ(\cdot | u)$ and $P_{θ_u}(\cdot)$, where $P$ is the LLM's probability distribution over token sequences. Across all our experiments, we find prompts can be readily baked into weight updates. Baking chain-of-thought prompts improves zero-shot performance on GSM8K, ASDiv, MBPP, ARC-Easy, ARC-Challenge, and CommonsenseQA benchmarks. Baking news headlines directly updates an LLM's knowledge. And baking instructions & personas alleviates "prompt forgetting" over long sequences. Furthermore, stopping baking early creates "half-baked" models, continuously scaling prompt strength. Baked models retain their sensitivity to further prompting and baking, including re-prompting with the baked-in prompt. Surprisingly, the re-prompted models yield further performance gains in instruction following, as well as math reasoning and coding benchmarks. Taking re-prompting and re-baking to the limit yields a form of iterative self-improvement we call Prompt Pursuit, and preliminary results on instruction following exhibit dramatic performance gains. Finally, we discuss implications for AI safety, continuous model updating, enhancing real-time learning capabilities in LLM-based agents, and generating more stable AI personas.

提示工程模型优化自迭代权重固化

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