6 Post-training and Alignment 7 / 7
  1. In this chapter
  2. SFT Data
  3. LoRA Fine-Tuning in Practice
  4. Reward Models
  5. Reinforcement Learning Basics
  6. Preference Optimization
  7. Reinforcement Learning for Reasoning
  8. Reasoning RL systems
All chapters →

Chapter 6 · Post-training and Alignment 6.7

Reasoning RL systems: asynchronous rollouts and policy lag

Reasoning RL joins generation, grading, learning, and weight publication. Asynchronous execution overlaps work and introduces policy lag. A runnable scheduling simulation separates elapsed time, accepted batches, and discarded trajectories.

Intermediate 9 min read Updated Companion code ↓

After this page you will be able to

  • Trace a rollout through grading, batching, policy updates, and weight publication.
  • Compare colocated, disaggregated synchronous, and asynchronous execution.
  • Explain the version conventions for behavior and learner policy probabilities.
  • Use a scheduling simulation and slices to inspect lag, discards, and effective training volume.
On this page
  1. Follow one trajectory through the system
  2. Colocated, disaggregated synchronous, and asynchronous training
  3. The behavior probability belongs to the actor
  4. Experiment: time saved and work retained
  5. Run controlled comparisons before tuning
  6. Summary and exercises
  7. Quick self-check
  8. Check whether discards change the task mix
  9. Further reading
  10. FAQ

Reasoning RL generates responses, grades them, and computes gradients. Separate generation and training devices can do this work concurrently. Overlap introduces an algorithmic issue: the learner may receive trajectories from older weights. Compare usable training data, policy lag, memory, and held-out quality together.

Asynchronous rollout and training pipeline An actor generates trajectories and sends them to a versioned queue. A grader returns rewards, a learner consumes trajectories and updates policy, and new weights flow back to the actor. Queue delays can increase policy lag. Actorpolicy version v Trajectory queuetask, probability, version Graderreward and outcome Learnerconsume and update publish policy v + 1Longer queue waits can widen behavior and learner policy lag
Asynchrony overlaps sampling and training. Track trajectory versions, queue age, and discard reasons together.

Follow one trajectory through the system

In reinforcement learning with verifiable rewards (RLVR), an actor reads a problem and samples a response using its current weights. A verifier or environment produces the reward and outcome. A learner forms batches, estimates advantages, and publishes updated weights. The NeMo RL lecture from Berkeley Scalable AI shows the boundaries among generation, training, the environment, and weight transfer.

StageRecord at leastCommon sources of delay
GenerationTask ID, sampling settings, behavior version, response tokens and masksPrefill, decoding tails, KV cache
Environment and gradingGrader version, final state, reward, failures and timeoutsTools, multi-turn state, verification
BatchingGroup ID, availability, discard reason, queue ageLong trajectories and missing group members
UpdateModel version, loss, sample and token countsForward and backward passes, communication, optimizer
Weight publicationVersions produced, sent, and activeShard conversion, transfer, serving reload

Group-relative methods need to know which responses shared a problem and which ones contributed to group statistics. Timeouts, truncation, and staleness filters can change group size. Decide whether to resample, drop the group, or regroup according to the algorithm. Record the resulting task mix. Keep verifier failures separate from wrong answers unless the reward contract explicitly counts a timeout as failure.

Colocated, disaggregated synchronous, and asynchronous training

Colocated systems alternate generation and training on the same devices. This simplifies weight consistency and is useful when device capacity is tight. The phases compete for memory, and stragglers can leave devices idle.

A disaggregated system can preserve a synchronization barrier, allowing the actor to wait for the latest weights before generating the next batch. Measure that version first to isolate resource separation and transfer costs. Relaxing barriers allows concurrent work. When generation outruns consumption, trajectories wait longer in queues. Queue limits, waiting for weights, and discarding stale work are ways to control that lag.

The behavior probability belongs to the actor

Let μ\mu be the sampling policy and πθ\pi_\theta the policy being updated. If hih_i denotes the prompt and response prefix, the ratio for action token yiy_i is:

ri(θ)=exp⁡(log⁡πθ(yi∣hi)−log⁡μ(yi∣hi))r_i(\theta)=\exp\bigl(\log \pi_\theta(y_i\mid h_i) -\log \mu(y_i\mid h_i)\bigr)

The stored behavior probability must correspond to the distribution that produced the sample. When temperature or truncation is active, check that the probability convention matches the algorithm’s assumptions and that templates, token boundaries, and masks align. Recomputing the denominator with current weights hides the old trajectory’s origin. Clipping ratios limits some extreme updates. Strong policy drift can still make old data unsuitable. Version lag is inexpensive to track. Also inspect ratio distributions, clipping fractions, and held-out quality because the same version gap can represent different amounts of drift.

Pin the policy version for the trajectory or record the per-step behavior version according to the framework’s contract. A long response can otherwise span a weight change with no provenance. Have the generation backend report when weights become active. Sending them and using them are separate events.

With multiple responses per problem, record where rewards are normalized. If four responses first contribute to group statistics and only two survive later filtering, reusing the original advantages or recomputing on the remaining two creates different training objectives. Keep raw trajectories, verification results, and loss-bearing batches distinct in storage. Save the selection rule and its version for reproducibility. Comparing schedules at the same number of usable trajectories is closer to algorithm cost than counting issued generation requests.

Experiment: time saved and work retained

