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.
