ChatPaper.aiChatPaper

将大型语言模型与进化算法相结合,产生强大的提示优化器。

Connecting Large Language Models with Evolutionary Algorithms Yields Powerful Prompt Optimizers

September 15, 2023
作者: Qingyan Guo, Rui Wang, Junliang Guo, Bei Li, Kaitao Song, Xu Tan, Guoqing Liu, Jiang Bian, Yujiu Yang
cs.AI

摘要

大型语言模型(LLMs)在各种任务中表现出色,但它们依赖精心设计的提示,这往往需要大量人力。为了自动化这一过程,本文提出了一种用于离散提示优化的新框架,名为EvoPrompt,它借鉴了进化算法(EAs)的思想,因为它们表现出良好的性能和快速收敛。为了让EAs能够处理自然语言表达的离散提示,这些提示需要连贯且易读,我们将LLMs与EAs相连接。这种方法使我们能够同时利用LLMs强大的语言处理能力和EAs高效的优化性能。具体而言,EvoPrompt不涉及任何梯度或参数,它从一组提示的种群开始,并根据进化算子迭代生成新的提示,根据开发集改进种群。我们对包括GPT-3.5和Alpaca在内的闭源和开源LLMs进行提示优化,涵盖了涵盖语言理解和生成任务的9个数据集。EvoPrompt在自动提示生成方面显著优于人工设计的提示和现有方法,分别提高了高达25%和14%。此外,EvoPrompt表明将LLMs与EAs相连接会产生协同效应,这可能激发进一步研究LLMs与传统算法结合的可能性。
English
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 9 datasets spanning language understanding and generation tasks. EvoPrompt significantly outperforms human-engineered prompts and existing methods for automatic prompt generation by up to 25% and 14% respectively. Furthermore, EvoPrompt demonstrates that connecting LLMs with EAs creates synergies, which could inspire further research on the combination of LLMs and conventional algorithms.
PDF5311December 15, 2024