The Research Report
MASPOB: When Bandits Meet Graph Networks to Tune Your Multi-Agent Prompts
An ICML 2026 Spotlight paper shows that the topology of your agent graph isn't just infrastructure — it's the key to optimizing prompts at scale.
You've built a multi-agent LLM system. A reasoning agent feeds a coding agent, which feeds a verification agent, which feeds back corrections. The workflow is solid — vetted by your domain experts, safety-reviewed, compliance-stamped. You can't change the topology. But the system still underperforms. What do you tune?
The prompts. Obviously.
But here's the problem nobody wants to admit: tuning prompts across multiple agents is a combinatorial nightmare. Each agent has its own prompt space. If Agent A has 20 candidate prompts and Agent B has 20 more, you're already at 400 combinations. Add Agent C and you're at 8,000. And because Agent A feeds Agent B, changing A's prompt shifts B's input distribution — meaning you can't optimize them independently.
Most teams just… don't optimize. They hand-tune each prompt in isolation and hope for the best. The ones who try automated approaches quickly discover that single-agent prompt optimizers (OPRO, PromptBreeder) ignore the coupling entirely, while multi-stage optimizers (MIPRO) treat the system as a black box and burn through evaluation budget without capturing the structure that matters.
Enter MASPOB — Multi-Agent System Prompt Optimization via Bandits — an ICML 2026 Spotlight paper from Zhi Hong, Qian Zhang, Jiahang Sun, Zhiwei Shang, Mingze Kong, Xiangyi Wang, Yao Shu, and Zhongxiang Dai. It's the first systematic framework that treats the agent graph topology as a first-class citizen in prompt optimization, and it does so with an elegant combination of three ideas: bandit exploration, graph neural networks, and coordinate ascent.
The results speak for themselves: 12.02% average improvement over the input-output baseline across six benchmarks, consistently outperforming every existing method under matched evaluation budgets.
Let's unpack why this matters and how it works.
The Three Problems Nobody Solved Together
Prompt optimization for multi-agent systems faces three intertwined challenges that previous work tackled piecemeal, at best:
1. Expensive Evaluations
Every time you want to test a prompt combination, you have to run the entire multi-agent pipeline end-to-end. A system with five agents might require five LLM calls per evaluation. At $0.15 per million tokens for GPT-4o-mini, that sounds cheap — until you realize the search space has 3.2 million configurations and you need statistical significance. Real-world teams have budgets measured in hundreds of evaluations, not millions.
2. Topology-Induced Coupling
This is the subtle killer. In a multi-agent DAG, changing an upstream agent's prompt doesn't just change that agent's behavior — it changes what every downstream agent receives. If you tweak the reasoning agent's prompt to be more verbose, the coding agent suddenly gets longer inputs. The verifier sees different error patterns. The system's performance surface isn't separable; it's a tangled web of dependencies that mirrors the DAG topology.
Independent optimization fails here because it treats each agent's prompt as a local decision. You might find the "best" prompt for each agent in isolation, only to discover that the globally optimal combination looks completely different — because what's optimal for Agent B depends critically on what Agent A is doing.
3. Combinatorial Explosion
With N agents each having a prompt domain of size |Pᵢ|, the joint search space is the Cartesian product — ∏ᵢ|Pᵢ|. This grows exponentially. Even with just 5 agents and 20 candidates each, you're looking at 3.2 million configurations. Exhaustive search is out. Even random search becomes wasteful when evaluations are expensive.
The MASPOB Framework: Three Ideas, One System
MASPOB tackles all three problems simultaneously. Here's how the pieces fit together:
🎯 UCB Bandit Exploration: Make Every Evaluation Count
MASPOB frames the prompt selection problem as a contextual bandit. At each round, you need to decide which prompt combination to evaluate next. The key insight is to use the Upper Confidence Bound (UCB) principle from the bandit literature.
UCB works by maintaining two quantities for each candidate:
- An exploitation score — how good the surrogate model predicts this combination will be
- An exploration bonus — how uncertain the model is about that prediction
The acquisition score is: UCB(c) = μ̂(c) + α · σ(c)
Where μ̂ is the predicted performance and σ is the epistemic uncertainty estimated via an information matrix in the learned representation space. The coefficient α controls the exploration-exploitation tradeoff.
This is brilliant for the budget-constrained setting. Early on, when you know nothing, the uncertainty term dominates and you explore broadly. As you gather data, the uncertainty shrinks and exploitation takes over. You never waste evaluations on configurations you already know are bad, but you also don't get trapped in local optima because uncertain regions always look tempting.
The paper uses LinUCB specifically — linear UCB in the feature space produced by the GNN surrogate — which is computationally efficient and well-understood theoretically.
🕸️ GNN Topology-Aware Surrogate: The Secret Sauce
This is where MASPOB truly differentiates itself. The GNN surrogate doesn't just predict system performance from prompt embeddings — it models how prompts propagate through the agent graph.
Here's how it works:
- Each agent node gets a feature vector derived from its current prompt embedding
- A Graph Attention Network (GAT) performs message passing along the DAG edges
- Through multiple rounds of message passing, each node aggregates information from its predecessors and successors
- The resulting topology-aware representations capture how an upstream prompt change cascades through the system
This is the structural inductive bias that makes the whole thing work. The GNN knows that agents connected by an edge are coupled, and it learns to represent that coupling. When you change the reasoning agent's prompt, the GNN doesn't just update the reasoning node — it updates every node reachable from it, with attention-weighted contributions.
The surrogate serves double duty: it provides the prediction μ̂(c) for the UCB score, and its learned representations become the features for the LinUCB uncertainty calculation.
🔍 Coordinate Ascent: Taming the Combinatorial Monster
Even with a smart surrogate and UCB guiding evaluations, you still need to decide which combinations to consider. The full Cartesian product is intractable.
MASPOB uses coordinate ascent: optimize one agent's prompt at a time while holding all others fixed, then cycle through agents repeatedly. In round k, you:
- Pick an agent aᵢ to update
- Use the UCB score to select the best prompt from Pᵢ (the prompt domain for agent i)
- Fix that prompt and move to the next agent
This reduces the search complexity from exponential (∏|Pᵢ|) to linear (∑|Pᵢ| per round). And crucially, it still accounts for inter-agent coupling through the GNN surrogate — when evaluating candidate prompts for agent i, the surrogate sees the full graph with all other agents' current prompts, so the UCB score reflects genuine system-level expected performance.
The paper also compares against exhaustive search (evaluating all combinations) and shows that coordinate ascent achieves comparable results with a fraction of the evaluations.
The Three-Phase Pipeline
MASPOB runs in three phases:
Phase 1: Initialization — Construct the agent topology (DAG), generate prompt embeddings for all candidates using a sentence embedding model, and build the graph structure that the GNN will use.
Phase 2: Search — The main loop. For each coordinate ascent round, for each agent:
- Compute the UCB score for every candidate prompt using the GNN prediction + LinUCB uncertainty
- Select the highest-UCB prompt
- Execute the full MAS pipeline with that combination
- Observe the system-level reward
Phase 3: Update — After each evaluation, update both the GNN surrogate model (via gradient descent on the observed reward) and the LinUCB information matrix (to refine uncertainty estimates).
The first 5 rounds are dedicated to random exploration (pretraining the GNN), after which the UCB-guided search takes over for the remaining rounds (default: 45 rounds).
Results: Consistent and Convincing
The paper evaluates MASPOB on six benchmarks spanning three domains:
| Domain | Benchmarks | Metric |
|---|---|---|
| Question Answering | HotpotQA, DROP | F1 |
| Mathematical Reasoning | GSM8K, MATH | Accuracy |
| Code Generation | HumanEval, MBPP | pass@1 |
Against baselines including IO (no optimization), OPRO, PromptBreeder, DSPy's MIPRO, and random search, MASPOB wins consistently. The overall average improvement is 12.02% over the IO baseline, and it outperforms the best competing method on every single benchmark.
Key observations from the results:
- Single-agent optimizers fail in multi-agent settings. OPRO and PromptBreeder, which optimize each prompt independently, show minimal improvement or even degradation. This confirms the topology-induced coupling problem — local optima aren't global optima.
- Topology-agnostic methods leave performance on the table. MIPRO, which uses Bayesian optimization without explicit graph structure, improves over baselines but falls short of MASPOB. The GNN's structural prior makes a real difference.
- UCB exploration matters. Ablation studies show that removing the exploration bonus (greedy selection) degrades performance significantly. The uncertainty quantification genuinely guides search toward informative configurations.
- Coordinate ascent is surprisingly effective. Despite its simplicity, coordinate ascent with the topology-aware surrogate and UCB guidance performs within striking distance of exhaustive search — at a fraction of the cost.
Practical Takeaways
For Practitioners Building Multi-Agent Systems
- Stop optimizing prompts in isolation. If your agents are connected, their prompts are coupled. Tuning Agent A's prompt while holding B fixed, then tuning B while holding A fixed, is not the same as jointly optimizing both. MASPOB gives you a principled way to do joint optimization.
- Topology is a feature, not a bug. Your agent graph isn't just infrastructure — it's a rich source of structural information about how prompts propagate. Methods that ignore this structure (treating the system as a black box) will always be less sample-efficient than methods that exploit it.
- Bandit methods are underused in prompt optimization. The UCB framework is perfect for the budget-constrained setting. Every LLM call costs money and time. Bandit methods explicitly optimize for making the most of each evaluation, with theoretical guarantees on cumulative regret.
- Coordinate ascent is your friend for combinatorial spaces. When the joint search space explodes, cycling through one variable at a time is both tractable and effective — especially when your surrogate model captures the cross-variable interactions.
For Researchers
- The GNN-as-surrogate idea deserves wider exploration. The paper uses Graph Attention Networks, but other architectures (Graph Transformers, message-passing GNNs with different aggregation schemes) might capture different aspects of agent interaction. The key insight — that the workflow topology provides a structural inductive bias for the surrogate — generalizes beyond prompt optimization.
- The bandit formulation opens doors. Framing prompt optimization as a contextual bandit problem connects it to decades of online learning theory. Regret bounds, Bayesian extensions, non-stationary bandits (for when agent behavior drifts over time) — there's rich territory here.
- The DAG assumption is limiting but pragmatic. Real multi-agent systems sometimes have iterative feedback loops (agent A → B → A). The paper's DAG assumption covers inter-agent information flow in a single pass, with internal loops handled per-agent. Extending the framework to general graphs with cycles is an open problem.
Limitations and Open Questions
No paper is perfect. MASPOB has some notable limitations:
- DAG-only workflows. The framework assumes inter-agent information flows form a DAG, excluding systems with cross-agent feedback loops. Many real agentic systems do have such loops (e.g., debate setups, iterative refinement across agents).
- Homogeneous model assumption. The experiments use GPT-4o-mini for all agents. How well does the framework handle heterogeneous setups where different agents use different models?
- Scalability beyond ~5 agents. The coordinate ascent approach reduces search from exponential to linear, but the GNN surrogate still needs to model increasingly complex topologies as agent count grows. The paper doesn't push beyond moderate-scale systems.
- Static topology. The workflow is fixed. What about systems where the topology itself should be jointly optimized with the prompts?
- Early codebase. At the time of writing, the GitHub repo has 0 stars. The code works, but expect rough edges. Requirements: Python 3.10+, PyTorch 2.0+, and an OpenAI-compatible API key.
The Bigger Picture: Prompt Engineering Meets Systems Engineering
MASPOB represents a broader shift in how we think about LLM systems. For the past two years, prompt engineering has been a cottage industry — individual practitioners hand-tuning prompts for individual models, sharing tips on Twitter, treating each prompt as an independent artifact.
But as LLM systems become multi-agent systems, prompt engineering becomes systems engineering. The prompts are no longer independent knobs; they're coupled components in a structured system. And the tools of systems engineering — graph theory, bandit algorithms, surrogate optimization — become the right tools for the job.
The paper's core insight is deceptively simple: the structure of your system matters for optimizing it. A GNN that knows which agents talk to which other agents will always outperform a black-box optimizer that treats the whole system as an opaque function. And a bandit that quantifies its own uncertainty will always make better use of a limited budget than a random search that doesn't.
These aren't just theoretical advantages. In a world where each LLM call costs real money and each evaluation takes real time, sample efficiency is the difference between a technique that's publishable and one that's deployable. MASPOB is both.
Paper: arXiv:2603.02630
Code: github.com/HZ1008/MASPOB
Venue: ICML 2026 Spotlight
If you're building multi-agent LLM systems and still tuning prompts by hand — or worse, tuning them independently — MASPOB gives you a principled, sample-efficient, topology-aware alternative. The code is open source. The benchmarks are reproducible. The 12% average improvement is real. What are you waiting for?