Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Modal 17 min read Research hardMaster

Toward RL on mixed-precision, mixed-accelerator samplers

RL training of Qwen3.6-35B-A3B on agentic coding stays stable when samplers run on six accelerator types (A100 through B300, RTX PRO 6000) in NVFP4, FP8 and BF16 with their own kernels, feeding a BF16 trainer on B200. Uncorrected GRPO collapses on both mixed and homogeneous samplers. Only score centering plus masked importance sampling (optionally with top-p mask replay) trains to the end, matching homogeneous-sampler SWE-bench Pro V2 pass@4 despite 4.7× larger sampler–trainer KL, at about 15% lower sampling cost per update. The central claim is that stability depends on whether mismatch keeps growing, not on its size, so off-policy correction can stand in for bitwise-identical on-policy matching. Collapse shows up as falling reward, KL growing 3× or more, and episodes ending when the model stops calling its tool.

Assumes: policy gradient RL (GRPO)importance samplinglow-precision number formatsLLM inference serving

Related posts

  • Putting RL back in RLHF

    Hugging Face hardMaster

    RLOO (REINFORCE Leave-One-Out) is now available as a trainer in Hugging Face TRL. It is an online RLHF algorithm that drops PPO's value model. It treats the whole completion as a single action, uses the REINFORCE loss, and computes each sample's baseline as the mean reward of the other k−1 completions for the same prompt. That cuts vRAM by roughly 50-70% and makes training 2-3x faster than PPO on Pythia 1B and 6.9B, while matching PPO's GPT-4-judged win rate (78.7% for 6.9B on TL;DR) and beating DPO. Code walkthroughs show the advantage computation and that REINFORCE is a special case of the PPO loss. There is a caveat: bf16 numerical mismatches between generation and training logprobs hurt RLOO more than PPO.

  • TRL v1.0: Post-Training Library Built to Move with the Field

    Hugging Face mediumAdept

    TRL v1.0 turns Hugging Face's post-training codebase, now covering 75+ methods and downloaded 3M times a month, into a library with an explicit stability contract. A semver-governed stable core (SFT, DPO, reward modeling, RLOO, GRPO trainers) sits alongside a fast-moving trl.experimental namespace. Methods are promoted based on the ratio of usage to maintenance cost. Because post-training paradigms keep shifting (PPO to DPO to RLVR/GRPO), the design deliberately avoids shared base classes and generic abstractions and accepts near line-for-line duplication between trainers like RLOO and GRPO, illustrated by the failed Judge abstraction. A comparison against OpenRLHF, veRL, PRIME-RL, Tinker, LLaMA-Factory and others positions TRL as broad, low-infrastructure and stable but lacking native tensor parallelism, with asynchronous GRPO planned next.

  • Keep the Tokens Flowing: Lessons from 16 Open-Source RL Libraries

    Hugging Face hardMaster

    Async RL post-training libraries have converged on one architecture: disaggregate inference and training onto separate GPU pools, connect them with a rollout buffer, and push weights asynchronously so generation never stops and training never waits. A survey of 16 open-source libraries (verl, AReaL, SLIME, PRIME-RL, NeMo-RL and others) compares them on seven axes: orchestration, buffer design, weight sync, staleness management, partial rollouts, LoRA support and training parallelism. Ray dominates orchestration, NCCL broadcast is the default weight-transfer method, staleness handling ranges from dropping samples to importance-sampling correction, LoRA support is sparse, and distributed MoE support is emerging as the differentiator. Throughput math shows why this matters, with 32K-token rollouts on a 32B model taking hours per step on one H100. The findings shape TRL's new async trainer, which uses a bounded queue with per-token model versions, packed NCCL weight sync and partial rollout support.

  • The N Implementation Details of RLHF with PPO

    Hugging Face hardMaster

    A from-scratch PyTorch reproduction of OpenAI's 2019 lm-human-preferences RLHF codebase closely matches the original learning curves on stylistic tasks like sentiment and descriptiveness. Along the way it catalogs the implementation details that matter for faithful replication: reward model and value head scoring the concatenated query and response, a dedicated out-of-vocabulary padding token, position-index adjustment for padding, fixed-length sampling that ignores EOS, learning-rate annealing, per-process seeds, reward normalization, rejection sampling and reward whitening. It also documents a TensorFlow vs PyTorch Adam numerical difference that causes overly aggressive updates, and how different base models behave when reward labels come from gpt2-large. Practical notes show how to replicate each behaviour with Hugging Face transformers, along with the hardware constraints of running the original TF1 code.

  • vLLM V0 to V1: Correctness Before Corrections in RL

    Hugging Face hardMaster

    Migrating PipelineRL's rollout generation from vLLM V0 (0.8.5) to V1 (0.18.1) caused training metrics (clip rate, KL, entropy, reward) to diverge. Matching the V0 reference took four backend fixes: setting logprobs-mode=processed_logprobs so returned logprobs reflect temperature and top-k/top-p processing, explicitly disabling V1's default prefix caching and async scheduling, reproducing V0's inflight weight-update semantics with pause_generation(mode="keep", clear_cache=False), and computing the lm_head in fp32 to match the trainer. Batch invariance and the logprob-mode fix alone did not close the gap. The broader recommendation is to restore inference-backend correctness before adding objective-side off-policy corrections such as truncated importance sampling, so those corrections don't hide backend bugs.

The quest for software engineering knowledge.

Look:
Layout: