Skip to content

v0.11.1.dev68

@mikasenghaas mikasenghaas tagged this 27 Nov 02:33
## Summary

- Bump `deps/verifiers` to `b181a1e02`, the merged
PrimeIntellect-ai/verifiers#3282: env workers get each memory snapshot
back as soon as the provider names it, not after the box has stopped and
resumed.
- `ckpt.rollouts_save_timeout` is now a deadline per rollout: the `save`
request carries it to the env workers, and a rollout that misses it
starts over. A pool that does not reply within `SAVE_REPLY_SECONDS` (600
s) after the deadline still contributes no restore points. The budget is
generous because restore files with top-k logprobs take minutes to write
(62 s at top-20 and 168 s at top-64 for 10k rollouts in a load test). It
delays a save only when a pool hangs.
- The publish-barrier hook (`checkpoint_rollouts`) returns once the
pipeline is recorded, the saved rollouts go on, and the arrays of the
cut batch are written (`batch_refs`, `persist_arrays`). The trainer
takes that batch through `send()`, outside `sink_lock`, once its
broadcast completes, and frees its arrays after it fetched them. A new
`write_rollout_ckpt` task then keeps `sink_lock` while it writes the
other training arrays and forks the writer, so the sink deletes none of
them meanwhile.
- Docs: the start-over list in `docs/training.md` covers the new cases.

## Why

In a prod run, the trainer waited about 15.5 minutes in its weight
broadcast for one rollout checkpoint:

| Phase | Time |
|---|---|
| Env workers taking memory snapshots (slowest of 1,749 workers) | 12m
56s |
| Training arrays written under the sink lock | 1m 27s |
| Writer fork | 10 s |

Most of the snapshot time was the box stopping and resuming, which the
checkpoint does not need. The tail came from resumes the platform
refused ("node budget exhausted") and the client retried for up to 10
minutes.

## Breaking

- `ckpt.rollouts_save_timeout` (and
`orchestrator.ckpt.rollouts_save_timeout`) now bounds each rollout's
memory checkpoint, not each env worker pool's whole save. Its default
drops from 600 to 120 seconds. A config that set it for a pool's whole
save can keep its value. The value now also bounds the trainer's stall,
plus the time the pools take to write the restore files.

## Verification

- Unit tests (`test_rollout_ckpt.py`, `test_env_replicas.py`,
`test_env_worker_save.py`, `test_env_client.py`, `test_configs.py`): 453
passed. New tests check that the barrier ends after the cut batch's
arrays and before the other arrays are written, with the sink still
locked, and that a barrier that cannot record the pipeline fails and
releases the rollouts.
- Reverse-text on Prime sandboxes
(`examples/basic/reverse-text/rl.toml`, prime runtime, `ckpt.interval =
2`, `ckpt.rollouts = true`, 8 steps):
- Before (earlier run of the same recipe): saves of 7.6 s, 11.2 s and
9.1 s.
- After: saves of 1.2 s, 1.0 s and 0.9 s (run A). A run resumed from run
A's step 4 restored 4 rollouts, and all 4 finished. Its own step-6 save
of 64 restore points took 2.0 s. No episode failed in either run.

### A/B: ScaleSWE, main against this branch

Both arms ran at the same time with the same config:
`recipes/qwen3.6-35b-a3b` with `recipes/data/swe.toml` (bash harness in
Prime sandboxes), 1 trainer node and 1 inference node each, NCCL weight
broadcast, no evals, rollout checkpoints every 2 steps. The same
uncommitted log line in the watcher timed the publish barrier, which is
what the trainer waits for in its broadcast. "Resume retries" counts the
"node budget exhausted" refusals: during the barrier on main, and in the
8 minutes after the save on this branch, where they run in the
background.

| Step | Barrier, main | Barrier, branch | Restore points, main / branch
| Resume retries, main / branch |
|---|---|---|---|---|
| 2 | 38.0 s | 6.9 s | 774 / 1,052 | 0 / 1 |
| 4 | 67.2 s | 8.8 s | 1,257 / 1,222 | 7 / 67 |
| 6 | 59.3 s | 5.2 s | 884 / 762 | 50 / 21 |
| 8 | 301.5 s | 2.8 s | 334 / 322 | 42 / 15 |

On main, the barrier grows with the number of boxes and with refused
resumes: at step 8, a few boxes that could not resume held the trainer
for 5 minutes. On this branch, the resumes and their retries run after
the save returns, so the barrier stays under 10 s. At most 15 in-flight
rollouts per save started over in either arm.

### A/B: wordle, main against this branch

Both arms ran at the same time on one node each:
`examples/basic/wordle/rl.toml` with the player on Prime sandboxes,
rollout checkpoints every 2 steps, batch 512. The same uncommitted log
line in the watcher timed the publish barrier, which is what the trainer
waits for. Wordle rollouts are interactions and take no memory snapshot,
so this A/B covers the move of the array write out of the barrier, not
the snapshot change.

| Step | Barrier, main | Barrier, branch | Save, main | Save, branch |
Array write, main (all in the barrier) | Array write, branch (cut batch
in the barrier + rest after) |
|---|---|---|---|---|---|---|
| 2 | 132.8 s | 110.8 s | 116 s | 107 s | 15.9 s | 3.8 s + 11.3 s |
| 4 | 28.0 s | 16.7 s | 15.4 s | 15.3 s | 12.6 s | 1.4 s + 9.0 s |
| 6 | 11.5 s | 4.7 s | 0.1 s | 3.3 s | 11.3 s | 1.4 s + 7.7 s |
| 8 | 5.7 s | 1.3 s | 0.0 s | 0.0 s | 5.7 s | 1.3 s + 7.3 s |

The saves took no snapshot in either arm. Their time at steps 2 and 4 is
the save request waiting on env workers that were busy booting
sandboxes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches the rollout checkpoint publish barrier and changes
`rollouts_save_timeout` semantics/default, which can increase rollouts
that restart on resume if the 120s budget is too tight.
> 
> **Overview**
> Shortens how long the **trainer blocks on weight broadcast** during
rollout checkpoints by splitting the publish-barrier work and tightening
snapshot timeouts.
> 
> **Per-rollout snapshot deadline:** `ckpt.rollouts_save_timeout`
default drops **600 → 120** and now bounds **each running rollout’s
memory checkpoint**, forwarded through `SaveRequest.timeout` to env
workers via `save_all`. Replicas still get up to **`SAVE_REPLY_SECONDS`
(600)** after that deadline to finish writing restore files; late pools
contribute no restore points.
> 
> **Earlier barrier return:** `checkpoint_rollouts` records snapshots,
then spawns `write_rollout_ckpt` and unblocks the trainer as soon as the
pipeline snapshot is taken, rollouts are **released**, and
**`batch_refs` arrays** for the batch about to ship are persisted
(`persist_arrays` / `persist_open_work` with `skip`). Remaining training
arrays and the forked checkpoint writer run in `ckpt_task` while holding
`sink_lock`.
> 
> **Docs** expand when rollouts start over (per-rollout timeout, failed
stop/restore, pool no-reply after 600s).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
882667a1de3c17d7e35ac276ccb30ec60294140e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Assets 2
Loading