ACL2026

RouterHGC: Optimized Router for LLM-based Multi-Agent Systems via Heterogeneous Graph Contrastive Learning

Yitao Xiao, Shaoyong Guo, Guoming Yang, Qingnan Wang, Yinlin Ren, Xuesong Qiu, Qi Feng

Abstract

While Large Language Model (LLM)-based Multi-Agent Systems (MAS) offer scalable solutions for complex tasks, dynamically configuring the optimal combination of collaboration modes, agent roles, and LLMs remains challenging. Existing routing methods typically resort to computationally expensive post-response optimization or focus on single-agent settings. We introduce Router-HGC, the first framework to harness heterogeneous graph contrastive learning for MAS routing. We formalize routing as a node selection problem on a heterogeneous graph, capturing high-order dependencies among queries, collaboration patterns, and roles. To optimize this, we design a novel global-local contrastive loss that aligns query graphs with high-performing configurations while distancing them from suboptimal or costly ones. Experiments on five datasets demonstrate that RouterHGC significantly improves reasoning accuracy while reducing costs.