Introduction
Training Large Language Models (LLMs) to align with human preferences through Reinforcement Learning from Human Feedback (RLHF) is a computationally intensive process. The standard Proximal Policy Optimization (PPO) algorithm involves four distinct models: Actor, Critic, Reward, and Reference. Traditional distributed training frameworks often employ a "co-located" strategy, where replicas of all four models are placed on every GPU. This approach leads to significant inefficiencies, primarily due to memory redundancy and the massive bottleneck created by the auto-regressive generation stage.
The FlexRLHF Framework
To address these challenges, researchers at Ant Group developed FlexRLHF, an adaptive framework that optimizes model placement and parallelism. FlexRLHF moves beyond simple co-location by introducing two primary placement strategies:
- Interleaving Strategy: This strategy assigns independent models, such as the Reference and Reward models, to exclusive device groups. By doing so, it reduces memory redundancy and enables parallel forward passes without the need for inter-node communication.
- Disaggregated Strategy: Designed for large-scale models, this strategy physically separates training and inference runtimes. It utilizes "shadow models"—inference-only versions of the Actor and Critic—allowing the system to pipeline generation and training. While training GPUs update weights, inference GPUs concurrently generate the next batch of data.
Key Results and Performance
FlexRLHF was evaluated using the Llama model family (7B to 65B parameters) on clusters of NVIDIA A100 and V100 GPUs. The framework demonstrated substantial improvements over state-of-the-art solutions like DeepSpeed-Chat:
- Throughput Speedup: For 65B parameter models, FlexRLHF achieved a 7x to 11x increase in training throughput.
- Memory Efficiency: By reducing redundancy, the framework allows for significantly larger batch sizes. In certain configurations, the maximum batch size increased from 2 to 50, a 25x improvement.
- Heterogeneous Support: The disaggregated strategy enables the use of mixed hardware, such as using high-end A100s for training and older V100s for inference-only shadow models, optimizing cost-efficiency.
Conclusion
FlexRLHF provides a flexible and efficient solution for large-scale RLHF training. By decoupling inference and training and optimizing model placement, it overcomes the traditional bottlenecks of the PPO algorithm, enabling faster iteration and better utilization of diverse hardware resources.
Summary updated