arXiv:2504.04365cs.LGcs.AI2025-04被引 28

自动优化大模型提示词,提升任务表现。

AutoPDL: Automatic Prompt Optimization for LLM Agents

  • 将提示词优化建模为组合搜索问题,用增量淘汰法高效寻优。
  • 在7个不同规模模型上平均提效9.21个百分点,最高达67.5个百分点。
  • 生成可读可改的代码级提示,支持人工迭代与复用。

大语言模型的性能高度依赖于提示设计,包括高层提示模式(如零样本、思维链、ReAct、ReWOO)和具体提示内容(指令与少样本示例)。手动调参耗时易错,且对特定模型和任务耦合性强。本文提出AutoPDL,一种自动发现优质大模型代理配置的方法。该方法将问题建模为在组合式代理与非代理提示模式及示例构成的搜索空间中进行结构化自动机器学习,采用逐轮削减法高效探索。我们构建了一个基于PDL提示编程语言的常用提示模式库,AutoPDL输出为可读、可编辑、可执行的PDL程序。该方法支持源到源优化,便于人机协同改进与复用。在三个任务、七种大模型(3B至70B参数)上的评估显示,性能平均提升9.21±15.46个百分点,最高达67.5个百分点,并揭示不同模型和任务适用的提示策略存在差异。

原文摘要 · Abstract (English)

The performance of large language models (LLMs) depends on how they are prompted, with choices spanning both the high-level prompting pattern (e.g., Zero-Shot, CoT, ReAct, ReWOO) and the specific prompt content (instructions and few-shot demonstrations). Manually tuning this combination is tedious, error-prone, and specific to a given LLM and task. Therefore, this paper proposes AutoPDL, an automated approach to discovering good LLM agent configurations. Our approach frames this as a structured AutoML problem over a combinatorial space of agentic and non-agentic prompting patterns and demonstrations, using successive halving to efficiently navigate this space. We introduce a library implementing common prompting patterns using the PDL prompt programming language. AutoPDL solutions are human-readable, editable, and executable PDL programs that use this library. This approach also enables source-to-source optimization, allowing human-in-the-loop refinement and reuse. Evaluations across three tasks and seven LLMs (ranging from 3B to 70B parameters) show consistent accuracy gains ($9.21\pm15.46$ percentage points), up to 67.5pp, and reveal that selected prompting strategies vary across models and tasks.

提示工程自动化LLM优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。