Large Language Models Are Human-Level Prompt Engineers
By Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, Jimmy Ba. 2022
1,479 citations recorded by the source corpus.
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 Engineer (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. Experiments on 24 NLP tasks 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 19/24 tasks. We conduct extensive qualitative and quantitative analyses to explore the performance of APE. We show that APE-engineered prompts can be applied to steer models toward truthfulness and/or informativeness, as well as to improve few-shot learning performance by simply prepending them to standard in-context learning prompts. Please check out our webpage at https://sites.google.com/view/automatic-prompt-engineer.
Subfields: Artificial Intelligence, Information Systems, Prompting & Reasoning
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Mohit Bansal
- Jianfeng Gao
- Luke S. Zettlemoyer
- Yejin Choi
- Percy Liang
- Quoc V. Le
- Caiming Xiong
- Hannaneh Hajishirzi
In Information Systems
In Prompting & Reasoning
Citations in the corpus
- Llama 2: Open Foundation and Fine-Tuned Chat Models (2023, background): “…a function of number of tasks, model size, prompt settings, etc. Prompts used for instruction tuning can be created by humans or by LLMs themselves (Zhou et al., 2022), and follow-up instructions can be used to refine initial generations to make them more useful, engaging, and unbiased (Ganguli et…”
- Cognitive Architectures for Language Agents (2023, methodology): “These can be broken down as follows: • Updating reasoning (e.g., prompt templates; Gao et al., 2020; Zhou et al., 2022b).”
- Automatic Prompt Optimization with "Gradient Descent" and Beam Search (2023, methodology): “Other work applies discrete manipulations to prompts via Reinforcement Learning or LLM-based feedback (Zhang et al., 2023; Zhou et al., 2022).”
- Security and Privacy Challenges of Large Language Models: A Survey (2024, neutral): “Our objective is to provide a clear vision for researchers, practitioners, and other stakeholders who plan to develop and/or deploy LLMs, in terms of the significance of LLM security and privacy challenges.”
- Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection (2023, neutral): “Building on these observations, we point out another critical insight; when augmenting LLMs with retrieval, processing untrusted retrieved data would be analogous to executing arbitrary code; the line between data and code (i.e., natural language instructions) would get blurry .”
- Jailbreaking Black Box Large Language Models in Twenty Queries (2023, neutral): “This significant discrepancy is a major strength and one of the key selling points of our approach relative to GCG.”
- Promptbreeder: Self-Referential Self-Improvement Via Prompt Evolution (2023, background): “Prompting an LLM in the right way is essential to its downstream performance (Moradi & Samwald, 2021; Madaan & Yazdanbakhsh, 2022; Zhou et al., 2023).”
- Causal Reasoning and Large Language Models: Opening a New Frontier for Causality (2023, methodology): “Below we describe a method to generate an appropriate prompt for a given task, based on Zhou et al. (2022).”
- Large Language Model as Attributed Training Data Generator: A Tale of Diversity and Bias (2023, background): “Several works attempt to optimize discrete prompts for querying LLMs with large language models [43, 64, 34].”
- Graph of Thoughts: Solving Elaborate Problems with Large Language Models (2023, background): “proposes to harness selecting the best prompt out of a candidate set [83].”
- Self-Collaboration Code Generation via ChatGPT (2023, neutral): “Meanwhile, since hand-crafted instructions or prompts may not always be optimal, some researchers have explored automated instruction or prompt generation approaches [24, 44, 51, 65].”
- Large Language Models Cannot Self-Correct Reasoning Yet (2023, background): “Additionally, such search efforts can be equally applied to the pre-hoc prompts (Zhou et al., 2022; Yang et al., 2023).”
- To CoT or not to CoT? Chain-of-thought helps mainly on math and symbolic reasoning (2024, methodology): “To test the impact of prompt choice on performance, we performed our zero-shot experiment on Llama 3.1 8B with 7 different datasets and 4 different zero-shot CoT prompting strategies common in the literature (Kojima et al., 2022; Wang et al., 2023b; Zhou et al., 2023b; Yang et al., 2024).”
- Unifying Large Language Models and Knowledge Graphs: A Roadmap (2023, methodology): “Automatic prompt engineer (APE) proposes an automatic prompt generation method to improve the performance of LLMs [66].”
- Unleashing the potential of prompt engineering in Large Language Models: a comprehensive review (2023, background): “For another example, many studies experiment mainly on certain models or tasks and employ disparate evaluation metrics, restricting comparability across meth-ods [110, 111].”