Guangming Sheng, Chi Zhang, Zilingfeng Ye, Xibin Wu, Wang Zhang, Ru Zhang, Yanghua Peng, Haibin Lin, Chuan Wu | 2024-09 | https://arxiv.org/abs/2409.19256 Category: framework | Tags: RLHF, training-system, scheduling, distributed-training Read: 2026-04-16
HybridFlow combines single-controller (for inter-model coordination) and multi-controller (for intra-model distributed computation) paradigms into a hierarchical hybrid programming model, plus a 3D-HybridEngine for zero-redundancy actor model resharding between training and generation, achieving 1.53x–20.57x throughput over SOTA RLHF baselines.
Q1: 这篇论文试图解决什么问题?
RLHF 训练涉及多个 LLM(actor、critic、reference、reward)的复杂 dataflow,现有系统要么用 single-controller(调度开销大)要么用 multi-controller(代码紧耦合、不灵活),且 actor 模型在 training 和 generation 阶段间的 weight resharding 带来巨大通信和内存冗余。需要一个既灵活表达各种 RLHF 算法、又高效执行分布式计算的统一框架。
Q2: 这是否是一个新的问题?如果不是,之前最好的方法是什么?
不是全新问题,但之前的方案都有明显缺陷。DeepSpeed-Chat 将所有模型放在同一组设备上、用 ZeRO+TP 但 resharding 开销大;OpenRLHF 各模型独占设备、减少冲突但浪费 GPU 资源且需维护两份 actor 权重;NeMo-Aligner 用相同 3D parallelism 做 training 和 generation 导致 generation 效率低。三者都只支持 PPO 且 placement 策略固定。
Q3: 本文的解决方案的关键是什么?有什么巧妙之处?
关键设计有三层:(1) Hybrid Programming Model — inter-node 用 single-controller 灵活编排 dataflow,intra-node 用 multi-controller 高效执行分布式计算,通过 3DParallelWorker 类和 transfer protocol 解耦计算与通信;(2) 3D-HybridEngine — 通过重新设计 generation 阶段的 parallel group 分配策略(interval-based 而非 consecutive),使得每个 GPU 上 training 和 generation 权重完全重叠,实现 zero memory redundancy resharding;(3) Auto Device Mapping — 自动搜索最优的模型放置和并行策略组合。巧妙之处在于 hybrid paradigm 的分层设计同时满足了灵活性和效率。
背景: RLHF 是 LLM alignment 的核心技术,但其 dataflow 比传统 RL 复杂得多——每个节点是分布式 LLM 程序,每条边是 many-to-many multicast。现有框架在灵活性和效率间难以兼顾:single-controller 灵活但 dispatch 开销大,multi-controller 高效但代码紧耦合、难以支持新算法和不同 placement 策略。
破局: 核心洞察是 RLHF dataflow 的 inter-node 层面节点少(仅几个模型)、single-controller 开销可忽略,而 intra-node 层面每个模型有数十亿参数、必须用 multi-controller 才能高效。因此应在两个层面分别使用最适合的范式。
拆解:
3DParallelWorker 封装模型的分布式计算,@register 装饰器关联 transfer protocol 统一数据 resharding,ResourcePool 虚拟化设备分配
Dataflow graphs for three RLHF algorithms: PPO, Safe-RLHF, and ReMax. Each involves three stages — Generation (①), Preparation (②), and Training (③). PPO uses 4 models (actor, critic, reference, reward); Safe-RLHF adds a cost model; ReMax eliminates the critic and adds an extra generation pass for variance reduction. This illustrates why a flexible framework is needed — different algorithms have different model compositions and data dependencies.

Comparison of multi-controller (existing systems) vs. HybridFlow's hybrid programming model. In (a), each model runs as a separate multi-controller program with explicit point-to-point send/recv for inter-model communication — tightly coupled and hard to modify. In (b), a single controller coordinates models at the dataflow level while each model internally uses multi-controller for efficient distributed computation. Grey inactive nodes show that models not executing at a given time are simply skipped by the controller.

Three-component architecture: (1) Hybrid Programming Model with hierarchical APIs (model classes, transfer protocols, ResourcePool), (2) 3D-HybridEngine for efficient actor training↔generation transitions, and (3) Auto-Mapping algorithm for optimized device placement. The single controller program orchestrates the dataflow, while ParallelWorker classes handle distributed computation on allocated devices.

Workflow of 3D-HybridEngine within one RLHF iteration on 4 GPUs. Training uses 1-2-2 (p-t-d) parallel groups; generation uses 1-1-2-2 (pg-tg-dg-d). Five steps: ① all-gather model params within micro DP groups, ② load prompts to replicas, ③ all-gather generation results, ④ re-partition params for training parallelism, ⑤ compute loss and update weights. The key insight is that different parallelism configs for training (compute-bound) and generation (memory-bound) maximize throughput in both stages.

