SGLang and Miles Achieve Bit-Exact On-Policy RL for LLM Training
Summary:The SGLang and Miles teams introduce True On-Policy (TOP) RL, a systems approach that aligns rollout and trainer modules, precision, and quantization contracts so that, at identical weights, every fresh token's FP32 log-probability is byte-identical across the two paths. The implementation has been checked across DeepSeek-V4-Flash, DeepSeek-V4.1, GLM-5.2/5.3, and multiple Qwen3 variants, with synchronous and asynchronous end-to-end RL runs. TOP does not erase asynchronous policy staleness: it r
Core Result
True On-Policy RL (TOP) is not designed to generate longer responses. Its goal is to ensure that when the trainer recomputes the probability of a token sampled during rollout, it obtains exactly the same result as the rollout engine. The stated criterion is strict: at identical weights, the FP32 log-probabilities produced by the trainer and rollout are identical token by token and byte by byte. This property reportedly remains intact when speculative decoding is enabled.
The guarantee has clear boundaries. It applies to supported models under fixed operator, precision, and quantization configurations; it is not a universal bit-exact property across arbitrary GPUs, library versions, parallel topologies, or numerical formats. TOP's main contribution is turning a previously hidden numerical discrepancy into an explicit engineering contract that gate tests can verify.
How Mismatch Creates Hidden Off-Policy Behavior
Let rollout sample x_t from context s_t under π_rollout, while the trainer computes π_trainer for the importance ratio. An ideal on-policy setup satisfies:
log π_trainer(x_t | s_t) = log π_rollout(x_t | s_t)
The importance weight r_t = exp(log π_trainer - log π_rollout) is then 1, preserving the assumptions behind PPO, GRPO, and related methods. In practice, rollout and training often use different CUDA kernels, batch shapes, fusion orders, or numerical precisions. Even a tiny matrix-multiplication discrepancy can flip MoE Top-k routing when expert scores sit near a threshold. A token may then enter a different expert, amplifying the original floating-point error into a substantial probability mismatch.
Two common mitigations are R3, which replays the rollout's MoE routing in the trainer, and TIS, which truncates importance weights to suppress extreme samples. Routing replay only addresses the discrete routing difference, while truncation introduces bias and variance. Neither mechanism restores true bitwise equality.
How TOP Works
TOP binds each model to a set of shared operators and fixed numerical contracts. The trainer and rollout may use different parallel layouts, but both must follow the same rules for attention, normalization, linear layers, MoE routing, and quantization. For FP8 models, scale granularity and scale computation are part of the contract as well. If rollout interprets blockwise FP8 weights with one scale rule while the trainer uses another, identical tensor formats can still produce divergent probabilities.
The tested coverage includes FP8 and BF16 variants of DeepSeek-V4-Flash, DeepSeek-V4.1-Flash, GLM-5.2/5.3, GLM-5.3-Flash, Qwen3 dense, the Qwen3.5 family, and Qwen3.8-Flash-Next. DeepSeek-V4.1 reportedly uses FP8 dense weights and converts MXFP4 experts to FP8 at load time on Hopper. The tests also cover speculative decoding and run on Hopper and Blackwell systems.
A notable topology choice is that both paths use tensor parallelism degree 1, while the trainer combines pipeline, context, and expert parallelism and rollout uses attention data parallelism plus expert parallelism. TOP therefore does more than execute the same process twice: it preserves token-level numerical semantics across different parallel strategies. However, results at TP=1 do not establish identical behavior for TP>1, alternative NUMA layouts, or different GPU generations.
End-to-End RL Results
The authors ran synchronous training on DeepSeek-V4-Flash, DeepSeek-V4.1, and GLM-5.2, plus asynchronous training on Qwen3.6-35B-A3B for multi-turn Text-to-SQL. Both arms used the same data, batch configuration, and learning rate.
| Scenario | Reported result | |---|---| | Synchronous RL | TOP uses neither R3 nor TIS, and the fresh-token train/rollout log-probability difference is 0 at every step | | Asynchronous RL | Fresh tokens remain bit-identical; stale tokens retain nonzero differences because their weights come from an older policy version | | Kernel mismatch at equal weights | Standard kernels differ by 0.006–0.0095 per token and disagree on 94%–98% of tokens; TOP's difference is 0 | | Weight-lag component | 0.020–0.058 per token under the TOP+TIS setup, measured separately from kernel mismatch | | Importance-weight tail | Without a cap, some weights reach the thousands; standard+R3 and TOP without routing replay lose accuracy mid-run, while TOP+R3 remains smooth |
The most important implication is that TOP removes the discrepancy caused by different kernels under equal weights; it does not automatically make asynchronous training strictly on-policy. Stale policies may select different experts, so R3 routing replay remains necessary. Uncapped importance weights can still form a heavy tail, meaning that removing truncation safeguards without a separate stability analysis is unsafe.
How to Interpret the Evaluation
The synchronous experiments use AIME-2024 avg@8, with 8 samples across 30 problems. The asynchronous Text-to-SQL evaluation uses greedy pass@1 on 398 BIRD-Platinum questions and 498 Arcwise-Plat questions. Matching data and training settings help isolate variables, but the collected text does not provide complete absolute scores, seed variance, or confidence intervals.
The evidence therefore supports numerical consistency more strongly than it supports a claim that TOP inherently produces higher rewards or stronger models. AIME contains relatively few problems, and the text-task results still depend on the authors' implementation and evaluation scripts. TOP's value is that it removes a difficult-to-detect systems error; it does not replace independent baselines, ablations, or repeated runs.
Engineering Costs and Maintenance Burden
On 64 H200s, TOP delivers whole-step token throughput equal to 0.90× the standard implementation on DeepSeek-V4-Flash and 0.93× on GLM-5.2. Rollout token rates fall further, to 0.79× and 0.88× respectively. This represents roughly a 7%–10% whole-step throughput loss and a 12%–21% rollout loss. Because large-scale RL is often constrained by the rollout tail, the latter reduction may matter more than the average end-to-end figure.
Exactness also creates model-maintenance work. TOP's modular design lets a new model reuse matching operators and implement only what is new. The authors report that an agent completed end-to-end DeepSeek-V4.1 support in under eight hours by following a skill document that was updated twice during the work. This demonstrates a potentially scalable workflow, but it does not prove that every new model can be integrated within the same time budget.
The collected material does not report peak memory, cross-node communication volume, operator-level timing attribution, or end-to-end cost. Numerical consistency across different parallel layouts also does not imply cross-hardware reproducibility. Evaluating TOP therefore requires throughput, rollout tail latency, memory, importance-weight tail distributions, and training stability—not only a zero log-probability difference.
Practical Adoption Guidance
- Define the consistency boundary explicitly. Model version, precision, quantization scales, parallel topology, speculative-decoding configuration, and operator versions all belong in the parity gate.
- Record the train/rollout log-probability difference, MoE routing agreement, and weight-version gap for every token so kernel mismatch can be separated from policy staleness.
- Use TOP to validate synchronous training first. Asynchronous training should retain R3 and keep an upper bound on importance weights until stability is independently demonstrated.
- Reproduce the parity checks under FP8, BF16, speculative decoding, and varied batch shapes, with dedicated test cases for MoE routing flips.
- The code is currently promised as branches in the SGLang and Miles repositories. Before production adoption, wait for the formal commits, verify the license and gate scripts, review the full training recipe, and independently measure end-to-end gains.
— END —Source: LMSYS / SGLang Blog (2026-11-23)
Tags: #SGLang #Miles #On-Policy Reinforcement Learning #FP8 #Mixture-of-Experts
Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.
Community Comments