arXiv:2309.03409 · 中英对照阅读
大语言模型(LLM)作为优化器
Large Language Models as Optimizers
中文速览
很多优化问题没有梯度可用,传统方法往往需要为不同任务专门设计求解器。OPRO让大语言模型直接读懂自然语言描述的目标,并根据已有方案及其得分反复提出新方案,再由外部程序评估、把结果反馈给模型。实验中,模型能在小规模线性回归和旅行商问题上找到不错的解,也能自动改进任务指令;优化后的提示词在GSM8K上最高比人工设计的提升8%,在部分Big-Bench Hard任务上提升最高达50%。这说明大语言模型不仅能回答问题,也能充当无需梯度的通用优化器,让许多难以用公式精确定义的问题更容易尝试自动优化。
摘要
优化无处不在。尽管基于导数的算法一直是解决各种问题的强大工具,但梯度的缺失给许多现实世界的应用带来了挑战。在这项工作中,我们提出了基于提示的优化(OPRO),这是一种简单且有效的方法,可利用大语言模型(LLM)作为优化器,并以自然语言描述优化任务。在每个优化步骤中,LLM根据提示生成新的解;该提示包含此前生成的解及其对应的数值。随后,对新解进行评估,并将其添加到提示中,以用于下一优化步骤。我们首先展示了 OPRO 在线性回归和旅行商问题上的应用,随后转向其主要应用——提示优化,其目标是找到能够最大化任务准确率的指令。我们使用多种 LLM 证明,OPRO 优化得到的最佳提示在 GSM8K 上的表现比人工设计的提示高出至多 $8\%$,在 Big-Bench Hard 任务上则高出至多 $50\%$。代码见 https://github.com/google-deepmind/opro。
Optimization is ubiquitous. While derivative-based algorithms have been powerful tools for various problems, the absence of gradient imposes challenges on many real-world applications. In this work, we propose Optimization by PROmpting (OPRO), a simple and effective approach to leverage large language models (LLMs) as optimizers, where the optimization task is described in natural language. In each optimization step, the LLM generates new solutions from the prompt that contains previously generated solutions with their values, then the new solutions are evaluated and added to the prompt for the next optimization step. We first showcase OPRO on linear regression and traveling salesman problems, then move on to our main application in prompt optimization, where the goal is to find instructions that maximize the task accuracy. With a variety of LLMs, we demonstrate that the best prompts optimized by OPRO outperform human-designed prompts by up to $8\%$ on GSM8K, and by up to $50\%$ on Big-Bench Hard tasks. Code at https://github.com/google-deepmind/opro.
术语表
- Optimization by PROmpting (OPRO)
- 基于提示的优化(OPRO)
- large language model (LLM)
- 大语言模型(LLM)
- derivative-based algorithm
- 基于导数的算法
- derivative-free optimization
- 无导数优化
- optimization task
- 优化任务
- optimization problem
- 优化问题
- objective function
- 目标函数
- solution
- 解
- decision space
- 决策空间
- performance landscape
- 性能景观
- natural language
- 自然语言
- prompt optimization
- 提示优化
- prompt engineering
- 提示工程
- meta-prompt
- 元提示
- meta-instruction
- 元指令
- training accuracy
- 训练准确率
- test accuracy
- 测试准确率
- optimization trajectory
- 优化轨迹
- exploration-exploitation trade-off
- 探索—利用权衡
- search space
- 搜索空间
- linear regression
- 线性回归
- traveling salesman problem
- 旅行商问题
- GSM8K
- GSM8K
- Big-Bench Hard
- Big-Bench Hard
- chain-of-thought prompting
- 思维链提示
- zero-shot prompting
- 零样本提示
- few-shot prompting
- 少样本提示
- PaLM 2-L
- PaLM 2-L
- GPT-4
- GPT-4
- gpt-3.5-turbo
- gpt-3.5-turbo