MASPO: Joint Prompt Optimization for LLM-based Multi-Agent Systems

Zhexuan Wang, Xuebo Liu, Li Wang, Zifei Shan, Yutong Wang, Zhenxi Song, Min Zhang

TL;DR

This paper introduces MASPO, a novel framework for automatically optimizing prompts in Large Language Model (LLM)-based Multi-Agent Systems (MAS). MASPO tackles the challenge of aligning individual agent goals with overall system objectives by using a joint evaluation mechanism and an evolutionary search, achieving a 2.9% average accuracy improvement on diverse tasks.

What Problem Does This Paper Address?

LLM-based Multi-Agent Systems (MAS) show great promise for complex collaborative tasks. However, their performance heavily relies on the quality of "prompts" – instructions that define each agent's role and guide its behavior. Jointly optimizing these prompts across multiple interacting agents is a significant challenge. This is because an agent might perfectly fulfill its local instructions (local validity) but generate outputs that mislead other agents, leading to system-wide failure (Local-Global Misalignment). Existing methods often struggle with this "credit assignment problem," either relying on ground-truth labels (which are scarce for intermediate steps) or focusing on isolated agent performance. The paper aims to bridge this gap by developing a framework that optimizes prompts for the entire system, considering how each agent's prompt contributes to the overall success.

Methods

MASPO introduces a novel framework with three key innovations:

  1. Multi-Granularity Joint Evaluation: Instead of just checking if an agent's output is locally correct, MASPO evaluates prompts based on:
  2. Local Validity: Does the agent's output meet its own role-specific constraints?
  3. Lookahead Potential: Does the agent's output facilitate better performance for downstream agents?
  4. Global Alignment: Does the agent's output contribute to the final system goal? This composite metric helps assign credit more effectively across the agent chain.

  5. Misalignment-Driven Generative Search: MASPO specifically mines "Misalignment Cases" – scenarios where an agent performs well locally but causes system failure. These hard negative examples are used to guide the prompt generation process, forcing the system to learn how to avoid such breakdowns.

  6. Adaptive Optimization Dynamics: To handle the non-stationary nature of MAS (where agent behaviors change as prompts are optimized), MASPO employs:
  7. Topological Scheduling: Agents are optimized sequentially based on their communication graph, but with interleaved updates to prevent overfitting.
  8. Beam Refresh Mechanism: This ensures that the optimization process doesn't get stuck due to outdated information from upstream agents by re-evaluating candidates against the current best prompt.
  9. Trace-Guided Beam Search: The framework uses actual execution traces to generate new prompts and navigates the high-dimensional prompt space efficiently using a beam search.

Datasets

The paper evaluates MASPO on a diverse suite of benchmarks across three domains:

  • Mathematical Proficiency: MATH-500, AQUA, and AGIEval-MATH.
  • Complex Reasoning: GPQA-Diamond.
  • Code Generation: MBPP and HumanEval-ET.

The experiments utilize a sample pool of 50 instances for iterative optimization.

Key Insights and Ideas

  • The "Ripple Effect" Matters: Simply optimizing an agent's local performance isn't enough. MASPO's "Lookahead Potential" metric highlights that an agent's true value lies in how well its output helps subsequent agents succeed. This is a crucial insight for collaborative AI.
  • Hard Negatives are Gold: Identifying and learning from "Misalignment Cases" (where local success leads to global failure) is more effective than just reinforcing successful interactions. These hard examples provide strong signals for correcting critical coordination breakdowns.
  • Dynamic Adaptation is Key: MAS environments are inherently non-stationary. MASPO's adaptive strategies (beam refresh, topological scheduling) are essential for agents to co-evolve and maintain performance as the system learns.
  • One-Step Lookahead is Sufficient: Surprisingly, extending the "Lookahead Potential" beyond one step didn't yield significant performance gains. This suggests that the "Global Alignment" component, combined with one-step lookahead, is enough to capture long-range dependencies.

Key Results

MASPO consistently outperforms state-of-the-art baselines across various tasks, achieving an average accuracy improvement of 2.9%.

  • It significantly surpasses standard single-agent prompting methods and heuristic-based collaborative paradigms.
  • MASPO demonstrates robustness and adaptability across different MAS topologies (Sequential and Hierarchical).
  • The framework shows strong performance even with sub-optimal prompt initialization and can generalize optimized prompts to different LLM architectures.

Limitations and Future Work

  • Computational Budget: While MASPO is efficient, optimizing prompts for large MAS can still be computationally intensive. The paper explores the impact of computational budget and finds that MASPO's gains are not solely due to brute-force resource scaling.
  • Optimizer Dependence: While MASPO shows robustness even with a weaker optimizer model, using a more capable foundation model can lead to superior results.
  • Future Work: The paper suggests exploring dynamic role specialization and architectural optimization within collaborative AI systems. The framework's ability to adapt to different topologies also opens avenues for more complex and dynamic MAS structures.

Summary updated

BibTeX
@inproceedings{wang2026maspo,
  author = {Zhexuan Wang and Xuebo Liu and Li Wang and Zifei Shan and Yutong Wang and Zhenxi Song and Min Zhang},
  title = {{MASPO: Joint Prompt Optimization for LLM-based Multi-Agent Systems}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=iZrp2P55ie},
}
Figure