TL;DR
My RL loop is synchronous: Megatron generates 512 answers, grades them, scores them twice and makes four updates, all on the same 8×H100. My first reading put a step at about 2.5 minutes, 80–90% in the rollout iteration; a full recount gives generation and grading 58%. Every step waits for its longest answer, a median of 865 tokens against a mean answer of 90.
I stayed synchronous: the loop is on-policy by construction, and no outside inference engine runs our V4-style router. Asynchrony could make a step at most about 1.7× faster here, so CUDA graphs and less padding come first.
What you’ll learn
- How one RL step runs in Megatron, phase by phase, and how long each phase took on 8×H100.
- Why synchronous generation waits for the longest answer, as a formula checked against the logs.
- What asynchronous RL changes: the step becomes a max instead of a sum, samples go stale, and the update needs an importance correction.
- Why a mixture-of-experts model makes asynchrony harder, and why I stayed synchronous.
- Which frameworks offer asynchronous RL, and which simpler fixes to try first.
The RL loop, step by step
Reinforcement learning (RL) trains a language model in a loop. The model answers questions, a program grades the answers, and an update makes the rewarded answers more likely. My questions were math word problems with a checkable final answer, and my update rule was GSPO, explained in Part 9.
A few terms first. A rollout is one generated answer with its reward. A step is one pass through the loop, and an update is one optimizer step on the weights. A log-prob is the logarithm of the probability the model gives a token or an answer.
One step in Megatron
I ran the loop in Megatron-LM, NVIDIA’s training framework, with its own RL loop and its own inference engine. One step has four phases.
- Generate. 16 prompts with 32 answers each: 512 answers. The engine samples at temperature 1, with no top-k or top-p cut, and stops a prompt plus its answer at 1,536 tokens.
- Grade. A grader checks each answer’s final number and turns it into a reward (Part 8). The reward also penalises answers from 768 tokens on and gives −1 beyond 1,024.
- Score. The trainer runs two forward passes over all 512 answers. The current weights give the “old” log-probs; the frozen SFT weights give the reference log-probs for a KL penalty of weight 0.01.
- Update. Four optimizer updates of 128 answers each, one answer per forward pass. The learning rate is 1e-6, and GSPO’s clip is 2e-2 below and 2.7e-2 above.
All four phases run on the same eight GPUs, one after the other. That makes the loop synchronous, since each phase waits for the one before it, and colocated, since generation and training share the GPUs. Megatron samples from the training model itself, so no weights are copied between trainer and engine. Between rollouts, the engine is suspended while the trainer works.
How the work is split across 8 GPUs
The model is a mixture of experts (MoE). Each layer has 64 small feed-forward networks, the experts, and a router sends each token to 8 of them.
I split the experts eight ways, which is called expert parallelism 8. Each GPU holds 8 of the 64 experts in every layer, plus a full copy of everything else. Part 4 covers the layout.
During generation, each GPU decodes 64 of the 512 answers. But at every layer, tokens travel to the GPU that holds their experts and back, an exchange called all-to-all. So the GPUs move in lockstep: a GPU with no answers left still runs a dummy forward pass while the others finish. When the last answer ends, GPU 0 gathers every rollout while the other seven wait.
Where the time goes
A synchronous step is a sum
Because the phases take turns, their times add:
where \(T_{\text{gen}}\) is the time to generate and grade all of a step’s answers, and \(T_{\text{score}}\) the time of the two scoring passes. \(K\) is the number of updates per step (4 here), and \(T_{\text{upd}}\) the time of one update.
In words: nothing overlaps, so every phase adds its full time to the step.
The share of the step spent generating is
where \(T_{\text{gen}}\) and \(T_{\text{step}}\) are as in equation (1).
In words: \(f_{\text{gen}}\) is the fraction of each step during which the GPUs write answers instead of learning from them.
My first reading: 80–90%
Megatron times its RL loop per optimizer update, which it calls an iteration. A step’s first iteration carries the rollouts, the scoring passes and the first update; the next three iterations are updates only.
My first reading covered three one-step calibration runs and the first steps of the main GSPO run, which I call GSPO-A.
In the calibration runs, the first step took about 4.5 minutes. Its rollouts took 194–260 s, of which generation was 76–141 s; then came 16–21 s of scoring and updates of about 3 s each. Later steps took about 2.5 minutes: about 125 s for the rollout iteration, then three updates of about 8.6 s. I concluded that rollouts were 80–90% of a step.
In equations (1) and (2), with the first update folded into the 125 s:
where 125 s is the rollout iteration and 8.6 s each later update.
In words: on those steps, the rollout iteration filled about five sixths of the time.
The full count: 58%
That reading had two flaws. It counted the scoring and the first update as rollouts, and it described long steps. So I recounted the timers of all 177 iterations of GSPO-A, 45 steps in all.
| Phase (Megatron timer) | Median per step | Total over 45 steps | Share |
|---|---|---|---|
Generate and grade (rl/rollout-collection) |
69.9 s | 2,951 s | 57.5% |
Score: old 4.6 s, reference 6.9 s (rl/prepare-data-for-update) |
11.8 s | 605 s | 11.8% |
| Four updates, with small overheads | about 8.5 s each | 1,576 s | 30.7% |
| Whole step | 111 s | 5,133 s | 100% |
The timers cover 5,133 s of the run’s 5,277 s. The rollout iteration ranged from 36 s to 317 s, the slow first step included. Equation (2) now gives \(f_{\text{gen}} = 2{,}951 / 5{,}133 \approx 0.575\).
Generation and grading are still the largest phase, but not the overwhelming one I first wrote down. The difference matters below, when we bound what asynchrony could save.
Why a step waits for its longest answer
A language model writes one token at a time. Each decode step adds one token to every unfinished answer, and a finished answer leaves the batch. So the batch runs until its longest answer ends:
where \(L_i\) is the length of answer \(i\) in tokens, and \(L_{\max} = \max_i L_i\) the longest of the step’s 512 answers. \(B_s\) is the number of answers still running at decode step \(s\), and \(\tau(B)\) the time of one decode step with \(B\) answers. \(T_{\text{prefill}}\) is the time to read the prompts in. The second form holds when \(\tau\) barely changes with \(B\); then \(r_{\text{dec}} = 1/\bar\tau\) is the decode rate of one answer, in tokens per second.
In words: the longest answer sets the number of decode steps, however short the other answers are.
That second form fits our run. In GSPO-A’s log, a decode step took a median of 54 ms with one answer on the GPU. With anywhere from 2 to 64 answers, it took about 90 ms. These are the engine’s own step times, which cover only its generation call.
The longest answer per step had a median of 865 tokens. With \(\bar\tau\) between 54 and 90 ms, equation (3) predicts roughly 47 to 78 s of decoding. The measured median for generating and grading was 69.9 s, inside that range.
How much of the decoding did useful work? Count the answer slots that still produce a token while the batch runs:
where \(N\) is the number of answers and \(\bar L\) their mean length.
In words: \(\eta\) is the share of the batch’s decode slots that are still writing an answer.
With GSPO-A’s mean answer of 90.2 tokens and the median longest answer of 865, \(\eta \approx 0.10\). If every answer had the mean length, generation would need about a tenth of the decode steps.
The log shows the tail directly. In 242 of 588 sampled decode steps, the GPU was running a single answer.
The laptop showed it first
I first saw this on a laptop RTX 3060 (6 GB), with a 64M-parameter dense model and my own synchronous loop.
- Generation took 91–93% of each step of about 10 s.
- In one run, steps without a capped answer took 3.0 s when the longest answer had 114 tokens, and 9.1 s at 254.
- Over steps 21–120 of another run, the median answer was 10 tokens, yet generation took 89% of the step. 77 of those 100 steps had an answer at the 256-token cap.
- Late in a 300-step run, the mean answer was 45–51 tokens, but rollouts still took 8.9–9.2 s. Generated tokens per second fell from about 1,500 to about 650.
- By the end, more than half the decode time produced no answer tokens.
A laptop GPU at its power cap says nothing about an H100’s speed. But the mechanism is the same: one long answer holds the whole batch.
What it adds up to: about 40× fewer tokens per GPU than PocketRL
GSPO-A generated 2,078,901 tokens in 5,277 s on 8 GPUs, about 49 tokens per GPU per second. PocketRL trains a 7B dense model with RL on a single GPU. From its 100-step profile on one H100, I estimate about 2,000 generated tokens per second, with answer lengths read off its Figure 8. That is about 40× more per GPU, with an active model 6× larger than ours.
The causes I have numbers for:
- the rollouts wait for the longest answer, a median of 865 tokens per step, while the average answer was 90 tokens;
- decoding ran without CUDA graphs, at 68 ms per token for a single answer (Part 11);
- an 8-way all-to-all, for a model whose RL state might fit without expert parallelism (an unmeasured ~51 GB per GPU, with the optimizer sharded over 8);
- the training passes run on rows padded to 1,536 tokens.
PocketRL runs everything on one GPU, with one set of weights for generation and training. The comparison mixes models, answer lengths and algorithms, so read 40× as a rough size, not as the effect of any one cause.
Synchronous and asynchronous RL, explained
Synchronous
In synchronous RL, generation and training take turns. Every answer of a step comes from the weights that the step’s first update starts from. The two sides can share GPUs, as mine do, or sit on separate GPUs and idle in turn. MOLT’s technical report puts the problem in one line: “In synchronous training, every step waits for its slowest episode”.
Asynchronous
In asynchronous RL, generation and training run at the same time on separate GPUs. Finished answers go into a queue, and the trainer takes batches from it. New weights go back to the generators after every update, or every few. The step is no longer a sum:
where the primes mark times on the GPUs each side gets after the split, and the other symbols are as in equation (1). \(T_{\text{sync}}\) is the time to send new weights to the generators.
In words: when the two sides overlap, the slower one sets the pace, plus the weight transfer.
The catch is staleness. MOLT’s report defines policy lag as “the number of updates by which the policy that generated a sample trails the trainer”. As a formula:
where \(v_{\text{train}}\) counts the updates the trainer has made, and \(v_i\) is the version of the weights that wrote answer \(i\).
In words: \(k_i\) is how many updates old the writer of an answer is when the trainer learns from it.
Laminar’s paper sorts asynchronous designs into three kinds:
- One-step staleness: the generators write the next batch with the previous weights while the trainer learns from the last one, so \(k = 1\).
- Streaming: the trainer starts on the first finished answers and takes the long ones in later updates.
- Partial rollouts: unfinished answers pause, the new weights load, and generation continues, so one answer can mix weight versions.
The paper finds that one-step staleness “cannot effectively hide the generation latency of long-tail trajectories”. Laminar instead lets each answer finish at its own pace, and moves the long ones onto a few dedicated generators.
My synchronous loop already has a lag of up to 3
Four updates per step mean the samples are not all fresh. The first update learns from answers that its own starting weights wrote. The second, third and fourth learn from answers written 1, 2 and 3 updates earlier. GSPO’s ratio, below, absorbs a small lag like this.
What stale samples need: an importance correction
The policy gradient is an average over answers drawn from the current policy. A stale answer was drawn from older weights, so the average is taken over the wrong distribution. Importance sampling fixes this with a weight:
where \(x\) is the prompt and \(y\) an answer. \(\pi_\theta\) is the current policy, and \(\mu\) the behaviour policy, the weights that wrote the answer. \(g\) is any function of the answer, such as its reward times the gradient of its log-prob.
In words: weighting each old answer by how much likelier the current policy finds it recovers the average under the current policy.
Derivation
Write the left side of (7) as a sum over answers, and cancel \(\mu\):
where the sums run over every possible answer \(y\) to the prompt \(x\).
In words: the weight cancels the old policy’s sampling probability and leaves the current policy’s in its place.
The right side is the expectation under \(\pi_\theta\). The step needs \(\mu(y\mid x) > 0\) wherever \(\pi_\theta(y\mid x) > 0\). Sampling at temperature 1 with no top-k or top-p cut gives every answer a non-zero probability, in principle.
The catch is variance. An answer’s ratio is the product of its tokens’ ratios, so small per-token differences multiply. For illustration, a ratio of 1.01 on each of 865 tokens gives \((1.01)^{865} \approx 5{,}500\). That is why practical methods clip, truncate or length-normalise the weight.
GSPO’s ratio, and decoupling the clip
GSPO takes the geometric mean of the per-token ratios, which keeps the answer’s ratio near 1:
where \(|y_i|\) is the length of answer \(i\), \(y_{i,t}\) its \(t\)-th token, and \(\pi_{\text{old}}\) the weights that wrote it.
In words: the ratio is the average per-token log-ratio, turned back into a ratio.
GSPO then clips \(s_i\) to \([1-\varepsilon_{\text{low}},\, 1+\varepsilon_{\text{high}}]\), which holds it close to 1. In my loop, \(\pi_{\text{old}}\) is the step’s starting weights, whose log-probs the trainer recomputes in the scoring pass. In an asynchronous loop, it would be whichever weights wrote each answer.
With a large lag, the old weights make a poor centre for the clip: most ratios fall outside it, and those answers stop teaching. AReaL’s decoupled PPO splits the two jobs of the old policy:
where \(\pi_{\text{behav}}\) is the stale policy that wrote token \(y_t\), and \(\pi_{\text{prox}}\) a recent policy whose log-probs the trainer recomputes before the update. \(\hat A\) is the answer’s advantage, how much better it scored than its group, and \(\epsilon\) is the clip.
In words: the outer weight corrects for staleness, and the clip keeps each update close to a recent policy rather than the stale one.
Equation (9) is per token, as in AReaL. For GSPO the same split would act on the sequence ratio, which I have not built.
How fast does staleness move the numbers? Microsoft AI’s RL team measured the gap between generator and trainer log-probs against staleness. Their fitted line gives about 0.015 nats per token after one stale step and about 0.045 after 40, read off their Figure 3.
Why I stayed synchronous
1. On-policy by construction, and easy to check
In my loop, the weights that generate are the weights that learn. Megatron’s generation lag stays at zero unless partial rollouts are switched on, and the run’s log shows them off.
That allows a sharp check. Before the first update, the new and old log-probs come from the same weights. So GSPO’s ratio must be exactly 1, and the KL exactly 0. On one GPU it was, in the rehearsal and again in the control run.
“Exactly” has limits, and I measured them.
- On 8 GPUs at expert parallelism 8, the first ratio was not exactly 1: median |log ratio| 4.9e-3, p99 0.034, KL 0.0027. The likely cause is kernel-level differences between the scoring pass and the training pass (Part 5).
- The engine’s own log-probs also differ from the trainer’s, even for the same weights. I logged this sampler–learner gap without correcting it: 0.0133 nats per token on one GPU, about 0.035 on eight.
A synchronous run is also easier to reproduce and debug. Its order of events is fixed: generate, grade, score, update. In an asynchronous run, which weights wrote which answer depends on timing. The ratio is never exactly 1 by design, so this check disappears.
2. Our router runs only in Megatron
A token’s probability depends on which experts the router picked for it. Our router uses DeepSeek V4’s sqrt-softplus scores, with a quantile-balancing bias added to the logits before the top-8 choice among 64 experts. Part 2 explains it.
When I checked in November 2026, neither vLLM nor SGLang could load our model as it is.
- vLLM’s DeepSeek-V4 router kernel handles only the expert counts in its switch, “including 128/256/384/512”. 64 was not confirmed, and a fallback for other counts was not merged.
- DeepSeek V4 adds its bias to the scores; ours adds it to the logits.
- Beyond the router, our model is not DeepSeek V4: its attention is grouped-query attention, as in Qwen3-MoE. Either engine would need a custom model class, in effect Qwen3-MoE with our router.
Why does a second engine matter? If it picks different experts for a token than the trainer does, the two compute different probabilities for the same token. That difference adds to the sampler–learner gap.
The R3 paper measured this between Megatron and SGLang. There, “about 10%” of router decisions differed, and 94% of tokens picked a different expert in at least one layer.
MOLT’s guide gives the reason: “Even at identical weights, numerical differences flip part of the top-k selection in each layer.” Megatron’s own engine runs the same routing code on the same weights. Staying in Megatron removes the second router without any extra machinery.
3. A modest gain on one node
Equation (5) gives a ceiling. If overlap were perfect and free, a step would shrink to its slower side:
where \(S_{\max}\) is the largest possible speed-up, and \(T_{\text{step}} - T_{\text{gen}}\) is the training side: scoring and updates.
In words: asynchrony can at best hide the shorter side behind the longer one.
With the full count, \(S_{\max} = 5{,}133 / 2{,}951 \approx 1.74\).
The real gain on one node would be smaller. The ceiling assumes generation keeps the speed of all 8 GPUs while training runs elsewhere. On one node, asynchrony means splitting the 8 GPUs, so each side runs on fewer. It also assumes free weight transfers and no learning penalty from stale samples.
Published systems also gain less at small scale. Laminar reports 2.56× over synchronous verl on average, but a “moderate” 1.41× at 64 GPUs or fewer, averaged over all four of its baselines. MOLT measured 2.40× on 16 GPUs: 12,000 updates in 68.55 hours against 164.77. Both are other workloads, with other baselines.
The bigger loss sits inside generation: \(\eta \approx 0.10\) from equation (4). Asynchrony attacks it by refilling the batch with new prompts while the long answers finish. Megatron offers a small dose of that, under “What I’d do next”.
What asynchrony would buy, and what it would take
| My synchronous loop | An asynchronous loop | |
|---|---|---|
| Waiting for the longest answer | Every step | Hidden: generation keeps running |
| GPUs | All 8 generate, then all 8 train | Split between generators and trainers |
| Weight transfer | None: the engine uses the trainer’s weights | After every update, or every few |
| Policy lag | 0 to 3 within a step | Larger, bounded by the queue |
| Correction | GSPO’s ratio and clip | A weight against the behaviour policy, as in (9), plus clipping or truncation |
| MoE routing | One engine, one routing code | Two engines: routing replay or a correction |
| Debugging | First ratio exactly 1 on one GPU; fixed order of events | Ratio never 1 by design; order depends on timing |
Routing replay needs a sentence. R3 records the experts the inference engine chose for each token and replays them in the trainer’s forward pass. The trainer then scores each token through the experts the generator used.
The options
Ray coordinates processes across GPUs and machines; vLLM and SGLang are inference engines; RL frameworks combine them with a trainer.
| Framework | Trainer and engine | Asynchronous mode | What our model would need |
|---|---|---|---|
| Megatron’s RL loop (mine) | Megatron and its own engine | Partial rollouts with a set lag; off by default | Nothing new; untested |
| verl | Megatron for model parallelism, with a separate inference engine | Laminar built its one-step and streaming baselines on verl | Our router in the engine |
| NeMo-RL | Megatron through Megatron-Bridge, with a separate inference engine | Asynchronous GRPO with trajectories at most one step old, in its Nemotron 3 Super recipe | Our router in the engine |
| slime | Megatron with SGLang | A one-step asynchronous mode | Our router in SGLang |
| Miles | Built on slime: Megatron or FSDP, with SGLang | Fully asynchronous, but not when trainer and engines share GPUs; routing replay built in | Our router in SGLang |
| AReaL | SGLang with Megatron, in Laminar’s comparison | Fully asynchronous, with decoupled PPO | Our router in its engine |
| PRIME-RL | Not read in detail | Fully asynchronous | Our router in its engine |
| MOLT | Hugging Face models in an FSDP2 trainer, with vLLM and Ray | Fully asynchronous streaming, with an importance correction | A Hugging Face class for our model; our router in vLLM |
For every outside engine the work is the same. I estimated about half a day for a mapping from our Megatron checkpoint, and about a day for a model class with our router. Both would then be checked against Megatron’s logits and expert choices on the same prompts.
The simpler wins first
Less padding
Megatron’s RL training pass holds one answer per forward pass, padded to the full 1,536-token row. Our rows held about 160 real tokens. The padded share of a row is
where \(L_{\text{real}}\) counts the prompt and answer tokens, and \(L_{\text{row}}\) is the padded row length.
In words: about nine in ten tokens that the scoring passes and updates process are padding.
The padding is masked from the loss and comes after the answer, so causal attention keeps it out of the real tokens’ log-probs. But it still runs through the experts and wastes the updates’ expert compute.
Scoring and updating took 42% of the logged time, so shorter rows with a padding mask are worth trying early.
CUDA graphs
Every engine step of the main run logged “cuda graph OFF”. A CUDA graph records a sequence of GPU kernel launches once, then replays it with a single launch. That removes most of the CPU’s launch work per step, as Part 11 explains. In the control run, a dense 1.5B model on one H100, graphs cut an engine step from about 43 ms to about 6 ms.
For our MoE at expert parallelism 8, Megatron also needs the experts padded to fixed sizes during decoding. The switch is in rl_common.sh, untested on our model. In equation (3), a smaller \(\bar\tau\) shortens generation directly, because the tail is a long string of small decode steps. I have not measured by how much on our MoE.
Expert parallelism 1
At expert parallelism 1, each GPU would hold the whole model, and the all-to-all would leave generation. My estimate, unmeasured, is about 51 GB per GPU for the RL state, with the optimizer sharded over 8 GPUs. It would also test whether expert parallelism causes the first ratio’s noise.
What went wrong, and how I fixed it
- Logging took 11 s a step. The rollout code opened, appended and closed a file for every record, 11.1 ms a line on network storage. A step’s 512 rollouts made about 1,025 appends, about 11 s on GPU 0 while the others waited. One held handle per file takes 0.046 ms a line; I switched to it before GSPO started.
- A crashed run hung instead of exiting. In the rehearsal on one H100, a failed RL run sat at 0% GPU for 24 minutes, holding 25.9 GB. Megatron’s inference coordinator was a non-daemon process, so Python waited for it. As a daemon, the same crash exits about 1 s after its error, and a stall guard catches a second hang mode.
- The grader froze the loop. In the control run, the math checker spun forever on one answer at update 16. Grading runs on the thread that drives generation, so everything stopped. A 10 s CPU-time limit per grading, and no grading of cut-off answers, fixed it, with 0 timeouts after.
- CUDA graphs were silently off. The first 8-GPU RL launch stopped on a check that requires expert padding with CUDA graphs. I added the flag, which satisfied the check, but no graph was ever captured. The log said “cuda graph OFF” from the first rerun; I saw its effect only in the serving benchmark.
- My summary overstated generation. I wrote “80–90%” from the long early steps; the full count says 58%. Now I note which timer each share comes from, and recount over the whole run.
What I’d do next
In order, smallest change first:
- CUDA graphs in the rollouts, measured on our MoE at expert parallelism 8 against the 54–90 ms decode steps.
- Shorter rows with a padding mask in the scoring passes and updates.
- Megatron’s in-flight rollouts. At the commit I pinned,
--rl-partial-rolloutslets inference “continue generating rollouts while training updates the policy weights”, and--rl-generation-lagbounds the staleness. A lag of 1, with the engine’s log-probs in the correction (--rl-inference-logprobs-is-correction), would test asynchrony without a new framework. - RL at expert parallelism 1, for speed, and to settle where the first ratio’s noise comes from.
- An asynchronous stack: the checkpoint mapping, our router in SGLang, then Miles with routing replay, first synchronous and then asynchronous on split GPUs. I would compare it with my loop on throughput, the sampler–learner gap and the KL.
Run it yourself
- Hardware and time: one 8×H100 node. GSPO-A ran 45 steps in 5,277 s, with an 85-minute time cap on training.
- Before you start: the environment from the setup guide, and an SFT checkpoint (Part 7).
- Software and data: Megatron-LM at commit d6316eb45 with our patch, and the curriculum data.
# From the repository root, inside the container.
M=code/scripts/megatron
mkdir -p out
export SFT_CKPT=<your-sft-checkpoint> CURRICULUM_DIR=data/curriculum
export GROUP_SIZE=32 PROMPTS_PER_STEP=16 RL_ENV_CONFIG=code/rl/curriculum_env_medium.yaml
export GSPO_CLIP_LOW=2e-2 GSPO_CLIP_HIGH=2.7e-2
RUN_DIR=out/gspo RUN_NAME=gspo GSPO_LR=1e-6 EXIT_MINS=85 bash $M/gspo.sh > out/gspo.log 2>&1
To time the steps from the log:
# One line per update; the first of every four carries the rollouts.
grep "elapsed time per iteration" out/gspo.log | head -8
# The phases, in ms, as (min, max) over the GPUs.
grep -E "rl/rollout-collection|rl/compute-(old|ref)-logprobs|forward-backward" out/gspo.log | head -12
# Decode steps: time, active answers ("reqs: a N/128"), and whether a CUDA graph ran.
grep "cuda graph" out/gspo.log | head
To try CUDA graphs, add RL_CUDA_GRAPHS=1 to the launch; on our MoE at expert parallelism 8 this is untested.
What to expect (our numbers):
- about 2.5 minutes for a long step, 111 s for the median step, and a slower first step;
- generation and grading at about 58% of the logged time;
- “cuda graph OFF” in every engine step line, unless graphs are on;
- on 8 GPUs, a first-update median |log ratio| near 4.9e-3; on one GPU, exactly 0.
Code: code/scripts/megatron/gspo.sh, code/scripts/megatron/rl_common.sh, code/scripts/megatron/common.sh, code/rl/megatron_agent.py, code/rl/curriculum_env_medium.yaml and code/patches/megatron-d6316eb45.patch. The full sequence, from the SFT checkpoint to the evaluations, is in the RL guide; the stall guard is code/scripts/stall_guard.py.
What to take away
- A synchronous step is a sum of its phases. Measure each phase from the timers, over the whole run, not from a summary.
- Synchronous generation lasts as long as the longest answer. Here the longest answer had a median of 865 tokens per step, while the average answer was 90 tokens, so about a tenth of the decode slots did work.
- Asynchrony turns the sum into a max. It also adds policy lag, an importance correction and, for an MoE, a second router that must agree with the first.
- On one node with short answers, the ceiling was about 1.7×, before splitting the GPUs.
- Fix the simple things first: CUDA graphs, padding, and how many GPUs the experts are split over.
References
- Zheng et al., “Group Sequence Policy Optimization” (GSPO), arXiv:2507.18071. https://arxiv.org/abs/2507.18071
- Sheng, Tong et al., “Laminar: A Scalable Asynchronous RL Post-Training Framework”, EuroSys '26. https://doi.org/10.1145/3767295.3803580
- Hu et al., “MOLT: A Hugging Face-Native, Minimal, and Scalable Framework for Agentic Reinforcement Learning”, NVIDIA technical report, 2026. Code: https://github.com/NVIDIA-NeMo/labs-molt. Guide pages: asynchronous training, MoE routing.
- Fu et al., “AReaL: A Large-Scale Asynchronous Reinforcement Learning System for Language Reasoning”, arXiv:2505.24298. https://arxiv.org/abs/2505.24298
- Ma et al., “Stabilizing MoE Reinforcement Learning by Aligning Training and Inference Routers” (R3), arXiv:2510.11370. https://arxiv.org/abs/2510.11370
- RadixArk, Miles v0.1, arXiv:2609.08368. https://arxiv.org/abs/2609.08368
- The Microsoft AI Team, “RL infrastructure at Microsoft AI”, November 2026. https://microsoft.ai/news/rl-infrastructure-at-microsoft-ai/
- Chung and Du, “PocketRL: Training a 7B Language Model with Reinforcement Learning on One RTX 5090”, arXiv:2611.37942. https://arxiv.org/abs/2611.37942
- NVIDIA, Megatron-LM (commit d6316eb45). https://github.com/NVIDIA/Megatron-LM
- NVIDIA, Megatron-Bridge. https://github.com/NVIDIA-NeMo/Megatron-Bridge
- verl. https://github.com/verl-project/verl
- NVIDIA, NeMo-RL. https://github.com/NVIDIA-NeMo/RL
- slime. https://github.com/THUDM/slime
- Prime Intellect, PRIME-RL. https://github.com/PrimeIntellect-ai/prime-rl
Cite this
@misc{aboagye2026minidsv4part10,
author = {Aboagye, Prince Osei},
title = {Mini DeepSeek V4, Part 10: The RL system: synchronous or asynchronous?},
year = {2026},
howpublished = {\url{https://poaboagye.github.io/blog/10-rl-system/}}
}