Simulate six batches with one actor and one learner. Updates take a fixed time and one generation is unusually slow. A version is published at update completion and becomes visible immediately, including at an equal timestamp. Batches enter training in generation order. A batch that exceeds the lag limit at its training turn is dropped. Durations are illustrative. The simulation has no model, device communication, reward, or convergence behavior. It ran with Python 3.12.14 on an Apple M2 Max.

from __future__ import annotations

from bisect import bisect_right
from dataclasses import dataclass


@dataclass(frozen=True)
class Trace:
    elapsed: int
    accepted: int
    dropped: int
    lags: tuple[int, ...]


def simulate(
    durations: list[int],
    update_time: int,
    *,
    overlap: bool,
    max_lag: int,
) -> Trace:
    """Simulate FIFO training with a fixed update time."""
    if update_time <= 0 or max_lag < 0 or min(durations, default=1) <= 0:
        raise ValueError("durations must be positive and max_lag nonnegative")
    actor_free = 0
    publish_times: list[int] = []
    lags = []
    for duration in durations:
        learner_free = publish_times[-1] if publish_times else 0
        start = actor_free if overlap else max(actor_free, learner_free)
        actor_free = start + duration
        train_start = max(actor_free, learner_free)
        actor_version = bisect_right(publish_times, start)
        train_version = bisect_right(publish_times, train_start)
        lag = train_version - actor_version
        lags.append(lag)
        if lag <= max_lag:
            publish_times.append(train_start + update_time)
    accepted = len(publish_times)
    elapsed = max(actor_free, publish_times[-1] if accepted else 0)
    return Trace(elapsed, accepted, len(durations) - accepted, tuple(lags))

durations = [3, 3, 9, 2, 2, 2]
serial = simulate(durations, 6, overlap=False, max_lag=0)
bounded = simulate(durations, 6, overlap=True, max_lag=1)
permissive = simulate(durations, 6, overlap=True, max_lag=9)
assert serial.accepted == permissive.accepted == 6
assert all(lag == 0 for lag in serial.lags)
assert bounded.elapsed < permissive.elapsed < serial.elapsed
assert bounded.dropped > 0 and max(permissive.lags) > 1
for label, trace in zip(
    ('serial', 'bounded', 'permissive'), (serial, bounded, permissive)
):
    print(label, trace.elapsed, trace.accepted, trace.lags)
serial 57 6 (0, 0, 0, 0, 0, 0)
bounded 29 4 (0, 1, 2, 0, 1, 2)
permissive 39 6 (0, 1, 2, 1, 2, 3)

The widget below draws this replay as a timeline: the top lane is the actor’s six generations, the bottom lane the learner’s accepted updates, dropped batches marked in red — switch the three modes to see elapsed time, effective batches and the max version gap.

Serial execution consumes every batch at zero lag. Permissive overlap consumes the same six batches sooner, while accepting older data. Bounded overlap ends even earlier and completes fewer updates because it discards work. Report usable batches and usable sample throughput alongside elapsed time. To compare convergence, measure elapsed time or GPU-hours to a fixed held-out quality target.

Run controlled comparisons before tuning

  1. Fix the model, problems, reward, response length limits, and hardware budget. Measure each stage and held-out quality in a synchronous baseline.
  2. Separate generation and training while preserving synchronization. Measure peak memory and weight transfer separately.
  3. Allow a small amount of overlap. Log staleness, discard rates, and usable tokens by task type and length.
  4. Compare quality at the same effective update budget. For a cost comparison, record total GPU-hours to a specified quality.

Generation tokens per second can rise without raising training throughput. Early termination, verifier failures, filters, and retries separate the measurements. Count generated tokens, loss-bearing tokens, and completed updates independently. Break them down by task difficulty or response length to detect systematic discards. To measure length sensitivity, vary the length mix without changing the sampling and grading versions at the same time.

Summary and exercises

  • Measure generation, grading, batching, and updates with a shared trajectory ID.
  • Asynchrony trades policy freshness for overlap. Track behavior probabilities and when weights become active.
  • Compare usable training volume, held-out quality, and GPU-hours, with discarded work visible.

Quick self-check

1. What should travel with a generated trajectory?

  • The actual behavior policy version and sampling log probabilities.
  • Only the newest learner weights.

Replay needs the distribution that produced the action.

2. What needs recounting after staleness filtering?

  • Only the raw generation rate.
  • Accepted batches, loss-bearing tokens, and task mix.

Filtering changes training volume and can change the sample composition.

3. What does receipt of a weight file guarantee?

  • Check separately when that version is active for generation.
  • Past trajectories automatically came from the new version.

The version that produced an existing action is fixed.

4. How should you decide whether overlap reduced training cost?

  • Compare only the time for a fixed number of generation requests.
  • Compare GPU-hours to the same held-out quality target.

The runs may complete different amounts of effective training.

Check whether discards change the task mix

Suppose longer problems lose more trajectories to staleness. Specify two diagnostics and a controlled comparison that could test a remedy.

Worked answer

By task type and generation length, record generated batches, accepted batches, and lag distributions. Measure each group’s share of loss-bearing tokens. Compare a synchronous baseline with an asynchronous run that uses a shorter queue on the same problem set and budget. Check slice discard rates and held-out quality, and record the time difference.

Further reading

FAQ

Does disaggregation imply asynchronous training?
Disaggregation allocates separate devices. A barrier can still require new weights before each batch. Asynchrony lets generation continue across updates and requires tracking lag.
How can you measure policy lag?
Record the behavior version at sampling and the version at the time the learner uses the trajectory. Track their difference along with ratios that reflect policy drift.
Is a shorter asynchronous run always better?
Compare accepted updates and held-out quality. A short run can discard more work, so elapsed time alone cannot establish faster convergence.