Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Weight sync | Copying the trainer’s new weights into the running inference engines after a training step. |
| On-policy | Training only on rollouts generated by the current weights. |
| Off-policy / stale | Training on rollouts generated by older weights. Staleness (or weight lag) is how many updates old they are. |
| Log-probability (logprob) | The log of the probability the model gave a token. RL losses are built from these. |
| Mismatch | The rollout engine and the trainer computing different logprobs for the same token. Two causes: weight lag and kernel differences. |
| Importance sampling (IS) | Correcting for sampling from one policy (μ, the rollout engine) while training another (π, the learner) by weighting each token by π/μ. |
| Batch invariance | A kernel gives bit-identical results for one sequence whatever else is in the batch. |
| Resharding | Converting weights from the trainer’s split across GPUs to the engine’s (different tensor-, expert- or pipeline-parallel layout). |
1. What is it?#
Every RL step ends with new weights on the trainer. The rollout engines (27.d) must start using them. Two questions follow:
- Mechanics: how do gigabytes or terabytes of weights get from the trainer’s GPUs into a running vLLM or SGLang server, quickly, without restarting it and without losing in-flight work?
- Policy: if generation keeps running while weights change, some rollouts were produced by older weights. How stale may they be, and how is the training loss corrected?
In 2026 both engines expose this as first-class API. vLLM v0.32.0 has a four-phase weight-transfer protocol with pluggable backends, a pause/resume API with three modes, and per-token weight-version labels in outputs. SGLang has weight-update sessions, pause/continue and a deterministic inference mode. Facts checked on 13 November 2026.
2. Why does it matter?#
- Sync time is dead time in a synchronous loop. For a trillion-parameter MoE model it can be tens of seconds per step if done naively (section 4).
- Asynchronous RL is much faster but off-policy. vLLM and NVIDIA Research reported 2.40 times the training-step throughput of synchronous training at comparable quality in November 2026 (vendor-side, one recipe), by overlapping generation and training.
- Mismatch silently breaks training. In the same report, with standard (non-aligned) kernels the median rollout-to-learner KL divergence rose 83 times over training and online AIME24 pass@1 fell from 34.27% to 13.96%. The bug is invisible to an inference engineer who checks only that outputs “look right”.
3. Simple analogy#
A newspaper with many printing presses. The editors (trainer) revise the paper every hour.
- Sync: getting the new plates to every press. One courier with all the plates (one sender) is slow; every press fetching its own page from a shelf (sharded pull) is fast.
- Pause modes: stop the presses and throw away half-printed copies (
abort), let them finish the current run first (wait), or freeze them mid-copy and continue with new plates (keep). - Off-policy: some copies on the delivery van were printed from last hour’s plates. Readers can cope with an hour-old story; not with a week-old one.
- Mismatch: two presses that print the “same” plate with slightly different ink. The editors think they know what readers saw, but they don’t.
4. Tiny example: how long a sync takes on the wire#
Wire time only, with illustrative effective bandwidths. Real syncs also gather FSDP shards, reshard, and run post-processing such as re-quantization.
path \ model 8B dense, BF16 70B dense, BF16 1T MoE, FP8
same GPU (CUDA IPC) 0.02 s ( 0.0%) 0.14 s ( 0.0%) 1.00 s ( 0.3%)
one sender, one 400G NIC 0.36 s ( 0.1%) 3.11 s ( 1.0%) 22.22 s ( 6.9%)
sharded pull, 8 NICs/replica 0.04 s ( 0.0%) 0.39 s ( 0.1%) 2.78 s ( 0.9%)
checkpoint via storage 3.20 s ( 1.1%) 28.00 s ( 8.5%) 200.00 s (40.0%)
(percent = share of a 300 s step spent syncing, if nothing overlaps it)For small models any method works. For a trillion-parameter MoE, broadcasting everything from one trainer rank costs 7% of every step and writing a checkpoint costs 40%. That is why vLLM added a sharded, pull-based backend for very large models, and why asynchronous loops hide the sync behind generation.
5. Technical explanation#
vLLM v0.32.0: the weight-transfer protocol#
Two symmetric engines: TrainerWeightTransferEngine on the trainer, WeightTransferEngine inside
vLLM. The protocol has four phases:
| Phase | Call / HTTP endpoint | When |
|---|---|---|
| 1. Initialise | init_weight_transfer_engine | Once, before training: set up the channel |
| 2. Start | start_weight_update | Each sync: prepare the workers |
| 3. Update | update_weights | One or more times per sync (chunked transfers) |
| 4. Finish | finish_weight_update | Each sync: post-process (for example quantize) and commit; may set a weight version |
Backends (backend in WeightTransferConfig):
| Backend | Use |
|---|---|
nccl | NCCL broadcast; trainer and engine on separate GPUs |
ipc | CUDA IPC handles; trainer and engine colocated on the same GPUs |
sparse_nccl | Broadcast only sparse patches (indices and values) of changed parameters |
sharded_rdt | Pull-based over NIXL / Ray Direct Transport, a layer at a time; for very large models such as MoE with expert parallelism |
nccl_m2n | NCCL resharding when trainer and engine use different sharding layouts |
| ModelExpress | Version-based transfer of published weights, including object-storage checkpoints and deltas |
VLLM_SERVER_DEV_MODE=1 vllm serve my-model --weight-transfer-config '{"backend": "nccl"}'# trainer side (one engine per trainer rank; only rank 0 sends with NCCL)
engine = WeightTransferTrainerFactory.trainer_init(
init_info=NCCLTrainerInitInfo(master_address=addr, master_port=port,
world_size=world_size, rank=0, packed=True),
client=HTTPVLLMWeightSyncClient("http://localhost:8000"),
source=ModuleSource(model),
)
for step in range(num_steps):
train_one_step(model)
engine.send_weights() # drives start, update and finishDetails that matter in production:
- The HTTP endpoints exist only with
VLLM_SERVER_DEV_MODE=1, which also exposes other development endpoints. Keep such servers on a trusted network. - With NCCL, every trainer rank builds an engine and calls
send_weights(), but only rank 0 holds a communicator and sends. That single sender is the bottleneck in section 4’s second row. sharded_rdthas the trainer gather and publish one layer at a time while the inference ranks pull the slice they need, so gather and transfer overlap. It rejects runtime expert rebalancing (EPLB), because moving experts invalidates the recorded transfer plan.- The Rust frontend offers the same lifecycle through an optional gRPC
Controlservice for trusted sidecars.
Pausing generation#
The weight update needs a quiet window. vLLM’s pause_generation(mode=..., clear_cache=...)
(HTTP POST /pause?mode=..., POST /resume) has three modes:
| Mode | In-flight requests | Async RL possible? |
|---|---|---|
abort (default) | Aborted; partial results returned; the client retries | Yes |
wait | Allowed to finish before the pause takes effect | No: generation must drain first |
keep | Frozen in place; continue after resume_generation | Yes |
With keep, a request generates some tokens with the old weights and the rest with the new ones.
clear_cache=True drops the KV and prefix cache at the pause, so everything after the resume is
recomputed with the new weights; clear_cache=False keeps the old KV, so later tokens attend to
keys and values computed by older weights (stale KV). Set a label with weight_version on
finish_weight_update (or POST /update_weight_version), and every output carries
weight_versions: spans of token indexes with the version that sampled them. Under data
parallelism with an external load balancer, pause, resume and the version label must be sent to
every engine instance.
Colocated: sleep instead of transfer#
When trainer and engine share GPUs, the engine sleeps while the trainer runs (16.g). The documented
pattern for weight updates: sleep at level 2 (discard weights and KV cache), wake with
tags=["weights"] so only weight memory comes back, load the new weights (CUDA IPC, or
collective_rpc("reload_weights")), then wake with tags=["kv_cache"]. Waking weights first
avoids allocating the KV cache during the update, which lowers the risk of running out of memory.
SGLang equivalents#
SGLang’s RL documentation lists POST /release_memory_occupation and /resume_memory_occupation
(sleep and wake), weight-update sessions (/begin_weight_update, /end_weight_update) around
update_weights_from_tensor or update_weights_from_distributed, update_weights_from_disk,
/pause_generation and /continue_generation, per-token weight-version attribution, and
--enable-deterministic-inference. The shapes match vLLM’s; the names differ.
On-policy, off-policy and the two kinds of mismatch#
Write μ for the policy that generated a token (the rollout engine) and π for the policy being trained (the learner). Policy-gradient losses assume μ = π. In practice they differ for two reasons, which vLLM’s November 2026 post separates:
- Weight lag: the learner has moved on since the rollout was generated. Smooth and predictable; this is what importance sampling (weighting each token by π/μ) is designed to correct.
- Kernel mismatch: rollout engine and trainer compute different numbers for identical weights, because of different kernels, batch composition, precision paths, or MoE routing decisions. It fluctuates with batching and persists even with IS.
Common corrections in RL frameworks clip or truncate the importance weight, or reject tokens or sequences whose ratio is too far from 1, to keep variance down. The cost is bias: the same post reports a sequence-level gate rejecting 24.48% of sequences late in training.
The November 2026 “REINFORCE Zero” recipe (vLLM with NVIDIA Research) takes the other route:
- Align the kernels so engine and trainer produce bit-identical logprobs for every sampled
token (“zero mismatch”). The trainer’s forward pass calls vLLM’s own modules and kernels;
batch-invariant mode (
VLLM_BATCH_INVARIANT, 28.c) removes dependence on batch composition; a prefix-cache hit must give the same logprobs as a miss. - Apply plain, unclipped token-level IS for the weight lag that remains.
- Use plain REINFORCE with group-mean-centred advantages, no value model, no rejection gates.
Reported results (vendor-side, from one team): training stays stable at staleness 2 and 8 on maths reasoning and 64 on agentic tool use; 48.80% (lag 2) and 48.53% (lag 8) against 48.91% for synchronous training on a 1.5B model; and a 6.8% step-time cost for alignment on one computer-use task. On AMD MI355X, bisection found ten separate sources of batch variance, half of them libraries choosing kernels by shape.
Choosing how stale is acceptable#
| Staleness | What it buys | What it costs |
|---|---|---|
| 0 (synchronous) | Simplest maths, no correction | Generation and training alternate; long tails idle the fleet (27.d) |
| 1 (one-step overlap) | Generation of step k+1 overlaps training of step k | Small, easily corrected lag |
| A few steps | Most of the async speed-up for reasoning RL | Needs IS; mismatch must be small |
| Tens of steps | Agentic RL with very slow environments | Needs tight kernel alignment and monitoring of KL between μ and π |
6. Under the hood: the sync-time model#
// weightsync.go — how long does pushing new weights into the rollout engines take?
package main
import "fmt"
func main() {
models := []struct {
name string
gb float64 // bytes on the wire per sync, GB
}{
{"8B dense, BF16", 16},
{"70B dense, BF16", 140},
{"1T MoE, FP8", 1000},
}
// Effective rates are ILLUSTRATIVE round numbers, not measurements.
paths := []struct {
name string
gbs float64
}{
{"same GPU (CUDA IPC)", 1000}, // colocated: a device-local copy
{"one sender, one 400G NIC", 45}, // broadcast from trainer rank 0
{"sharded pull, 8 NICs/replica", 360}, // every inference rank pulls its slice
{"checkpoint via storage", 5}, // write, then every replica reloads
}
const stepS = 300.0 // one RL step without the sync
fmt.Printf("%-30s", "path \\ model")
for _, m := range models {
fmt.Printf(" %18s", m.name)
}
fmt.Println()
for _, p := range paths {
fmt.Printf("%-30s", p.name)
for _, m := range models {
t := m.gb / p.gbs
fmt.Printf(" %7.2f s (%4.1f%%)", t, 100*t/(stepS+t))
}
fmt.Println()
}
fmt.Println("\n(percent = share of a 300 s step spent syncing, if nothing overlaps it)")
}Output:
path \ model 8B dense, BF16 70B dense, BF16 1T MoE, FP8
same GPU (CUDA IPC) 0.02 s ( 0.0%) 0.14 s ( 0.0%) 1.00 s ( 0.3%)
one sender, one 400G NIC 0.36 s ( 0.1%) 3.11 s ( 1.0%) 22.22 s ( 6.9%)
sharded pull, 8 NICs/replica 0.04 s ( 0.0%) 0.39 s ( 0.1%) 2.78 s ( 0.9%)
checkpoint via storage 3.20 s ( 1.1%) 28.00 s ( 8.5%) 200.00 s (40.0%)
(percent = share of a 300 s step spent syncing, if nothing overlaps it)A broadcast is pipelined, so its time hardly depends on how many replicas receive it; it is set by
the slowest link out of the sender. A sharded pull scales with the number of links used in
parallel. Where the trainer stores FP32 or BF16 master weights and the engine serves FP8 or FP4,
quantization in finish_weight_update adds compute time on top.
7. Performance implications#
- Overlap beats speed. In an asynchronous loop, a 20-second sync hidden behind generation costs little; in a synchronous loop it adds directly to every step.
keepwithclear_cache=Truerecomputes the prefill of every in-flight request after the resume: correct, but a burst of prefill work.clear_cache=Falseavoids it at the price of stale KV.- Batch-invariant kernels cost throughput (single-digit percent in the reported results) and constrain kernel choices such as split-K; budget for them in rollout capacity.
- MoE adds routing to the mismatch budget. Return and replay routed experts (27.d) or align the router computation.
8. Production implications#
- Version everything. Label each sync with the trainer step and keep
weight_versionswith every rollout; it is the only way to debug a training curve that went wrong. - Verify every sync. Check that every rank has the new weights (vLLM has a weight-checker guide) and that a fixed probe prompt gives the expected logprobs after each update.
- Monitor mismatch as a production metric: KL or max ratio between engine and trainer logprobs per step. A sudden rise after an engine upgrade, a new kernel or a changed batch size is an incident.
- Secure the control surface. Weight-transfer endpoints can replace the model; never expose a dev-mode server outside the training network.
- Handle partial failure. A sync that dies halfway leaves engines with mixed weights; design the client to redo the whole start-update-finish sequence and to fence engines that fail.
9. Common mistakes#
- Exposing
VLLM_SERVER_DEV_MODE=1servers to shared networks. - Using
waitmode and expecting asynchronous overlap. - Pausing only one replica behind an external load balancer.
- Assuming identical weights give identical logprobs in the engine and the trainer.
- Treating clipped or gated IS as free; it biases the gradient by discarding data.
- Upgrading vLLM, a kernel library or the batch size mid-run without re-checking mismatch.
- Writing a checkpoint to storage and reloading it every step for a very large model.
10. Hands-on exercise#
A. Sync a small model. Run vLLM’s examples/rl/rlhf_http_nccl.py (v0.32.0) on two GPUs. Time
send_weights() and verify a probe prompt’s output changes after the update.
B. Pause modes. Start long generations, then pause with abort, wait and keep. For keep,
print weight_versions and confirm the tokens split at the update.
C. Measure mismatch. For 100 rollouts, compute the trainer’s logprobs for the sampled tokens with Hugging Face Transformers and compare with vLLM’s returned logprobs. Repeat with vLLM’s batch-invariant mode on. Plot the distribution of differences.
D. Model the overlap. Extend weightsync.go with a generation time per step and a staleness
of 1, so the sync overlaps generation. At what model size does the sync stop being hidden?
11. Interview questions#
- Walk through vLLM’s four-phase weight-transfer protocol. Why split start, update and finish?
- Compare
abort,waitandkeeppause modes. Which ones allow asynchronous RL? - What are the two sources of mismatch between rollout and trainer logprobs, and which one does importance sampling fix?
- How would you sync a trillion-parameter MoE model into 32 inference replicas every few minutes?
- What does
clear_cachecontrol, and what is the risk of keeping the KV cache across an update? - Your RL run’s reward collapses after an inference-engine upgrade. How do you investigate?
12. Further reading#
Checked on 13 November 2026.
- vLLM v0.32.0 — Weight transfer
- vLLM v0.32.0 — Async reinforcement learning (pause/resume, weight versions)
- vLLM v0.32.0 — Sleep mode
- vLLM v0.32.0 — Batch invariance
- Native RL APIs in vLLM (vLLM blog, May 2026)
- Zero mismatch, simple async RL (vLLM blog, November 2026)
- SGLang for RL
- AReaL: asynchronous RL for language reasoning (arXiv 2505.24298)
- PipelineRL: in-flight weight updates (arXiv 2509.19128)
- Inter-node networking for transfers: 9.a onward. Engine sleep and pause internals: 16.g.