Compare commits

...
Author SHA1 Message Date
1ef8f1a843 chore: bump verifiers and research-environments to latest main (#3172)
* chore: bump verifiers and research-environments to latest main

verifiers f646beb37 -> f6e420b99 (0.2.2.dev66, 17 commits) and
research-environments 6a2dee6fc -> ccb375ce5 (main + the scicode-v1
pin relax from research-environments#740).

Adaptations to the verifiers changes:
- Episode.error is now Episode.errors + a last_error property (vf#2187)
- verifiers.v1.loaders / verifiers.v1.push moved into
  verifiers.v1.utils.{loaders,platform} (vf#2204)
- verifiers floors bumped to 0.2.2.dev66 (root and prime-rl-configs)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump research-environments to latest main

ccb375ce5 -> 9a57c713c: research-environments#740 refreshed on current
main, picking up the ViRL39K v1 taskset (RE#689) and the taskset prompt
config fixes (RE#742). verifiers main is unchanged since f6e420b99.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump verifiers to 0.2.2.dev73 (per-rollout clients)

f6e420b99 -> 576506d66 (7 commits). vf#2218 builds one client per
rollout with a process-wide elastic renderer pool: TrainClientConfig
drops pool_size for a multiplex knob, and the config module moved from
clients.config to configs.client. The orchestrator config follows suit
(pool_size -> multiplex, None = client default). Floors to dev73.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore!: pin research-environments to the scicode merge commit, drop orchestrator.multiplex

deps/research-environments -> 21a284618 (research-environments#740 on
main). The orchestrator-level renderer knob (pool_size, briefly
multiplex) is removed instead of renamed: clients resolve inside env-
server workers, whose concurrency is already bounded per env by
serve.pool.multiplex (default 128, below the client-side renderer
default of 256), so each worker warms one renderer and the elastic pool
grows on demand.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(orchestrator): read the agent timing span

vf#2187 renamed Timing.generation to Timing.agent (GenerationSpan ->
AgentSpan); the timing metrics group crashed every RL run's first
to_wandb. Metric keys follow (timing/agent, timing/agent/{model,
harness}). The unit fixture missed it because mk() duck-types Trace;
its namespace now mirrors the real field names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 13:43:28 -07:00
e229a286f2 fix: checkpoint and resume the orchestrator train data position (#3164)
* fix(orchestrator): checkpoint and resume the train data position

Shuffle each finite env's task table with seed=epoch (1-indexed) so the
permutation is reproducible, snapshot per-env {epoch, cursor} into
Progress.data_positions at checkpoint time, and restore + log the
position on resume.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(orchestrator): track and fast-forward infinite taskset cursors on resume

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(orchestrator): drop old-checkpoint load compat

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(orchestrator): make the data position first-class checkpoint state

TrainSource is a torch Stateful (state_dict/load_state_dict) saved under
its own train_source key next to progress, mirroring the SFT dataloader.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: simplify orchestrator checkpoint table row

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(orchestrator): simplify TrainSource surface

Hardcode the env-choice seed, drop the torch Stateful base (nothing
consumes the protocol), log the restored position from ckpt.load, and
rename _shuffled to _shuffle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(orchestrator): make the cross-env dispatch sequence reproducible

Advance the env-choice RNG exactly once per dispatched example - a draw
whose permit cost doesn't fit is held (head-of-line) instead of redrawn -
and checkpoint the RNG state and pending draw with the per-env positions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(orchestrator): save the interval checkpoint on the event loop

state_dict() on a to_thread worker raced the dispatcher mutating
TrainSource; the payload is tiny, so snapshot and write synchronously.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 11:31:56 -07:00
2ffe374e02 fix(trainer): add B300/GB200/GB300 peak FLOPS for MFU (#3168)
B300 device names fell through to the A100 fallback (312 TFLOPS),
inflating reported MFU ~7x. Add dense BF16 peaks per NVIDIA datasheets:
GB200/GB300 superchips at 2.5 PFLOPS, HGX B200/B300 at 2.25 PFLOPS.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-01 21:51:18 +02:00
bbb90a1b41 chore(configs): expand inline TOML tables to sections (#3167)
Every checked-in config, example, and doc snippet now uses [section]
headers instead of key = { ... } inline tables. Purely stylistic: all
48 rewritten TOML files parse identically to their previous versions.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 15:24:35 -07:00
Matej SirovatkaandGitHub 9f0d41e23d chore(inference): bump vLLM to 0.26.0 (#3166) 2026-07-30 21:57:55 +02:00
e0638c7eb6 chore: adapt to the verifiers trace record cleanups (#3157)
* rename training environments to sources

* fix CPU test config fixtures

* rename evaluation environments to sources

* chore(orchestrator)!: rename max_inflight_rollouts to max_inflight_episodes

A dispatcher permit has always bought one episode, not one rollout: for a v1
env one `run` request is one episode (however many agents play it), and a
legacy group-scoring call reserves one permit per bridged v0 rollout, each of
which is its own single-agent episode. Name the knob what it counts.

`max_inflight_rollouts` still parses as an alias, as `rollouts_per_example`
does for `group_size`.

* feat(orchestrator)!: compose the verifiers env, serve and legacy blocks

verifiers split `EnvServerConfig` into three blocks, so an env entry composes
them instead of inheriting one class:

    [[orchestrator.train.source]]
    env    = { taskset = { id = "..." } }   # what runs
    serve  = { pool = { ... }, address, max_concurrent }   # how it's hosted
    legacy = { id, args }                   # a classic v0 env instead

`serve.pool` sizes the spawned server (was `pool`), `serve.address` points at an
external one (was `address`), and `serve.max_concurrent` bounds one worker's
episodes in flight — usually left unset, since `max_inflight_episodes` is the
run's bound. Each moved key raises with a pointer home, including the
`num_workers` shorthand the old validator migrated silently.

BREAKING: `pool` / `address` / `num_workers` on an env entry move under `serve`,
and a v0 env's `id` / `args` / `extra_env_kwargs` move under `legacy`.

TEMPORARY: `deps/verifiers` points at the `feat/one-agent-per-episode` branch
(PrimeIntellect-ai/verifiers#2157) so the two sides can be run together; re-pin
to a merged `main` commit before this lands.

* fix the source-config readers the compose commit missed

The Prime monitor still built its run-registration payload from `env.id`, which
the composed entry doesn't have — `AttributeError` at registration whenever
Prime monitoring is on. It reads `env_id` now, the property that spans both the
v1 and the v0 shape.

The packer's fixture still used the bare `id` shorthand, so its three runs were
rejected at config parse and skipped by `discover_runs`. Full CPU unit suite:
416 passed.

Re-pins `deps/verifiers` to the branch tip of verifiers#2157, which fixes the
same class of stale access on that side (`config.legacy.id`). Still a branch
commit — re-pin to a merged `main` before this lands.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* spell the env annotation out instead of vf.EnvField

verifiers dropped the `EnvField` alias, which was only ever
`SerializeAsAny[EnvConfig]` under a name that collided with `env_field()`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* declare the env default with the factory verifiers exports

`vf.env_field()` is gone: it only wrapped `Field(default_factory=...)`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* inline the legacy helpers, use the config class as the default

Follows verifiers dropping the three `configs/legacy.py` helpers and the
`single_agent_env_config` factory: `is_legacy` and `env_id` are one-liners here,
the mixed-run refusal is spelled out in `validate_env`, and the `env` default is
`vf.SingleAgentEnvConfig()`. `env.max_concurrent` now works as an alias for
`env.max_concurrent_agents`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* drop the serving-key pointers here too

The same call as verifiers a0ebc408: `num_workers` / `pool` / `address` on a source
entry now fail as an ordinary `extra_forbidden` instead of naming their new home.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* bump verifiers: no max_concurrent alias on the env block

`env.max_concurrent` used to bound a served worker's agent runs across episodes, so
accepting it as `max_concurrent_agents` multiplied it by the episodes in flight. It
errors now, like every other moved key. 416 unit tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* bump verifiers to 0.2.2.dev43 (merged main)

deps/verifiers d0bb0ffe5 -> fcb48822e, which is the squash-merge of the composed
env/serve/legacy config blocks (#2157) plus everything else since the last bump:
Harbor 0.20.0 (#2161), runtime-blamed box failures (#2156), standalone MCP clients
pinned to v1 (#2155), and the v1 test/E2E split (#2127).

Lock: harbor 0.14.0 -> 0.20.0, which drops claude-agent-sdk and datasets from its
own deps and adds filelock/platformdirs, so those move with it.

Replaces the temporary branch pin this PR carried.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: spawn the env server again, and let a pip-only install resolve verifiers

Two CI failures from the compose commit.

The orchestrator stopped spawning env servers. It decides spawn-vs-connect by
`address is None`, and prime-rl's own field defaulted to None; `vf.ServingConfig`
defaults to `tcp://127.0.0.1:5000`, so every env looked external and the run waited
120s for a server nobody started. It now asks whether the address was *pinned*
(`model_fields_set`), so an unset `[serve]` spawns on a free port as before, and
pinning any address — including verifiers' own default — connects.

The slim `prime-rl-configs` wheel is installed from /tmp with no workspace context,
so `verifiers` resolves from PyPI, where `>=0.2.1` picks stable 0.2.1 — no
`SingleAgentEnvConfig`. Floor is `>=0.2.2.dev43` now, a pre-release specifier so the
dev release is eligible.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: adapt to the verifiers trace record cleanups

Companion to PrimeIntellect-ai/verifiers#2172: record_* mutators, required
agent seat and RunInfo.id, last_error, and agent.name/.trainable reads.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: re-pin verifiers to merged main (f646beb37)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 10:34:53 -07:00
87 changed files with 3014 additions and 2208 deletions
+14 -3
View File
@@ -34,9 +34,20 @@ max_completion_tokens = 768
[[orchestrator.train.source]]
name = "alphabet-sort"
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "alphabet-sort-v1"
min_turns = 3
max_turns = 5
[orchestrator.train.source.env.taskset.task]
power_per_turn = false
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[ckpt] # Checkpoint at the end of training
+11 -3
View File
@@ -21,9 +21,17 @@ seq_len = 8192
[[orchestrator.train.source]]
name = "hendrycks-math"
env.taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "math-env-v1"
dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B"
dataset_subset = "default"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[trainer.model]
seq_len = 16384
+9 -3
View File
@@ -24,9 +24,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+9 -3
View File
@@ -42,9 +42,15 @@ max_completion_tokens = 512
[[orchestrator.train.source]]
name = "wiki-search"
env.taskset = { id = "wiki-search-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "wiki-search-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[ckpt] # Checkpoint at the end of training
+9 -3
View File
@@ -23,9 +23,15 @@ group_size = 8
[[orchestrator.train.source]]
name = "wordle"
env.taskset = { id = "wordle-v1" }
env.player.harness = { id = "null" }
env.player.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "wordle-v1"
[orchestrator.train.source.env.player.harness]
id = "null"
[orchestrator.train.source.env.player.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 1024
+17 -3
View File
@@ -24,9 +24,23 @@ max_completion_tokens = 384
[[orchestrator.train.source]]
name = "alphabet-sort"
env.taskset = { id = "alphabet-sort-v1", min_turns = 2, max_turns = 2, min_names_per_turn = 1, max_names_per_turn = 3, task = { similarity_power = 4, power_per_turn = false } }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "alphabet-sort-v1"
min_turns = 2
max_turns = 2
min_names_per_turn = 1
max_names_per_turn = 3
[orchestrator.train.source.env.taskset.task]
similarity_power = 4
power_per_turn = false
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference]
@@ -28,9 +28,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference]
enable_lora = true
@@ -27,9 +27,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference]
enable_lora = true
@@ -27,9 +27,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference]
gpu_memory_utilization = 0.7
@@ -16,9 +16,15 @@ max_completion_tokens = 128
[[train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[train.source.env.taskset]
id = "reverse-text-v1"
[train.source.env.agent.harness]
id = "null"
[train.source.env.agent.runtime]
type = "subprocess"
[ckpt]
interval = 10
@@ -39,9 +39,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -52,9 +58,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
@@ -45,9 +45,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -58,9 +64,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
@@ -25,9 +25,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference]
@@ -24,9 +24,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference]
+14 -3
View File
@@ -20,9 +20,20 @@ group_size = 16
[[orchestrator.train.source]]
name = "alphabet-sort"
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "alphabet-sort-v1"
min_turns = 3
max_turns = 5
[orchestrator.train.source.env.taskset.task]
power_per_turn = false
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 768
+20 -6
View File
@@ -20,20 +20,34 @@ seq_len = 8192
[[orchestrator.train.source]]
name = "hendrycks-math"
env.taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "math-env-v1"
dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B"
dataset_subset = "default"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 50
[[orchestrator.eval.source]]
name = "aime2024"
env.taskset = { id = "aime24-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
group_size = 32
[orchestrator.eval.source.env.taskset]
id = "aime24-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer]
[trainer.model]
+9 -3
View File
@@ -20,9 +20,15 @@ group_size = 16
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 128
+9 -3
View File
@@ -25,9 +25,15 @@ enforce = true
[[orchestrator.train.source]]
name = "wiki-search"
env.taskset = { id = "wiki-search-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "wiki-search-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 512
+9 -3
View File
@@ -20,9 +20,15 @@ group_size = 16
[[orchestrator.train.source]]
name = "wordle"
env.taskset = { id = "wordle-v1" }
env.player.harness = { id = "null" }
env.player.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "wordle-v1"
[orchestrator.train.source.env.player.harness]
id = "null"
[orchestrator.train.source.env.player.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 1024
@@ -22,9 +22,16 @@ max_completion_tokens = 64
[[orchestrator.train.source]]
name = "color-codeword"
env.taskset = { id = "color-codeword-v1", images_per_turn = 1 }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "color-codeword-v1"
images_per_turn = 1
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[trainer]
+14 -3
View File
@@ -26,9 +26,20 @@ alpha = 0.1
[[orchestrator.train.source]]
name = "alphabet-sort"
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "alphabet-sort-v1"
min_turns = 3
max_turns = 5
[orchestrator.train.source.env.taskset.task]
power_per_turn = false
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 512
+18 -6
View File
@@ -23,9 +23,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -36,9 +42,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+18 -6
View File
@@ -23,9 +23,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -36,9 +42,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+27 -9
View File
@@ -33,15 +33,27 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text-grpo"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.train.source]]
name = "reverse-text-opd"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.train.source.algo]
type = "opd"
@@ -59,9 +71,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+18 -6
View File
@@ -35,9 +35,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -48,9 +54,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+18 -6
View File
@@ -35,9 +35,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -48,9 +54,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 1e-4
+30 -10
View File
@@ -23,11 +23,21 @@ max_completion_tokens = 512
[[orchestrator.train.source]]
name = "kuhn-poker"
env.taskset = { id = "kuhn-poker-v1" }
env.player0.harness = { id = "null" }
env.player0.runtime = { type = "subprocess" }
env.player1.harness = { id = "null" }
env.player1.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "kuhn-poker-v1"
[orchestrator.train.source.env.player0.harness]
id = "null"
[orchestrator.train.source.env.player0.runtime]
type = "subprocess"
[orchestrator.train.source.env.player1.harness]
id = "null"
[orchestrator.train.source.env.player1.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -38,11 +48,21 @@ max_completion_tokens = 512
[[orchestrator.eval.source]]
name = "kuhn-poker"
env.taskset = { id = "kuhn-poker-v1" }
env.player0.harness = { id = "null" }
env.player0.runtime = { type = "subprocess" }
env.player1.harness = { id = "null" }
env.player1.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "kuhn-poker-v1"
[orchestrator.eval.source.env.player0.harness]
id = "null"
[orchestrator.eval.source.env.player0.runtime]
type = "subprocess"
[orchestrator.eval.source.env.player1.harness]
id = "null"
[orchestrator.eval.source.env.player1.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+18 -6
View File
@@ -31,9 +31,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -44,9 +50,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+18 -6
View File
@@ -40,9 +40,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -53,9 +59,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+18 -6
View File
@@ -40,9 +40,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 1
@@ -53,9 +59,15 @@ max_completion_tokens = 128
[[orchestrator.eval.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 1e-4
+1 -1
+1 -1
+59 -21
View File
@@ -100,7 +100,9 @@ Echo also takes an optional user-supplied token filter that narrows the role sel
```toml
[orchestrator.algo.filter]
import_path = "my_module.drop_warnings"
kwargs = { patterns = ["WARNING"] }
[orchestrator.algo.filter.kwargs]
patterns = ["WARNING"]
```
```python
@@ -121,18 +123,32 @@ Both components resolve per environment. Each env inherits `[orchestrator.algo]`
type = "grpo"
[[orchestrator.train.source]]
name = "math"
env.taskset = { id = "math-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
# inherits the top-level grpo
name = "math" # inherits the top-level grpo
[orchestrator.train.source.env.taskset]
id = "math-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.train.source]]
name = "terminal"
env.taskset = { id = "terminal-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "subprocess" }
algo = { type = "echo" } # this env runs its own algorithm
[orchestrator.train.source.env.taskset]
id = "terminal-v1"
[orchestrator.train.source.env.agent.harness]
id = "bash"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
# this env runs its own algorithm
[orchestrator.train.source.algo]
type = "echo"
```
### The Algorithm Classes
@@ -253,7 +269,9 @@ Wire it up:
[trainer.loss]
type = "custom"
import_path = "my_module.ppo_clip_loss"
kwargs = { clip_eps = 0.2 }
[trainer.loss.kwargs]
clip_eps = 0.2
```
The dataclasses:
@@ -346,12 +364,22 @@ episode_agents = ["solver"]
[[orchestrator.train.source]]
name = "proposer-solver"
group_size = 4 # proposed problems per source task
env.taskset = { id = "proposer-solver-v1" }
env.n = 4 # solver attempts per proposed problem
env.proposer.harness = { id = "null" }
env.proposer.runtime = { type = "subprocess" }
env.solver.harness = { id = "null" }
env.solver.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "proposer-solver-v1"
[orchestrator.train.source.env.proposer.harness]
id = "null"
[orchestrator.train.source.env.proposer.runtime]
type = "subprocess"
[orchestrator.train.source.env.solver.harness]
id = "null"
[orchestrator.train.source.env.solver.runtime]
type = "subprocess"
```
`group_size` controls how many problems are proposed from each source task. `env.n` controls how many solvers attempt each proposed problem. If a comparison contains only one trace—for example, a solver when `env.n = 1`—its advantage is zero and the zero-advantage filter removes it.
@@ -371,11 +399,21 @@ decay = 0.95
[[orchestrator.train.source]]
name = "kuhn-poker"
env.taskset = { id = "kuhn-poker-v1" }
env.player0.harness = { id = "null" }
env.player0.runtime = { type = "subprocess" }
env.player1.harness = { id = "null" }
env.player1.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "kuhn-poker-v1"
[orchestrator.train.source.env.player0.harness]
id = "null"
[orchestrator.train.source.env.player0.runtime]
type = "subprocess"
[orchestrator.train.source.env.player1.harness]
id = "null"
[orchestrator.train.source.env.player1.runtime]
type = "subprocess"
```
Both of `kuhn-poker-v1`'s agents late-bind to the run's own model — shared-policy self-play against a continuously improving opponent. Pin one agent to a frozen endpoint (`env.player1.model = ...`) for asymmetric play; its traces are marked untrainable by the env and never reach the advantage computation. A single-agent env under `rae` degrades to REINFORCE with an EMA baseline.
+34 -11
View File
@@ -97,7 +97,7 @@ Overlay TOMLs **replace** lists wholesale — an overlay that wants to add one i
### Dicts
CLI takes a JSON literal. TOML uses a table or inline-table. CLI dicts deep-merge with TOML dicts — CLI keys win on conflict but don't wipe the file's keys:
CLI takes a JSON literal. TOML uses a table. CLI dicts deep-merge with TOML dicts — CLI keys win on conflict but don't wipe the file's keys:
```bash
uv run rl @ rl.toml --orchestrator.train.source.0.args \
@@ -106,7 +106,10 @@ uv run rl @ rl.toml --orchestrator.train.source.0.args \
```toml
[[orchestrator.train.source]]
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
[orchestrator.train.source.args]
dataset_name = "openai/gsm8k"
dataset_subset = "main"
```
### Optional Sub-Configs
@@ -149,23 +152,43 @@ Training and evaluation sources are arrays of tables. Set one source per environ
```toml
[[orchestrator.train.source]]
name = "gsm8k"
env.taskset = { id = "gsm8k-v1", split = "train" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
ratio = 3 # 75% of batches
[orchestrator.train.source.env.taskset]
id = "gsm8k-v1"
split = "train"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
ratio = 1 # default — 25% of batches
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.eval.source]]
name = "gsm8k-eval"
env.taskset = { id = "gsm8k-v1", split = "test" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "gsm8k-v1"
split = "test"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
```
`ratio` defaults to `1` (equal weight per env); values are relative weights normalized to probabilities across envs.
+17 -7
View File
@@ -174,11 +174,17 @@ Every deployment fronts its vLLM engines with a single global router — it list
```toml
[inference.router] # or [router] for the standalone inference entrypoint
type = "llm-d" # "vllm-router" (default) or "llm-d"
# llm-d-only knobs (all optional):
scorers = { "prefix-cache-scorer" = 3.0, "active-request-scorer" = 2.0 } # base, applied to every profile
prefill_scorer_overrides = { "queue-scorer" = 2.0, "kv-cache-utilization-scorer" = 2.0 } # merged onto the P/D prefill profile
decode_scorer_overrides = {} # merged onto the P/D decode profile
non_cached_tokens = 16 # below this many non-cached prompt tokens, skip remote prefill (P/D)
non_cached_tokens = 16 # llm-d only: below this many non-cached prompt tokens, skip remote prefill (P/D)
# llm-d only: base scorer weights, applied to every profile
[inference.router.scorers]
"prefix-cache-scorer" = 3.0
"active-request-scorer" = 2.0
# llm-d only: merged onto the P/D prefill profile (decode_scorer_overrides for decode)
[inference.router.prefill_scorer_overrides]
"queue-scorer" = 2.0
"kv-cache-utilization-scorer" = 2.0
```
- **`vllm-router`** (default) — our fork of [vllm-router](https://github.com/PrimeIntellect-ai/router). Knob: `policy`. The only backend supported for single-node (local) deployments.
@@ -255,8 +261,12 @@ For configuring various knobs with environment variables, we enable you to confi
[inference.deployment]
type = "disaggregated"
prefill_env_vars = {"VLLM_ENABLE_MOE_DP_CHUNK"="0", "VLLM_DEEP_GEMM_WARMUP"="skip"}
decode_env_vars = {"VLLM_DEEP_GEMM_WARMUP"="skip"}
[inference.deployment.prefill_env_vars]
"VLLM_ENABLE_MOE_DP_CHUNK" = "0"
"VLLM_DEEP_GEMM_WARMUP" = "skip"
[inference.deployment.decode_env_vars]
"VLLM_DEEP_GEMM_WARMUP" = "skip"
```
These are role-specific and layer on top of [`env_vars`](configuration.md#environment-variables) shared by all inference processes regardless of role.
+1 -1
View File
@@ -217,7 +217,7 @@ Checkpointing is split across processes because the orchestrator and trainer can
| Process | What's saved | Where |
|---|---|---|
| Trainer | FSDP-sharded model (DCP), optimizer, scheduler, progress | `<output_dir>/checkpoints/step_N/trainer/` |
| Orchestrator | Step counter, total tokens / samples / problems | `<output_dir>/checkpoints/step_N/orchestrator/` |
| Orchestrator | Progress, per-env data state | `<output_dir>/checkpoints/step_N/orchestrator/` |
| Inference | _nothing_ — re-pushed from the latest checkpoint on restart | n/a |
| Trainer (HF weights) | HF-compatible weight snapshot for serving | `<output_dir>/weights/step_N/` |
+42 -8
View File
@@ -95,8 +95,18 @@ num_turns_weight = 0.0
# the plugged BC-style prompt is replaced by the reference judge's stock prompt).
[[orchestrator.train.source]]
name = "openseeker"
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072] }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] }
[orchestrator.train.source.env.agent.harness]
id = "rlm"
skills = ["search"]
forward_env = ["SERPER_API_KEY"]
summarize_at_tokens = [65536, 131072]
[orchestrator.train.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-search"]
[orchestrator.train.source.env.taskset]
id = "openseeker-v1"
@@ -118,8 +128,18 @@ choices = ["A", "B"]
[[orchestrator.train.source]]
name = "redsearcher"
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072] }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] }
[orchestrator.train.source.env.agent.harness]
id = "rlm"
skills = ["search"]
forward_env = ["SERPER_API_KEY"]
summarize_at_tokens = [65536, 131072]
[orchestrator.train.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-search"]
[orchestrator.train.source.env.taskset]
id = "redsearcher-v1" # optional `difficulty` filter (easy/medium/hard)
@@ -147,13 +167,27 @@ interval = 20
[[orchestrator.eval.source]]
name = "browsecomp"
num_examples = 500 # full set is 1266; cap eval at 500
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = 98304 }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] }
env.agent.timeout = { rollout = 3600 }
[orchestrator.eval.source.env.agent.harness]
id = "rlm"
skills = ["search"]
forward_env = ["SERPER_API_KEY"]
summarize_at_tokens = 98304
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-search"]
[orchestrator.eval.source.env.agent.timeout]
rollout = 3600
[orchestrator.eval.source.env.taskset]
id = "browsecomp-v1"
task = { judge = { model = "Qwen/Qwen3-235B-A22B-Instruct-2507" } }
[orchestrator.eval.source.env.taskset.task.judge]
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
# [[orchestrator.eval.source.env.taskset.task.judges]]
+29 -7
View File
@@ -99,9 +99,19 @@ thinking_retention = "all"
[[orchestrator.train.source]]
name = "scaleswe"
env.taskset = { id = "scaleswe-v1" }
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072] }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] }
[orchestrator.train.source.env.taskset]
id = "scaleswe-v1"
[orchestrator.train.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = [65536, 131072]
[orchestrator.train.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-swe"]
[orchestrator.prime_monitor]
@@ -112,10 +122,22 @@ interval = 20
[[orchestrator.eval.source]]
name = "swebench-verified"
env.taskset = { id = "swebench-verified-v1" }
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] }
env.agent.timeout = { rollout = 3600 }
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
[orchestrator.eval.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = 98304
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-swe"]
[orchestrator.eval.source.env.agent.timeout]
rollout = 3600
# --- Inference ---
+36 -8
View File
@@ -93,8 +93,16 @@ num_turns_weight = 0.1
[[orchestrator.train.source]]
name = "tmax"
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072] }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] }
[orchestrator.train.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = [65536, 131072]
[orchestrator.train.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-terminal"]
[orchestrator.train.source.env.taskset]
id = "tmax-v1"
@@ -121,9 +129,19 @@ interval = 20
[[orchestrator.eval.source]]
name = "swebench-verified"
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] }
env.agent.timeout = { rollout = 3600 }
[orchestrator.eval.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = 98304
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-terminal"]
[orchestrator.eval.source.env.agent.timeout]
rollout = 3600
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
@@ -145,9 +163,19 @@ id = "swebench-verified-v1"
[[orchestrator.eval.source]]
name = "terminal-bench-2"
group_size = 4 # avg@4
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] }
env.agent.timeout = { rollout = 3600 }
[orchestrator.eval.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = 98304
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["glm45air-terminal"]
[orchestrator.eval.source.env.agent.timeout]
rollout = 3600
[orchestrator.eval.source.env.taskset]
id = "terminal-bench-2-v1"
+21 -5
View File
@@ -35,16 +35,32 @@ prefill_nodes_per_replica = 2
num_prefill_replicas = 4
decode_nodes_per_replica = 8
num_decode_replicas = 1
prefill_env_vars = {"VLLM_ENABLE_MOE_DP_CHUNK"="0", "VLLM_DEEP_GEMM_WARMUP"="skip", "UCX_RCACHE_MAX_UNRELEASED"="1024"}
decode_env_vars = {"VLLM_DEEP_GEMM_WARMUP"="skip", "UCX_RCACHE_MAX_UNRELEASED"="1024"}
[deployment.prefill_env_vars]
"VLLM_ENABLE_MOE_DP_CHUNK" = "0"
"VLLM_DEEP_GEMM_WARMUP" = "skip"
"UCX_RCACHE_MAX_UNRELEASED" = "1024"
[deployment.decode_env_vars]
"VLLM_DEEP_GEMM_WARMUP" = "skip"
"UCX_RCACHE_MAX_UNRELEASED" = "1024"
[router]
type = "llm-d"
scorers = { "prefix-cache-scorer" = 3.0 }
prefill_scorer_overrides = { "queue-scorer" = 4.0, "active-request-scorer" = 5.0 }
decode_scorer_overrides = { "active-request-scorer" = 5.0, "kv-cache-utilization-scorer" = 4.0, "queue-scorer" = 3.0 }
non_cached_tokens = 128
[router.scorers]
"prefix-cache-scorer" = 3.0
[router.prefill_scorer_overrides]
"queue-scorer" = 4.0
"active-request-scorer" = 5.0
[router.decode_scorer_overrides]
"active-request-scorer" = 5.0
"kv-cache-utilization-scorer" = 4.0
"queue-scorer" = 3.0
[slurm]
job_name = "glm5.2-16node-llmd"
partition = "all"
+41 -11
View File
@@ -28,23 +28,44 @@ prefill_nodes_per_replica = 2
num_prefill_replicas = 4
decode_nodes_per_replica = 8
num_decode_replicas = 1
# skip warmup for faster start in cost of some jit overhead early
# ucx needs to be set else random segfaults, vllm can't autoset before importing for some reason
prefill_env_vars = {"VLLM_ENABLE_MOE_DP_CHUNK"="0", "VLLM_DEEP_GEMM_WARMUP"="skip", "UCX_RCACHE_MAX_UNRELEASED"="1024"}
decode_env_vars = {"VLLM_DEEP_GEMM_WARMUP"="skip", "UCX_RCACHE_MAX_UNRELEASED"="1024"}
[inference.deployment.prefill_env_vars]
"VLLM_ENABLE_MOE_DP_CHUNK" = "0"
"VLLM_DEEP_GEMM_WARMUP" = "skip"
"UCX_RCACHE_MAX_UNRELEASED" = "1024"
[inference.deployment.decode_env_vars]
"VLLM_DEEP_GEMM_WARMUP" = "skip"
"UCX_RCACHE_MAX_UNRELEASED" = "1024"
# gives the most KV cache while keeping decent throughput, KV cache increase comes in from lower deep-ep LL static buffers
prefill_vllm_overrides = {"enable_dbo"=true}
decode_vllm_overrides = {"max_num_batched_tokens"=96, "max_num_seqs"=96}
[inference.deployment.prefill_vllm_overrides]
"enable_dbo" = true
[inference.deployment.decode_vllm_overrides]
"max_num_batched_tokens" = 96
"max_num_seqs" = 96
[inference.router]
type = "llm-d"
scorers = { "prefix-cache-scorer" = 3.0 } # need some prefix-cache routing, however due to shared mooncake pool do low prio
prefill_scorer_overrides = { "queue-scorer" = 4.0, "active-request-scorer" = 5.0 } # prefill creates queues quite heavily, queue scorer to 4.0, active request at 5.0 is needed due to burstiness of early pipeline RL fill
decode_scorer_overrides = { "active-request-scorer" = 5.0, "kv-cache-utilization-scorer" = 4.0, "queue-scorer" = 3.0 } # decode doesn't really create queue, it fills in KV cache fast, give 4.0
non_cached_tokens = 128 # if <128 tokens, skip prefill go to decode immediately
[inference.router.scorers] # need some prefix-cache routing, however due to shared mooncake pool do low prio
"prefix-cache-scorer" = 3.0
[inference.router.prefill_scorer_overrides] # prefill creates queues quite heavily, queue scorer to 4.0, active request at 5.0 is needed due to burstiness of early pipeline RL fill
"queue-scorer" = 4.0
"active-request-scorer" = 5.0
[inference.router.decode_scorer_overrides] # decode doesn't really create queue, it fills in KV cache fast, give 4.0
"active-request-scorer" = 5.0
"kv-cache-utilization-scorer" = 4.0
"queue-scorer" = 3.0
[slurm]
job_name = "glm5-llmd"
partition = "all" # FILL IN: set to your cluster's partition
@@ -93,14 +114,23 @@ clear_thinking = false
[orchestrator.train.sampling]
temperature = 1.0
extra_body = {chat_template_kwargs = {clear_thinking = false}}
[orchestrator.train.sampling.extra_body.chat_template_kwargs]
clear_thinking = false
[[orchestrator.train.source]]
name = "r2e"
env.taskset = { id = "r2e-gym-v1" }
env.agent.harness = { id = "rlm" }
env.agent.runtime = { type = "prime", labels = ["glm5-llmd"] }
[orchestrator.train.source.env.taskset]
id = "r2e-gym-v1"
[orchestrator.train.source.env.agent.harness]
id = "rlm"
[orchestrator.train.source.env.agent.runtime]
type = "prime"
labels = ["glm5-llmd"]
[inference]
enable_expert_parallel = true
+10 -3
View File
@@ -73,9 +73,16 @@ interval = 20
[[orchestrator.eval.source]]
name = "swe-bench-verified"
env.taskset = { id = "swebench-verified-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["glm5-pd-disag", "swe-bench-verified"] }
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
[orchestrator.eval.source.env.agent.harness]
id = "bash"
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
labels = ["glm5-pd-disag", "swe-bench-verified"]
[[orchestrator.post_batch_filters]]
type = "gibberish"
+71 -21
View File
@@ -50,37 +50,74 @@ oversampling_factor = 2
[[orchestrator.train.source]]
name = "swe"
ratio = 0.3
env.taskset = { id = "r2e-gym-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["intellect-3.1", "swe"] }
[orchestrator.train.source.env.taskset]
id = "r2e-gym-v1"
[orchestrator.train.source.env.agent.harness]
id = "bash"
[orchestrator.train.source.env.agent.runtime]
type = "prime"
labels = ["intellect-3.1", "swe"]
[[orchestrator.train.source]]
name = "deepdive"
ratio = 0.2
env.taskset = { id = "deepdive-v1" }
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"] }
env.agent.runtime = { type = "prime", labels = ["intellect-3.1", "deepdive"] }
[orchestrator.train.source.env.taskset]
id = "deepdive-v1"
[orchestrator.train.source.env.agent.harness]
id = "rlm"
skills = ["search"]
forward_env = ["SERPER_API_KEY"]
[orchestrator.train.source.env.agent.runtime]
type = "prime"
labels = ["intellect-3.1", "deepdive"]
[[orchestrator.train.source]]
name = "math"
ratio = 0.3
env.taskset = { id = "i3_math_v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "i3_math_v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.train.source]]
name = "logic"
ratio = 0.2
env.taskset = { id = "i3_logic_v1", filter = { max = 0.874 } }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "i3_logic_v1"
[orchestrator.train.source.env.taskset.filter]
max = 0.874
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.train.source]]
name = "code"
ratio = 0.2
env.taskset = { id = "i3_code_v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "i3_code_v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.pre_batch_filters]]
type = "zero_advantage"
@@ -91,15 +128,28 @@ interval = 25
[[orchestrator.eval.source]]
name = "swe-bench-verified"
env.taskset = { id = "swebench-verified-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["intellect-3.1", "swe-bench-verified"] }
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
[orchestrator.eval.source.env.agent.harness]
id = "bash"
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
labels = ["intellect-3.1", "swe-bench-verified"]
[[orchestrator.eval.source]]
name = "aime2025"
env.taskset = { id = "aime25-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "aime25-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[inference.parallel]
tp = 8
+20 -6
View File
@@ -51,18 +51,32 @@ max_off_policy_steps = 16
[[orchestrator.train.source]]
name = "swe"
env.taskset = { id = "r2e-gym-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["minimax-swe", "swe"] }
[orchestrator.train.source.env.taskset]
id = "r2e-gym-v1"
[orchestrator.train.source.env.agent.harness]
id = "bash"
[orchestrator.train.source.env.agent.runtime]
type = "prime"
labels = ["minimax-swe", "swe"]
[orchestrator.eval]
interval = 25
[[orchestrator.eval.source]]
name = "swe-bench-verified"
env.taskset = { id = "swebench-verified-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["minimax-swe", "swe-bench-verified"] }
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
[orchestrator.eval.source.env.agent.harness]
id = "bash"
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
labels = ["minimax-swe", "swe-bench-verified"]
[inference.parallel]
tp = 8
+29 -7
View File
@@ -83,9 +83,19 @@ truncate_history_thinking = false
[[orchestrator.train.source]]
name = "scaleswe"
env.taskset = { id = "scaleswe-v1" }
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072] }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] }
[orchestrator.train.source.env.taskset]
id = "scaleswe-v1"
[orchestrator.train.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = [65536, 131072]
[orchestrator.train.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["nemotron-3-super-swe"]
[orchestrator.prime_monitor]
@@ -94,10 +104,22 @@ interval = 20
[[orchestrator.eval.source]]
name = "swebench-verified"
env.taskset = { id = "swebench-verified-v1" }
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] }
env.agent.timeout = { rollout = 3600 }
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
[orchestrator.eval.source.env.agent.harness]
id = "rlm"
summarize_at_tokens = 98304
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
vm = true
idle_timeout = "None"
labels = ["nemotron-3-super-swe"]
[orchestrator.eval.source.env.agent.timeout]
rollout = 3600
[inference]
enable_expert_parallel = true
+18 -6
View File
@@ -50,18 +50,30 @@ max_completion_tokens = 32768
[[orchestrator.train.source]]
name = "math"
env.taskset = { id = "i3_math_v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "i3_math_v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 25
[[orchestrator.eval.source]]
name = "aime2025"
env.taskset = { id = "aime25-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "aime25-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[inference.parallel]
tp = 8
+20 -6
View File
@@ -48,18 +48,32 @@ max_off_policy_steps = 16
[[orchestrator.train.source]]
name = "swe"
env.taskset = { id = "r2e-gym-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["qwen30b-swe", "swe"] }
[orchestrator.train.source.env.taskset]
id = "r2e-gym-v1"
[orchestrator.train.source.env.agent.harness]
id = "bash"
[orchestrator.train.source.env.agent.runtime]
type = "prime"
labels = ["qwen30b-swe", "swe"]
[orchestrator.eval]
interval = 25
[[orchestrator.eval.source]]
name = "swe-bench-verified"
env.taskset = { id = "swebench-verified-v1" }
env.agent.harness = { id = "bash" }
env.agent.runtime = { type = "prime", labels = ["qwen30b-swe", "swe-bench-verified"] }
[orchestrator.eval.source.env.taskset]
id = "swebench-verified-v1"
[orchestrator.eval.source.env.agent.harness]
id = "bash"
[orchestrator.eval.source.env.agent.runtime]
type = "prime"
labels = ["qwen30b-swe", "swe-bench-verified"]
[inference.parallel]
tp = 8
+13 -3
View File
@@ -36,9 +36,19 @@ group_size = 16
max_off_policy_steps = 32
[[orchestrator.train.source]]
env.taskset = { id = "general-agent-v1", task = { tools = { colocated = true } }, min_tier = 1 }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "modal" }
[orchestrator.train.source.env.taskset]
id = "general-agent-v1"
min_tier = 1
[orchestrator.train.source.env.taskset.task.tools]
colocated = true
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "modal"
[inference]
gpu_memory_utilization = 0.85
+14 -3
View File
@@ -33,8 +33,19 @@ max_completion_tokens = 768
[[orchestrator.train.source]]
name = "alphabet-sort"
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "alphabet-sort-v1"
min_turns = 3
max_turns = 5
[orchestrator.train.source.env.taskset.task]
power_per_turn = false
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[inference] # Default inference config
+20 -6
View File
@@ -18,20 +18,34 @@ seq_len = 8192
[[orchestrator.train.source]]
name = "hendrycks-math"
env.taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "math-env-v1"
dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B"
dataset_subset = "default"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[orchestrator.eval]
interval = 50
[[orchestrator.eval.source]]
name = "aime2024"
env.taskset = { id = "aime24-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
group_size = 32
[orchestrator.eval.source.env.taskset]
id = "aime24-v1"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
[trainer.model]
seq_len = 16384
+9 -3
View File
@@ -17,9 +17,15 @@ max_completion_tokens = 128
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[trainer.optim]
lr = 3e-6
+9 -3
View File
@@ -46,9 +46,15 @@ enforce = true
[[orchestrator.train.source]]
name = "wiki-search"
env.taskset = { id = "wiki-search-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "wiki-search-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[ckpt] # Checkpoint at the end of training
+9 -3
View File
@@ -20,9 +20,15 @@ group_size = 16
[[orchestrator.train.source]]
name = "wordle"
env.taskset = { id = "wordle-v1" }
env.player.harness = { id = "null" }
env.player.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "wordle-v1"
[orchestrator.train.source.env.player.harness]
id = "null"
[orchestrator.train.source.env.player.runtime]
type = "subprocess"
[orchestrator.train.sampling]
max_completion_tokens = 1024
+9 -3
View File
@@ -15,9 +15,15 @@ max_completion_tokens = 128
[[train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[train.source.env.taskset]
id = "reverse-text-v1"
[train.source.env.agent.harness]
id = "null"
[train.source.env.agent.runtime]
type = "subprocess"
[renderer]
name = "prime-qwen3"
+2 -2
View File
@@ -7,10 +7,10 @@ requires-python = "~=3.12.0"
dependencies = [
"pydantic>=1.10.13",
"prime-pydantic-config>=0.4.2",
"renderers>=0.1.8",
"renderers>=0.1.9.dev10",
"tomli>=2.2.1",
"tomli-w>=1.2.0",
"verifiers>=0.2.2.dev43",
"verifiers>=0.2.2.dev73",
]
[build-system]
@@ -467,11 +467,6 @@ class OrchestratorConfig(BaseConfig):
``tokenizer.name_or_path`` via ``MODEL_RENDERER_MAP``. RL/OPD roll out through the renderer
client; SFT uses it to backfill tokens for its chat-completions teacher."""
pool_size: int | None = Field(None, ge=1)
"""Number of renderer slots shared across concurrent rollouts. Bump
for long multi-turn prompts where client-side jinja tokenization
serializes."""
optim: OptimizerConfig = OptimizerConfig()
"""Per-run optimizer configuration for multi-run training."""
@@ -619,22 +614,6 @@ class OrchestratorConfig(BaseConfig):
"""True when at least one train env samples rollouts from the live policy."""
return any(env.algo is not None and env.algo.sampling.source == "policy" for env in self.train.source)
@model_validator(mode="after")
def validate_pool_size(self):
"""``pool_size`` sizes the renderer-client pool for policy-sourced
sampling. Reject it when that path never runs — no train env samples
from the policy — so callers don't silently pass it and wonder why
it's ignored."""
if self.pool_size is None:
return self
if not self.any_policy_sourced:
raise ValueError(
f"orchestrator.pool_size={self.pool_size!r} is set but no train env samples "
"from the policy — the renderer-client sampling pool never runs (the renderer "
"is still used for client-side tokenization). Remove pool_size."
)
return self
@model_validator(mode="after")
def validate_renderer_auto_resolves(self):
"""Reject the silent DefaultRenderer fallback at config time.
+4 -4
View File
@@ -18,7 +18,7 @@ dependencies = [
"torchaudio",
"torchdata>=0.11.0",
"transformers==5.6.2",
"vllm>=0.24.0",
"vllm>=0.26.0",
"mooncake-transfer-engine>=0.3.10.post2",
"wandb>=0.26.1",
"wandb-workspaces>=0.4.3",
@@ -33,7 +33,7 @@ dependencies = [
"setproctitle>=1.3.0",
"uvloop>=0.21.0",
"torchtitan",
"verifiers[harbor]>=0.2.2.dev43",
"verifiers[harbor]>=0.2.2.dev73",
"renderers",
"dion",
"tilelang>=0.1.8",
@@ -200,8 +200,8 @@ vllm-router = [
{ url = "https://github.com/PrimeIntellect-ai/router/releases/download/v0.1.26/vllm_router-0.1.26-cp38-abi3-manylinux_2_28_aarch64.whl", marker = "platform_machine == 'aarch64'" },
]
vllm = [
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl", marker = "platform_machine == 'x86_64'" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.24.0/vllm-0.24.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl", marker = "platform_machine == 'aarch64'" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.26.0/vllm-0.26.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl", marker = "platform_machine == 'x86_64'" },
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.26.0/vllm-0.26.0+cu129-cp38-abi3-manylinux_2_28_aarch64.whl", marker = "platform_machine == 'aarch64'" },
]
deep-ep = [
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl", marker = "platform_machine == 'x86_64'" },
+21 -6
View File
@@ -34,6 +34,8 @@ Incompatible combinations (e.g. CP requires flash attention) must raise in a `mo
## Special syntax
**No inline tables** — checked-in configs use `[section]` headers, never `key = { ... }`. Expand `env.taskset = { id = "..." }` to a full-path header (`[orchestrator.train.source.env.taskset]` — subtable headers after a `[[...]]` entry attach to that entry).
**Booleans** — CLI `--flag` / `--no-flag`; TOML must be explicit (`enforce_eager = true`).
**None** — TOML has no null, use the string `"None"` (`max_model_len = "None"`); CLI: `--model.max-model-len None`.
@@ -43,15 +45,28 @@ Incompatible combinations (e.g. CP requires flash attention) must raise in a `mo
```toml
[[orchestrator.train.source]]
name = "reverse-text"
env.taskset = { id = "reverse-text-v1" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.train.source.env.taskset]
id = "reverse-text-v1"
[orchestrator.train.source.env.agent.harness]
id = "null"
[orchestrator.train.source.env.agent.runtime]
type = "subprocess"
[[orchestrator.eval.source]]
name = "reverse-text-eval"
env.taskset = { id = "reverse-text-v1", split = "test" }
env.agent.harness = { id = "null" }
env.agent.runtime = { type = "subprocess" }
[orchestrator.eval.source.env.taskset]
id = "reverse-text-v1"
split = "test"
[orchestrator.eval.source.env.agent.harness]
id = "null"
[orchestrator.eval.source.env.agent.runtime]
type = "subprocess"
```
CLI: `--orchestrator.train.source.0.env.taskset.id reverse-text-v1` or `--orchestrator.eval.source.0.env.taskset.id reverse-text-v1`.
@@ -1,7 +1,7 @@
"""Prime-RL extensions to vLLM's `/inference/v1/generate` handler.
vLLM 0.22 ships a generic tokens-in / tokens-out handler at
``vllm.entrypoints.serve.disagg.serving.ServingTokens`` that already covers
vLLM ships a generic tokens-in / tokens-out handler at
``vllm.entrypoints.scale_out.token_in_token_out.serving.ServingTokens`` that covers
prefix-cache salting, lora dispatch, multimodal features, prompt logprobs,
priority, ``data_parallel_rank`` header routing and server-side ``max_tokens``
defaulting. We subclass it for the bits still missing from the upstream handler:
@@ -37,12 +37,12 @@ from vllm.entrypoints.openai.engine.protocol import (
RequestResponseMetadata,
UsageInfo,
)
from vllm.entrypoints.serve.disagg.protocol import (
from vllm.entrypoints.scale_out.token_in_token_out.protocol import (
GenerateRequest,
GenerateResponse,
GenerateResponseChoice,
)
from vllm.entrypoints.serve.disagg.serving import ServingTokens
from vllm.entrypoints.scale_out.token_in_token_out.serving import ServingTokens
from vllm.entrypoints.serve.utils.api_utils import get_max_tokens
from vllm.outputs import RequestOutput
from vllm.sampling_params import RequestOutputKind, SamplingParams
@@ -176,7 +176,7 @@ class PrimeRlServingTokens(ServingTokens):
request: GenerateRequest,
raw_request: Request | None = None,
) -> PrimeRlGenerateResponse | ErrorResponse | AsyncGenerator[str, None]:
# Mirrors upstream ``ServingTokens.serve_tokens`` (vllm 0.22). Diffs:
# Mirrors upstream ``ServingTokens.serve_tokens``. Diffs:
# (a) inject ``data_parallel_rank`` from the inbound header into
# ``engine_client.generate``; (b) default ``sampling_params.max_tokens``
# to ``max_model_len - prompt_len`` when the caller didn't set it; and
@@ -200,10 +200,11 @@ class PrimeRlServingTokens(ServingTokens):
# Build the engine input — features-aware (MM) or text-only fallback.
# Identical to upstream so we keep tracking it.
if features := request.features:
from vllm.entrypoints.serve.disagg.mm_serde import decode_mm_kwargs_item
from vllm.entrypoints.scale_out.token_in_token_out.mm_serde import decode_mm_kwargs_item
from vllm.inputs import mm_input
from vllm.multimodal.inputs import (
MultiModalKwargsItem,
MultiModalKwargsItems,
PlaceholderRange,
)
@@ -220,13 +221,13 @@ class PrimeRlServingTokens(ServingTokens):
mm_kwargs[modality] = [None] * len(hashes)
engine_input = mm_input(
prompt_token_ids=request.token_ids,
mm_kwargs=mm_kwargs, # type: ignore[arg-type]
mm_kwargs=MultiModalKwargsItems(mm_kwargs),
mm_hashes=features.mm_hashes,
mm_placeholders=mm_placeholders,
cache_salt=request.cache_salt,
)
else:
(engine_input,) = await self.openai_serving_render.preprocess_completion(
(engine_input,) = await self.online_renderer.preprocess_completion(
request,
prompt_input=request.token_ids,
prompt_embeds=None,
@@ -29,10 +29,10 @@ class HierarchicalGRPOAlgorithm(Algorithm):
self.episode_agents = set(config.episode_agents)
async def score_group(self, group: list[Rollout]) -> None:
peers: dict[tuple[str | None, str | None], list[Rollout]] = defaultdict(list)
peers: dict[tuple[str, str | None], list[Rollout]] = defaultdict(list)
for rollout in group:
episode_scoped = rollout.agent_name in self.episode_agents
key = (rollout.agent_name, rollout.episode_id if episode_scoped else None)
episode_scoped = rollout.agent.name in self.episode_agents
key = (rollout.agent.name, rollout.episode_id if episode_scoped else None)
peers[key].append(rollout)
for members in peers.values():
baseline = sum(rollout.reward for rollout in members) / len(members)
+3 -3
View File
@@ -32,10 +32,10 @@ class RAEAlgorithm(Algorithm):
def __init__(self, config: RAEAlgoConfig, policy_pool: InferencePool):
super().__init__(config, policy_pool)
self.decay = config.decay
self.baselines: dict[str | None, float] = defaultdict(float)
self.baselines: dict[str, float] = defaultdict(float)
async def score_group(self, group: list[Rollout]) -> None:
for rollout in group:
baseline = self.baselines[rollout.agent_name]
baseline = self.baselines[rollout.agent.name]
rollout.assign_advantages(rollout.reward - baseline)
self.baselines[rollout.agent_name] = self.decay * baseline + (1.0 - self.decay) * rollout.reward
self.baselines[rollout.agent.name] = self.decay * baseline + (1.0 - self.decay) * rollout.reward
+17 -5
View File
@@ -1,4 +1,5 @@
"""Checkpoint manager for ``Progress``. Layout:
"""Checkpoint manager for the orchestrator state (``Progress`` counters +
``TrainSource`` data position). Layout:
``<output_dir>/checkpoints/step_N/orchestrator/progress.pt``."""
from __future__ import annotations
@@ -13,6 +14,7 @@ from pathlib import Path
import torch
from prime_rl.configs.orchestrator import CheckpointConfig
from prime_rl.orchestrator.train_source import TrainSource
from prime_rl.orchestrator.types import Progress
from prime_rl.utils.logger import format_time, get_logger
from prime_rl.utils.pathing import get_ckpt_dir, get_step_path
@@ -26,7 +28,7 @@ class CheckpointManager:
def get_ckpt_path(self, step: int) -> Path:
return get_step_path(self.ckpt_dir, step) / "orchestrator"
def save(self, progress: Progress, step: int) -> None:
def save(self, progress: Progress, train_source: TrainSource, step: int) -> None:
ckpt_path = self.get_ckpt_path(step)
ckpt_path.mkdir(parents=True, exist_ok=True)
start = time.perf_counter()
@@ -35,7 +37,7 @@ class CheckpointManager:
fd, tmp_name = tempfile.mkstemp(dir=ckpt_path, prefix="progress.pt.", suffix=".tmp")
try:
with os.fdopen(fd, "wb") as f:
torch.save({"progress": progress}, f)
torch.save({"progress": progress, "train_source": train_source.state_dict()}, f)
os.replace(tmp_name, ckpt_path / "progress.pt")
except BaseException:
with contextlib.suppress(OSError):
@@ -45,7 +47,7 @@ class CheckpointManager:
f"Orchestrator checkpoint saved to {ckpt_path} in {format_time(time.perf_counter() - start)}"
)
def load(self, progress: Progress, step: int) -> None:
def load(self, progress: Progress, train_source: TrainSource, step: int) -> None:
ckpt_path = self.get_ckpt_path(step)
state_file = ckpt_path / "progress.pt"
if not state_file.exists():
@@ -53,7 +55,7 @@ class CheckpointManager:
get_logger().debug(f"Loading checkpoint from {state_file}")
start = time.perf_counter()
if self.config.skip_progress:
get_logger().info("Skipping progress loading from checkpoint")
get_logger().info("Skipping progress and data position loading from checkpoint")
else:
with open(state_file, "rb") as f:
state = torch.load(f, weights_only=False)
@@ -61,6 +63,16 @@ class CheckpointManager:
for key, value in asdict(saved).items():
if hasattr(progress, key):
setattr(progress, key, value)
train_source.load_state_dict(state["train_source"])
for name, position in state["train_source"]["envs"].items():
if name not in train_source.base_rows:
continue
rows = train_source.base_rows[name]
num_tasks = len(rows) if rows is not None else "infinite"
get_logger().info(
f"Resumed data position for env {name} - epoch={position['epoch']}, "
f"cursor={position['cursor']}/{num_tasks}"
)
get_logger().debug(f"Orchestrator checkpoint loaded in {format_time(time.perf_counter() - start)}")
+10 -5
View File
@@ -8,7 +8,7 @@
- Emit-everything invariant: every dispatched env-rollout eventually reaches
``out_q`` exactly once, as one episode (a ``list[Rollout]``). Failures
(env error, empty trajectory, task exception, off-policy cancel) carry
``trace.error`` set; sinks decide drop / partial-train policy.
``trace.last_error`` set; sinks decide drop / partial-train policy.
- ``DispatcherMode.PREFER_TRAIN`` / ``PREFER_EVAL`` controls which kind to
schedule next. Transitions are level-triggered (driven by the eval
source's emptiness), so in-flight rollouts of the opposite kind drain
@@ -521,11 +521,14 @@ class RolloutDispatcher:
get_logger().warning(f"Rollout task failed in group {meta.group_id} ({meta.env_name}): {exc!r}")
task_idx = group.task_idx if group is not None else -1
rollouts = [
Rollout(task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)))
Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
)
for _ in range(meta.rollout_count)
]
for r in rollouts:
r.capture_error(exc)
r.record_error(exc)
is_synth_exception = True
for r in rollouts:
@@ -537,9 +540,9 @@ class RolloutDispatcher:
get_logger().warning(f"Empty trajectory in group {meta.group_id} ({meta.env_name})")
if r.has_error:
self.metrics.record_error(kind=meta.kind, env_name=meta.env_name)
if not is_synth_exception and r.error is not None:
if not is_synth_exception and r.last_error is not None:
get_logger().warning(
f"Rollout failed in group {meta.group_id} ({meta.env_name}) — {r.error.type}: {r.error.message}"
f"Rollout failed in group {meta.group_id} ({meta.env_name}) — {r.last_error.type}: {r.last_error.message}"
)
if meta.rollout_count == 1:
# A ``run`` task: the whole result is one episode.
@@ -601,6 +604,7 @@ class RolloutDispatcher:
for _ in range(meta.rollout_count):
trace = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
ok=False,
errors=[vf.Error(type="Cancelled", message="Off-policy cancel")],
stop_condition="error",
@@ -628,6 +632,7 @@ class RolloutDispatcher:
for _ in range(unscheduled_cancelled):
trace = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
ok=False,
errors=[vf.Error(type="Cancelled", message="Off-policy cancel")],
stop_condition="error",
+2 -2
View File
@@ -217,14 +217,14 @@ class Env:
sampling=self._sampling(cache_salt),
)
if not episode.traces:
error = episode.error
error = episode.last_error
detail = f"{error.type}: {error.message}" if error is not None else "no traces and no error recorded"
raise RuntimeError(f"env-rollout failed before any trace was minted — {detail}")
rollouts = [ROLLOUT_TYPE.model_construct(**dict(wire)) for wire in episode.traces]
for rollout in rollouts:
rollout.episode_id = episode.id
if not episode.ok and rollout.ok:
error = episode.error or vf.Error(
error = episode.last_error or vf.Error(
type="EpisodeFailed", message="A sibling trace in this episode failed"
)
rollout.errors = [*rollout.errors, error]
+17 -15
View File
@@ -90,26 +90,26 @@ class TimingMetrics(StatGroup):
"""Per-phase rollout durations, nested so ``metrics.timing.setup.mean()`` reads naturally.
``total`` is the per-rollout sum across all phases."""
PHASES = ("setup", "generation", "finalize", "scoring")
PHASES = ("setup", "agent", "finalize", "scoring")
@property
def setup(self) -> Stat:
return Stat([r.timing.setup.duration for r in self.rollouts])
@property
def generation(self) -> Stat:
return Stat([r.timing.generation.duration for r in self.rollouts])
def agent(self) -> Stat:
return Stat([r.timing.agent.duration for r in self.rollouts])
@property
def generation_model(self) -> Stat:
"""The share of the generation phase spent inside model calls (inference)."""
return Stat([r.timing.generation.model.duration for r in self.rollouts])
def agent_model(self) -> Stat:
"""The share of the agent phase spent inside model calls (inference)."""
return Stat([r.timing.agent.model.duration for r in self.rollouts])
@property
def generation_harness(self) -> Stat:
"""The share of the generation phase spent outside model calls (harness, tools,
def agent_harness(self) -> Stat:
"""The share of the agent phase spent outside model calls (harness, tools,
user simulation)."""
return Stat([r.timing.generation.harness.duration for r in self.rollouts])
return Stat([r.timing.agent.harness.duration for r in self.rollouts])
@property
def finalize(self) -> Stat:
@@ -126,8 +126,8 @@ class TimingMetrics(StatGroup):
def stats(self) -> dict[str, Stat]:
return {
**{phase: getattr(self, phase) for phase in self.PHASES},
"generation/model": self.generation_model,
"generation/harness": self.generation_harness,
"agent/model": self.agent_model,
"agent/harness": self.agent_harness,
"total": self.total,
}
@@ -226,7 +226,7 @@ class RolloutMetrics:
def error_types(self) -> dict[str, int]:
"""Count of errored rollouts by error type (the rollout's last error — e.g. ``Cancelled``,
``ProviderError``)."""
types = [r.error.type for r in self.rollouts if r.has_error]
types = [r.last_error.type for r in self.rollouts if r.has_error and r.last_error is not None]
return {t: types.count(t) for t in sorted(set(types))}
def solve_rates(self) -> dict[str, float]:
@@ -360,7 +360,7 @@ class TrainRollouts:
@property
def effective(self) -> TrainRollouts:
return TrainRollouts([r for r in self.rollouts if not r.has_error and not r.is_filtered and r.trainable])
return TrainRollouts([r for r in self.rollouts if not r.has_error and not r.is_filtered and r.agent.trainable])
def by_env(self) -> dict[str, TrainRollouts]:
grouped: dict[str, list[Rollout]] = {}
@@ -399,13 +399,15 @@ class EvalRollouts:
return self._group_size
counts: dict = {}
for r in self.rollouts:
if r.trainable:
if r.agent.trainable:
counts[r.group_id] = counts.get(r.group_id, 0) + 1
return max(counts.values(), default=0)
@property
def effective(self) -> EvalRollouts:
return EvalRollouts([r for r in self.rollouts if not r.has_error and r.trainable], group_size=self.group_size)
return EvalRollouts(
[r for r in self.rollouts if not r.has_error and r.agent.trainable], group_size=self.group_size
)
@property
def metrics(self) -> EvalMetrics:
+14 -7
View File
@@ -24,6 +24,7 @@ from __future__ import annotations
import asyncio
import os
import time
import uuid
from typing import TYPE_CHECKING
import tomli_w
@@ -241,6 +242,9 @@ class Orchestrator:
train_env_names=[env.resolved_name for env in config.train.source],
eval_env_names=[source.resolved_name for source in config.eval.source] if config.eval is not None else [],
)
# ``RunInfo.id`` is required on the trace: fall back to a run-local uuid
# when no external monitor identity (W&B) exists.
self.run_id = self.monitor.run_id or uuid.uuid4().hex
if config.heartbeat is not None:
self.heart = Heartbeat(config.heartbeat.url)
@@ -339,8 +343,10 @@ class Orchestrator:
self.lora_name = config.model.lora.name if config.model.lora else None
self.train_source = TrainSource(self.train_envs)
if self.resume_step is not None and self.ckpt_manager is not None:
self.ckpt_manager.load(self.progress, step=self.resume_step)
self.ckpt_manager.load(self.progress, self.train_source, step=self.resume_step)
# The checkpoint finished step ``resume_step``; resume at the next step. Derive the step
# from ``resume_step`` (not the loaded progress.step) so it stays coordinated with the
# trainer even when ``ckpt.skip_progress`` left the counter unrestored.
@@ -380,7 +386,6 @@ class Orchestrator:
self.policy.model_name = self.lora_name
self.policy.version = sync_version
self.train_source = TrainSource(self.train_envs, seed=42)
self.eval_source: EvalSource | None = (
EvalSource(
self.eval_envs,
@@ -496,7 +501,7 @@ class Orchestrator:
if self.ckpt_manager is not None and self.progress.step > 1:
self.progress.step -= 1
get_logger().info("Writing final checkpoint")
self.ckpt_manager.save(self.progress, step=self.progress.step)
self.ckpt_manager.save(self.progress, self.train_source, step=self.progress.step)
await self.stop()
if clean_exit:
get_logger().success("Orchestrator finished.")
@@ -527,12 +532,12 @@ class Orchestrator:
step = episode[0].eval_step if kind == "eval" else self.progress.step
assert step is not None
run: vf.RunInfo = (
vf.EvalRunInfo(id=self.monitor.run_id, step=step)
vf.EvalRunInfo(id=self.run_id, step=step)
if kind == "eval"
else vf.TrainRunInfo(id=self.monitor.run_id, step=step)
else vf.TrainRunInfo(id=self.run_id, step=step)
)
for rollout in episode:
rollout.stamp(
rollout.record_run(
run,
env_name=rollout.env_name,
group_id=str(rollout.group_id),
@@ -900,7 +905,9 @@ class Orchestrator:
return 0.0
get_logger().info(f"Saving checkpoint at step {step}")
t = time.perf_counter()
await asyncio.to_thread(self.ckpt_manager.save, self.progress, step)
# Synchronous on purpose: the payload is tiny, and snapshotting on the
# event loop keeps the dispatcher from mutating TrainSource mid-save
self.ckpt_manager.save(self.progress, self.train_source, step)
return time.perf_counter() - t
def update_dispatch_gate(self) -> None:
+2 -2
View File
@@ -155,7 +155,7 @@ class TrainSink:
message graph. Training is renderer-only across all modes (RL/OPD student, SFT teacher),
so every node already carries its tokens. Errored rollouts are dropped at the group
level, so skip them here; untrainable traces never become training data."""
if rollout.has_error or not rollout.trainable:
if rollout.has_error or not rollout.agent.trainable:
return
samples = await asyncio.to_thread(
trace_to_samples,
@@ -198,7 +198,7 @@ class TrainSink:
)
return
# Untrainable traces carry no samples and must not skew the group baseline.
survivors = [r for r in survivors if r.trainable]
survivors = [r for r in survivors if r.agent.trainable]
if not survivors:
get_logger().debug(
f"Finished group | env={env_name} task_idx={task_idx} | "
+74 -17
View File
@@ -2,10 +2,11 @@
Weights are each env's configured ``ratio`` (default 1, i.e. equal weight
per env). A v1 env serves the tasks the orchestrator loaded client-side: a
finite one as a shuffled table (reshuffled on cursor exhaustion), an
infinite one (``num_tasks is None``) straight off its generator — every
pull is a fresh task and there are no epochs to shuffle. A legacy env's
dataset lives on its server, so it serves shuffled task *indices*."""
finite one as a shuffled table (reshuffled with ``seed=epoch`` on cursor
exhaustion), an infinite one (``num_tasks is None``) straight off its
generator — every pull is a fresh task and there are no epochs to shuffle.
A legacy env's dataset lives on its server, so it serves shuffled task
*indices*."""
from __future__ import annotations
@@ -22,51 +23,107 @@ class TrainSource:
returns its next example (or ``None`` when the env's per-call permit
cost doesn't fit — the dispatch loop retries when permits free up).
Returned dicts carry ``env_name`` + ``task_idx`` (+ ``task`` for v1 envs,
whose data is shipped to the env server at dispatch)."""
whose data is shipped to the env server at dispatch).
def __init__(self, train_envs: TrainEnvs, *, seed: int | None) -> None:
self.rng = random.Random(seed)
The data position round-trips through a checkpoint via ``state_dict()``
/ ``load_state_dict()``: per-env ``{epoch, cursor}`` plus the env-choice
RNG state, making the dispatch sequence reproducible across resumes. For
a finite env, epochs are 1-indexed and seed that epoch's shuffle; for an
infinite env the epoch stays 1 and the cursor counts generator pulls,
replayed on restore by fast-forwarding the generator (exact iff it's
deterministic). Cursors advance at dispatch time (ahead of shipped
batches), so a resume skips the tasks that were in flight at checkpoint
time."""
def __init__(self, train_envs: TrainEnvs) -> None:
self.rng = random.Random(42)
# The drawn-but-undispatched env. A draw whose permit cost doesn't fit
# is held here (head-of-line) rather than redrawn, so the choice stream
# advances exactly once per dispatched example and stays reproducible.
self.pending_env: str | None = None
self.envs = list(train_envs)
if not self.envs:
raise ValueError("TrainSource needs at least one train env")
# A finite env's shuffled example table; ``None`` for an infinite env,
# whose generator (``self.iters``) is pulled per example.
# A finite env's example table in canonical order (each epoch's shuffle
# starts from this); ``None`` for an infinite env, whose generator
# (``self.iters``) is pulled per example.
self.base_rows: dict[str, list[dict] | None] = {}
self.examples: dict[str, list[dict] | None] = {}
self.iters: dict[str, Iterator[vf.Task]] = {}
self.epochs: dict[str, int] = {}
self.cursors: dict[str, int] = {}
# Group-scoring envs reserve ``group_size`` permits up front;
# per-rollout envs need 1
self.env_costs: dict[str, int] = {}
for env in self.envs:
if env.tasks is None: # legacy: sample over the index range from info()
rows: list[dict] = [{"task_idx": i, "env_name": env.name} for i in range(env.num_tasks)]
self.rng.shuffle(rows)
self.examples[env.name] = rows
rows: list[dict] | None = [{"task_idx": i, "env_name": env.name} for i in range(env.num_tasks)]
elif env.num_tasks is None: # infinite: pull the generator per example
self.examples[env.name] = None
rows = None
self.iters[env.name] = env.tasks
else:
rows = [{"task_idx": task.data.idx, "task": task, "env_name": env.name} for task in env.tasks]
self.rng.shuffle(rows)
self.examples[env.name] = rows
self.base_rows[env.name] = rows
self.epochs[env.name] = 1
self.cursors[env.name] = 0
self.examples[env.name] = self._shuffle(env.name)
self.env_costs[env.name] = env.config.group_size if env.requires_group_scoring else 1
self.env_names = [e.name for e in self.envs]
self.weights: list[float] = [float(e.config.ratio) for e in self.envs]
def _shuffle(self, env_name: str) -> list[dict] | None:
"""The env's example table shuffled for its current epoch — a pure
function of (canonical order, epoch), so a restored position replays
the exact epoch permutation."""
rows = self.base_rows[env_name]
if rows is None:
return None
rows = rows.copy()
random.Random(self.epochs[env_name]).shuffle(rows)
return rows
def state_dict(self) -> dict:
"""Env-choice RNG state + pending draw + per-env ``{epoch, cursor}``."""
return {
"rng": self.rng.getstate(),
"pending_env": self.pending_env,
"envs": {name: {"epoch": self.epochs[name], "cursor": self.cursors[name]} for name in self.epochs},
}
def load_state_dict(self, state_dict: dict) -> None:
self.rng.setstate(state_dict["rng"])
pending = state_dict["pending_env"]
self.pending_env = pending if pending in self.env_costs else None
for name, position in state_dict["envs"].items():
if name not in self.base_rows:
continue
self.epochs[name] = position["epoch"]
self.cursors[name] = position["cursor"]
if self.base_rows[name] is None:
for _ in range(position["cursor"]):
next(self.iters[name])
else:
self.examples[name] = self._shuffle(name)
def next_example(self, available_permits: int) -> dict | None:
env_name = self.rng.choices(self.env_names, weights=self.weights, k=1)[0]
if self.pending_env is None:
self.pending_env = self.rng.choices(self.env_names, weights=self.weights, k=1)[0]
env_name = self.pending_env
if self.env_costs[env_name] > available_permits:
return None
self.pending_env = None
rows = self.examples[env_name]
cursor = self.cursors[env_name]
if rows is None: # infinite env: pull the next generated task
task = next(self.iters[env_name])
self.cursors[env_name] = cursor + 1
return {"task_idx": task.data.idx, "task": task, "env_name": env_name}
if cursor >= len(rows):
self.rng.shuffle(rows)
self.epochs[env_name] += 1
rows = self._shuffle(env_name)
self.examples[env_name] = rows
cursor = 0
example = rows[cursor]
self.cursors[env_name] = cursor + 1
+1 -1
View File
@@ -77,7 +77,7 @@ class Rollout(vf.Trace[DataT], Generic[DataT]):
orchestration metadata lives on it directly (set by the dispatcher once the rollout
returns), so there's no wrapper. Train vs eval is the ``kind`` discriminator. All metadata
fields are ``exclude=True``, so dumping a Rollout yields a plain trace on the wire; the
orchestrator mirrors them onto the trace's own fields via ``vf.Trace.stamp`` (``kind`` as
orchestrator mirrors them onto the trace's own fields via ``vf.Trace.record_run`` (``kind`` as
``run.type``, the run id, the step, and ``env_name``/``group_id``/``policy_version`` into
``info``) when a rollout arrives, so the on-disk records stay fully placeable.
-1
View File
@@ -45,7 +45,6 @@ async def setup_policy_inference_pool(*, config: OrchestratorConfig, tokenizer):
train_client_type="renderer",
eval_client_type="openai_chat_completions",
renderer_config=config.renderer,
pool_size=config.pool_size,
)
return renderer, inference_pool
+7 -1
View File
@@ -86,8 +86,14 @@ class PerfCounter:
return 756e12
else: # For H100 SXM and other variants
return 989e12
if "B200" in device_name:
if "GB200" in device_name or "GB300" in device_name:
# Grace Blackwell Superchips, dense BF16 per GPU: 2,500 TFLOPS
# https://www.nvidia.com/en-us/data-center/dgx-gb200/
# https://www.nvidia.com/en-us/data-center/dgx-gb300/
return 2.5e15
if "B200" in device_name or "B300" in device_name:
# https://nvdam.widen.net/s/wwnsxrhm2w/blackwell-datasheet-3384703
# Checked after GB200/GB300 to avoid false match on "GB300"
return 2.25e15 # This is half of the FLOPS reported in torchtitan
# AMD Instinct GPUs
if "MI300X" in device_name:
+1 -1
View File
@@ -236,7 +236,7 @@ class MultiRunManager:
with open(config_path, "rb") as f:
config_dict = tomli.load(f)
from verifiers.v1.loaders import skip_plugin_install
from verifiers.v1.utils.loaders import skip_plugin_install
from prime_rl.configs.orchestrator import OrchestratorConfig
+2 -9
View File
@@ -13,7 +13,7 @@ from httpx import AsyncClient
from openai import AsyncOpenAI
from renderers import RendererConfig
from tenacity import AsyncRetrying, retry, retry_if_exception, stop_after_attempt, stop_after_delay, wait_exponential
from verifiers.v1.clients.config import EvalClientConfig, TrainClientConfig
from verifiers.v1.configs.client import EvalClientConfig, TrainClientConfig
from prime_rl.configs.shared import ClientConfig
from prime_rl.utils.logger import get_logger
@@ -122,7 +122,6 @@ class StaticInferencePool:
train_client_type: str = "openai_chat_completions",
eval_client_type: str = "openai_chat_completions",
renderer_config: RendererConfig | None = None,
pool_size: int | None = None,
):
renderer_model_name = model_name if train_client_type == "renderer" else None
self._train_clients = setup_clients(
@@ -130,7 +129,6 @@ class StaticInferencePool:
client_type=train_client_type,
renderer_config=renderer_config,
renderer_model_name=renderer_model_name,
pool_size=pool_size,
)
self._eval_clients = setup_clients(client_config, client_type=eval_client_type)
self._admin_clients = setup_admin_clients(client_config)
@@ -195,7 +193,6 @@ async def setup_inference_pool(
train_client_type: str = "openai_chat_completions",
eval_client_type: str = "openai_chat_completions",
renderer_config: RendererConfig | None = None,
pool_size: int | None = None,
) -> InferencePool:
"""Create an inference pool from config (static or elastic)."""
if client_config.is_elastic:
@@ -207,7 +204,6 @@ async def setup_inference_pool(
train_client_type=train_client_type,
eval_client_type=eval_client_type,
renderer_config=renderer_config,
pool_size=pool_size,
)
return StaticInferencePool(
@@ -216,7 +212,6 @@ async def setup_inference_pool(
train_client_type=train_client_type,
eval_client_type=eval_client_type,
renderer_config=renderer_config,
pool_size=pool_size,
)
@@ -225,7 +220,6 @@ def setup_clients(
client_type: str = "openai_chat_completions",
renderer_config: RendererConfig | None = None,
renderer_model_name: str | None = None,
pool_size: int | None = None,
) -> list[vf.ClientConfig]:
"""Build one v1 client config per base URL. ``client_type``
``renderer`` → token-in/out (``TrainClientConfig``, with the renderer the env
@@ -237,7 +231,6 @@ def setup_clients(
if is_renderer:
renderer_extra = {
"renderer": renderer_config,
"pool_size": pool_size or 1,
"renderer_model_name": renderer_model_name,
}
env_headers = {
@@ -608,7 +601,7 @@ async def prefill_logprobs(openai: AsyncOpenAI, model: str, token_ids: list[int]
+ ``prompt_logprobs`` (the prime-rl server-side extension in
``inference/vllm/serving_tokens.py``). Returns one logprob per token (0.0 for
the leading token, which has no preceding context)."""
from vllm.entrypoints.serve.disagg.protocol import GenerateResponse
from vllm.entrypoints.scale_out.token_in_token_out.protocol import GenerateResponse
# `/inference/v1/generate` is mounted at server root, not under `/v1`: pass an
# absolute URL so the SDK skips the base-url merge. vLLM's `GenerateResponse`
-5
View File
@@ -116,7 +116,6 @@ class ElasticInferencePool:
train_client_type: str = "openai_chat_completions",
eval_client_type: str = "openai_chat_completions",
renderer_config: RendererConfig | None = None,
pool_size: int | None = None,
):
self.logger = get_logger()
self.client_config = client_config
@@ -129,7 +128,6 @@ class ElasticInferencePool:
self.train_client_type = train_client_type
self.eval_client_type = eval_client_type
self.renderer_config = renderer_config
self.pool_size = pool_size
self.router_url = client_config.router_url
self._servers: dict[str, ServerState] = {}
@@ -155,7 +153,6 @@ class ElasticInferencePool:
train_client_type: str = "openai_chat_completions",
eval_client_type: str = "openai_chat_completions",
renderer_config: RendererConfig | None = None,
pool_size: int | None = None,
) -> ElasticInferencePool:
if client_config.elastic is None:
raise ValueError("Elastic inference pool requires elastic config")
@@ -165,7 +162,6 @@ class ElasticInferencePool:
train_client_type=train_client_type,
eval_client_type=eval_client_type,
renderer_config=renderer_config,
pool_size=pool_size,
)
await pool.start()
return pool
@@ -211,7 +207,6 @@ class ElasticInferencePool:
client_type=self.train_client_type,
renderer_config=self.renderer_config,
renderer_model_name=self.renderer_model_name,
pool_size=self.pool_size,
)
if urls
else []
+2 -2
View File
@@ -15,7 +15,7 @@ import pyarrow as pa
import pyarrow.parquet as pq
from prime_cli.core.config import Config as PrimeConfig
from transformers.tokenization_utils import PreTrainedTokenizer
from verifiers.v1.push import trace_to_sample
from verifiers.v1.utils.platform import trace_to_sample
from prime_rl.configs.orchestrator import OrchestratorConfig
from prime_rl.configs.shared import PrimeMonitorConfig
@@ -295,7 +295,7 @@ class PrimeMonitor(Monitor):
"""Convert rollouts to Parquet bytes for upload. One row per rollout. The conversation
is the unit (no prompt/completion split — meaningless mid-branch): `completion` is the
last branch's messages and `trajectory` is one message list per branch. Shares
`verifiers.v1.push.trace_to_sample` with verifiers' eval `--push`, so a training-run
`verifiers.v1.utils.platform.trace_to_sample` with verifiers' eval `--push`, so a training-run
sample and an eval sample land on the platform identically; the RFT-only columns
(run/step/advantage/problem_id/env_name) are layered on here."""
now = datetime.now(timezone.utc)
+2 -2
View File
@@ -1,6 +1,6 @@
"""Sanity tests for the prime-RL ``ServingTokens`` subclass.
The full happy-path is owned upstream by vLLM 0.20's
The full happy-path is owned upstream by vLLM's
``vllm/entrypoints/serve/disagg`` test suite. We only cover the prime-RL
deltas here:
* ``serialize_routed_experts`` round-trips a compact raw-byte payload.
@@ -15,7 +15,7 @@ import asyncio
import numpy as np
import pybase64
from vllm.entrypoints.openai.engine.protocol import UsageInfo
from vllm.entrypoints.serve.disagg.protocol import GenerateResponse, GenerateResponseChoice
from vllm.entrypoints.scale_out.token_in_token_out.protocol import GenerateResponse, GenerateResponseChoice
from prime_rl.inference.vllm.routed_experts import serialize_routed_experts
from prime_rl.inference.vllm.serving_tokens import (
@@ -99,6 +99,7 @@ def _build_rollout(
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=nodes,
calls=calls,
rewards={"reward": vf.Reward(score=reward)},
+7 -1
View File
@@ -162,7 +162,11 @@ def _make_rollout(
advantages: list[float] | None = None,
) -> Rollout:
rollout = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)), nodes=[], rewards={}, env_name="test-env"
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=[],
rewards={},
env_name="test-env",
)
rollout.samples = samples
rollout.advantages = advantages
@@ -257,6 +261,7 @@ def _two_turn_rollout(observation_role: str = "tool") -> Rollout:
]
rollout = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=nodes,
rewards={"r": vf.Reward(score=1.0)},
env_name="test-env",
@@ -308,6 +313,7 @@ def test_echo_weights_only_content_tokens_when_is_content_present():
]
rollout = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=nodes,
rewards={"r": vf.Reward(score=1.0)},
env_name="test-env",
+2
View File
@@ -59,6 +59,7 @@ def _make_rollout(
nodes = [_assistant_node(completion_ids, completion_logprobs)]
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=nodes,
rewards={"reward": vf.Reward(score=reward)},
)
@@ -141,6 +142,7 @@ def test_gibberish_aligns_logprobs_under_generation_prompt_scaffold():
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=[_scaffold_assistant_node([50, 80, 120_000], [-1.0, -0.5, gibberish_filter.logprob_threshold - 1.0])],
rewards={"reward": vf.Reward(score=1.0)},
)
+13 -15
View File
@@ -30,9 +30,9 @@ def mk(
is_filtered: bool = False,
filter_results: dict | None = None,
setup: float = 0.0,
generation: float = 0.0,
generation_model: float = 0.0,
generation_harness: float = 0.0,
agent: float = 0.0,
agent_model: float = 0.0,
agent_harness: float = 0.0,
finalize: float = 0.0,
scoring: float = 0.0,
):
@@ -48,21 +48,21 @@ def mk(
is_truncated=is_truncated,
is_completed=is_completed,
has_error=has_error,
error=SimpleNamespace(type=error_type) if has_error else None,
last_error=SimpleNamespace(type=error_type) if has_error else None,
stop_condition=stop_condition,
metrics=metrics or {},
env_name=env_name,
group_id=group_id,
trainable=trainable,
agent=SimpleNamespace(trainable=trainable),
is_trainable=is_trainable,
is_filtered=is_filtered,
filter_results=filter_results or {},
timing=SimpleNamespace(
setup=SimpleNamespace(duration=setup),
generation=SimpleNamespace(
duration=generation,
model=SimpleNamespace(duration=generation_model),
harness=SimpleNamespace(duration=generation_harness),
agent=SimpleNamespace(
duration=agent,
model=SimpleNamespace(duration=agent_model),
harness=SimpleNamespace(duration=agent_harness),
),
finalize=SimpleNamespace(duration=finalize),
scoring=SimpleNamespace(duration=scoring),
@@ -154,16 +154,14 @@ def test_nested_metrics_and_rewards():
def test_nested_timing():
m = TrainRollouts(
[mk(setup=1.0, generation=2.0, generation_model=1.5, generation_harness=0.5, finalize=0.5, scoring=0.5)]
).metrics
m = TrainRollouts([mk(setup=1.0, agent=2.0, agent_model=1.5, agent_harness=0.5, finalize=0.5, scoring=0.5)]).metrics
assert m.timing.setup.mean() == 1.0 and m.timing.total.mean() == 4.0 # total sums all four phases
assert m.timing.generation_model.mean() == 1.5 and m.timing.generation_harness.mean() == 0.5
assert m.timing.agent_model.mean() == 1.5 and m.timing.agent_harness.mean() == 0.5
out = m.to_wandb(prefix="train/agg", subset="all")
assert out["train/agg/all/timing/setup/mean"] == 1.0
assert out["train/agg/all/timing/total/mean"] == 4.0
assert out["train/agg/all/timing/generation/model/mean"] == 1.5
assert out["train/agg/all/timing/generation/harness/mean"] == 0.5
assert out["train/agg/all/timing/agent/model/mean"] == 1.5
assert out["train/agg/all/timing/agent/harness/mean"] == 0.5
def test_train_only_metrics_absent_from_eval():
@@ -17,7 +17,6 @@ def test_setup_policy_inference_pool_uses_renderer_when_enabled():
name="policy-model",
),
renderer=renderer_settings,
pool_size=None,
any_policy_sourced=True,
)
renderer = object()
@@ -44,7 +43,6 @@ def test_setup_policy_inference_pool_uses_renderer_when_enabled():
train_client_type="renderer",
eval_client_type="openai_chat_completions",
renderer_config=renderer_settings,
pool_size=None,
)
asyncio.run(run())
@@ -65,7 +63,6 @@ def test_setup_policy_inference_pool_keeps_renderer_without_policy_sampling():
name="policy-model",
),
renderer=renderer_settings,
pool_size=None,
any_policy_sourced=False,
)
renderer = object()
@@ -92,7 +89,6 @@ def test_setup_policy_inference_pool_keeps_renderer_without_policy_sampling():
train_client_type="renderer",
eval_client_type="openai_chat_completions",
renderer_config=renderer_settings,
pool_size=None,
)
asyncio.run(run())
+2 -2
View File
@@ -96,8 +96,8 @@ def test_renderer_client_qwen3_vl_e2e_features_payload_roundtrips_through_vllm()
ClientConfig,
UserMessage,
)
from vllm.entrypoints.serve.disagg.mm_serde import decode_mm_kwargs_item
from vllm.entrypoints.serve.disagg.protocol import GenerateRequest
from vllm.entrypoints.scale_out.token_in_token_out.mm_serde import decode_mm_kwargs_item
from vllm.entrypoints.scale_out.token_in_token_out.protocol import GenerateRequest
# ── Build a real Qwen3VLRenderer with a real processor. ─────────────
tokenizer = load_tokenizer(_MODEL)
+1 -1
View File
@@ -3,7 +3,7 @@ from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
from verifiers.v1.clients.config import EvalClientConfig
from verifiers.v1.configs.client import EvalClientConfig
from prime_rl.configs.shared import ClientConfig
from prime_rl.utils.client import _is_retryable_lora_error, check_health, load_lora_adapter, setup_clients
+1 -1
View File
@@ -4,7 +4,7 @@ from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
from verifiers.v1.clients.config import TrainClientConfig
from verifiers.v1.configs.client import TrainClientConfig
from prime_rl.utils.elastic import (
AdapterState,
+3 -1
View File
@@ -37,6 +37,7 @@ def _build_rollout(*, example_id: int, reward: float, task: str) -> Rollout:
]
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=example_id, prompt=f"prompt-{example_id}")),
agent=vf.AgentInfo(config=vf.AgentConfig()),
nodes=nodes,
rewards={"reward": vf.Reward(score=reward)},
)
@@ -81,7 +82,8 @@ def test_rollouts_to_parquet_bytes_skips_rollouts_without_trajectory():
rollout_with_branches = _build_rollout(example_id=1, reward=1.0, task="task-a")
rollout_without_branches = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=2, prompt="missing-trajectory"))
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=2, prompt="missing-trajectory")),
agent=vf.AgentInfo(config=vf.AgentConfig()),
)
assert rollout_without_branches.branches == []
Generated
+1830 -1773
View File
File diff suppressed because it is too large Load Diff