arXiv:2211.01910 · 中英对照阅读
Large Language Models are Human-Level Prompt Engineers
中文速览
给大语言模型写什么指令,往往会明显影响它能不能把任务做好,而靠人反复试提示既费力也不稳定。研究者提出自动提示工程(APE):先让一个语言模型根据少量输入和答案示例生成多种指令,再用目标模型实际执行这些指令、按任务得分筛选,并反复改写表现较好的候选。实验中,APE 在 24 项指令归纳任务和 21 项 BIG-Bench 任务中的 17 项上,达到或超过人工指令的表现,也能改进少样本学习、找到更好的思维链提示,并引导模型更诚实或更有信息量。它的重要性在于把提示设计从靠经验试错变成可自动搜索和评估的过程,让人更容易把模型引导到想要的行为。
摘要
By conditioning on natural language instructions, large language models (LLMs) have displayed impressive capabilities as general-purpose computers. However, task performance depends significantly on the quality of the prompt used to steer the model, and most effective prompts have been handcrafted by humans. Inspired by classical program synthesis and the human approach to prompt engineering, we propose Automatic Prompt Engineer11 1 We define “prompt engineering” as optimizing the language in a prompt in order to elicit the best possible performance. Notably, this does not include prompts that chain multiple LLM queries together or give the LLM access to external tools. (APE) for automatic instruction generation and selection. In our method, we treat the instruction as the ‘‘program,’’ optimized by searching over a pool of instruction candidates proposed by an LLM in order to maximize a chosen score function. To evaluate the quality of the selected instruction, we evaluate the zero-shot performance of another LLM following the selected instruction. Extensive experiments show that our automatically generated instructions outperform the prior LLM baseline by a large margin and achieve better or comparable performance to the instructions generated by human annotators on 24/24 Instruction Induction tasks and 17/21 curated BIG-Bench tasks. We conduct extensive qualitative and quantitative analyses to explore the performance of APE. We show that APE-engineered prompts are able to improve few-shot learning performance (by simply prepending them to standard in-context learning prompts), find better zero-shot chain-of-thought prompts, as well as steer models toward truthfulness and/or informativeness. 22 2 Our code is available at https://github.com/keirp/automatic_prompt_engineer.
术语表
- Large Language Model (LLM)
- 大型语言模型(LLM)
- Automatic Prompt Engineer (APE)
- Automatic Prompt Engineer(APE)
- prompt engineering
- 提示工程
- natural language instruction
- 自然语言指令
- instruction generation
- 指令生成
- instruction selection
- 指令选择
- natural language program synthesis
- 自然语言程序合成
- black-box optimization
- 黑盒优化
- instruction candidate
- 指令候选项
- score function
- 评分函数
- zero-shot learning
- 零样本学习
- few-shot learning
- 少样本学习
- in-context learning
- 上下文学习
- chain of thought (CoT)
- 思维链(CoT)
- Monte Carlo search
- 蒙特卡罗搜索
- instruction induction
- 指令归纳
- Instruction Induction
- Instruction Induction(指令归纳)
- BIG-Bench
- BIG-Bench
- inference model
- 推理模型
- prompt generation
- 提示生成
- prompt scoring
- 提示评分
- prompt paraphrasing
- 提示改写
- prompt tuning
- 提示调优
- soft prompt
- 软提示
- downstream task
- 下游任务
- input-output pair
- 输入—输出对
- truthfulness
- 真实性
- informativeness
- 信息丰富度
- transformer-based language model
- 基于 Transformer 的语言模型