MAPRO: Recasting Multi-Agent Prompt Optimization as Maximum a Posteriori Inference

Zheyuan Zhang, Lin Ge, Hongjiang Li, Weicheng Zhu, Chuxu Zhang, Yanfang Ye

TL;DR

MAPRO (Multi-Agent PRompt Optimization) is a novel framework that treats the complex task of tuning prompts for multi-agent systems as a mathematical inference problem. By applying a language-guided version of the "belief propagation" algorithm, it efficiently finds globally optimal prompt combinations, consistently outperforming both manual engineering and existing automated optimization methods across coding, math, and reasoning tasks.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly deployed in Multi-Agent Systems (MAS), where specialized agents (e.g., a "coder," a "reviewer," and a "tester") collaborate to solve complex problems. However, these systems suffer from extreme prompt sensitivity: a tiny change in one agent's instructions can cause a "cascade of errors" that breaks the entire workflow.

Optimizing these prompts is a nightmare for two reasons:

  1. Combinatorial Explosion: If you have 5 agents and 10 candidate prompts for each, there are 100,000 possible combinations to test. Brute-force search is impossible.
  2. Ambiguous Credit Assignment: If the final output is wrong, it’s hard to tell which agent’s prompt was the weak link. Was the "coder" vague, or did the "reviewer" fail to provide helpful feedback?

Current tools mostly optimize agents in isolation, failing to capture the complex interdependencies that make multi-agent systems powerful but fragile.

Methods

The authors introduce MAPRO, a four-stage framework that recasts prompt optimization as a Maximum a Posteriori (MAP) inference problem over a Directed Acyclic Graph (DAG).

  • MAP Formulation: They model the MAS as a graph where nodes are agents and edges are their interactions. The goal is to find the prompt set that maximizes the "Joint Quality Score"—the probability that every agent is competent and every "hand-off" between agents is successful.
  • LMPBP (Language-guided Max-Product Belief Propagation): To avoid the exponential search space, they adapt a classical message-passing algorithm. LLM-based reward models score individual agent outputs (nodes) and the quality of communication between agents (edges). The algorithm then passes "messages" through the graph to find the globally best prompt configuration in polynomial time.
  • Topology-aware Refinement: Instead of just looking at the final result, MAPRO uses "downstream blames." If a later agent struggles with an earlier agent's output, that feedback is used to specifically mutate and improve the earlier agent's prompt.
  • Iterative Optimization: The system runs in a loop—selecting the best prompts, collecting execution feedback, and refining the prompt pool—until performance plateaus.

Datasets

The researchers evaluated MAPRO across three diverse domains using several rigorous benchmarks:

  • Code Generation: HumanEval-ET, MBPP-Plus, and CodeContest.
  • Question Answering: NewsQA and WebQuestions.
  • Math Reasoning: MATH and GSM8K.

They compared MAPRO against single-agent baselines (CoT, ReAct), single-agent optimizers (EvoPrompt, PromptBreeder), and multi-agent frameworks (Chain Design, DMAD, and "Swarm" styles like ChatEval).

Key Insights and Ideas

  • Global Coordination Trumps Local Fixes: The "aha moment" here is that fixing one agent's prompt at a time (greedy optimization) often leads to suboptimal systems. By treating the whole system as a single probabilistic model, MAPRO ensures agents are "tuned" to work specifically with one another.
  • The "Edge" is as Important as the "Node": Most optimizers only care if an agent's output looks good. MAPRO explicitly scores the interaction (the edge), asking: "Did Agent A's output actually help Agent B do its job?"
  • Steady Gains vs. Random Walks: Unlike other optimization methods (like TPE) that show fluctuating performance, MAPRO’s trajectory is remarkably steady, suggesting that the MAP formulation provides a much more principled "compass" for navigating the prompt space.

Key Results

MAPRO achieved State-of-the-Art (SOTA) results across the board, using both Claude 3.5 Haiku and Llama 3.3-70b as backbones:

  • Superior Accuracy: On the HumanEval-ET coding benchmark, MAPRO reached 80.21% accuracy, significantly higher than the raw model (69.38%) and even specialized multi-agent baselines like ChatEval (73.44%).
  • Consistency: It outperformed the best runner-up automated optimizers (like EvoPrompt and PromptBreeder) in almost every category, often by a margin of 3-5%.
  • Ablation Success: Removing the "demonstration-guided" reward mechanism caused performance to drop across all tasks (e.g., a 5.78% drop on CodeContest), proving that the specific feedback loop is vital to the system's success.

Limitations and Future Work

  • Fixed Topology: Currently, MAPRO optimizes the text of the prompts but keeps the structure of the agent graph (who talks to whom) fixed. The authors suggest that jointly optimizing both the prompts and the graph structure is a promising next step.
  • Reward Model Costs: The system relies on LLMs to act as reward models. While effective, this can be computationally expensive. Future work could explore using smaller, fine-tuned "critic" models to reduce costs.
  • Search Space Constraints: The study limited the number of candidate prompts and demonstrations to keep experiments manageable; exploring how the system scales to even larger, more complex agent societies remains an open question.

Summary updated

BibTeX
@inproceedings{zhang2026mapro,
  author = {Zheyuan Zhang and Lin Ge and Hongjiang Li and Weicheng Zhu and Chuxu Zhang and Yanfang Ye},
  title = {{MAPRO: Recasting Multi-Agent Prompt Optimization as Maximum a Posteriori Inference}},
  booktitle = {EACL (Findings)},
  year = {2026},
  doi = {10.18653/v1/2026.findings-eacl.233},
}
Figure