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

提示优化作为状态空间搜索问题

Prompt Optimization as a State-Space Search Problem

University of Minnesota(明尼苏达大学)

Maanas Taneja

AI总结:

将提示优化视为状态空间搜索问题,通过束搜索和随机游走算法改进提示性能,验证了优化作为搜索问题的有效性。

摘要:

语言模型对输入提示字符串的微小变化都非常敏感,容易导致性能崩溃。诸如斯坦福NLP的DSpy库通过基于演示的提示优化避免了这一问题。受此启发,我提出了一种替代方法,将提示优化视为经典的状态空间搜索问题。我将提示空间建模为一个图,其中节点代表提示状态,边对应于有意的变换,如缩短、添加示例或重新排列内容。使用束搜索和随机游走算法,我系统地探索此空间,在开发集上评估候选者并修剪不值得的分支。在五个NLP任务(情感分类、问答、摘要、推理和自然语言推理)中,我发现即使浅层搜索配置(束宽=2,深度=2)也能在开发集上改进种子提示。例如,束搜索在推理任务上的开发准确率提升从0.40到0.80,尽管测试集的改进更为温和(0.20到0.50),这表明过度拟合开发集的启发式方法。对成功优化路径的分析显示,使提示简洁的变换出现频率最高,而冗长操作从不被选择。我的结果验证了提示优化作为搜索问题,并表明随着计算资源的增加和评估指标的改进,更深入的探索可能产生在开发集之外更具泛化能力的提示。代码和实现可在[https://github.com/MaanasTaneja/PromptOptimiser]获得。

英文摘要:

Language Models are extremely susceptible to performance collapse with even small changes to input prompt strings. Libraries such as DSpy (from Stanford NLP) avoid this problem through demonstration-based prompt optimisation. Inspired by this, I propose an alternative approach that treats prompt optimisation as a classical state-space search problem. I model the prompt space as a graph where nodes represent prompt states and edges correspond to deliberate transformations such as shortening, adding examples, or re- ordering content. Using beam search and random walk algorithms, I systematically explore this space, evaluating candidates on development sets and pruning unpromising branches. Across five NLP tasks (sentiment classification, question answering, summarisation, reason- ing, and natural language inference), I find that even shallow search configurations (beam width=2, depth=2) improve upon seed prompts on development sets. For instance, beam search achieves development accuracy gains from 0.40 to 0.80 on reasoning tasks, though test set improvements are more modest (0.20 to 0.50), indicating overfitting to the develop- ment heuristic. Analysis of successful optimisation paths reveals that transformations that make prompts concise appear most frequently, while verbosity operators are never selected. My results validate prompt optimization as a search problem and suggest that with greater computational resources and improved evaluation metrics, deeper exploration could yield more robust prompts that generalize beyond development sets. Code and implementation are available at [https://github.com/MaanasTaneja/PromptOptimiser].

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

↑