通过记忆机制提升提示优化效率,让大模型更准更快地生成好答案。
Efficient and Accurate Prompt Optimization: the Benefit of Memory in Exemplar-Guided Reflection
- 用历史反馈和检索样例共同指导提示改进,避免信息浪费。
- 在LIAR数据集上F1提升10.1%,优化步数减少一半。
- 适合需要高效调优提示的AI研发人员和部署工程师。
自动提示工程旨在提升大语言模型的生成质量。近期工作利用错误案例的反馈来指导提示优化,在推理时进一步检索若干语义相关的样例并拼接到优化后的提示中以提升性能。然而,这些方法仅使用当前步骤的反馈,忽略了潜在有益的历史及未选中的反馈。此外,样例选择仅基于一般语义关系,可能并非任务表现最优或与优化提示匹配最佳。本文提出一种带记忆的样例引导反思机制(ERM),实现更高效准确的提示优化。我们设计了样例引导的反思机制,使反馈生成额外受生成样例的引导;同时构建两种记忆模块,充分利用历史反馈信息,并支持更有效的样例检索。实验表明,本方法在较少优化步骤下超越先前最先进方法:在LIAR数据集上F1分数提升10.1%,在ProTeGi上优化步数减少一半。
原文摘要 · Abstract (English)
Automatic prompt engineering aims to enhance the generation quality of large language models (LLMs). Recent works utilize feedbacks generated from erroneous cases to guide the prompt optimization. During inference, they may further retrieve several semantically-related exemplars and concatenate them to the optimized prompts to improve the performance. However, those works only utilize the feedback at the current step, ignoring historical and unseleccted feedbacks which are potentially beneficial. Moreover, the selection of exemplars only considers the general semantic relationship and may not be optimal in terms of task performance and matching with the optimized prompt. In this work, we propose an Exemplar-Guided Reflection with Memory mechanism (ERM) to realize more efficient and accurate prompt optimization. Specifically, we design an exemplar-guided reflection mechanism where the feedback generation is additionally guided by the generated exemplars. We further build two kinds of memory to fully utilize the historical feedback information and support more effective exemplar retrieval. Empirical evaluations show our method surpasses previous state-of-the-arts with less optimization steps, i.e., improving F1 score by 10.1 on LIAR dataset, and reducing half of the optimization steps on ProTeGi.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。