OFA-MAS: One-for-All Multi-Agent System Topology Design based on Mixture-of-Experts Graph Generative Models

Shiyuan Li, Yixin Liu, Yu Zheng, Mei Li, Quoc Viet Hung Nguyen, Shirui Pan · DOI

Abstract

Multi-Agent Systems (MAS) offer a powerful paradigm for solving complex problems, yet their performance is critically dependent on the design of their underlying collaboration topology. As MAS become increasingly deployed in web services (e.g., search engines), designing adaptive topologies for diverse cross-domain user queries becomes essential. Current graph learning-based design methodologies often adhere to a "one-for-one" paradigm, where a specialized model is trained for each specific task domain. This approach suffers from poor generalization to unseen domains and fails to leverage shared structural knowledge across different tasks. To address this, we propose OFA-TAD, a one-for-all framework that generates adaptive collaboration graphs for any task described in natural language through a single universal model. Our approach integrates a Task-Aware Graph State Encoder (TAGSE) that filters task-relevant node information via sparse gating, and a Mixture-of-Experts (MoE) architecture that dynamically selects specialized sub-networks to drive node and edge prediction. We employ a three-stage training strategy: unconditional pre-training on canonical topologies for structural priors, large-scale conditional pre-training on LLM-generated datasets for task-topology mappings, and supervised fine-tuning on empirically validated graphs. Experiments across six diverse benchmarks show that OFA-TAD significantly outperforms specialized one-for-one models, generating highly adaptive MAS topologies.

Introduction

Large Language Model (LLM) based Multi-Agent Systems solve complex problems by orchestrating multiple specialized agents, such as a "Coder" agent interacting with a "Reviewer" agent. The efficacy of these systems is fundamentally determined by their collaboration topology—the structural graph defining the communication pathways and sequence between agents.

Historically, automatic topology designers have followed a "one-for-one" paradigm, where a model is trained exclusively for a single domain (e.g., mathematical reasoning or code generation). This approach presents several challenges: it assumes users can pre-categorize queries, it lacks scalability due to the overhead of maintaining domain-specific models, and it fails to capture shared problem-solving patterns (e.g., "Planner → Executor → Verifier") across different fields.

Methodology: The OFA-MAS Framework

OFA-MAS is an autoregressive graph generation model designed to construct a MAS graph step-by-step by selecting agent roles from a universal pool and predicting their connections based on the task at hand.

The detailed architecture of OFA-MAS, illustrating the autoregressive generation process, the Task-Aware Graph State Encoder (TAGSE), and the Mixture-of-Experts (MoE) prediction module.

Architectural Innovations

  1. Task-Aware Graph State Encoder (TAGSE): This specialized GNN encoder utilizes global task descriptions to gate message passing. By applying L1 sparsity, it ensures that only task-relevant information is propagated between nodes during graph construction.
  2. Mixture-of-Experts (MoE) Module: Instead of a static prediction head, OFA-MAS employs a gating network to route tasks to specialized expert sub-networks. This allows the model to dynamically adapt its design strategy based on the specific domain of the query.

Three-Stage Training Curriculum

To overcome the scarcity of ground-truth MAS topology data, a three-stage curriculum is employed:

  • Unconditional Pre-training: Learning basic structural priors (chains, stars, meshes).
  • LLM-Driven Data Synthesis: Using GPT-4o-mini to generate massive pseudo-labeled pairs for task-to-graph alignment.
  • Supervised Fine-Tuning: Refining the model on a small set of empirically validated, high-performing graphs.

Experimental Evaluation

OFA-MAS was evaluated across six in-distribution benchmarks (MMLU, GSM8K, AQuA, MultiArith, SVAMP, and HumanEval) and an out-of-distribution (OOD) benchmark (GAIA).

Experimental results showing robustness analysis, qualitative topology cases for HumanEval and GSM8K, and a heatmap demonstrating MoE expert specialization across different task domains.

Key Results

  • Performance: OFA-MAS achieved a state-of-the-art average score of 93.02% across in-distribution benchmarks, outperforming specialized baselines like EIB-LEARNER (91.38%).
  • Generalization: On the unseen GAIA benchmark, OFA-MAS achieved 8.79% accuracy, significantly higher than the 5.50% achieved by G-Designer.
  • Robustness and Efficiency: The system demonstrated superior resilience to adversarial attacks, with only a 2.2% performance drop. Furthermore, it achieved high accuracy on GSM8K with the lowest token cost among competitors, highlighting the efficiency of optimized topologies.

Insights from MoE Specialization

Visualizing MoE gating weights confirms that the model naturally groups similar tasks. Coding tasks activate specific experts, while math tasks activate a different set. This specialization prevents catastrophic forgetting and allows for creative cross-domain role composition, such as utilizing a "Critic" role to verify an "Algorithm Designer's" output in a math context.

Conclusion

OFA-MAS represents a shift from specialized topology design to a universal, adaptive framework. By leveraging shared structural knowledge and a Mixture-of-Experts architecture, it provides a scalable and robust solution for multi-agent collaboration. Future work will focus on expanding the role pool and exploring applications in larger, more complex agentic swarms.

Summary updated

BibTeX
@inproceedings{li2026ofa,
  author = {Shiyuan Li and Yixin Liu and Yu Zheng and Mei Li and Quoc Viet Hung Nguyen and Shirui Pan},
  title = {{OFA-MAS: One-for-All Multi-Agent System Topology Design based on Mixture-of-Experts Graph Generative Models}},
  booktitle = {The Web Conference},
  year = {2026},
  doi = {10.1145/3774904.3792537},
}
Figure