EvoPrompt: Connecting LLMs with Evolutionary Algorithms Yields Powerful Prompt Optimizers
Qingyan Guo12† , Rui Wang2 , Junliang Guo2, Bei Li23, Kaitao Song2, Xu Tan2 , Guoqing Liu2, Jiang Bian2, Yujiu Yang1‡ 1Tsinghua University 2Microsoft Research 3Northeastern University Work done during an internship at Microsoft Research Asia. Equal Contribution.Corresponding Author.
Abstract
Large Language Models (LLMs) excel in various tasks, but they rely on carefully crafted prompts that often demand substantial human effort. To automate this process, in this paper, we propose a novel framework for discrete prompt optimization, called EvoPrompt, which borrows the idea of evolutionary algorithms (EAs) as they exhibit good performance and fast convergence. To enable EAs to work on discrete prompts, which are natural language expressions that need to be coherent and human-readable, we connect LLMs with EAs. This approach allows us to simultaneously leverage the powerful language processing capabilities of LLMs and the efficient optimization performance of EAs. Specifically, abstaining from any gradients or parameters, EvoPrompt starts from a population of prompts and iteratively generates new prompts with LLMs based on the evolutionary operators, improving the population based on the development set. We optimize prompts for both closed- and open-source LLMs including GPT-3.5 and Alpaca, on 31 datasets covering language understanding, generation tasks, as well as BIG-Bench Hard (BBH) tasks. EvoPrompt significantly outperforms human-engineered prompts and existing method
中文速览
大语言模型(LLM)的表现高度依赖人工精心设计的提示词(prompt),这一过程费时费力且难以标准化。为此,研究者提出了 EvoPrompt 框架,将进化算法(Evolutionary Algorithms, EA)的思路引入离散提示词的自动优化——用 LLM 充当进化算子来完成变异和交叉操作,同时让 EA 掌控整体搜索方向,从而在"探索多样提示"与"利用已知好提示"之间取得平衡。在覆盖语言理解、文本生成和 BIG-Bench Hard 推理任务的 31 个数据集上,EvoPrompt 持续优于人工设计提示和现有自动提示方法,在 BIG-Bench Hard 上最高提升达 25%,且全程无需访问模型参数或梯度,生成的提示词对人类同样可读。这项工作不仅提供了一个实用的提示自动优化工具,更揭示了 LLM 与经典优化算法结合的潜力,为两者的协同研究开辟了新方向。
原文 arXiv:2309.08532;中英对照 + 大白话阅读 https://aha.fim.ai/paper/2309.08532v3