Large language model (LLM)-based multi-agent systems (MAS) rely on role-specific prompts and execution models to solve complex tasks collaboratively. However, prompt optimization typically keeps model assignments fixed, leaving differences in role requirements and their associated inference costs outside the search. We present UniMASO, a Unified framework for heterogeneous Multi-Agent System Optimization through the joint adaptation of prompts and model assignments. UniMASO evaluates candidate updates through local, downstream, and global feedback, using cost-aware Pareto search to retain useful quality-cost trade-offs. Topology-aware co-evolution then coordinates these updates according to agent roles and dependencies. Cross-level trajectory memory further supplies historical successes and failures to guide subsequent optimization. Experiments on five benchmarks and five execution topologies show that UniMASO achieves competitive task performance at substantially lower deployment cost than the strongest homogeneous configurations. Under centralized execution, it improves the average score from 69.79 to 70.40 while reducing token-weighted deployment cost by 85.2% relative to DeepSeek-V4-Pro with MASPO. These results support joint prompt-model adaptation as an effective approach to efficient multi-agent collaboration. The code is available at https://github.com/Achilles008/UniMASO_main.
Figures & tables
Method
Prompt
Model
MIPRO ( Opsahl-Ong et al., 2024 )
✓
✗
GPTSwarm ( Zhuge et al., 2024 )
✓
✗
MASS ( Zhou et al., 2026 )
✓
✗
MASPOB ( Hong et al., 2026 )
✓
✗
MASPO ( Wang et al., 2026 )
✓
✗
MasRouter ( Yue et al., 2025 )
✗
✓
Table 1: Comparison of prompt and model optimization paradigms.
Figure 1: Homogeneous vs. Heterogeneous MAS.
Figure 2: Overview of UniMASO. Cost-aware multi-agent optimization proposes and evaluates prompt candidates from execution traces; heterogeneous execution runs the current prompt–model configuration on the realized topology; topology-aware adaptation reconciles role, dependency, and system views to update model assignments; and trajectory memory records cross-level feedback and retrieves historical evidence for subsequent rounds.
Model
Method
AGIEval
GPQA
BFCL
LiveCodeBench
HotpotQA
Avg.
Acc.
Cost
Acc.
Cost
Acc.
Cost
pass@1
Cost
EM
Cost
Result
Cost
Qwen3.5-4B
Vanilla MAS
62.11
7.3
67.17
5.3
88.40
4.8
18.32
3.8
58.00
5.8
58.80
5.38
+TPE
59.77
8.2
66.67
6.1
88.80
5.4
19.08
4.2
58.20
6.5
58.50
6.08
+SPO
63.28
8.3
69.70
5.9
88.60
5.5
20.61
4.3
58.00
6.6
60.03
6.12
+MASPOB
63.67
8.2
68.69
5.8
89.40
5.3
19.85
4.3
58.60
6.5
60.04
6.02
+MASPO
63.28
8.2
69.19
5.9
89.60
5.5
21.37
4.4
58.40
6.4
60.36
6.08
Table 2: Task quality and deployment cost under the centralized topology. Prompt-only baselines use homogeneous models; UniMASO jointly optimizes prompts and model assignments.
Figure 5
Method
AGIEval
GPQA
BFCL
LiveCodeBench
HotpotQA
Avg.
Acc.
Cost
Acc.
Cost
Acc.
Cost
pass@1
Cost
EM
Cost
Result
Cost
Reference: Proposed Framework
UniMASO (Full)
82.42
56.86
78.28
33.02
92.40
12.21
35.11
13.27
63.80
39.26
70.40
30.92
(I) Component Ablations
Table 3: UniMASO ablations and parameter sensitivity under centralized execution.
Target
Memory
Acc.
Cost
AGIEval-MATH
None
80.08
51.35
Own
82.42
56.86
Other
81.64
52.93
GPQA-Diamond
None
76.77
31.58
Own
78.28
33.02
Other
77.78
29.43
Table 4: Cross-task memory transfer.
Method
Coordination
Efficiency
Comm. ↑
Plan. ↑
Cost-of-Pass ↓
Centralized MAS
68.45
64.39
1.154
+TPE
71.81
66.86
1.357
+SPO
69.90
64.15
1.271
+MASPOB
71.54
67.08
1.245
+MASPO
72.84
68.41
1.241
Table 5: Coordination and efficiency.
Figure 9
Target dataset
Method
Opt. pool
Accuracy ↑ (%)
Cost ↓ (M)
AGIEval-MATH
Vanilla MAS
None
76.17
217.3
MASPO
AGIEval-MATH
78.12
249.6
UniMASO (in-domain)
AGIEval-MATH
82.42
56.9
UniMASO (cross-dataset)
MATH-500
81.25
58.7
MATH-500
Vanilla MAS
None
79.20
262.9
MASPO
MATH-500
84.80
339.5
Table 6: Cross-dataset transfer of UniMASO between AGIEval-MATH and MATH-500. The Vanilla MAS and MASPO baselines use DeepSeek-V4-Pro for all task agents. Accuracy and deployment cost are measured on the target evaluation set.
Method
AGIEval-MATH
GPQA-Diamond
BFCL-V3
HotpotQA
LiveCodeBench
Input
Output
Cost
Input
Output
Cost
Input
Output
Cost
Input
Output
Cost
Input
Output
Cost
UniMASO
5.92
0.085
51.9
4.14
0.072
37.0
1.93
0.065
19.0
4.89
0.070
42.8
6.45
0.077
55.6
MASPO
7.48
0.103
1188.4
5.21
0.086
843.1
2.37
0.074
421.2
6.19
0.082
979.9
8.17
0.094
1278.0
Table 7: Optimization-side LLM usage and cost of MASPO and UniMASO under centralized execution. Input and output tokens and relative weighted-token cost are reported in millions (M). The accounting includes optimizer and evaluator calls and UniMASO’s Co-Evolver calls.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
Samples
Metric
AGIEval-MATH
256
Accuracy
GPQA-Diamond
198
Accuracy
BFCL-V3
500
Accuracy
LiveCodeBench-v6
131
Pass@1
HotpotQA
500
Exact match
Total
1,585
–
Appendix
Table 8: Final-evaluation sample counts and metrics by benchmark.
Table 9: Performance comparison of UniMASO against homogeneous model assignments across five execution topologies. For each topology, we compare five homogeneous configurations with the heterogeneous configuration selected by UniMASO, reporting both task quality and deployment cost.
Model
Capability
cin
cout
Qwen3.5-4B
Very weak
1
4
Qwen3.5-9B
Medium
2
8
Qwen3.5-27B
Strong
8
32
DeepSeek-V4-Flash
Very strong
24
72
DeepSeek-V4-Pro
Extremely strong
72
216
Appendix
Table 10: Model capability levels and relative token-cost coefficients.
Large language model (LLM)-based Multi-agent systems (MAS) have shown promise in tackling complex collaborative tasks, where agents are typically orchestrated via role-specific prompts. While the quality of these prompts is pivotal, jointly optimizing them across interacting agents remains a non-trivial challenge, primarily due to the misalignment between local agent objectives and holistic system goals. To address this, we introduce MASPO, a novel framework designed to automatically and iteratively refine prompts across the entire system. A core innovation of MASPO is its joint evaluation mechanism, which assesses prompts not merely by their local validity, but by their capacity to facilitate downstream success for successor agents. This effectively bridges the gap between local interactions and global outcomes without relying on ground-truth labels. Furthermore, MASPO employs a data-driven evolutionary beam search to efficiently navigate the high-dimensional prompt space. Extensive empirical evaluations across 6 diverse tasks demonstrate that MASPO consistently outperforms state-of-the-art prompt optimization methods, achieving an average accuracy improvement of 2.9. We release our code at https://github.com/wangzx1219/MASPO.
Zhexuan Wang, Xuebo Liu, Li Wang +4
Institute of Computing and Intelligence, Harbin Institute of Technology, Shenzhen, China.
Multi-agent systems (MAS) offer a scalable path forward for agentic AI, comprising multiple LLM-based agents, each assigned a system prompt and a position within a workflow that governs inter-agent coordination and output aggregation. System prompts thus form a critical and accessible optimization surface: they specify agents' roles and behaviors, enabling system-level improvements without model finetuning. Although prompt optimization has shown substantial potential for single LLMs, extending it to MAS poses distinct challenges, notably an exponentially growing search space. It remains unclear whether, when, and by how much prompt optimization improves MAS performance, and how sensitive such gains are to system configuration. In this work, we systematically study system-prompt optimization across a broad range of MAS setups varying in task, workflow, communication protocol, and team size, benchmarking two prompt optimizers that naturally extend state-of-the-art single-agent methods. The results reveal its potential to unlock significant gains while exposing open challenges, characterizing when and how much prompt optimization helps across diverse MAS settings.
Juyang Bai, Laixi Shi
Department of Electrical and Computer Engineering, Johns Hopkins University, Baltimore, MD 21218, USA.
Large Language Models (LLMs) have achieved great success in many real-world applications, especially the one serving as the cognitive backbone of Multi-Agent Systems (MAS) to orchestrate complex workflows in practice. Since many deployment scenarios preclude MAS workflow modifications and its performance is highly sensitive to the input prompts, prompt optimization emerges as a more natural approach to improve its performance. However, real-world prompt optimization for MAS is impeded by three key challenges: (1) the need of sample efficiency due to prohibitive evaluation costs, (2) topology-induced coupling among prompts, and (3) the combinatorial explosion of the search space. To address these challenges, we introduce MASPOB (Multi-Agent System Prompt Optimization via Bandits), a novel sample-efficient framework based on bandits. By leveraging Upper Confidence Bound (UCB) to quantify uncertainty, the bandit framework balances exploration and exploitation, maximizing gains within a strictly limited budget. To handle topology-induced coupling, MASPOB integrates Graph Neural Networks (GNNs) to capture structural priors, learning topology-aware representations of prompt semantics. Furthermore, it employs coordinate ascent to decompose the optimization into univariate sub-problems, reducing search complexity from exponential to linear. Extensive experiments across diverse benchmarks demonstrate that MASPOB achieves state-of-the-art performance, consistently outperforming existing baselines.
Zhi Hong, Qian Zhang, Jiahang Sun +5
The Chinese University of Hong Kong, Shenzhen · South China University of Technology · Ritsumeikan University +1