Dynamic Optimizations of LLM Ensembles with Two-Stage Reinforcement Learning Agents

Selim Furkan Tekin, Fatih Ilhan, Gaowen Liu, Ramana Rao Kompella, Ling Liu
2/6/2025
cs.CL

Official code: sftekin/rl-focal (7 stars, last commit 2026-03-25).

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. Code is available at https://github.com/sftekin/rl-focal

View on arXivView PDF

Code Implementations(1)

sftekin/rl-focalOfficial100%

Dynamically selecting the most diverse ensemble set of multiple LLMs and fusing the outputs with Multi Agent Reinforcement Learning. Overal system can switch between models according to the tasks and boost the overall accuracy and robustness

70PythonDec 18, 20246 months ago

Similar Papers

Cite this paper

@article{tekin2025dynamic,
  title  = {Dynamic Optimizations of LLM Ensembles with Two-Stage Reinforcement Learning Agents},
  author = {Selim Furkan Tekin and Fatih Ilhan and Gaowen Liu and Ramana Rao Kompella and Ling Liu},
  year   = {2025},
  eprint = {2502.04492},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.04492v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.04492.svg)](https://codeofpaper.com/paper/2502.04492)

Discussion