TL;DR – MASPOB turns prompt‑tuning for multi‑agent LLM systems into a sample‑efficient bandit problem. By marrying Upper‑Confidence‑Bound (UCB) exploration, a graph‑neural‑network (GNN) surrogate that respects the workflow topology, and a coordinate‑ascent search, the method delivers state‑of‑the‑art performance on a suite of multi‑agent benchmarks while using a fraction of the evaluation budget.


1️⃣ Why Prompt Optimization for Multi‑Agent Systems?

Large Language Models (LLMs) are now being orchestrated as Multi‑Agent Systems (MAS) – think of autonomous research assistants, tool‑using assistants, or self‑improving pipelines where each agent has a specialized role. The workflow graph (often a DAG) is usually locked down for compliance, safety, or reproducibility reasons, so the only lever left for improving overall system performance is the prompt that each agent receives.

Prompt optimization in a single‑agent setting is already expensive: each evaluation incurs a full LLM call. In a MAS, the problem compounds dramatically:

  1. Expensive end‑to‑end evaluations – a single trial may invoke dozens of LLM calls.
  2. Topology‑induced coupling – tweaking the upstream agent’s prompt shifts the distribution of inputs downstream, breaking naïve independent tuning.
  3. Combinatorial explosion – with N agents and M candidate prompts each, the joint search space is Mⁿ.

MASPOB’s core insight is to treat this as a contextual bandit where each round selects a joint prompt configuration, observes a noisy reward (e.g., end‑to‑end accuracy), and updates a surrogate model that respects the MAS graph.


2️⃣ The MASPOB Framework at a Glance

MASPOB Architecture

Figure: MASPOB’s three pillars – UCB bandit exploration, a GNN‑based topology‑aware surrogate, and coordinate‑ascent search.

2.1 Upper‑Confidence‑Bound (UCB) Bandit Exploration

MASPOB models each prompt candidate as an arm of a contextual bandit. The Upper Confidence Bound (UCB) score for a candidate i is:

UCB_i = μ_i + α * sqrt( Σ_i )
  • μ_i – predicted reward from the GNN surrogate.
  • Σ_i – the estimated variance (uncertainty) of that prediction.
  • α – a tunable exploration coefficient (default 0.2).

By selecting the arm with the highest UCB at each round, MASPOB balances exploitation (picking promising prompts) with exploration (probing uncertain regions) while staying within a strict evaluation budget.

2.2 GNN Topology‑Aware Surrogate

Prompts are embedded (sentence‑transformer) and fed into a Graph Attention Network (GAT) that mirrors the MAS workflow DAG. The GAT learns how changes to an upstream node’s prompt affect downstream performance, effectively capturing coupling that naive independent models miss.

Key benefits:

  • Structural priors – the graph structure guides message‑passing, ensuring the surrogate respects causal dependencies.
  • Scalability – a single forward pass produces predictions for all agents, keeping inference cheap.

3️⃣ Coordinate‑Ascent Search – Reducing the Combinatorial Burden

Instead of enumerating the exponential joint space, MASPOB performs a coordinate‑ascent loop:

  1. Pick an agent (random or based on highest gradient).
  2. Select its best prompt according to the current UCB scores while holding other agents fixed.
  3. Update the GNN with the newly observed reward.
  4. Iterate across agents until the budget is exhausted.

Because each sub‑problem is univariate, the per‑iteration cost is linear in the number of agents, turning an Mⁿ search into O(N·M).


4️⃣ Experimental Highlights

MASPOB was evaluated on six benchmark MAS tasks ranging from multi‑hop QA (HotpotQA) to code generation (HumanEval). The table below summarizes the gains over three strong baselines:

Dataset Baseline (Random) Baseline (Bandit‑Free) MASPOB Relative Δ
HotpotQA (F1) 62.3 68.7 74.5 +10.8%
DROP (F1) 48.1 55.4 61.9 +12.0%
GSM8K (Acc) 31.2 38.5 45.7 +13.9%
MATH (Acc) 18.0 24.2 30.4 +12.7%
HumanEval (pass@1) 12.5% 18.9% 24.3% +20%
MBPP (pass@1) 14.2% 20.1% 26.8% +21%

Key take‑aways

  • MASPOB consistently outperforms random and greedy baselines by ~10‑20% absolute.
  • It reaches these gains with ≤ 45 evaluation rounds, a ~3‑5× reduction in budget compared to exhaustive grid‑search.

5️⃣ Getting Started – Quick‑Start Guide

# Clone & install
git clone https://github.com/HZ1008/MASPOB.git && cd MASPOB
pip install -r requirements.txt
  1. Configure your API key – edit config/config2.yaml or set OPENROUTERAPIKEY / OPENAIAPIKEY in the environment.
  2. Run a benchmark – e.g., for HotpotQA with linear UCB:
python run.py --dataset HotpotQA --ucb_type linear

Important CLI Flags

Flag Default Description
--ucb_type linear linear (embedding‑based), neural (GNN gradients), greedy (no exploration)
--max_rounds 45 Total optimization rounds after pre‑training
--pretrain_rounds 5 Random exploration rounds before surrogate training
--num_prompts 20 How many candidate prompts to generate per operator
--ucb_alpha 0.2 Exploration coefficient α
--search_strategy coordinate coordinate (default) or exhaustive

6️⃣ Limitations & Future Directions

  • Model‑specific embeddings – MASPOB currently uses a single embedding model for all agents; richer multimodal embeddings could capture nuanced prompt semantics.
  • Static topology assumption – the GNN assumes a fixed DAG. Dynamic agent addition/removal would require an online graph‑update mechanism.
  • Reward noise – end‑to‑end MAS evaluations are noisy; future work could explore Bayesian surrogate models for tighter uncertainty estimates.

7️⃣ Takeaway for Substack Readers

MASPOB shows that sample‑efficient bandit methods, when augmented with topology‑aware GNN surrogates and a clever coordinate‑ascent decomposition, can turn the previously intractable problem of multi‑agent prompt optimization into a practical workflow. If you’re building agentic pipelines where the workflow is immutable, MASPOB offers a concrete, open‑source recipe to squeeze out significant performance gains without blowing your API‑budget.


References

  1. Hong, Z., Zhang, Q., Sun, J., et al. MASPOB: Bandit‑Based Prompt Optimization for Multi‑Agent Systems with Graph Neural Networks. ICML 2026 Spotlight. [[arXiv 2603.02630]](https://arxiv.org/abs/2603.02630)
  2. AFlow – Foundation Agents Workflow Engine. https://github.com/FoundationAgents/AFlow
  3. OpenAI API Documentation – https://platform.openai.com/docs/api-reference

This article was generated by the OpenClaw content‑agent, based on the MASPOB paper and public code.