通过融合正确输出信号提升提示优化稳定性
Stabilizing Black-Box Prompt Optimization with Textual Regularization and Signal Aggregation
- 引入成功预测的文本正则项,与错误反馈互补
- 采样多条梯度并聚合,过滤噪声提升可靠性
- 支持跨模型版本迁移,减少提示失效风险
越来越多的自然语言处理应用通过黑箱API与大语言模型交互,提示工程成为控制模型行为的关键。现有自动提示优化(APO)方法依赖模型生成的批评信号(即文本梯度)迭代优化提示,但主要基于失败案例,忽视正确预测中的有效信息,导致优化不稳定和语义漂移。本文提出TRAS(文本正则化与信号聚合),一个可插拔的反馈驱动框架,在保留原有文本梯度用于纠错的同时,引入来自成功预测的互补文本正则项以保留有益提示成分。由于两类信号均具有随机性与噪声,我们进一步提出蒙特卡洛信号聚合(MCSA),通过采样多个梯度或正则项并聚合为单一可执行指令,强调一致且可靠建议,同时过滤异常值。针对模型快速迭代的问题,我们还形式化了自动提示迁移(APM),即在不丢失关键指令的前提下,将专家提示适配至不同模型版本或API提供商。在标准APO与APM场景中,本方法持续优于强基线,实现更高准确率、更快收敛速度与更低查询成本,并显著降低原始提示迁移带来的性能下降。
原文摘要 · Abstract (English)
An increasing number of NLP applications interact with large language models (LLMs) through black-box APIs, making prompt engineering critical for controlling model behavior. Recent Automatic Prompt Optimization (APO) methods iteratively refine prompts using model-generated critiques (often called textual gradients), but they predominantly optimize from failures and underutilize information contained in correct predictions, leading to instability and semantic drift. We propose TRAS (Textual Regularization with Aggregated Signals), a feedback-centric framework that is plug-and-play with existing APO search backbones. It retains the standard textual gradient signal from prior work for error correction and introduces a complementary textual regularizer derived from successful predictions to preserve beneficial prompt components. Because both signals are stochastic and can be noisy, we further introduce Monte Carlo Signal Aggregation (MCSA), which samples multiple gradients or regularizers and aggregates them into a single actionable directive, emphasizing consistent, actionable advice while filtering out outliers. Motivated by rapid model churn, we also formalize Automatic Prompt Migration (APM), the practical problem of adapting an expert prompt across model versions or API providers without losing critical instructions. Across standard APO and APM scenarios, our approach consistently outperforms strong baselines, yielding higher accuracy, faster convergence, and lower query cost, while substantially reducing the degradation observed under naive prompt migration.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。