Summary (Overview)
- ReLibra is an MoE (Mixture-of-Experts) RL training system that exploits a unique opportunity in RL's rollout-training workflow—routing replay—to enable fine-grained load balancing at micro-batch granularity.
- The key insight is to place two load-balancing mechanisms at different timescales: inter-batch expert reordering for coarse-grained cross-node balancing, and intra-batch expert replication for fine-grained local adaptation, matching their communication patterns to hierarchical network bandwidths.
- ReLibra decomposes the NP-hard load-balancing problem into two tractable sub-problems, solved via a swap-based simulated annealing algorithm (inter-batch) and an incremental greedy heuristic with MILP formulation (intra-batch).
- A layer-shared replica buffer stores replicas for only one layer at a time, reducing memory overhead by 1–2 orders of magnitude, with synchronization overlapped with attention computation.
- Experiments show ReLibra improves training throughput by up to 1.6× over Megatron-LM and up to 1.2× over EPLB+ (even with oracle loads), achieving 90%–94% of an idealized balanced baseline.
Introduction and Theoretical Foundation
Background: MoE Training and RL Workflow
MoE (Mixture-of-Experts) architectures scale LLMs by sparsely routing tokens to a small set of experts, increasing model capacity without proportionally increasing computation. However, MoE training suffers from load imbalance—dynamic routing can overload GPUs hosting "hot" experts under expert parallelism (EP).
The paper identifies a critical distinction between pretraining and RL post-training:
- MoE pretraining exhibits relatively stable imbalance patterns due to web-scale diverse corpora and algorithmic load-balancing mechanisms (auxiliary losses, routing bias).
- MoE RL training shows fluctuating imbalance patterns: hot experts shift substantially from one micro-batch to the next because (1) RL targets narrower domains (math, coding, instruction following), and (2) load-balancing mechanisms are removed during RL training.
The Opportunity: Routing Replay
RL consists of two stages:
- Rollout stage: generates responses via auto-regressive decoding
- Training stage: updates the model on generated samples
Since both stages process the same token sequence with the same MoE parameters, they produce the same routing scores and top-k expert selections. Thus, token-to-expert routing decisions are known before training starts—this is "routing replay."
The Challenge: Practical Load-Balancing Planning
Even with exact routing known, finding optimal load-balancing plans is computationally intractable:
- Without replication and memory constraints, the problem reduces to makespan minimization on identical machines ()—NP-hard
- With replication and capacity constraints, it contains replica placement decisions similar to the facility location problem
Key Insight: Timescale Decomposition
Under cross-node EP:
- Expert reordering is a global operation requiring coordinated placement changes across the EP group—poorly suited for micro-batch-level fluctuations due to expensive cross-node coordination
- Expert replication can be restricted within a node using high-bandwidth intra-node links—well-suited for micro-batch timescale
Therefore: expert reordering at inter-batch timescale, expert replication at intra-batch timescale.
Methodology
System Architecture
ReLibra has two planes:
Control Plane: Maintains global view, receives routing information from rollout, solves load-balancing problems (overlapped with post-rollout processing).
Data Plane:
- Routing Capturer: Records routed experts for each token during rollout generation
- Load-Balancing Executor: Executes reordering and replication plans, manages the layer-shared replica buffer
Inter-Batch Expert Reordering
Problem Formulation: For each MoE layer, ReLibra jointly optimizes computation and communication loads. The total load of GPU is:
where is the number of tokens on GPU routed to expert .
Communication load accounts for the rail-optimized topology with three patterns: intra-node NVLink, inter-node same-rail RDMA, and inter-node cross-rail (NVLink relay + RDMA). The MoE execution time is:
Algorithm: A swap-based simulated annealing algorithm:
- Initial state from greedy LPT (Longest Processing Time) heuristic
- Repeatedly swaps randomly chosen experts with incremental state updates ( complexity per swap)
- Objective smoothing via log-sum-exp (LSE) surrogate to escape plateaus:
- Multiple parallel annealing runs with different seeds
- Second round of optimization for data locality (sample-to-GPU assignment)
Intra-Batch Expert Replication
Layer-Shared Replica Buffer: Each GPU allocates only a small number of replica slots, stores replicas for one layer at a time, and reuses the buffer across all layers. This reduces memory overhead from replica slots (naive) to just slots.
MILP Formulation: For each expert in a micro-batch, the system jointly optimizes replica placement ( binary variables) and token splitting ( continuous variables):
Subject to constraints:
- (token fractions sum to 1)
- (coupling token splitting with placement)
- for home GPUs
- (per-GPU replica buffer limit)
Incremental Greedy Heuristic: Avoids direct MILP solving by iteratively:
- Identifying the bottleneck GPU (highest load)
- Selecting the bottleneck expert on that GPU
- Adding a replica to the least-loaded feasible GPU
- Re-solving token splitting via linear programming
Empirical Validation / Results
Testbed and Models
- Hardware: 20-node cluster, 8 NVIDIA Hopper GPUs per node, rail-optimized InfiniBand (8×400 Gbps per node), 900 GB/s NVLink
- Models: Qwen3-30B-A3B, GLM4.5-106B-A12B, Qwen3-235B-A22B (all with 128 experts/layer, top-8 routing)
- Datasets: Reasoning (DAPO-Math-17k, GPQA), Instruction Following (IFBench), Coding (CodeForces), and Mixed
Overall Performance
| Metric | Improvement |
|---|---|
| vs. Megatron-LM | 1.21–1.58× |
| vs. PopFetcher | 1.17–1.27× |
| vs. EPLB+ (oracle loads) | 1.06–1.21× |
| vs. LPLB+ (oracle loads) | 1.06–1.21× |
| vs. Balanced (ideal) | 90%–94% |
Ablation Study
| Idx | Method | Reasoning Throughput | Mixed Throughput |
|---|---|---|---|
| 1 | Megatron-LM | 1.0 | 1.0 |
| 2 | + inter-batch reordering | 1.12 (+12%) | 1.15 (+15%) |
| 3 | + intra-batch replication | 1.46 (+34%) | 1.39 (+24%) |
Case Study: Load Imbalance Reduction
- EP size study (Qwen3-30B-A3B): ReLibra maintains average skewness of 1.00–1.08 across EP sizes 8–64 (1.0 = perfectly balanced), while Megatron-LM degrades significantly with larger EP sizes
- Across datasets (Qwen3-235B-A22B): ReLibra achieves average skewness of 1.02–1.07
System Overhead
| Model | Replica Buffer Memory | Model Parameters | Ratio |
|---|---|---|---|
| Qwen3-30B-A3B | 18 MiB | 6.26 GiB | 0.28% |
| GLM4.5-106B-A12B | 22 MiB | 16.64 GiB | 0.13% |
| Qwen3-235B-A22B | 72 MiB | 4.35 GiB | 1.62% |
- Solving time fully hidden behind post-rollout processing
- Expert reordering overhead: only 1.4%–2.1% of training batch time
- Replica synchronization fully overlapped with attention computation
Theoretical and Practical Implications
Theoretical Contributions
-
Problem decomposition: ReLibra demonstrates that the intractable joint optimization of expert reordering and replication can be decomposed by timescale, matching communication patterns to network hierarchy—making the problem tractable while achieving near-optimal results.
-
Routing replay as a paradigm: The paper formalizes routing replay as a load-balancing opportunity unique to RL training, contrasting with the prediction-based approaches used in pretraining.
-
Holistic replication planning: The MILP formulation jointly optimizes replica placement and token splitting, showing that these coupled decisions outperform optimizing either in isolation.
Practical Implications
-
Industrial relevance: The paper aligns with recent industrial practice (DeepSeek-V3.2) that has adopted routing replay for training stability, making ReLibra's approach immediately applicable.
-
Memory efficiency: The layer-shared replica buffer design makes micro-batch-level replication practical for deep MoE models, reducing memory overhead by 1–2 orders of magnitude.
-
Orthogonality: ReLibra is orthogonal to existing all-to-all optimizations (DeepEP, hierarchical communication) and can be combined with them.
Conclusion
ReLibra addresses fluctuating load imbalance in MoE RL training by exploiting routing replay. Key takeaways:
-
Timescale decomposition is the core insight: expert reordering at inter-batch timescale for cross-node balancing, expert replication at intra-batch timescale for local adaptation—matching communication patterns to network bandwidth hierarchy.
-
Routing replay transforms load balancing from prediction-based to knowledge-based, enabling proactive fine-grained decisions at micro-batch granularity.
-
Efficient algorithms (swap-based simulated annealing, incremental greedy heuristic) make the NP-hard problem tractable, with solving time hidden behind post-rollout processing.
-
Lightweight system design (layer-shared replica buffer, overlapped synchronization) achieves load balancing with negligible overhead (0.13%–1.62% additional memory).
Future directions include extending to off-policy RL with asynchronous rollout-training workflows, where routing replay may not directly apply but recent industrial practice suggests it can be adopted for training stability.
Related papers
- Harness Continual Learning: Continual Adaptation Beyond Model Parameters
Harness Continual Learning enables frozen foundation models to accumulate capabilities by evolving prompts, memories, and tools around them, with guarded updates preventing harness-level forgetting.
- Rethinking Self-Evolving Agents: Do We Still Need Prescribed Optimization Pipelines?
Frontier optimizers can compose task-specific improvement strategies online without prescribed pipelines, matching or beating them on 12 of 14 settings while using a third of the compute.
- Priming: Hybrid State Space Models From Pre-trained Transformers
Priming initializes hybrid state-space models from pre-trained Transformers using less than 0.5% of the token budget, yielding faster, lighter models that outperform source Transformers on reasoning benchmarks.