Table of Contents
Fetching ...

AMPO: Automatic Multi-Branched Prompt Optimization

Sheng Yang, Yurong Wu, Yan Gao, Zineng Zhou, Bin Benjamin Zhu, Xiaodi Sun, Jian-Guang Lou, Zhiming Ding, Anbang Hu, Yuan Fang, Yunsong Li, Junyan Chen, Linjun Yang

TL;DR

AMPO introduces automatic Multi-Branched Prompt Optimization to move beyond single-flow prompts by constructing adaptive, multi-branch prompt structures that are refined through failure-case feedback. It decomposes the process into Pattern Recognition, Branch Adjustment, and Branch Pruning, aided by three LLM agents (Analyzer, Summarizer, Revisor) and a minimal search strategy, formalizing the objective as $P^*=\argmax_{P\in S} \sum_i R(p_\beta(a_i|q_i, P))$ over $D_{train}$. Across five tasks spanning General NL and Domain Knowledge, AMPO consistently outperforms state-of-the-art feedback-based optimizers, with pronounced gains on complex domains like MedQA, while reducing exploration overhead. The work demonstrates that adaptive multi-branch prompts can better capture diverse patterns, offering a scalable, efficient pathway for automatic prompt engineering and improving robustness to data distribution shifts.

Abstract

Prompt engineering is very important to enhance the performance of large language models (LLMs). When dealing with complex issues, prompt engineers tend to distill multiple patterns from examples and inject relevant solutions to optimize the prompts, achieving satisfying results. However, existing automatic prompt optimization techniques are only limited to producing single flow instructions, struggling with handling diverse patterns. In this paper, we present AMPO, an automatic prompt optimization method that can iteratively develop a multi-branched prompt using failure cases as feedback. Our goal is to explore a novel way of structuring prompts with multi-branches to better handle multiple patterns in complex tasks, for which we introduce three modules: Pattern Recognition, Branch Adjustment, and Branch Pruning. In experiments across five tasks, AMPO consistently achieves the best results. Additionally, our approach demonstrates significant optimization efficiency due to our adoption of a minimal search strategy.

AMPO: Automatic Multi-Branched Prompt Optimization

TL;DR

AMPO introduces automatic Multi-Branched Prompt Optimization to move beyond single-flow prompts by constructing adaptive, multi-branch prompt structures that are refined through failure-case feedback. It decomposes the process into Pattern Recognition, Branch Adjustment, and Branch Pruning, aided by three LLM agents (Analyzer, Summarizer, Revisor) and a minimal search strategy, formalizing the objective as over . Across five tasks spanning General NL and Domain Knowledge, AMPO consistently outperforms state-of-the-art feedback-based optimizers, with pronounced gains on complex domains like MedQA, while reducing exploration overhead. The work demonstrates that adaptive multi-branch prompts can better capture diverse patterns, offering a scalable, efficient pathway for automatic prompt engineering and improving robustness to data distribution shifts.

Abstract

Prompt engineering is very important to enhance the performance of large language models (LLMs). When dealing with complex issues, prompt engineers tend to distill multiple patterns from examples and inject relevant solutions to optimize the prompts, achieving satisfying results. However, existing automatic prompt optimization techniques are only limited to producing single flow instructions, struggling with handling diverse patterns. In this paper, we present AMPO, an automatic prompt optimization method that can iteratively develop a multi-branched prompt using failure cases as feedback. Our goal is to explore a novel way of structuring prompts with multi-branches to better handle multiple patterns in complex tasks, for which we introduce three modules: Pattern Recognition, Branch Adjustment, and Branch Pruning. In experiments across five tasks, AMPO consistently achieves the best results. Additionally, our approach demonstrates significant optimization efficiency due to our adoption of a minimal search strategy.

Paper Structure

This paper contains 34 sections, 7 figures, 6 tables, 1 algorithm.

Figures (7)

  • Figure 1: Our prompt optimization approach aims to iteratively optimize a single flow of instructions into a multi-branched format to handle multiple patterns.
  • Figure 2: Overall framework of AMPO
  • Figure 3: Comparison between our pattern selection strategy and the random strategy on MedQA and SST-5.
  • Figure 4: Exploration efficiency analysis. Our method achieved the best results with the fewest exploration prompts. The horizontal axis represents the number of intermediate exploratory prompts, while the vertical axis represents accuracy. Here, AMPO-No-S refers to AMPO without the Summarizer.
  • Figure 5: Convergence Analysis
  • ...and 2 more figures