MASPOB: Bandit-Based Prompt Optimization for Multi-Agent Systems with Graph Neural Networks

Zhi Hong, Qian Zhang, Jiahang Sun, Zhiwei Shang, Mingze Kong, Xiangyi Wang, Yao Shu, Zhongxiang Dai

Large Language Models (LLMs) are increasingly deployed as collaborative agents within Multi-Agent Systems (MAS) to tackle complex tasks like coding and multi-step reasoning. In many enterprise and high-stakes environments, the workflow or "topology" of these agents is designed by experts and strictly frozen for safety and compliance. However, the overall system's performance remains highly sensitive to the specific prompts assigned to each agent.

Optimizing these prompts presents three major hurdles:

  1. Prohibitive Cost: Evaluating a single prompt configuration requires executing the entire multi-agent pipeline, which is computationally expensive and slow.
  2. Topology Coupling: Modifying an upstream agent's prompt alters the input to downstream agents, creating a cascading effect that prevents independent, isolated optimization.
  3. Combinatorial Explosion: A modest system with 5 agents and 20 candidate prompts per agent yields 3.2 million possible combinations.

The MASPOB Framework

To overcome these challenges, researchers introduce MASPOB (Multi-Agent System Prompt Optimization via Bandits). MASPOB is a sample-efficient framework that leverages graph intelligence and bandit-based exploration to find optimal prompt combinations under strict evaluation budgets. The framework relies on three core innovations:

  • Topology-Aware GNN Surrogate: Rather than treating the MAS as a black box, MASPOB employs a Graph Attention Network (GAT) to encode the agent workflow as a graph. Nodes represent agents, and edges represent information flows. This structural prior allows the model to learn how prompt modifications propagate through the system.
  • Contextual Bandits (LinUCB): To maximize sample efficiency, MASPOB uses an Upper Confidence Bound (UCB) strategy. It balances exploitation (selecting prompts the GNN predicts will perform well) with exploration (testing prompts in uncertain regions of the search space). Interestingly, the authors found that a linear uncertainty estimator (LinUCB) outperforms neural uncertainty methods in low-budget settings, providing stable and lightweight estimates.
  • Coordinate Ascent Search: To mitigate the combinatorial explosion, MASPOB optimizes one agent's prompt at a time while keeping the others fixed. This coordinate ascent approach reduces the search complexity from exponential to linear.

Experimental Setup

The framework was rigorously evaluated across six diverse benchmarks spanning Question Answering (HotpotQA, DROP), Code Generation (HumanEval, MBPP), and Mathematical Reasoning (GSM8K, MATH Level-5). MASPOB was compared against single-agent baselines (like Chain-of-Thought and ReAct) and state-of-the-art multi-agent optimizers, including MIPRO and AFlow.

Key Findings and Results

  • State-of-the-Art Performance: MASPOB achieved the highest scores across all six benchmarks, delivering an average improvement of 12.02% over the standard Input-Output (IO) baseline and roughly 2% over the previous best multi-agent optimizers.
  • Sample Efficiency: Operating under a strict budget of just 50 evaluations, MASPOB converged to near-optimal performance significantly faster than competing methods. The explicit modeling of the graph allows the GNN to generalize from a few evaluations much better than "structure-blind" optimizers.
  • Computational Efficiency: By utilizing coordinate ascent instead of a global search, MASPOB reduced runtime by 98% to 99.8% while maintaining nearly identical performance levels.

Limitations and Future Directions

The primary limitation of MASPOB is its reliance on a Static Directed Acyclic Graph (DAG) assumption. It currently assumes the agent workflow lacks loops and that information paths are fixed.

Future research aims to extend the framework to handle cyclic workflows (e.g., iterative refinement loops), dynamic routing (where paths change conditionally based on inputs), and heterogeneous LLM deployments (optimizing systems that mix different models like GPT-4o and smaller local models). Ultimately, MASPOB highlights a practical industrial truth: optimizing prompts within a fixed, expert-vetted structure is often the most viable path to improving multi-agent AI systems.

Summary updated

BibTeX
@inproceedings{hong2026maspob,
  author = {Zhi Hong and Qian Zhang and Jiahang Sun and Zhiwei Shang and Mingze Kong and Xiangyi Wang and Yao Shu and Zhongxiang Dai},
  title = {{MASPOB: Bandit-Based Prompt Optimization for Multi-Agent Systems with Graph Neural Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=A5venxSvpw},
}
Figure