HierRouter: Coordinated Routing of Specialized Large Language Models via Reinforcement Learning

Nikunj Gupta, Bill Guo, Rajgopal Kannan, Viktor K. PrasannaarXiv 2025 · DOI

Abstract

HierRouter is a reinforcement learning-based framework designed to orchestrate a "team" of small, specialized Large Language Models (LLMs) to solve complex tasks through multi-step reasoning. By formulating model selection as a sequential decision-making process, HierRouter achieves up to a 2.4x improvement in response quality over individual specialized models. Notably, it often outperforms general-purpose models five times its size while maintaining high efficiency, finding an optimal balance on the cost-performance Pareto frontier.

Introduction

The current landscape of Large Language Models is characterized by a tension between performance and efficiency. While massive "monolithic" models like Llama-3-70B offer high reasoning capabilities, they are often too resource-intensive for real-time applications. Conversely, small, specialized models (typically under 3B parameters) excel in specific domains like coding or mathematics but struggle with general reasoning or multi-stage problem-solving.

Existing strategies such as static routing or simple cascading lack the flexibility required for collaborative model interaction. HierRouter addresses this by enabling a sequence of models to build an answer step-by-step, invoking different specialists as the reasoning process evolves.

Methodology

HierRouter treats LLM coordination as a finite-horizon Markov Decision Process (MDP). Instead of a single one-shot decision, the system selects a sequence of models over a fixed number of "hops" or stages. For instance, a reasoning-heavy model might be selected to draft a plan, followed by a coding specialist to execute it.

Figure 1: The HierRouter architecture for sequential model selection and training.

The router is an agent trained using Proximal Policy Optimization (PPO). It learns a policy that maps the current state—comprising the initial query, the generated context, and accumulated inference costs—to the most appropriate model for the next step. The training objective is guided by a sparse reward function:

$$Reward = Quality(Response) - \alpha \cdot Cost(Inference)$$

This formulation encourages the router to be judicious, escalating to more expensive models only when the potential quality gain justifies the additional cost. The architecture utilizes a frozen Sentence-Transformer for context embedding and a multi-layer perceptron (MLP) for routing decisions.

Experimental Setup

The framework was evaluated across six diverse benchmarks to test various specialist domains:

  • Mathematics: GSM8K and MATH.
  • Code Generation: MBPP (Mostly Basic Python Problems).
  • General Knowledge/QA: MMLU and ARC (Easy & Challenge).

The candidate pool for the "mixture of specialists" included three small models: Qwen2.5-Coder-3B, DeepSeek-R1-Distill-Qwen-1.5B, and Phi-3.5-mini.

Results

HierRouter demonstrates significant performance gains by effectively chaining specialists. On the GSM8K math benchmark, it achieved a quality score of 0.139, more than doubling the performance of the best individual small model (0.067) and surpassing the much larger Qwen2.5-14B (0.077).

Table 1: Performance comparison of HierRouter against individual specialized models and larger general-purpose LLMs.

In challenging QA tasks like ARC-Challenge, HierRouter improved performance by over 3x compared to static model selection. While the multi-hop nature increases costs relative to a single small model, the total inference cost remains significantly lower than that of larger 8B or 14B models. The system successfully leverages "compositional reasoning," using models like DeepSeek-R1 for initial structuring and Qwen-Coder for final output generation.

Discussion and Future Work

While HierRouter shows promise, several avenues for improvement remain. The current fixed-horizon approach could be enhanced with an "early exit" strategy to stop once a confident answer is reached. Additionally, the system currently uses a static pool of models; future iterations could incorporate dynamic pools that adapt to new releases. Finally, integrating uncertainty-aware decision-making could allow the router to defer to human experts or massive frontier models when specialized models reach their limits.

Summary updated

BibTeX
@misc{gupta2025hierrouter,
  author = {Nikunj Gupta and Bill Guo and Rajgopal Kannan and Viktor K. Prasanna},
  title = {{HierRouter: Coordinated Routing of Specialized Large Language Models via Reinforcement Learning}},
  year = {2025},
  eprint = {2511.09873},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.09873},
}
Figure