arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.03495cs.CLcs.AIcs.LG

结合“梯度下降”与束搜索的自动提示优化

Automatic Prompt Optimization with "Gradient Descent" and Beam Search

Microsoft Azure AI(微软Azure人工智能)

Reid Pryzant, Dan Iter, Jerry Li, Yin Tat Lee, Chenguang Zhu, Michael Zeng

AI总结:

提出自动提示优化(APO)方法,受数值梯度下降启发,利用自然语言梯度、束搜索和bandit选择自动改进提示,在多个任务上使初始提示性能提升高达31%。

摘要:

大型语言模型(LLMs)作为通用智能体展现出了令人印象深刻的性能,但其能力仍然高度依赖于人工编写且需要费力试错的提示。我们针对此问题提出了一种简单且非参数化的解决方案——自动提示优化(APO),该方法受数值梯度下降启发,在假设可访问训练数据和LLM API的前提下自动改进提示。该算法使用小批量数据来形成批评当前提示的自然语言“梯度”。随后,通过沿着与梯度相反的语义方向编辑提示,将这些“梯度”“传播”到提示中。这些梯度下降步骤由束搜索和bandit选择过程引导,从而显著提高了算法效率。在三个基准NLP任务以及LLM越狱检测这一新问题上的初步结果表明,APO能够超越先前的提示编辑技术,并通过利用数据将模糊的任务描述重写为更精确的标注指令,使初始提示的性能提升高达31%。

英文摘要:

Large Language Models (LLMs) have shown impressive performance as general purpose agents, but their abilities remain highly dependent on prompts which are hand written with onerous trial-and-error effort. We propose a simple and nonparametric solution to this problem, Automatic Prompt Optimization (APO), which is inspired by numerical gradient descent to automatically improve prompts, assuming access to training data and an LLM API. The algorithm uses minibatches of data to form natural language "gradients" that criticize the current prompt. The gradients are then "propagated" into the prompt by editing the prompt in the opposite semantic direction of the gradient. These gradient descent steps are guided by a beam search and bandit selection procedure which significantly improves algorithmic efficiency. Preliminary results across three benchmark NLP tasks and the novel problem of LLM jailbreak detection suggest that Automatic Prompt Optimization can outperform prior prompt editing techniques and improve an initial prompt's performance by up to 31%, by using data to rewrite vague task descriptions into more precise annotation instructions.

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

↑