End-to-end throughput comparison of HybridFlow vs. DeepSpeed-Chat, OpenRLHF, and NeMo-Aligner across different model sizes (7B–70B) and GPU counts (16–64). HybridFlow achieves 1.53x–20.57x throughput improvement. The gains come from three sources: efficient 3D-HybridEngine resharding, optimized model placement via auto-mapping, and the hybrid programming model's ability to use the best parallelism strategy for each model independently.
| Feature | DeepSpeed-Chat | OpenRLHF | NeMo-Aligner | HybridFlow |
|---|---|---|---|---|
| Training Parallelism | ZeRO | ZeRO | 3D Parallelism | 3D, ZeRO, FSDP |
| Generation Parallelism | TP | TP | 3D Parallelism | 3D Parallelism |
| Actor Weights Strategy | Reshard ZeRO→TP | Two copies | Shared (same config) | Zero-redundancy reshard |
| Model Placement | All colocated | All separate | Actor/Ref + Critic/RM | Flexible (any combo) |
| Execution Pattern | Sequential | Partial parallel | Partial parallel | Fully flexible |
| Metric | DeepSpeed-Chat | HybridFlow-V | HybridFlow |
|---|---|---|---|
| Comm. Volume | (tpd-1)/(tpd) · M | (tp-1)/(tp) · M | (tp-tg·pg)/(tg·pg·tp) · M |
| Peak Memory | M | M | M/(tg·pg) |
| Redundancy | M/(tpd) | M/(tp) | 0 |
| Capability | DeepSpeed-Chat | OpenRLHF | NeMo-Aligner | HybridFlow |
|---|---|---|---|---|
| PPO | Yes | Yes | Yes | Yes |
| ReMax | No | No | No | Yes |
| Safe-RLHF | No | No | No | Yes |
| Custom Algorithms | Hard | Hard | Hard | Few lines of code |
| Auto Device Mapping | No | No | No | Yes |
HybridFlow (open-sourced as veRL) is an RLHF training framework from ByteDance/HKU that addresses the inflexibility and inefficiency of existing RLHF systems. Its core innovation is a hierarchical hybrid programming model that uses a single-controller for inter-model dataflow coordination (flexible, low overhead since few nodes) and multi-controller for intra-model distributed computation (efficient, leveraging existing LLM engines). The 3D-HybridEngine enables the actor model to use different 3D parallelism strategies for training (compute-bound, larger TP/PP) and generation (memory-bound, larger DP), with a novel parallel group rearrangement that achieves zero memory redundancy during resharding. An auto-mapping algorithm searches over model placements and parallelism configurations to minimize iteration latency. Published at EuroSys 2025.
HybridFlow is a distributed RLHF training framework that spans the full RLHF iteration pipeline: prompt batching, auto-regressive generation, reward/reference/critic inference, and actor/critic training. It targets multi-GPU clusters (16–64+ GPUs) running LLMs from 7B to 70B+ parameters. The system does not handle reward model pre-training, SFT, or data preprocessing — it focuses purely on the RL fine-tuning loop. It integrates with existing LLM engines (Megatron-LM, DeepSpeed, PyTorch FSDP, vLLM) rather than replacing them.
The architecture has three layers:
@register decorators bind each model operation to a protocol (3D_PROTO, DP_PROTO, ONE_TO_ALL, etc.). Each protocol defines collect (gather outputs to controller as futures) and distribute (scatter inputs to workers by DP rank). The controller chains source.collect → destination.distribute to implement any-to-any resharding.Data flow per RLHF iteration: prompts → actor.generate → [prompts, responses] → {critic.compute_values, ref.compute_log_probs, reward.compute_reward} → compute_advantage → {actor.update, critic.update}.
auto_parallel finds the best (p,t,d) per model. d_cost estimates iteration latency: colocated models' times sum; separated models' times max.ActorWorker, CriticWorker, RefWorker, RewardWorker) inherit from 3DParallelWorker/FSDPWorker/ZeROWorker@register decoratormodel.to(resource_pool)HybridFlow (veRL) establishes a new design pattern for multi-model distributed training: hybrid control planes. The single-controller handles the "macro" dataflow while multi-controllers handle "micro" distributed computation. This pattern is applicable beyond RLHF to any system orchestrating multiple distributed programs (e.g., constitutional AI pipelines, multi-agent LLM systems, compound AI systems). The 3D-HybridEngine's zero-redundancy resharding is a generally useful primitive for any workload switching parallelism strategies mid-pipeline.
| Dimension | DeepSpeed-Chat | OpenRLHF | NeMo-Aligner | HybridFlow |
|---|---|---|---|---|
| Programming Model | Multi-controller | Multi-controller | Multi-controller | Hybrid |
| Training Backend | DeepSpeed ZeRO | DeepSpeed ZeRO | Megatron-LM 3D | Megatron/DS/FSDP |
| Generation Backend | HuggingFace | vLLM | Megatron-LM | Megatron/vLLM |
| Actor Resharding | All-gather all GPUs | Two copies | No resharding | Zero-redundancy |
| Model Placement | All colocated | All separate | Paired colocation | Any combination |
| Algorithms | PPO only | PPO only | PPO only | PPO, ReMax, Safe-RLHF, extensible |
| Auto-Mapping | No | No | No | Yes |
| Peak Throughput | 1x (baseline) | ~2.5x | ~1.2x | 1.53x–20.57x |
| Code Modularity | Low (coupled) | Low (coupled) | Low (coupled) | High (decoupled) |