TL;DR
This paper introduces RLAX, a novel framework for training large language models (LLMs) using reinforcement learning (RL) on TPUs. RLAX addresses the challenges of scalability, efficiency, and robustness in RL for LLMs, enabling significant improvements in coding capabilities with impressive speedups and resilience to system interruptions.
What Problem Does This Paper Address?
Reinforcement learning (RL) has become a crucial technique for enhancing the reasoning abilities of Large Language Models (LLMs), particularly for tasks like coding and following instructions. However, scaling RL training for these massive models on distributed hardware like TPUs presents several significant challenges:
- Scalability: Existing RL frameworks struggle to efficiently handle the immense computational demands of LLMs and the vast amounts of data required for effective training.
- Efficiency: Training LLMs with RL can be slow, with idle periods for different components (e.g., trainers and inference workers) leading to underutilization of expensive hardware.
- Robustness: Large-scale distributed systems are prone to failures and preemptions (e.g., when higher-priority jobs need resources). RL training needs to be resilient to these interruptions without losing progress or correctness.
- Numerical Stability: Subtle differences in how computations are performed on inference workers versus trainers can lead to numerical inaccuracies, destabilizing the training process, especially with low-precision formats like bfloat16.
- Algorithm Flexibility: The field of RL for LLMs is rapidly evolving, with new algorithms emerging. A robust framework needs to support a wide range of these algorithms without extensive re-engineering.
Methods
RLAX tackles these challenges with a multi-faceted approach:
- Parameter-Server Architecture: RLAX employs a disaggregated architecture with a parameter server that holds the LLM weights. A master trainer pushes updated weights, while a fleet of inference workers pull the latest weights to generate "rollouts" (model outputs and associated rewards). This separation allows for flexible resource allocation.
- Preemptible Training: The system is designed to be fully preemptible. It uses a controller-driven, checkpoint-based recovery mechanism. Components are passive executors, and the controller periodically saves snapshots of the system's state. This allows training to resume seamlessly after preemption without losing progress.
- Numerical Alignment: To combat numerical divergence between trainers and inference workers (often caused by differences in parallelism strategies and JAX kernel fusion), RLAX recomputes log-probabilities using an inference-matched training graph. This ensures that the trainer's calculations closely mirror those of the inference workers, leading to more stable training.
- Flexible RL Algorithm Support: RLAX provides a unified formulation for various RL training paradigms (on-policy and off-policy) through configurable staleness parameters. This allows users to easily experiment with different algorithms and trade-offs between throughput and stability.
- Modular Design: The framework is built with a modular design for computing the RL loss function, enabling plug-in implementation of different algorithmic components and facilitating rapid experimentation.
- Verifier Service (OUBLIETTE): For code-based RL tasks, RLAX uses a remote code execution service called OUBLIETTE, built on AWS Lambda. This service efficiently and scalably verifies generated code against test cases, handling compilation and execution with robust isolation.
- Data Curation: RLAX incorporates data curation strategies, including pre-filtering and dynamic filtering, to ensure that training data provides a balanced reward distribution, which is crucial for algorithms that rely on advantage estimation.
Datasets
- Codeforces Dataset: Used for training and evaluation. The paper mentions using data from 2013-2024 for training and 2025 for evaluation. This dataset is noted for its scale and the use of special checkers for problem verification.
Key Insights and Ideas
- Preemption is a First-Class Citizen: Instead of treating preemption as an edge case, RLAX is fundamentally designed to handle it gracefully. The controller-centric, passive component design and robust checkpointing are key to this.
- Numerical Alignment is Crucial for LLM RL: The paper highlights that even subtle differences in computation order between training and inference can destabilize RL training for LLMs, especially with bfloat16. Their recomputation strategy is a practical solution.
- Staleness is a Tunable Trade-off: The framework's ability to control staleness between inference workers and the trainer allows for a flexible balance between hardware utilization (higher throughput) and training stability.
- Modular RL Design Simplifies Experimentation: By breaking down the RL objective into distinct components (aggregation, importance sampling, advantage estimation, gradient terms), RLAX makes it easier to implement and test new RL algorithms.
Key Results
- Improved Coding Accuracy: RLAX achieved a significant improvement of 12.8% in QwQ-32B's pass@8 accuracy on the Codeforces 2025 dataset, trained using data from 2013-2024.
- Efficient Training: The system demonstrated impressive scalability, achieving near-linear throughput scaling with TPU core count. Training on 1024 v5p TPUs took only 12 hours and 48 minutes for the reported accuracy gains.
- Robustness to Preemption: RLAX reliably resumed training from checkpoints after unexpected preemptions, with no observable deviation in learning curves, confirming its fault tolerance.
- Numerical Alignment Benefits: The numerical alignment strategy significantly reduced the volatility of log-probability differences between the trainer and rollouts, leading to more stable policy updates. The 95th percentile of the per-step log-probability difference was reduced from 0.044348 to 0.019943.
Limitations and Future Work
- Mixture of Experts (MoE) Divergence: The paper notes that for MoE models, the set of activated experts can differ significantly between old and new policy models, leading to divergence. Future work will focus on enforcing routing alignment to address this.
- Staleness Impact: While the paper explores staleness, it acknowledges that the impact on convergence and performance is workload-dependent and requires further validation for different models and scenarios.
- Further Algorithm Exploration: The modular design of RLAX suggests it can be readily extended to support even more RL algorithms and paradigms.
Summary updated