- A background rollout worker keeps SGLang generation in flight and pushes completed samples into a queue.
- The trainer drains the queue, runs optimizer steps, and syncs updated weights back to rollout engines.
rollout_time + train_time toward max(rollout_time, train_time).
When to use it
The mode is especially useful for long-context math, tool-use, and agentic workloads
where generation dominates the iteration.
Enable it
Switch the entrypoint fromtrain.py to train_async.py and provide a rollout
function that owns the background worker:
Queue model
The queue is the contract. If it stays populated, the trainer does not wait for generation. If it is empty, rollout is still the bottleneck and async cannot hide it.Tuning knobs
The reference worker caps its output queue at 1000 groups, so if training is slower
than rollout the producer eventually blocks rather than growing the queue without
bound. If the queue stays at zero, rollout is the bottleneck — scale rollout capacity
or lower per-sample generation cost.
What to monitor
The reference worker logs progress to stdout, not wandb. Useful lines to grep for:--max-weight-staleness.

