Abstract
Large Language Model (LLM)-driven Multi-agent systems (Mas) have recently emerged as a powerful paradigm for tackling complex real-world tasks. However, existing Mas construction methods typically rely on manually crafted interaction mechanisms or heuristic rules, introducing human biases and constraining the autonomous ability. Even with recent advances in adaptive Mas construction, existing systems largely remain within the paradigm of semi-autonomous patterns. In this work, we propose MasHost, a Reinforcement Learning (RL)-based framework for autonomous and query-adaptive Mas design. By formulating Mas construction as a graph search problem, our proposed MasHost jointly samples agent roles and their interactions through a unified probabilistic sampling mechanism. Beyond the accuracy and efficiency objectives pursued in prior works, we introduce component rationality as an additional and novel design principle in Mas. To achieve this multi-objective optimization, we propose Hierarchical Relative Policy Optimization (HRPO), a novel RL strategy that collaboratively integrates group-relative advantages and action-wise rewards. To our knowledge, our proposed MasHost is the first RL-driven framework for autonomous Mas graph construction. Extensive experiments on six benchmarks demonstrate that MasHost consistently outperforms most competitive baselines, validating its effectiveness, efficiency, and structure rationality.
Introduction
The effectiveness of Large Language Model (LLM) agents is significantly enhanced through collaborative multi-agent systems (MAS). However, the design of interaction mechanisms—determining which agents communicate and in what order—remains a primary bottleneck. Current methodologies are largely semi-autonomous, relying on human-crafted templates, heuristic rules, or selection from a limited candidate pool of predefined structures. These approaches introduce human bias and often fail to find the optimal interaction path for specific, complex queries.
MasHost addresses these limitations by treating MAS construction as a fully autonomous graph search problem. Unlike static workflows or fixed candidate pools, MasHost adaptively builds a unique interaction graph for every query from scratch, exploring a high-dimensional combinatorial space to optimize performance.
Methods
MasHost models the construction of a MAS as a Markov Decision Process (MDP), utilizing two primary innovations to navigate the search space:
- Joint Probabilistic Space Sampling (JPSS): Constructing a graph requires dual decisions: selecting an agent role (node) and determining its connectivity (edges). JPSS simultaneously models the distribution over agent attributes and their interaction patterns. This unified probabilistic mechanism allows for a differentiable sampling process, enabling optimization via reinforcement learning.
- Hierarchical Relative Policy Optimization (HRPO): Inspired by Group Relative Policy Optimization (GRPO), HRPO optimizes a "triple objective":
- Accuracy: Maximizing the correctness of the final output.
- Efficiency: Minimizing token consumption and computational cost.
- Rationality: Ensuring the internal structure and agent interactions are logical and stable.
HRPO employs a hierarchical reward structure that compares the relative performance of different MAS configurations for the same query. It also incorporates step-wise rewards to ensure that each structural modification—such as adding a specific agent—is a rational move. To encourage exploration, the framework uses an "exemption time" ($T_E$) during training, allowing the system to explore novel structures without immediate penalties for incorrect intermediate results.
Experimental Results
The framework was evaluated across six benchmarks, including mathematical reasoning (GSM8K, MATH), general knowledge (MMLU, GPQA), and code generation (HumanEval, MBPP), using gpt-4o-mini-0718 as the execution engine.
MasHost achieved an average score of 74.20% across all benchmarks, outperforming the previous state-of-the-art autonomous framework, MaAS (73.56%), and agentic workflow methods like GPTSwarm (71.03%). Notably, on the MATH benchmark, MasHost proved to be the most cost-efficient, requiring fewer prompt tokens and lower overall costs than its competitors. Visualization of the generated graphs confirms that MasHost assigns highly relevant roles (e.g., "Algebra Solver") and creates interpretable information flows tailored to the specific task.
Conclusion
MasHost represents the first RL-driven framework for fully autonomous MAS graph construction. By moving beyond semi-autonomous templates and optimizing for structural rationality alongside accuracy and efficiency, it sets a new standard for adaptive agent collaboration. While currently limited by the underlying LLM's execution capabilities and a predefined global role pool, future iterations could involve dynamic role generation to further enhance autonomy.
Summary updated