Abstract
The advancement of LLMs and their accessibility have triggered renewed interest in multi-agent reinforcement learning as robust and adaptive frameworks for dynamically changing environments. This paper introduces RL-Focal, a two-stage RL agent framework that routes and ensembles LLMs. First, we develop the Decider RL-agent, which learns to dynamically select an ensemble of small size ($m_i$) among $N$ LLMs ($m_i \ll N$) for incoming queries from a user-defined downstream task $i$, by maximizing both error-diversity and reasoning-performance of the selected ensemble through iterative updates of task-adaptive rewards and policy. Second, to enable effective fusion of dynamically selected LLMs, we develop the stage-2 Fusion RL-agent, which learns to resolve reasoning conflicts from different LLMs and dynamically adapts to different ensemble teams composed by the Decider Agent for different downstream tasks. Third, we introduce the focal diversity metric to better model the error correlations among multiple LLMs, further improving the generalization performance of the Decider Agent, which actively prunes the ensemble combinations. By focal diversity, we enhance performance across tasks by effectively promoting reward-aware and policy-adaptive ensemble selection and inference fusion. Extensive evaluations on five benchmarks show that RL-Focal achieves the performance improvement of 8.48% with an ensemble of small size compared to the best individual LLM in a pool and offers stronger robustness.
Introduction
Ensembling multiple Large Language Models (LLMs) is a proven strategy for enhancing performance. However, existing approaches face significant hurdles. Architectural ensembles like Mixture-of-Experts (MoE) demand immense computational resources and full access to model weights. Conversely, post-inference methods such as majority voting are often static, failing to adapt to varying query types. LLM routing, while efficient, is fundamentally limited by the performance of the single best model in its pool.
RL-Focal addresses these challenges by introducing an adaptive ensemble system. It dynamically determines the optimal subset of models for a specific query and intelligently fuses their outputs, maximizing performance while minimizing inference costs.
The RL-Focal Framework
RL-Focal formulates the ensembling problem as a multi-agent reinforcement learning (MARL) game, utilizing two cooperative agents trained via Multi-Agent Proximal Policy Optimization (MAPPO) with a centralized critic.
Stage 1: The Decider Agent
The Decider Agent analyzes incoming queries and selects a small subset ($m$) from a larger pool of $N$ models. Efficiency is achieved through a novel focal diversity metric. Rather than simply selecting the most accurate models, the Decider identifies models with high negative error correlation—those that rarely fail on the same types of questions.
Stage 2: The Fusion Agent
After the ensemble is selected, the Fusion Agent processes their outputs (e.g., probability distributions). It learns to resolve conflicts and weigh the confidence of different models to arrive at a final prediction, effectively "correcting" the majority when necessary.
Experimental Evaluation
The framework was evaluated across five rigorous benchmarks: MMLU, GSM8K, BBH, MUSR, and GPQA. These datasets focus on complex reasoning and multiple-choice formats. To ensure stability during training, the system employs an offline "warm-start" phase using plurality voting before transitioning to online continuous adaptation.
Results and Analysis
RL-Focal demonstrates significant improvements over both individual models and existing ensemble methods. It achieved up to an 8.48% relative performance boost on BBH compared to the best individual LLM in the pool. Notably, it outperformed Mixtral-8x7b (a native MoE) by margins as high as 23.13% on BBH and 17.17% on GPQA.
Key findings include:
- Diversity over Pure Accuracy: The focal diversity metric confirms that ensembles of models with complementary error patterns outperform those consisting solely of top-tier models with shared blind spots.
- Efficiency: The RL-Focal agents are lightweight (~17k parameters) with a negligible inference overhead of 0.014 seconds, making them far more efficient than supervised methods like LLM-Blender.
- Cost-Effectiveness: By aggressively pruning the ensemble size per query, RL-Focal provides the benefits of a large model pool without the associated inference costs of running every model.
Conclusion and Future Work
RL-Focal provides a robust, scalable solution for dynamic LLM ensembling. While currently optimized for multiple-choice formats due to its reliance on logit data, future work will explore extending the Fusion Agent to handle open-ended text generation. Additionally, addressing the inherent instability of multi-agent RL training remains a priority for further refining the framework's adaptability.
Summary updated