44 Commits
Author SHA1 Message Date
cb74ae2beb feat: bump verifiers to 0.2.2.dev7, adopt the multi-agent episode wire (#3104)
* feat: bump verifiers to 0.2.2.dev7, adopt the multi-agent episode wire

Companion to PrimeIntellect-ai/verifiers#1939 (multi-agent api). Re-pins
deps/verifiers to 192fd8ef0 (= 0.2.2.dev7) and deps/pydantic-config to
v0.4.2 (verifiers now requires prime-pydantic-config>=0.4.2).

- Serve wire: the env-server route run_rollout -> run, answering one
  Episode envelope ({id, env, ok, errors, traces}) per env-rollout.
  Env.run returns list[Rollout]; an episode that failed before minting
  any trace raises (the dispatcher synthesizes its error marker), and a
  not-ok episode marks its clean traces failed so a broken episode's
  partial seats are never trained on.
- The episode is the pipeline currency: the dispatcher emits one episode
  (list[Rollout]) per completed task onto out_q (a legacy run_group
  result emits its traces as single-trace episodes), and both sinks
  count episodes - never loose traces - toward group_size and eval epoch
  sizes. episode_id is stamped into info so saved records keep grouping.
- ok is the success sentinel: has_error now reads it, so the dispatcher's
  empty-trajectory promotion also flips ok, and error markers carry it.
- Only the trainable subset becomes training samples: a trace stamped
  untrainable (a multi-agent env's frozen agent) is never tokenized,
  never enters the group advantage, and never ships; it still lands in
  the trace files and observation window.
- Config shape: everything env lives under the env block, following the
  new vf.EnvServerConfig (env.taskset, env.agent.harness, per-agent caps
  under env.agent.*). All checked-in TOMLs migrated; the spawned env
  server receives the picklable env block via env_config_data.
- run_group survives only for v0/legacy bridge envs (a v1 server refuses
  it and always reports requires_group_scoring=False); vf's @group_reward
  removal doesn't touch prime-rl's own Algorithm.score_group.

Verified: tests/unit green (487 passed; config-loading params covered all
migrated TOMLs), ruff clean, and a 3-step reverse-text RL run on 2 GPUs
trains at 0% errors with every saved trace carrying ok, agent.name,
agent.trainable, and a distinct info.episode_id.

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

* chore: trim narrative comments to the load-bearing facts

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

* fix: count buffered sink progress in episodes; explicit ok=False on cancel markers

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

* fix: keep untrainable traces out of the effective views and the derived avg@k

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 16:44:20 -07:00
691dd4ef14 chore: overhaul public configs/ and examples/ (#3085)
* chore: overhaul public configs/ and examples/

Restructure the public configs/ and examples/ trees for clarity.

- examples/: split into basic/ (core-env tutorials) and advanced/
  (folder-per-model: qwen3-30b-a3b, glm-4.5-air, glm-5.2, minimax-m2.5,
  nemotron-3-super, intellect-3.1), each with a README; drop multinode/
  and the example screenshots.
- configs/: add basic/ (small 2-GPU dev mirrors of the core envs, one folder
  + README each, validated at 1 step); rename debug/algorithms -> debug/algo;
  move debug/{rl,sft} -> debug/fake/{rl,sft}.toml; remove stale/internal
  configs (gsm8k, nemotron_*, hendrycks_math, general_agent, elastic,
  debug/v1, debug/{infer,orch,multimodal}.toml, debug/{hendrycks_sanity,moe,multi_env}).
- Remove the k8s/ Helm chart and its docs.
- Repoint README, docs/, nightly tests, and CI to the new paths; lowercase
  prime-rl throughout docs and READMEs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: drop per-model READMEs in examples/advanced

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(k8s): keep Helm chart, refresh reverse-text example configs

Keep the k8s/ Helm chart (undo its removal earlier in this branch) and bring
its reverse-text example back in sync with the current config layout.

The chart invoked examples/reverse_text/rl/{orch,infer,train}.toml — a split
config layout flattened into a single rl.toml months ago (#1859), so the
shipped example had pointed at non-existent files. Add current, validated
orch/infer/train configs under k8s/prime-rl/examples/reverse-text/ (split from
examples/basic/reverse_text/rl.toml), point the chart and docs at them, and
COPY k8s/ into the CUDA image so /app/k8s/... resolves at runtime.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(configs): hyphenate all directory names in configs/, examples/, k8s/

Normalize directory naming to hyphens, matching the model dirs and logical
ids (reverse-text-v1, prime-rl). Renames the env/task dirs that still used
underscores:

  examples/basic/{reverse_text,alphabet_sort,wiki_search,hendrycks_sanity}
  configs/basic/{reverse_text,alphabet_sort,wiki_search,hendrycks_sanity}
  configs/ci/integration/reverse_text{,_lora,_moe,_multi_run,_rl_opd,_rl_sft,_sft,_sft_lora}

to the same names with hyphens, and updates every path reference (README,
docs, skills, nightly + integration test path args, the cpu_tests
config-import check). Python test files/modules and *.toml filenames keep
underscores.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(examples): eval CLI migration, SLURM cleanup, batch sizes, glm-5.2 layout

- Migrate every eval command in examples/basic READMEs from `vf-eval` to the v1
  `eval` CLI (pydantic-config): `-b` -> `--client.base-url`, `--max-tokens`/`-t`
  -> `--sampling.max-tokens`, `--env-args` -> `--args`, plus `-r 3` (v1 defaults
  to 1 rollout; these READMEs report 20x3), `--harness.id null` (these envs train
  with the null harness), and `--no-push`. Drop the now-dead vf-eval skip in
  tests/unit/test_configs.py.
- Remove all SLURM overlays (slurm_rl.toml, slurm_sft.toml) from examples/basic.
  Move the slim-wheel SFT+[slurm] parse fixture to configs/ci/slim_sft.toml and
  repoint cpu_tests.yaml; drop the SLURM section from the hendrycks-sanity README
  and the SLURM line from the start-run skill.
- Tune basic example batch/group sizes: alphabet-sort 256/16, wordle 512/16
  (wiki-search already 512/16).
- Restructure examples/advanced/glm-5.2: inference configs ->
  infer/{pd,pd-llmd}.toml, RL configs -> {swe,swe-llmd}.toml; repoint docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: fix outdated docs/skills/configs surfaced by v1 audit

Swept docs/, skills/, READMEs, and config TOMLs for outdated content (special
focus on v0->v1 drift). Verified every fix against current code.

docs/
- configuration.md: repoint 5 dead Basic example links to examples/basic/<hyphen>;
  scope the "each dir has a README" claim to basic (advanced dirs are config-only).
- algorithms.md: opd reference-model field is `teacher` not `model`; renderer names
  `glm-5`/`glm-4.5` (were invalid `glm5`/`glm4.5`); rewrite the per-env algorithm
  example in the v1 taskset/harness form (was the v0 bare-`id` form).
- development.md: drop invalid `--data.type null` (SFT DataConfig has no such type).
- inference.md: fix "Dissagregation" typo + dead P/D anchor.
- overview.md: token-in route is `/inference/v1/generate`.

skills/
- monitor-run: correct the metric tables to the real
  {scope}/{subset}/<metric>/<stat> scheme (num_total_tokens, has_error,
  time/wait_for_policy, dispatcher/*); the old seq_len / errored_rollouts /
  scheduler/* / generate_completions names never existed.
- install: drop the deep-gemm mention (no such section) from the description.

READMEs
- examples/README.md: basic runs on 1-8 GPUs (not 2); hyphenate env names.
- configs/README.md: drop stale "standalone entrypoint configs"; hyphenate.
- wiki-search: eval inference uses `--model.*` (not `--inference.model.*`) and drops
  the auto-derived `enable_auto_tool_choice` flag; "native V1 tools" not "MCP".
- reverse-text: fix dead sft/train.toml path -> sft.toml.
- hyphenate configs/basic/* README headings.

configs/
- qwen3-30b-a3b/tool.toml: move `min_tier` into the taskset (was under a v0
  `[...env.args]` block a v1 taskset never reads); group_size alias.
- glm-5.2/swe-llmd.toml: rollouts_per_example -> group_size.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(configs): use prime-qwen3 renderer for reverse-text (was default)

The reverse-text configs run PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT, whose
`-SFT` suffix misses MODEL_RENDERER_MAP's exact-match lookup and so fell back to
the DefaultRenderer. reverse-text is single-turn and always sends a system
prompt ([system, user, assistant]); the prime-qwen3 renderer is token-for-token
identical to the model's apply_chat_template for that shape (verified via
render_ids parity), and unlike the stock qwen3 renderer it does not inject an
empty <think></think> block. Switch the 7 standard + 3 distill reverse-text
configs to prime-qwen3.

Kept `default` where no hand-coded renderer fits (each errors on the model's
tokenizer): hendrycks-sanity (DeepSeek-R1-Distill-Qwen-1.5B), reverse-text-moe
(samsja/mini-glm-moe), intellect-3.1 (INTELLECT-3-Base).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(configs): use prime-qwen3 (not qwen3) for PrimeIntellect Qwen3 configs

The stock `qwen3` renderer injects an empty <think></think> block the
PrimeIntellect Qwen3 template never emits, so it mismatches these models'
apply_chat_template — single-turn for reverse-text, and every multi-turn shape
for wordle (verified via render_ids parity) — corrupting training tokenization.

- configs/basic/wordle/rl.toml: qwen3 + thinking_retention="all" -> prime-qwen3,
  matching the tutorial examples/basic/wordle (which already uses prime-qwen3).
- configs/debug/algo/{echo,grpo,max_rl,self_distill,mixed_grpo_opd,opd,opd_lora}.toml
  and configs/ci/integration/reverse-text-rl-opd/start.toml: qwen3 -> prime-qwen3
  (all run PrimeIntellect/Qwen3-0.6B-Reverse-Text-{SFT,RL}).

prime-qwen3 handles the PI template's think retention natively, so the explicit
thinking_retention="all" is dropped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(k8s): use prime-qwen3 renderer in reverse-text orch config

The k8s reverse-text orchestrator config was split from the reverse-text example
before that example migrated to prime-qwen3, and the renderer migration was
scoped to configs/ and examples/ — so this one kept the stale `default`. Align
it with the source (PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT → prime-qwen3).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(k8s): drop redundant renderer comment in reverse-text orch config

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 10:59:06 -07:00
18665f7d58 feat: stamp platform trace metadata via verifiers Trace fields (#3061)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: stamp platform trace metadata via verifiers Trace fields

Companion to verifiers#2053 (RES-1078). Rollouts are stamped on arrival
in the orchestrator via vf.Trace.stamp - run_id (from the new
Monitor.run_id: platform id preferred, else wandb), tag, step as
first-class trace fields, env_name/group_id/policy_version into info -
replacing the Rollout.to_record override. Bumps deps/verifiers to the
trace-fields commit and deps/renderers to satisfy its >=0.1.8 floor.

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

* chore: bump verifiers to reshaped trace metadata

VersionInfo + AgentInfo (model, sampling, harness id), taskset_id
dropped upstream.

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

* chore: bump verifiers - run_id/tag grouped into Trace.run, schema_version renamed to version

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

* chore: bump verifiers - RunInfo discriminated union, stamp(run)

step lives on TrainRunInfo; inline-eval trigger step goes to
info.eval_step to keep eval records placeable.

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

* chore: bump verifiers to branch head (gepa stamping reverted)

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

* chore: bump verifiers - AgentInfo embeds full HarnessConfig

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

* chore: bump verifiers - eval trigger step moves to EvalRunInfo.step

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

* chore: bump verifiers - verifiers_commit foreign-repo guard

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

* chore: bump verifiers to branch head

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

* chore: bump verifiers past the openenv restructure

openenv is a built-in taskset behind verifiers[openenv] now (vf#2059),
so the deps/verifiers/packages/* workspace glob goes away again.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 10:15:28 -07:00
Florian BrandandGitHub 5f7e3ffcaa chore: migrate environment configs to V1 (#3058)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-07-17 15:34:42 +02:00
Matej SirovatkaandGitHub 390dfdc556 fix: support DeepGEMM FP8 training on SM100 (#3022)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix: support DeepGEMM grouped GEMM on SM100

* Remove FP8 inference instructions

Remove FP8 inference section from SKILL.md.

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>

* refactor: inline DeepGEMM scale mode

* fix: support FP8 linears on SM100

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-07-14 02:19:24 +02:00
cb43db2ad1 feat: make all envs uv workspace members, drop the envs extra (#3019)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: make research-environment envs uv workspace members

Research envs under deps/research-environments/environments/*/* are now
auto-discovered uv workspace members instead of being hand-registered in
the `envs` extra + [tool.uv.sources]. Adding a new research env needs no
pyproject.toml change - the glob picks it up and it's locked automatically.

They are opt-in: `uv sync` / `--all-extras` no longer install them; use
`uv sync --all-packages`. Env-running sites (sbatch training templates,
gpu/nightly CI, Docker image + entrypoint, nemotron config, example
READMEs) gain --all-packages; dev quickstart and cpu unit tests stay lean.

tau2-synth-v1 and tau3-bench-v1 are excluded - they pin `tau2` forks/revs
that conflict with the canonical tau2-bench-v1 in the workspace's shared lock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: make verifiers envs workspace members, drop the envs extra

Extends the workspace glob to deps/verifiers/environments/*, so verifiers-repo
envs are auto-discovered members alongside the research envs. Removes the
now-empty `envs` optional-dependency and all its [tool.uv.sources] entries, and
drops the defunct `--extra envs` from cpu_tests, Dockerfile.cuda, and
docker-entrypoint.sh (env members install via --all-packages instead).

All 94 env members (66 research + 28 verifiers) lock, install, and import.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ci): install all env packages in cpu_tests

test_load_configs parses every config, and parsing a v1-taskset config makes
verifiers import the env package to derive its taskset config type. With envs
now workspace members, the lean `uv sync --extra flash-attn` left them
uninstalled, so 28 config tests failed with ModuleNotFoundError. Add
--all-packages so the referenced env packages are importable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 15:46:33 -07:00
1caebf8a1b feat: save all rollouts, not just the effective ones (#2983)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore(deps): bump verifiers to fab50d51

Picks up feat: record runtime info on the trace (verifiers#1959) — every
trace now carries its runtime's full config plus the provisioned resource
id — and the results.jsonl -> traces.jsonl rename (verifiers#1956).

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

* feat(orchestrator): save all rollouts, not just the batched ones

Rollout traces move from rollouts/step_N/{train,eval}_rollouts*.jsonl to
traces/{train,eval}/{all,effective}/:

- all/traces.jsonl is a flat run-level stream appended the moment each
  rollout completes — errored, filtered, and never-batched rollouts
  included — so it is durable across crashes and drains.
- effective/step_N/traces.jsonl is written on batch finalize as before,
  but now holds only the clean subset that shipped to the trainer (eval:
  the non-errored epoch cohort; multiple eval envs share the step file).

Rollout.to_record() now includes the orchestration metadata (kind,
env_name, group_id, policy_version, eval_step) so records in the flat
all stream can be placed without relying on the file path. Together with
the verifiers bump, each record also carries the runtime info (config +
sandbox id), so sandbox errors can be correlated from the all stream.

The all streams have no per-step layout, so resume can't rewind them;
they are wiped on fresh runs only. The per-step effective files rewind
past the resume step exactly like the rollout dirs.

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

* refactor(orchestrator): nest trace files under per-step directories

traces/{train,eval}/... -> traces/step_N/{train,eval}/{all,effective}/
traces.jsonl. Train arrivals attribute to the batch window currently
collecting (progress.step), eval arrivals to their eval trigger step, so
the all files stay append-per-rollout. Per-step layout also lets resume
rewind traces past the resume step exactly like rollouts and broadcasts.

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

* refactor(orchestrator): nest trace files under the rollout dir

traces/step_N/{train,eval}/... -> rollouts/{train,eval}/step_N/
{all,effective}/traces.jsonl. No separate traces/ top-level dir; the
per-kind subtrees coexist with the trainer-bound rollouts/step_N/*.bin
transport files and rewind on resume like the other step directories.

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

* refactor(orchestrator): order trace files step-first under the rollout dir

rollouts/{train,eval}/step_N/... -> rollouts/step_N/{train,eval}/
{all,effective}/traces.jsonl, next to the step's train_rollouts.bin.
The existing per-step rewind on the rollout dirs covers the traces
again, so clean_future_steps needs no extra entries.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 15:40:51 -07:00
9fede0ac78 feat: auto-create curated W&B overview view per project (#2933)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: auto-create curated W&B "overview" saved view per project

Creates an idempotent "overview" saved view (train / eval / stability /
performance sections) on the first run into a W&B project, so a new project
gets a usable overview without hand-picking panels from the thousands of
logged metrics.

- New src/prime_rl/utils/monitor/workspace.py builds the view via wandb-workspaces
- WandbMonitor creates it after wandb.init (run's primary process, online only,
  best-effort so a failure never breaks training; skips if it already exists)
- Per-env train/<env> and eval/<env> sections built from the orchestrator's
  resolved env names; single train env collapses to train/<env>, multiple add
  train/agg on top
- inference/* panels use the wall-clock x-axis (they are logged against
  _timestamp); every other panel uses `step`
- Config: WandbConfig.create_overview (default True; --wandb.no-create-overview)

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

* feat: add time/wait_for_batch to overview performance section

* feat: always create overview when wandb enabled (drop create_overview config)

* chore: rename overview env-name params to train_env_names/eval_env_names

* chore: make overview metric/layout constants public

* feat: version overview on env-set change; make helpers public, inline x_for

* refactor: fold overview view code into monitor/wandb.py

* docs: note deliberate metric volume + auto-created W&B overview view

* feat: unify train/eval overview metrics (reward vs avg@), all subset only

* chore: drop perf throughput/throughput_per_gpu/peak_memory from overview

* fix: isolate per-view load in overview reuse loop so one bad view doesn't abort

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 12:39:30 -07:00
2a0007f51d chore: bump verifiers + research-environments to main (#2904)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore: bump verifiers + research-environments to main

- verifiers: aa95826d → 97be43bf
- research-environments: 99ebd2e13 → bae0ffe5a
- lock new v1 envs: lean-v1 (6 per-dataset Lean tasksets), prolog-v1
- bump verifiers floor 0.1.15.dev400 → dev404

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

* chore: lock remaining research-environments v1 envs

Lock the 21 previously-unlocked RE v1 env packages into the `envs` extra
+ tool.uv.sources, and alphabetize both the `envs` list and the env source
entries.

tau3-bench-v1 is intentionally excluded: it requires tau2 @ git 58e5e1a,
which conflicts with the tau2 @ 337326e pinned by the already-locked
tau2-bench-v1 (uv cannot resolve two URLs for one package).

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

* chore: drop rlm-swe to remove the verifiers override

rlm-swe pins verifiers>=0.1.15.dev17,<0.1.15.dev156 — a stale upper bound
that conflicts with the editable verifiers submodule (dev404) and with the
other envs / prime-rl-configs. It was the sole reason verifiers needed a
global override-dependencies entry (without it, resolution is unsatisfiable).

Dropping rlm-swe lets us remove that override: verifiers now resolves to the
editable submodule through tool.uv.sources alone. Also prunes rlm-swe's heavy
transitive deps (modal, swebench, swe-rex, pygithub, …) from the lock.

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

* chore: migrate rlm_swe config dependents to r2e-gym-v1

Dropping the rlm-swe env orphaned its in-repo config dependents:
- examples/glm5_llmd/rl.toml: migrate the v0 `rlm_swe` env block to the v1
  `r2e-gym-v1` taskset on the rlm harness (prime runtime), mirroring
  configs/debug/v1/r2e_gym.toml
- configs/rlm_swe/qwen35_4b.toml: remove (superseded by configs/debug/v1/r2e_gym.toml)
- skills/training/start-run: point the find_spec example at r2e_gym_v1
- configs/debug/v1/r2e_gym.toml: drop the stale reference to the removed v0 config

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 13:56:02 -07:00
halleriteandGitHub 0be5ac452a feat: algorithm abstraction — named algorithm classes + inline frozen-model references (grpo, opd, sft_distill, self_distill, echo) (#2746)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-06-27 21:15:02 +02:00
7089ba1e4d feat: vf v1 <> nano bridge (#2742)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: add vf-nano as submodule

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

* chore: bump deps/vf-nano to feat/env-server (EnvServer)

Points the submodule at the vf-nano EnvServer branch so the orchestrator can
build on the env-server abstraction.

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

* feat: run orchestrator on a vf-nano env server (reverse-text)

Switch prime-rl's env path to vf-nano: the orchestrator spawns a vf-nano
EnvServer per env (it never loads an environment), dispatches rollouts by task
index, and trains on the returned Trace dicts (branches + renderer tokens).

- pyproject: dep verifiers -> vf-nano; drop v1/research env packages; only the
  vf-nano reverse-text example; override out the transitive v1 verifiers (pulled
  by the prime CLI) so it can't shadow vf-nano's `verifiers` package; add orjson
  /pandas/msgspec (were transitive via verifiers).
- EnvConfig inherits vf-nano's swappable agent/runtime (+ max_turns).
- envs.py: spawn EnvServer child + EnvClient, info() for num_tasks/group-scoring,
  dispatch by task_idx, adapt Trace -> RolloutOutput-shaped dict.
- trajectories.py: trace_to_samples (one sample per Trace branch) + trace_to_output.
- train_source: index sampling; client pool builds vf-nano ClientConfig; lag
  monitor vendored; env-server entrypoint repointed; ~14 files retyped off
  vf.RolloutOutput / vf.ClientConfig.
- configs/debug/vf_nano_reverse_text.toml.

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

* feat: consume vf-nano Trace natively (branches→samples, shared renderer config)

- trace_to_samples stitches each Trace branch's tokens into one TrainingSample
  (prompt = branch start, then each turn's new context [masked] + generated
  tokens [trained]); drop the RolloutOutput adapter — read the Trace's native
  fields directly (reward, error{type,message}, timing generation/scoring,
  num_turns, branches).
- envs returns the raw Trace; eval_sink / train_sink / dispatcher / metrics /
  orchestrator read native Trace fields (no token_usage/completion/timing.total).
- client pool forwards the shared renderers.RendererConfig to the env server's
  renderer client (so it uses qwen3, not the tool-less default fallback).
- debug config: tool_call_parser=hermes (vLLM accepts the agent's tools),
  max_steps=20.
- bump deps/vf-nano.

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

* refactor: pass typed ClientConfig/SamplingConfig to the env client (no timeout)

- Env.run_rollout/run_group pass the vf-nano ClientConfig object and a
  SamplingConfig (built from the env's sampling args) directly — no model_dump,
  no per-rollout timeout forwarded to the server.
- debug config: max_steps=20.
- bump deps/vf-nano (typed env-server RPC).

* refactor: orchestrator holds a typed vf.Trace[EnvTask] (no dicts)

The env server returns a Trace minus its derived fields; the orchestrator resolves
the env's Task subclass (from config.id) and validates the wire dict into a strict
Trace[EnvTask], so the whole orchestrator works with a real, typed vf.Trace —
typed task fields included (e.g. task.answer), nothing subscriptable.

- envs.py: resolve_task_type(env_id); run_rollout/run_group validate -> Trace[EnvTask].
- trajectories/types/dispatcher/train_sink/eval_sink/metrics/filters/advantage/utils
  /orchestrator: attribute access on the typed Trace (reward, error{type,message},
  branches, timing.<span>.duration, num_turns, ...); derived fields recompute on the
  consumer.
- Task/Trace/TimeSpan stay strict (StrictBaseModel) — no extra=ignore anywhere.
- bump deps/vf-nano.

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

* chore: depend on vf-nano[serve]; bump submodule

The orchestrator spawns the env server, so request the serve extra
(zmq/msgpack) explicitly now that vf-nano keeps them out of core.

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

* chore: bump vf-nano (client docstring cleanup)

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

* chore: drop redundant forward-ref quotes in advantage.py

`from __future__ import annotations` already defers all annotations to strings,
so the quotes + `# noqa: F821` on the TYPE_CHECKING-only `vf.Trace` / `TrainRollout`
annotations are unnecessary (no import cycle — verifiers.nano never imports prime_rl).

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

* refactor: rename FinishedRollout.raw -> trace

The field holds a typed vf.Trace, so `trace` reads truer than `raw` (which
suggested an unparsed dict). Renames the field + every `.raw` access, the
`emit_rollout(trace=...)` param/kwarg, the to_dict field filter, and the
dispatcher cancel-path locals.

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

* refactor: simplify FinishedRollout, read straight off the typed Trace

- Drop the FinishedRollout proxy properties (error/reward/is_truncated and the
  example_id field); consumers now read r.trace.{reward,is_truncated,task.idx,...}
  directly. The trace is the single source of truth.
- Use vf.Trace.has_error for existence checks instead of `.error is not None`.
- Replace the prime-rl trace_* token-length utils with vf.Trace.{completion_len,
  total_tokens,has_response} (now on the trace); keep trace_to_samples.
- Carry task_idx end-to-end (GroupState.task_idx, env.run_rollout/run_group(task_idx),
  source dict key) instead of the example/example_id dict carrier; identity comes
  off trace.task.idx.
- Mark the local-package env arrangement as a temporary/experimental TODO.
- Move the debug config to configs/debug/nano/reverse_text.toml.
- Bump deps/vf-nano (Trace/Turn accessors).

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

* refactor: spawn env server on an OS-assigned port, drop the startup poll

- The env server binds tcp://127.0.0.1:0 and reports its concrete address back
  over a queue; the orchestrator connects to that. Removes _get_free_port and its
  TOCTOU race (the OS assigns the port atomically).
- A spawned server has already bound + loaded by the time it reports its address,
  so the untimed info() is enough — only poll wait_for_server_startup for an
  external (config.address) server, which has no spawn handshake.
- Bump deps/vf-nano (port report + Trace/Branch token-length accessors).

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

* refactor: use vf.task_type instead of a local resolve_task_type

The Task-subclass introspection now lives in vf-nano (vf.task_type); drop the
prime-rl copy and build the typed Trace via vf.Trace[vf.task_type(env_id)]. Bump
deps/vf-nano.

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

* feat: restore backfill_rollout_tokens for SFT (typed Trace)

SFT trains on a teacher served over the chat client, which returns no token ids,
so the trace's turns have tokens=None and trace_to_samples yields nothing. Restore
backfill: for each tokenless turn, render its prompt + assistant response with the
student chat template and split on the longest common prefix to fill TurnTokens
(masks/logprobs come from trace_to_samples). train_sink.process_rollout backfills
when any turn lacks tokens, before building samples.

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

* fix: pass task_idx when building Cancelled traces on off-policy drop

drop_group's error_rollout_output calls omitted the required task_idx, so an
off-policy cancel (on_new_version) raised TypeError. Use the group's task_idx
(or -1 when the group is already gone), mirroring handle_completed_rollout.

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

* refactor: consume typed Trace[WireTask]; inline synthetic error traces

- envs.py: EnvClient now returns Trace[WireTask]; upgrade to this env's real Task
  subclass via self.trace_type.model_validate(wire.to_wire()).
- dispatcher.py: drop the error_rollout_output helper — inline the synthetic error
  Trace at each call site using vf.Error's field names (type/message/traceback); the
  task-exception path carries a real traceback, cancels/empty-trajectory carry none.
- Bump deps/vf-nano.

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

* feat: env-server file logging; align debug config batch/group to canonical

- Spawned env servers now route their output (logging + subprocess-runtime output)
  to <output_dir>/logs/envs/<name>.log via a _run_env_server wrapper that redirects
  stdout/stderr and sets up logging in the child. Previously the orchestrator-spawned
  server logged nowhere.
- Debug config: batch_size 16->128, group_size 8->16, eval num_examples 8->128
  (interval=1), matching configs/debug/training_modes/rl.toml.

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

* fix: don't double the envs/ segment in the env-server log path

The orchestrator already passes a train/eval-split log_dir (.../logs/envs/train,
.../logs/envs/eval), so _spawn must drop the file directly under it
(<log_dir>/<name>.log) rather than re-adding an envs/ subdir — which had buried the
train/eval split under logs/envs/<kind>/envs/<name>.log.

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

* chore: bump vf-nano (Error.traceback str | None)

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

* chore: bump vf-nano (to_wire ordering)

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

* feat: launch env servers as separate processes from the rl entrypoint

Instead of the orchestrator sidecar-spawning each env server as an mp child, the
rl launcher now spawns one `env-server` process per env (train + eval), each on a
free port, with output to logs/envs/{kind}/{name}.log and a crash monitor — same
model as inference/trainer. It sets env.address in the orchestrator config so the
orchestrator attaches (its existing external path) instead of spawning. Envs that
already set address (user-managed external server) are left alone; the orchestrator's
mp sidecar stays as the fallback for running `orchestrator` directly.

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

* refactor: env servers use fixed configurable ports, not get_free_port

Add RLConfig.env_server_base_port (default 5000); the i-th launcher-managed env binds
base_port + i. Drops the get_free_port dependency in the launcher.

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

* refactor: separate train/eval env-server port blocks

Train envs bind base_port + i; eval envs bind base_port + ENV_SERVER_KIND_STRIDE + i
(stride 1000), so each kind has headroom for many envs without the blocks colliding
(was a single running index — train and eval sat adjacent).

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

* fix: env-server logs + sidecar queue cleanup; train-only debug config

- env_server entrypoint: intercept vf-nano stdlib logging so the server's own logs
  (EnvServer up, request failures) land in logs/envs/<kind>/<name>.log — previously
  only loguru output was captured, swallowing them.
- envs.py: close the address-handoff mp.Queue after use (no resource_tracker
  leaked-semaphore warning on the sidecar path).
- configs/debug/nano/reverse_text.toml: drop the eval block, mirroring
  examples/reverse_text/rl.toml (train-only smoke; eval path validated separately).
- bump deps/vf-nano (serve/types docstring trim).

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

* chore: bump vf-nano (BaseRequest marker, no request_type field)

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

* chore: env client uses client= (was client_config=); bump vf-nano

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

* chore: bump vf-nano (drop renderers dep comment)

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

* chore: bump vf-nano (configs/ + cli/ split, serve/ runtime-only)

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

* refactor: drop FinishedRollout.to_dict; serialize the Trace to disk directly

The I/O boundary (save_rollouts + monitor sample tables) now dumps the typed
vf.Trace itself (r.trace.model_dump(mode="json")) instead of a Trace+metadata
merge — the on-disk rollout is just the trace.

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

* refactor: track vf-nano agent->harness rename

vf-nano renamed its rollout-driver abstraction Agent -> Harness. Update the
integration: EnvConfig.agent -> harness (HarnessConfig/DefaultHarnessConfig);
env.run_rollout/run_group spawn forwards harness_config; the env-server entrypoint
passes harness_config/harness_timeout; debug config uses `harness = {...}`. Bump
deps/vf-nano to the renamed branch.

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

* chore: track vf-nano plugin reorg (reverse-text path + bump)

vf-nano reorganized examples into examples/{tasksets,harnesses}/; point the
reverse-text editable source at examples/tasksets/reverse_text and bump deps/vf-nano.
No prime-rl code change — EnvConfig.harness (default) resolves via vf-nano's built-in
harness registry. Verified: 3-step reverse-text smoke trains (0.26 -> 0.42, 0% error).

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

* feat: reuse vf.EnvConfig in the orchestrator (typed taskset/harness, drop args)

prime-rl's EnvConfig now subclasses vf.EnvConfig and resolves taskset + harness to their
specific config types by id (taskset_config_type / harness_config_type), so env-specific
fields are validated against the real config — the untyped `args` dict and the top-level
`id` are gone (id/stripped_id/resolved_name are now properties off taskset.id). Timeouts
come from vf.TimeoutConfig (timeout.rollout / timeout.scoring), superseding prime-rl's flat
timeout. The env server is spawned with the typed taskset_config (no env_id/args).

- pyproject: install the vf-nano plugin packages (default/rlm harnesses, gsm8k taskset)
  as path sources; bump deps/vf-nano to the plugin-packages branch.
- configs/debug/nano/reverse_text.toml: taskset = { id = ... }, harness.id (was harness.type).

Verified: custom taskset (gsm8k.split) + harness (rlm.ref) resolve to typed configs; bad
fields are rejected; the migrated TOML loads through RLConfig.

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

* refactor: inherit vf's shared plugin resolution; trim dead EnvConfig fields

EnvConfig drops its own _resolve_plugins (now inherited from vf.EnvConfig's shared
validator) and the dead v1-forwarding fields: extra_env_kwargs, max_total_completion_tokens,
state_columns (no readers on the vf-nano branch). Also drop stripped_id (no hub installs ->
no @version, so id == it) — callers use .id. Bump deps/vf-nano.

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

* refactor: require a configured taskset per env (no reverse-text default)

EnvConfig no longer auto-defaults its taskset to reverse-text; an env with no taskset id
errors at validation. Env-list defaults are empty (eval's non-empty check still fires only
when an eval block is configured). Bump deps/vf-nano.

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

* chore: bump deps/vf-nano (dashboard taskset.id/harness.id fix)

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

* chore: bump deps/vf-nano (sampling max_tokens fix)

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

* fix(env-server): require a configured env; build EnvServer from the EnvConfig

EnvServerConfig.env was a bare EnvConfig() default, which now raises (no taskset) and
crashed the env-server at import. Make env required — the orchestrator always passes a
real env config. Build the server straight from config.env (vf-nano EnvServer takes the
EnvConfig). Bump deps/vf-nano (is_truncated computed field).

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

* feat(nano): reverse-text uses default harness with enable_bash=false

The model answers directly (no bash tool), so the tool_call_parser is no longer needed.
Bump deps/vf-nano (enable_bash flag).

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

* feat(nano): hendrycks-sanity config on the math-env taskset

Add configs/debug/nano/hendrycks_sanity.toml (vf-nano analog of configs/debug/hendrycks_sanity):
math-env train env on the sanity dataset (R1-distill, default renderer with think parser,
single-turn no-bash), aime24 eval env. Register math-env + aime24 in the envs group + sources.
Bump deps/vf-nano (math/aime tasksets, enable_bash, SerializeAsAny + is_truncated fixes).

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

* chore: bump deps/vf-nano to merged main (math/aime tasksets, fixes)

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

* chore: drop deps/verifiers, bump deps/vf-nano to merged main

vf-nano main (#8) adds the subprocess-runtime env passthrough (inherit host env
minus API_KEY, so UV_CACHE_DIR reaches rollout workers and lands the uv cache on
local disk) and the math-verify scoring fix (wrap gold + prediction in \boxed,
matching v1 math-env — fixes matrix/vector answers scoring 0).

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

* feat(nano): hendrycks-sanity mirrors examples/hendrycks_sanity + slurm overlay

nano config is now a verbatim copy of examples/hendrycks_sanity/rl.toml with only
the env sections swapped to vf-nano taskset/harness syntax (math-env taskset,
default harness, subprocess runtime; aime24 eval). Adds a slurm overlay setting
the output dir, wandb run name, and partition.

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

* chore(nano): fold wandb + slurm into hendrycks_sanity config

Move the [wandb] and [slurm] sections from the slurm overlay into the base config, so it
submits to slurm by default (run locally with --no-slurm). The overlay now only redirects
output_dir. wandb run name is vf-nano-subprocess.

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

* chore(nano): fold output_dir into hendrycks_sanity config, drop slurm overlay

Everything (output_dir, wandb, slurm) now lives in the one config; remove the now-empty
slurm overlay. Run locally with --no-slurm.

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

* feat(vf-v1): run on the unified verifiers package (v0 envs + v1=nano + legacy bridge)

Depend on the single verifiers package (deps/verifiers, nesting vf-nano) instead of standalone
vf-nano. EnvConfig is dual-mode: v0 envs via id+args (legacy bridge), v1 envs via taskset/harness
(native nano). The env-server spawn (standalone + mp) picks LegacyEnvServer for v0 and EnvServer
for v1; both return vf.Trace so the orchestrator is unchanged. Plugin sources repointed under
deps/verifiers; reverse-text is the v0 env, reverse-text-v1 the nano taskset.

Verified: uv run rl @ examples/reverse_text/rl.toml (v0, unchanged) trains via the bridge
(reward 0.14->0.79); vf-eval + vf-eval-v1 reverse-text both reward 1.0.

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

* test(v0): wire alphabet-sort (multi-turn) + bump verifiers (State scrub)

Add the v0 alphabet-sort env as an installable source; bump deps/verifiers to the State-scrub
commit. Verified the bridge on a multi-turn v0 env: alphabet-sort runs (Turns 2.0, 128/128
trainable, 0% error) alongside single-turn reverse-text.

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

* test(v0): wire wordle + add configs/wordle/rl.toml (2-GPU)

Wire the v0 wordle TextArena env (multi-turn game) as an installable source; add a 2-GPU
(1 trainer + 1 inference) wordle config. Verified through the legacy bridge: wordle trains
(Turns ~5.3, reward ~0.81, 128/128 trainable, 0% error).

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

* chore: bump deps/verifiers (v1 hygiene: init.py/tests/docs)

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

* refactor(v1): track de-vendored verifiers, rename nano -> v1

- Bump deps/verifiers to the de-vendored commit: vf-nano is now vendored as the
  verifiers.v1 subpackage (no nested deps/vf-nano submodule).
- Repoint env-plugin sources from deps/verifiers/deps/vf-nano/... to
  deps/verifiers/{examples,packages}/...
- Rename verifiers.nano -> verifiers.v1 across the orchestrator/utils/configs;
  rename configs/debug/nano -> configs/debug/v1. "v1" is the name now (no "nano").

Verification: v0 reverse-text (legacy bridge) and v1 reverse-text-v1 (native)
both train over a 3-step smoke (reward present, 0% error).

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

* chore(v1): bump verifiers (eval/serve, v1 deps in base, bundled plugins)

- Bump deps/verifiers: v1 runtime deps moved to base (no `v1` extra), v1 CLIs
  renamed eval/serve, shipped plugins bundled in the tasksets/harnesses umbrella
  packages, verifiers/v1/harness.py (flattened harnesses subpackage).
- Depend on `verifiers` (was verifiers[v1]) and the `harnesses` umbrella package
  (was standalone default/rlm).

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

* chore(v1): bump verifiers (Task.system_prompt); write full rollout jsonl

- Bump deps/verifiers to the system_prompt commit: Task.system_prompt + harness
  APPENDS_SYSTEM_PROMPT support, reverse_text_v1 byte-identical to the v0 env (separate
  system message), plus this branch's eval/serve, v1-deps-in-base, CI fixes, and the
  retired semgrep policy.
- save_rollouts: drop exclude_keys={"trajectory"} for both train and eval rollouts so the
  jsonl carries the full trajectory.

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

* chore: drop semgrep from uv.lock (verifiers retired the policy group)

Follow-up to the deps/verifiers bump (00c7b77a removed the `policy` dependency
group); regenerates the lock to match.

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

* fix: pin the env-server renderer tokenizer to the base model for LoRA runs

Wire `renderer_model_name` (the base model) into the renderer client config so
the env-server renderer builds its tokenizer from the base model instead of the
per-request LoRA adapter name, which has no published HF tokenizer and 404'd
once LoRA training set the served model name to the adapter. Mirrors the
`renderer_model_name` wiring already in `setup_clients` on main. Bumps
deps/verifiers to the matching fix.

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

* feat(orchestrator): request vLLM token ids for MITO training (#2745)

On the MITO path (no renderer), set return_token_ids in the train env
sampling args so the openai_chat_completions client gets the prompt and
completion token ids back from vLLM and can carry them for training
instead of re-tokenizing the messages downstream. Scoped to
renderer is None so it never reaches the renderer /inference/v1/generate
endpoint (which forwards sampling params to vLLM verbatim).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers submodule; restore v0 env catalog + v1 -v1 imports

- bump deps/verifiers to the feat/nano-as-v1 tip (token-parse #1585, bridge meta #1586,
  taskset -v1 rename #1587, native retries #1588, runtime resource cleanup #1590)
- restore the full v0 env catalog in optional-dependencies.envs + [tool.uv.sources]
  (init the research-environments submodule); the taskset -v1 rename freed the v0 names,
  so v0 envs (legacy bridge) and v1 tasksets coexist
- point the v1 taskset sources at their -v1 names / _v1 paths (gsm8k-v1, math-env-v1,
  aime24-v1; reverse-text-v1 already correct)
- update v1 configs to the -v1 taskset ids (hendrycks_sanity) and drop the superseded
  standalone configs/debug/reverse_text_v1.toml
- relock

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

* chore(v1): bump verifiers submodule to feat/nano-as-v1 tip (textarena #1592)

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

* chore(v1): bump verifiers submodule to feat/nano-as-v1 tip

Pulls in runtime resources named after the rollout id (#1596) and the
alphabet-sort-v1 taskset (#1595).

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

* chore(v1): bump verifiers submodule to feat/nano-as-v1 tip

Brings in env-hub ids (#1597), v0 envs on the eval CLI (#1598), modal runtime (#1594).

* chore(v1): add v1 alphabet-sort debug config (port of examples/alphabet_sort)

* fix: forward extra_env_kwargs to v0 legacy envs; drop dead trajectory tests (#2749)

Restores main's escape hatch for v0 (legacy-bridge) envs: a legacy env's extra_env_kwargs
is auto-populated (timeout_seconds <- timeout.rollout, max_total_completion_tokens <-
max_output_tokens, max_seq_len <- seq_len) and forwarded to LegacyEnvServer at spawn, so v0
rollouts again honor the wall-clock timeout, multi-turn completion budget, and seq-len
truncation (all were silently dropped on this branch).

Also removes tests/unit/orchestrator/test_{trajectories,sft_trajectories}.py, which imported
the deleted interleave_rollout and broke test collection.

* fix: install the bundled `tasksets` package (harbor-v1, textarena-v1)

The `envs` extra wired `harnesses` and the individual `*-v1` example tasksets but
never the bundled `tasksets` package, so the integration tasksets it ships
(`harbor-v1`, `textarena-v1`) couldn't be resolved — `import_taskset("harbor-v1")`
raised ModuleNotFoundError ("tried to import 'harbor_v1'").

Add `tasksets` to the `envs` extra + a path source, and bump the verifiers
submodule to the feat/nano-as-v1 tip (#1600), where the bundled tasksets live
under the `tasksets` namespace package (`tasksets.harbor_v1`) and the loader
resolves the namespaced module.

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

* feat: consume the v1 message-graph trace (#2763)

* feat: consume the v1 message-graph trace (graph-walk trace_to_samples)

Walk the new message graph (verifiers feat/trace-message-graph, PR #1606): trace_to_samples
builds one TrainingSample per branch by concatenating each branch path's node token_ids /
sampled_mask / logprobs (graph.branch_token_sequences), splitting prompt|completion at the
first sampled token — identical training tensors to the old per-turn stitching, off a trace
that is now linear (not quadratic) in turns. backfill_rollout_tokens is a no-op (training is
renderer-only; `trajectory` is now a read-only view over the graph). Bumps the verifiers
submodule to the graph-trace branch.

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

* chore: bump verifiers submodule (MessageNode.mask rename)

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

* chore: wire alphabet-sort-v1 taskset

Add alphabet-sort-v1 to the `envs` extra + `[tool.uv.sources]` so
configs/debug/v1/alphabet_sort.toml resolves (it referenced an example taskset that was
never wired into prime-rl). Used to verify graph-based training-sample construction on real
RL runs — v0 (legacy bridge) and v1 (native renderer path) both train cleanly.

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

* refactor: consume nodes/branches directly (drop Turn/trajectory readers)

`trace_to_samples` already walks the graph; the remaining readers move off the removed
Turn/trajectory API: the gibberish/repetition filters iterate per-node completions,
advantage/dispatcher use `trace.num_turns`/`trace.completion_len`, `get_model_completion_len`
is dropped (use `trace.completion_len`), and the renderer-only train_sink drops the backfill
path (also removing `backfill_rollout_tokens`). Bumps the verifiers submodule.

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

* chore: bump verifiers submodule (merge #1605 multiplex interception)

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

* chore: bump verifiers submodule (dead-code cleanup)

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

* chore(v1): bump verifiers (readme highlight + ruff format)

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

* feat: enforce renderer, SFT backfill, branch-first-class logging

Training is renderer-only now. RL/OPD roll out through the renderer client
(exact sampled token ids + logprobs); SFT rolls out against a chat-completions
teacher that returns no tokens and re-renders the conversation to backfill them
(`backfill_trace`). A renderer is required for every mode (`renderer=None`
rejected) — the oai client never produces correct training tokens for the
message graph. Drops the MITO no-renderer training path.

Logging consumes `trace.branches` as the first-class unit (`branch.token_ids` /
`branch.messages`) instead of the removed `trajectory` field; `trace_to_samples`
builds one sample per branch from the same accessors. Sample loggers take the
rollout objects so env_name/advantage are available.

Add configs/v1/training_mode (rl/opd/sft + lora/external) mirroring the v0
debug configs. Fix the v0 SFT debug configs + rlm_swe to validate under the
renderer requirement.

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

* refactor: flat TrainingSample (token_ids + mask), required renderer

Drop the prompt/completion split from TrainingSample — it doesn't fit a
multi-turn/agentic branch, where context and model-sampled spans interleave. A
sample now carries the branch's flat `token_ids` plus per-token `mask` (True =
trainable), `logprobs`, and `temperatures` (all aligned). `prepare_sample`
passes them straight into the MicroBatch (already flat), and the packer
validates against `token_ids` length.

Make `orchestrator.renderer` a non-optional type (drop the `enforce_renderer`
validator) — training is renderer-only, so the type carries the requirement.

Bump the verifiers submodule to feat/nano-as-v1 (merged #1606 + Branch.branches
inlined).

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

* refactor: SFT teacher rolls out through the renderer client (drop backfill)

Training is renderer-only across every mode, so the SFT teacher now rolls out
through the renderer client too — its rollouts carry tokens directly, the same
as RL/OPD. Drops the chat-completions backfill (`backfill_trace` + the SFT path
in TrainSink) and the now-unused TrainSink renderer.

This requires a self-hosted teacher that shares the student's tokenizer (the
student trains on exactly the ids the renderer feeds the teacher); distilling
from an external chat API is no longer supported. Remove the `sft_external`
debug configs.

Validated: SFT on reverse-text-v1 trains cleanly (Trainable 128/128, eval reward
~0.1 -> ~0.82 over 20 steps) with the teacher on the renderer client, no backfill.

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

* chore: drop configs/v1/training_mode README

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

* refactor: consolidate rollout types into Rollout(vf.Trace)

The trace *is* the rollout: replace the FinishedRollout/TrainRollout/EvalRollout
wrappers with a prime-rl Rollout(vf.Trace[TaskT]) subclass that carries the
orchestration metadata (kind, env_name, group_id, policy_version,
off_policy_steps, samples, advantage, is_filtered, filter_results, eval_step) as
exclude=True fields — so dumping a Rollout still yields a plain trace (on-disk
results.jsonl unchanged). envs.py validates the wire trace into Rollout; the
dispatcher stamps the metadata; train vs eval is the `kind` discriminator
(replacing the isinstance check). All consumers read rollout.X directly instead
of rollout.trace.X.

Drop the monitor's SampleRollout duck-type Protocol — the loggers take the real
Rollout (TYPE_CHECKING import) and read branch.token_ids / branch.messages. Also
drop the prime monitor's _split_branch_messages and _json helpers: the
conversation is the unit (no prompt/completion split — meaningless multi-turn).

Fix a latent dispatcher bug surfaced along the way: synthetic error traces used
`error=` / `r.error = ` (a read-only computed field) — now `errors=[...]` /
`r.errors.append(...)`.

Rewrite the (long-stale, dict/`raw`-based) advantage + filters unit tests to
build real Rollouts — they now exercise the current trace-based code (previously
all failing on import/construction).

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

* ci: allow verifiers + datasets in the slim-config dep check

The v1 config types (EnvConfig, Task, ...) extend `verifiers.v1`, which is a
declared, pure-pydantic dependency of prime-rl-configs (it pulls `datasets` for
the taskset/Task types but no GPU/ML deps). Drop `verifiers` and `datasets` from
the slim-install forbidden list — keep the real heavy training deps (torch,
vllm, transformers, ...).

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers submodule to feat/nano-as-v1 tip

Picks up the v1 end-to-end eval test suite (#1609) and the v0 legacy
env-server group-scoring fix (#1612).

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

* chore(v1): bump verifiers submodule to feat/nano-as-v1 tip

Picks up the v0 legacy-bridge fixes: guard against non-renderer training
clients (#1613) and serve the eval split for eval-only v0 envs (#1614).

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

* chore(v1): fix stale sft.toml teacher comments

The SFT teacher rolls out through the renderer client (token-in/out) and
must share the student's tokenizer; drop the leftover oai-client / token
backfill description removed in the renderer-only refactor.

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

* chore(v1): bump verifiers (v0 eval chat-completions client)

Picks up verifiers#1615: the legacy bridge builds a chat-completions client
for v0 eval rollouts (renderer for training), instead of raising on the
non-renderer eval client.

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

* feat(v1): scaleswe configs + taskset registration (#2765)

- register the scaleswe-v1 taskset (pyproject envs list + uv source)
- point the existing rlm-swe config (configs/rlm_swe/qwen35_4b.toml) at the
  scaleswe taskset (task_type="scaleswe", train + eval)
- add configs/debug/v1/scaleswe.toml — a per-env v1 port of that config using
  the scaleswe-v1 taskset via the rlm harness on the prime runtime

Companion to verifiers feat/scaleswe-v1 (scaleswe-v1 taskset + setup/workdir hooks).
Needs the deps/verifiers submodule bumped to that branch once it lands.

* feat(v1): multimodal training through the message graph + color-codeword-v1

Consume the v1 trace's multimodal sidecar. `trace_to_samples` builds, per branch,
`mm_kwargs` (the branch's per-image renderer items concatenated on dim 0 and
EncodedTensor-encoded) and `mm_token_type_ids` (the renderer's
`mm_token_type_id_map` applied to the branch tokens); `TrainSink` threads the
mapping through. The wandb sample logger now renders the task as a Table-safe JSON
string with image data elided — an image-bearing instruction crashed wandb's
Table type inference on the nested content list.

Adds `configs/v1/multimodal_color_codeword.toml` (Qwen3-VL-4B on color-codeword-v1,
2-GPU) and registers the `color-codeword-v1` taskset; bumps the verifiers submodule
for the multimodal message-graph support.

Verified end-to-end: the VLM trains through the mm path (eval 0.69 -> 0.78,
Trainable 256/256 — mm_kwargs reach the Qwen3-VL forward); v0 `color-codeword`
eval 0.625 ~= v1 `color-codeword-v1` eval 0.69 (faithful port).

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

* Revert "feat(v1): multimodal training through the message graph + color-codeword-v1"

This reverts commit 85b27cfc0be12b84f9b36456675b10387d01dc8a.

* feat: multimodal training through the v1 message graph + color-codeword-v1 (#2766)

* feat(v1): multimodal training through the message graph + color-codeword-v1

Consume the v1 trace's multimodal sidecar. `trace_to_samples` builds, per branch,
`mm_kwargs` (the branch's per-image renderer items concatenated on dim 0 and
EncodedTensor-encoded) and `mm_token_type_ids` (the renderer's
`mm_token_type_id_map` applied to the branch tokens); `TrainSink` threads the
mapping through. The wandb sample logger now renders the task as a Table-safe JSON
string with image data elided — an image-bearing instruction crashed wandb's
Table type inference on the nested content list.

Adds `configs/v1/multimodal_color_codeword.toml` (Qwen3-VL-4B on color-codeword-v1,
2-GPU) and registers the `color-codeword-v1` taskset; bumps the verifiers submodule
for the multimodal message-graph support.

Verified end-to-end: the VLM trains through the mm path (eval 0.69 -> 0.78,
Trainable 256/256 — mm_kwargs reach the Qwen3-VL forward); v0 `color-codeword`
eval 0.625 ~= v1 `color-codeword-v1` eval 0.69 (faithful port).

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

* chore(v1): bump verifiers pin — multimodal review-pass cleanups

Picks up the verifiers feat/v1-multimodal head: the multimodal review-pass
(capability-flag docstrings, trimmed mm comments, color-codeword-v1 config
validator + module constants) and the merged malloc_trim worker-RSS fix (#1621).

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

* chore(v1): bump verifiers pin (content-part mm attribution) + config/test sync

- Bump deps/verifiers to the content-part multimodal attribution (drops the unused
  placeholder offset machinery).
- Drop max_turns/seed from the color-codeword-v1 taskset args in the config — the
  taskset hard-codes them as module constants now, and passing them is rejected.
- Update the mm egress unit test to assert mm_items order (the new attribution),
  not placeholder offsets.

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

* fix(trainer): slice mm_kwargs on truncation so tokens match embeddings

When a sample exceeds seq_len, prepare_sample truncated input_ids and
mm_token_type_ids but passed mm_kwargs through whole — leaving more image
embeddings than surviving image placeholders. Now truncation cuts to a
whole-image boundary (never splitting an image's placeholder block) and slices
mm_kwargs (pixel_values + image_grid_thw) to the images that fully survive, so
image-placeholder count == image-embedding count.

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

* chore(v1): bump verifiers pin to ruff-formatted graph.py

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

* chore(v1): remove test_trajectories_mm.py

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: thread num_workers to the env-server worker pool (#2768)

* feat(v1): thread num_workers to the env-server worker pool

Wire the verifiers env-server worker pool into prime-rl: the orchestrator's
spawned env server (envs.py) and the `env-server` CLI now serve via
verifiers' serve_env with num_workers, so requests fan out across N worker
processes instead of one event loop. num_workers was already a config field but
dropped on the floor; it's now passed through and defaults to 4.

Companion to verifiers feat/v1-env-workers; needs deps/verifiers bumped to it.

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

* feat(v1): default num_workers to 4

Make the worker pool the default: num_workers defaults to 4 (was "auto"->1)
across the per-env, train, and eval configs, so training/eval env servers fan
rollouts across 4 worker processes out of the box. "auto" stays a valid value
(scales per concurrency); set num_workers=1 for the old single-process server.

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

* fix(v1): keep num_workers="auto" default on the orchestrator

Revert the orchestrator's per-env / train / eval num_workers defaults back to
"auto" (was 4) so they keep scaling 1 worker per 256 concurrent rollouts out of
the box. The standalone env server can't scale (no concurrency context — it's
driven by external clients), so its resolver collapses "auto" to a fixed 4.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers to be76cbc3 (env-server worker pool)

Align the pin with #1623 (env-server worker pool: router + N workers),
which the just-merged #2768 (thread num_workers to the pool) requires;
the pin had lagged at the pre-#1623 multimodal tip.

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

* feat(v1): register r2e-gym-v1 taskset

Add r2e-gym-v1 to the base v1 taskset deps + uv sources (editable from
deps/verifiers/examples/tasksets/r2e_gym_v1) so the id resolves through
the v1 loader, matching the other -v1 tasksets.

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

* chore(swe): use r2e-gym for rlm_swe configs (v0 + v1)

- v0 configs/rlm_swe/qwen35_4b.toml: restore the train env to r2e and the
  eval env to swebench-verified-quick (as on main), reverting the scaleswe switch
- v1: rename configs/debug/v1/scaleswe.toml -> r2e_gym.toml, point the train env
  at the r2e-gym-v1 taskset, and drop the eval block

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

* chore(swe): point rlm_swe configs at r2e-gym (content)

Apply the edits the prior rename commit missed:
- v0 rlm_swe/qwen35_4b.toml: train -> r2e, eval -> swebench-verified-quick (as on main)
- v1 debug/v1/r2e_gym.toml: taskset -> r2e-gym-v1, eval block removed

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

* fix(v1): restore env-server worker logs to the env log file (#2770)

Env servers spawn their worker pool as fresh `spawn` processes with no logging
handlers (verifiers#1626), so per-rollout logs (rollout start/done, context-exceed
warnings) were silently dropped. Pass `setup_env_server_logging` to verifiers'
`serve_env` as `log_setup`; it runs in the broker and in every worker. A worker
inherits the broker's redirected stdout/stderr, so its logs land in the same
`envs/{train,eval}/<name>.log` as before — no new files or paths.

Bumps deps/verifiers to the worker-logging fix.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers to 955b6cdf (dashboard token usage fallback)

Realign the pin onto origin/feat/nano-as-v1 and pick up #1627: the --rich
dashboard's token counts fall back to provider usage when the endpoint returns
no token ids (no more 0/0). The prior pin 3df34ba5 was a pre-rebase #1626
variant; 955b6cdf already contains the equivalent #1626 (env-server worker
logging) plus #1627.

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

* chore(v1): bump verifiers to 8e4ad735 (clean env-server teardown)

Picks up the serve_env SIGTERM-teardown fix: pool/in-process env servers no
longer print a spurious KeyboardInterrupt traceback into the env logs on
shutdown.

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

* chore(deps): bump verifiers (renderers floor 0.1.8.dev40)

Picks up the verifiers floor bump so the renderers offset-tokenizer fix (dev40,
PRs #72/#75) can't be undercut by a pre-fix PyPI resolution. Re-locks uv.lock to
the dev40 specifier.

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

* chore(v1): bump verifiers to db82b38a (reap subprocess tree on cancel)

Picks up #1628 (reap the whole subprocess tree when a runtime run is cancelled).

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

* feat: elastic env-server pool (inherit static/elastic pool config) (#2774)

* feat(v1): elastic env-server pool (inherit pool config from verifiers)

Companion to verifiers#1629. prime-rl's EnvConfig now extends vf.EnvServerConfig, so
each env inherits the `pool` discriminated union (static{num_workers=4} |
elastic{max_workers=None, multiplex=128}, default elastic) and the orchestrator's env
servers scale workers on demand instead of pre-spawning a fixed `auto` count.

- Drop the per-env / train-group / eval-group `num_workers` fields + the auto-resolution
  (ceil(max_inflight/256)); the elastic pool self-sizes from load.
- envs.py / env_server.py pass `vf.pool_serve_kwargs(env.pool)` to serve_env.
- Bump deps/verifiers to the elastic-pool branch.

Breaking: `num_workers` is replaced by `pool`. Configs set `pool = { type = "elastic",
multiplex = N }` or `{ type = "static", num_workers = N }`; the rlm_swe + r2e debug
configs are migrated.

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

* fix(v1): back-compat shim mapping legacy num_workers -> pool

EnvConfig forbids extra fields, so configs still setting the removed `num_workers`
would hard-fail. Add a `model_validator(mode="before")` that maps it onto `pool`:
an int -> a fixed `static` pool, `"auto"` -> the default `elastic` pool; an explicit
`pool` always wins. Keeps existing (incl. out-of-tree) configs parsing without edits.

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

* chore(v1): drop num_workers from rlm_swe + r2e configs (use default elastic pool)

The default `pool` is already elastic (multiplex 128), so an explicit `pool` here was
redundant — just remove the legacy `num_workers` and inherit the default.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers to f404e97f (elastic env-server pool)

Realign the pin onto origin/feat/nano-as-v1: the prior pin d0c5bc98 was the
unsquashed #1629 feature branch, now squash-merged as f404e97f
(content-identical). Picks up #1629 (static/elastic env-server pool config).

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

* chore(v1): bump verifiers to 88e9bedd

Picks up #1631 (per-rollout setup timing as a distinct phase) and #1632
(per-call model + runtime retries).

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

* chore(v1): bump verifiers to 40a2e89f (fix trace.timing.*.duration to_wire validation)

Fixes RunRolloutResponse ValidationError 'trace.timing.setup.duration: Extra
inputs are not permitted' that crashed every rollout (#1636 drops computed
durations from to_wire).

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

* chore(v1): bump verifiers to 5dc084f5

Picks up #1638 (add --resume for evals: re-run a previous run's
missing/errored rollouts).

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

* chore(v1): bump verifiers to 472622ba

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

* chore: stop importing env modules in the orchestrator (always Rollout[WireTask]) (#2781)

* chore(v1): stop importing env modules in the orchestrator

The orchestrator built its per-env trace_type as Rollout[vf.task_type(env_id)] for v1 envs, and
vf.task_type imports the env package just to read its Task subclass for typing the wire trace.
Nothing reads typed env task fields - only task.idx and a full task.model_dump - and WireTask
(extra="allow") preserves those fields (incl. on disk). Always use Rollout[vf.WireTask], so the
orchestrator never imports an env package: the env's type and runtime both live only in the
server process.

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

* chore(v1): hoist the constant Rollout[WireTask] to a module-level ROLLOUT_TYPE

It no longer varies per env, so it doesn't belong as a per-instance attribute set in
Env.__init__ - lift it to a module constant used directly in run_rollout/run_group.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers to 7270e69b

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

* chore(v1): bump verifiers to 66c87d5b

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

* chore(v1): bump verifiers to ef45f720

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

* chore(v1): bump verifiers pin (alphabet-sort host user sim, #1645)

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

* chore(v1): bump verifiers pin (modal creates_per_sec 5 -> 40, #1646)

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

* fix: cap v1 hendrycks-sanity scoring at 10s (#2790)

* fix(v1): cap hendrycks-sanity scoring at 10s

Without a scoring timeout (the default is no limit), a wedged math verify holds its
rollout's permit forever — sympy can spin past the in-script alarm — and at 512
concurrency that starves the pool and stalls long runs. Set timeout.scoring = 10 on the
train and eval envs so the framework cancels and the subprocess runtime kills a runaway
verify, freeing the permit.

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

* chore: drop inline comment on the scoring timeout

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers (eval/train client rename) + adopt config imports (#2792)

Bump deps/verifiers to feat/nano-as-v1 HEAD (8873a740), which includes verifiers#1654 — the v1
interception rework: role-named clients (EvalClient/TrainClient), route-detected wire dialects
(chat/responses/anthropic), 1:1 relay + streaming, reasoning preserved.

Adopt the renamed client config classes in prime_rl/utils/client.py:
OpenAIClientConfig -> EvalClientConfig, RendererClientConfig -> TrainClientConfig.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers pin (subprocess cached-interpreter uv-scripts, #1660)

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

* chore(v1): bump verifiers pin (codex built-in harness, #1661)

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

* chore: track terminal-bench-2-v1 as a taskset dependency

It was only a manual editable install, so `uv sync` pruned it. Add it to the env dependency
group + [tool.uv.sources] (mirroring r2e-gym-v1) so it persists across syncs and is available
out of the box.

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

* fix(v1): keep multimodal tensors out of rollout dumps (#2794)

verifiers#1653 (carry mm tensors across the env-server wire) is merged and pinned, so
`MessageNode.multi_modal_data` is no longer `exclude=True` — `model_dump(mode="json")` now
serializes the base64 pixel tensors into `train_rollouts.jsonl` and the wandb sample tables,
bloating every line. They're the training `mm_kwargs` carrier, not part of the rollout
record, so exclude them at the dump boundary (train + eval paths).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): install all v1 example tasksets in prime-rl

Declare the remaining 7 verifiers v1 example tasksets (code-golf, deepwiki,
glossary, swelego, wiki-search, wikispeedia, wordle) as editable deps so uv sync
installs every example, matching the verifiers examples set. chromadb/textarena
were already present via the v0 wiki-search/wordle envs.

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

* chore(v1): install the compact example harness in prime-rl

The example harness (examples/harnesses/compact) was missing from prime-rl deps,
so the documented --harness.id compact branching example failed to resolve
(ModuleNotFoundError: harness compact not found). Declare it like the example
tasksets so uv sync installs it.

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

* chore(v1): bump verifiers pin (v1 docs #1662 + Trace.info #1664)

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

* feat(v1): encode router-replay routed_experts into transport (#2808)

* feat(v1): encode router-replay routed_experts into transport

Pack Branch.routed_experts ([tokens, layers, top_k]) into the transport
RoutedExperts the trainer replays, realigning the token axis to len(token_ids)
as a backstop. Bumps the verifiers pin to the companion router-replay commit.

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

* chore(v1): bump verifiers pin (raw-bytes wire) + exclude routed_experts from disk dumps

Bumps deps/verifiers to the raw-bytes router-replay codec (RoutedExperts rename +
msgpack bin wire). routed_experts now rides the env-server wire as raw bytes, so it
can't round-trip the json disk dump — add it to ROLLOUT_DUMP_EXCLUDE alongside
multi_modal_data (both are training inputs, not part of the rollout record).

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

* fix(v1): guard router-replay vs prefix caching + bump verifiers/renderers pins

- Add disable_prefix_caching_for_router_replay validator: prefix-cache hits skip
  recomputing the cached prefix, so the engine returns no routed-expert decisions for
  those tokens. Router replay needs routing for every token, so force
  enable_prefix_caching=False (mirrors the existing kv_cache_offload guard).
- Bump deps/verifiers: tail-pad routed_experts so the final node aligns (the engine
  omits the last position's routing).
- Bump deps/renderers: _get_offset_tokenizer immune to the global fastokens patch race.

Together these make v1 MoE router replay work end-to-end (Qwen3-30B-A3B): verified
mismatch_kl drops vs no-replay (0.0005/0.0002/0.0002 vs 0.0015/0.0015/0.0005 @ steps 0/1/2).

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

* chore: bump deps/renderers pin (ruff format fix)

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

* chore: bump deps/verifiers pin (ruff format)

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

* chore: bump deps/verifiers pin to merged feat/nano-as-v1 (router-replay #1672)

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

* Remove disable_prefix_caching_for_router_replay validator

Drops the guard that force-disabled inference.enable_prefix_caching under router replay.
Validating whether prefix caching is actually compatible with router replay (cache hits
may carry no routed-expert decisions); re-add if the A/B shows it drops routing.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(orchestrator): keep top-level advantage wiring after merge

The merge auto-resolved train_sink.py and the orchestrator's TrainSink
construction to main's per-env advantage design (#2721), but envs.py and the
configs were kept on the branch's top-level design — so TrainSink read
`train_envs.get(env_name).advantage_fn`, which TrainEnv no longer defines
(AttributeError at rollout time).

Restore the branch's top-level advantage: TrainSink takes `advantage_config`
and builds its own `self.advantage_fn` once. Verified end-to-end with a
reverse-text-v1 RL smoke (reward climbs 0.16 -> 0.40 over 6 steps).

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

* chore(v1): bump verifiers pin to merged main (1b7736a8)

deps/verifiers feat/nano-as-v1 now includes origin/main merged in
(composable tasksets + sandbox/save utils). Pin moves 7a98b566 -> 1b7736a8.

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

* chore: bump pydantic-config submodule to main (single-dash short flags)

deps/pydantic-config 896ade4 -> 99f47c6 (origin/main). Picks up #16
(single-dash short flags for single-character aliases, e.g. `eval -n -m`)
and upstreams the dict[str,str] preservation fix (#14). No uv.lock change
(editable path source).

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

* chore(v1): bump verifiers pin to feat/nano-as-v1 tip (5fc0b295)

Picks up the py3.11 TypedDict CI fix and #1676 (prime-sandbox programs run for
the sandbox lifetime instead of the 15-min background-job default, + retry-log
wording). Pin moves 1b7736a8 -> 5fc0b295.

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

* chore(v1): bump verifiers pin to 3af08c9b

Includes verifiers#1677 - scaleswe-v1 resolves task images via Prime's
Artifact Registry instead of the incomplete public Docker Hub mirror.

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

* fix(orchestrator): trim glibc heap back to the OS each step (#2821)

Factor the existing end-of-run malloc_trim into a `trim_process_memory()`
helper and also call it at the end of `finalize_train_batch`. Each step frees a
step's worth of rollouts / traces / transport buffers, but glibc keeps those
pages in per-arena free lists, so orchestrator RSS climbs over a long run
without ever shrinking. Trimming per step returns them to the OS.

Mirrors the per-step trim in prime-rl #2807 — the trim only; that PR's
`.raw`-based retention helpers don't apply to this branch's typed Rollout/Trace.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers pin to 7862985b

Includes verifiers#1678 - scaleswe-v1 Prime Artifact Registry is now opt-in
(`use_prime_registry`, default off), so the default Docker Hub image path works
on local docker runtimes again.

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

* feat: route consistent_hash on X-Session-ID for cross-turn prefix reuse (#2822)

The vllm-router `consistent_hash` policy keys on request-id headers (default
x-request-id / x-correlation-id / x-trace-id / request-id). The v1 inference
clients send none of those per rollout, so a multi-turn rollout's turns hashed
to random DP shards and re-prefilled the growing prompt cold each turn (~40%
prefix cache hit rate on an agentic SWE run, where it should approach the
eviction-limited ceiling).

Launch the router with `--request-id-headers x-session-id` so it keys on the
per-rollout `X-Session-ID` header the v1 clients now emit (companion verifiers
change). Every turn of a rollout pins to one engine, keeping its cross-turn
prefix warm. Harmless for the random / round_robin policies, which ignore
request-id headers.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers pin to 211faecb (session-affinity routing)

Picks up verifiers #1680 (session-affinity routing header for cross-turn
prefix reuse) — the counterpart to prime-rl #2822. Pin 7862985b -> 211faecb.

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

* chore(v1): bump verifiers pin to 3f45f73b (scaleswe-v1 image filter)

Picks up verifiers #1679 (filter unavailable scaleswe-v1 images at load).
Pin 211faecb -> 3f45f73b.

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

* chore(v1): bump verifiers pin to 44da378c (r2e-gym-v1 registry opt-in)

Picks up verifiers #1681 (r2e-gym-v1 Prime Artifact Registry opt-in, default
off). Pin 3f45f73b -> 44da378c.

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

* chore(v1): bump verifiers pin to a723977c (scaleswe-v1 image_url filter)

Picks up verifiers #1683 (filter on Docker Hub image_url, not the resolved
image). Pin 44da378c -> a723977c.

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

* chore(v1): bump verifiers pin to 0c8d0aa1 (rootless harness install)

Picks up verifiers #1685 (harnesses install/run without root, pinned
/tmp/vf-{harness}) and #1684 (remove Claude Code harness). Pin a723977c -> 0c8d0aa1.

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

* chore(v1): bump verifiers pin to d4b054e3 (skip region-limited e2e test)

Picks up verifiers #1686 (skip test_multi_turn on prime — colocated user-sim
port exposure is region-limited). Pin 0c8d0aa1 -> d4b054e3.

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

* chore: point verifiers env paths at the flattened environments/ dir (#2824)

* chore: point verifiers env paths at the flattened environments/ dir

Companion to verifiers #1695 (flatten examples/ into a single environments/).
Update the deps/verifiers editable source paths in pyproject.toml + uv.lock:
examples/tasksets/<x> -> environments/<x> and
examples/harnesses/compact -> environments/compact. Bump the verifiers pin to
the flatten branch (7ddc78b2) so the relocated paths resolve.

Re-pin to the merged commit once verifiers #1695 lands.

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

* chore(deps): bump verifiers to 22b02e4b (flatten examples/ into environments/, #1695 merged)

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): advance verifiers pin to feat/nano-as-v1 tip (Trace.state + DNS fix)

#2824 retargeted the env paths but pinned deps/verifiers at 22b02e4b (#1695,
just after the examples/->environments/ flatten), which predates the later
merges. Advance the submodule to the actual feat/nano-as-v1 tip bf30ae5f
(verifiers 0.1.15.dev298): adds Trace.state (#1711), the unconditional MCP
DNS-rebinding relax (#1715, fixes the in-prime tool 421 CI failures), and the
init scaffold (#1713).

bf30ae5f also dropped verifiers' self-referential `packages` extra, so drop
`[packages]` from the verifiers override-dependency (and refresh the stale
sources comment).

Smoke: `eval reverse-text-v1 -n 1` (subprocess, temp=0) runs clean — no errors,
not truncated, reward ~1.0.

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

* chore(v1): bump verifiers pin to feat/nano-as-v1 tip (#1717 + #1719)

Advance deps/verifiers bf30ae5f -> f7fa7482:
- #1717 train-client prefix bridging + token-based message-graph branching
- #1719 default the harness runtime to subprocess

No prime-rl-side changes needed: every prime-rl v1 config already sets
harness.runtime.type explicitly (#1719's default flip is a no-op here), and the
consumed verifiers surface (serve EnvClient/serve_env/pool_serve_kwargs,
clients.config Eval/TrainClientConfig, task.TaskT, the Trace branch/token API) is
untouched by #1717. Imports resolve; reverse-text-v1 eval smoke clean.

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

* chore(v1): bump verifiers pin to feat/nano-as-v1 tip (f7fa7482 -> bbfd5646)

New since the last pin: #1718/#1721 (CI + tests), #1723 (per-harness tool
disabling), #1666 (client consolidation + chat-completion header forwarding),
#1722 (warn on non-default subprocess harnesses). No prime-rl-side changes
needed: clients.config (the consumed surface) is untouched by #1666's client
refactor, #1722 only warns and exempts the default harness (what prime-rl's
subprocess configs use), and the rest is additive/CI-only. Imports resolve;
reverse-text-v1 eval smoke clean (reward 1.0).

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

* chore: verifiers #1732 companion (model_dump traces, Task.prompt rename) (#2831)

* chore(v1): add prime CLI as deps/prime submodule (feat/nano-as-v1)

Tracks the companion PrimeIntellect-ai/prime#751 branch that adds verifiers v1
eval support to the prime CLI (run/view consume the v1 entrypoint + Trace format).

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

* chore(v1): bump verifiers pin to feat/nano-as-v1 tip (bbfd5646 -> 220f21d4)

New: #1727 (per-rollout isolation for shared writable tool servers) and #1702
(trim verifiers runtime deps — modal/notebook/quest/pdf moved to extras). No
prime-rl-side changes needed: the only dropped transitive dep is pymupdf, used
solely by verifiers' experimental quest PDF tool via a lazy import behind the
quest extra (prime-rl never touches it). Imports resolve on dev307;
reverse-text-v1 eval smoke clean (reward 1.0).

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

* chore: validate env-server traces via model_dump (companion to verifiers to_wire removal)

verifiers drops Trace.to_wire/from_wire and the derived computed fields (reward,
is_truncated, error, duration are plain properties now). Swap wire.to_wire() ->
wire.model_dump() when re-typing a returned Trace into ROLLOUT_TYPE; the .reward /
.is_truncated the metrics/eval code reads are the Trace properties, so they still work.

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

* chore: rename vf.Task(instruction=) -> prompt= (verifiers #1732 companion)

verifiers #1732 renames Task.instruction -> Task.prompt; update the dispatcher's
error-rollout Task construction to match. Pin bump to the merged commit comes when #1732
lands.

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

* chore(v1): bump verifiers pin to chore/v1-general-cleanup tip (220f21d4 -> d78d7474)

Pin #1732 (general v1 cleanup) so this companion's model_dump trace handling and the
Task.prompt rename round-trip against a verifiers that actually has them. Re-pin to the
feat/nano-as-v1 tip once #1732 merges.

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

* chore(v1): bump verifiers pin to feat/nano-as-v1 tip (d78d7474 -> caaf0ff3)

#1732 (general v1 cleanup) merged into feat/nano-as-v1; re-pin off the chore branch onto the
integration tip. This companion's model_dump trace handling + Task.prompt rename now run
against merged verifiers.

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

* chore: error-rollout placeholder task uses prompt=None

An error rollout has no prompt; None is the honest value (Task.prompt is str | Messages |
None) rather than an empty string.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(v1): drop removed enable_bash from harness configs (verifiers #1723) (#2833)

verifiers #1723 (in the current pin) removed the default harness's enable_bash
field — the default harness now exposes only the taskset's MCP tools (use an
agentic harness like mini-swe-agent for a shell). All v1 configs still set
`enable_bash = false`, which now fails config validation (Extra inputs are not
permitted). Drop it (no-bash is the default, so behavior is unchanged); no src/
code referenced it.

Verified: `uv run rl @ configs/debug/v1/reverse_text.toml` (Qwen3-0.6B, 2 steps)
runs end-to-end — orchestrator rollouts Error 0.0% (reward 0.117 -> 0.177),
trainer steps + checkpoint, 'Training finished!'.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers pin to feat/nano-as-v1 tip (caaf0ff3 -> cc4afd52)

New: #1733 (robust env-server teardown, no leaked tunnels/sandboxes), #1734
(general-agent solver v1 taskset, additive/opt-in), #1735 (reject unsupported
task system_prompt). No prime-rl-side changes needed: consumed serve/clients
surface unchanged, default harness supports system_prompt, new taskset not
registered. Imports resolve; reverse-text-v1 eval clean (reward ~1.0, no errors).

Note: #1733's worker teardown throws KeyboardInterrupt on SIGTERM but run_server
doesn't swallow it, so a benign KeyboardInterrupt traceback prints at env-server
shutdown (cosmetic; verifiers follow-up).

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

* feat(v1): add debug general-agent-v1 RL config + register the taskset

Add configs/debug/v1/general_agent.toml — the v1 general-agent-v1 taskset
(GeneralAgentSolverTaskset) on the default harness, with the agent and its tool
server colocated in a modal sandbox. Adapted from configs/general_agent/
rl_qwen3_4b.toml (Qwen3-4B, batch 256). Register general-agent-v1 in
[tool.uv.sources] + the envs extra so the id resolves.

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

* feat(v1): add scaleswe-v1 RL config (Qwen3.6-35B-A3B, 65k ctx)

configs/debug/v1/scaleswe.toml — the v1 scaleswe-v1 SWE taskset on the rlm
harness + modal runtime (each row injects its own Docker image into the sandbox;
no MCP toolset). Qwen3.6-35B-A3B, batch 256, 65k context, qwen3.6 renderer with
thinking. Deployment/parallelism (cp=2, infer dp=2 tp=4, 1 train + 1 infer node)
seeded from the 30B-A3B reference — tune on the cluster for the 35B / 65k
footprint. Multi-node slurm; scaleswe-v1 was already registered.

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

* chore(v1): bump verifiers pin (cc4afd52 -> 3c5f6586) + register swebench-verified-v1

New: #1738 (swebench-verified harbor taskset, prime prebuilt images), #1739
(don't retry program exec - fixes forked duplicate trace branches), #1736/#1737
(quest pdf sanitization, dashboard rotation). Register the new swebench-verified-v1
env (source + envs extra); no other prime-rl changes needed.

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

* feat(v1): add SWE-Bench-Verified online eval to the scaleswe run (prime runtime)

Mirror the v0 rlm_swe SWE-bench eval on the v1 scaleswe config: [orchestrator.eval]
interval=20, an eval env on the swebench-verified-v1 taskset via the rlm harness on
the prime runtime (use_prime_registry=true -> prime's prebuilt instance images),
rollout timeout 3600s. Train stays on modal; eval runs on prime.

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

* fix(v1): use public images for the scaleswe SWE-Bench-Verified eval

A debug eval showed use_prime_registry=true fails with IMAGE_PULL_FAILED on the prime
runtime: the SWE-bench Verified sweb.eval.* instance images aren't mirrored into prime's
prod-sandbox Artifact Registry. The same prime sandbox pulls r2e-gym-v1's prime-registry
image and the public swebench/sweb.eval.* image fine, so it's a missing-mirror issue, not
credentials. Drop use_prime_registry (default false -> public Docker Hub images) so the
online eval works on the prime runtime now; flip it back on once the images are mirrored.

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

* chore(v1): bump verifiers pin + re-enable use_prime_registry for the scaleswe SWE eval

Bump deps/verifiers 3c5f6586 -> 952b2a7d, which lands the swebench-verified-v1 prime-image
path fix (PrimeIntellect-ai/verifiers#1740): the mirror keeps the swebench/ org, so
use_prime_registry=true now resolves to prod-sandbox/swebench/sweb.eval.* and pulls. Flip the
scaleswe SWE-Bench-Verified eval back to use_prime_registry=true (verified to pull on a prime
sandbox), for the fast cached mirror instead of public Docker Hub.

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

* chore(v1): cap hendrycks-sanity at 256 in-flight rollouts + 30s scoring timeout

Set orchestrator max_inflight_rollouts=256 (below the 512 batch) and bump the per-env
scoring timeout 10s -> 30s on both the train and eval envs. Guards against the subprocess
env-server stall where unbounded concurrency + a hanging math-verify hold permits until the
run wedges.

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

* chore(v1): bump verifiers pin (general-agent-v1 colocated toolset fix)

Bump deps/verifiers 952b2a7d -> 56a720ca: PrimeIntellect-ai/verifiers#1741 makes the
general-agent-v1 toolset work when colocated in a sandbox (ships the task's tools.py + db.json
over /task). Env-package only - no framework/config surface, no prime-rl changes.

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

* chore(v1): bump hendrycks-sanity scoring timeout to 5min

Raise the per-env scoring timeout 30s -> 300s on both the train and eval envs - 30s was too
tight for the math-verify scoring under load.

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

* feat(orch): show avg branches next to turns in step + eval log lines

Add 'Branches {mean:.1f}' alongside 'Turns' in the per-step train head, the per-env
breakdown, and the eval line - the average trace branch count per rollout (1 = linear, >1 =
compaction/subagents).

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

* chore(v1): update tmux + monitor-run skill for flattened env log paths

Env logs are now one file per env (envs/{train,eval}/{env_name}.log)
instead of nested env_server/env_worker_* files.

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

* chore(v1): bump verifiers pin (retry backoff + relay retries)

Bump deps/verifiers 56a720ca -> 6647fe0a: PrimeIntellect-ai/verifiers#1744 adds exponential
backoff + jitter to the per-call client/runtime retries (so concurrent rollouts don't
re-thunder a shared endpoint) and lets harness clients retry the relay. Internal/additive -
no config schema or API change, no prime-rl edits.

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

* Fix routed SLURM inference DP rank client config (#2830)

Co-authored-by: Codex <codex@primeintellect.ai>
(cherry picked from commit 8dfe8734e3)

* chore(v1): scaleswe Qwen3.6 fixes — ulysses CP + qwen3_coder tool parser

Qwen3.6-35B-A3B is a hybrid/linear-attention MoE: ring CP is unsupported
(use ulysses), and the model id isn't matched by the auto tool-parser
resolver so set tool_call_parser=qwen3_coder explicitly (enables vLLM auto
tool choice for the SWE agent). Complements the cherry-picked #2830 DP-rank
client fix.

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

* chore(v1): bump verifiers pin (usage tracking + Terminus 2 harness)

Bump deps/verifiers 6647fe0a -> a630d3b0:
- PrimeIntellect-ai/verifiers#1704: track cached/reasoning/cost usage in v1 (new Usage type +
  Trace/Branch .usage properties; internal node prompt_tokens -> input_tokens rename).
- PrimeIntellect-ai/verifiers#1747: add the Harbor Terminus 2 harness (additive).

Additive for prime-rl - it consumes only stable Trace properties (completion_len, total_tokens,
num_turns, num_branches) + its own batch metrics, not the raw Usage. Verified: reverse-text RL
smoke (2 steps) trains clean (Error 0.0%, Trainable 128/128, Training finished).

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

* chore(v1): scaleswe — drop eval, prime train runtime, dist_timeout 3600, lm-head chunking

The multi-node trainer kept dying on an NCCL _ALLGATHER_BASE watchdog timeout while
it waited through the slow step-0 swebench eval (eval hogged all rollout slots →
trainer starved on the collective → timeout → SIGABRT). Fixes:
- drop the swebench eval (train-only) — this is what actually cleared the hang
- dist_timeout_seconds 600 -> 3600
- train harness runtime modal -> prime (matches eval; unique label per run)
- fused_lm_head_token_chunk_size = 1024 (activation-memory saver at 65k seq)
cp stays 2 (max for Qwen3.6's 2 KV heads under ulysses; cp=4 fails the divisibility assert).

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

* chore(v1): bump verifiers pin (reuse pool tunnel for colocated state channel)

Bump deps/verifiers a630d3b0 -> 7bb546c2: PrimeIntellect-ai/verifiers#1752 makes colocated
tool/user servers reuse the harness's existing pool tunnel for the state channel instead of
opening a second per-rollout host tunnel (which swamps the tunnel service at high concurrency).
Backward-compatible (new state_base param defaults to None; own-runtime servers still bridge
themselves) - internal rollout/MCP path, no prime-rl edits.

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

* chore(v1): bump verifiers pin (eval progress-bar reward/metric means)

Bump deps/verifiers 7bb546c2 -> b8fad841: PrimeIntellect-ai/verifiers#1753 shows per-reward/
metric running means under the eval progress bar. Eval CLI dashboard + format helper only -
no training/wire surface, no prime-rl edits.

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

* chore(v1): bump verifiers pin (rollout error taxonomy + interception debug logs)

Bump deps/verifiers b8fad841 -> cd205eee:
- PrimeIntellect-ai/verifiers#1751: type v1 rollout errors by boundary (RolloutError +
  Provider/Harness/Toolset/User/Sandbox/Taskset/Interception types, classified via boundary()).
  The trace Error record (type/message/traceback) and stop_condition values are unchanged, so
  prime-rl's consumed surface (vf.Error, errors/stop_condition, 'Cancelled'/'prompt_too_long')
  is intact.
- PrimeIntellect-ai/verifiers#1754: INFO interception up/down + debug-log intercepted routes.

Verified: reverse-text RL smoke (2 steps) trains clean (Error 0.0%, Training finished).

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

* refactor(orch): record caught rollout exceptions via Trace.capture_error

Use the canonical v1 Trace.capture_error(exc) for the dispatcher's caught-exception path
instead of hand-building a vf.Error record + stop_condition - same result (type=exc class
name, message, traceback, stop_condition='error') but routed through the framework's recorder,
so it picks up the #1751 RolloutError boundary types when one escapes. The synthetic Cancelled/
EmptyTrajectory markers stay explicit vf.Error records (not exceptions; the sink/metrics branch
on those exact type strings).

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

* chore(v1): bump verifiers pin (SDK-owned retries; merged worker-SIGTERM fix)

Bump deps/verifiers fedfa570 -> 2474b054, moving off the pre-merge fix/worker-sigterm-teardown
branch commit onto the feat/nano-as-v1 tip:
- PrimeIntellect-ai/verifiers#1755 (merged): swallow SIGTERM KeyboardInterrupt in spawned
  env-server workers.
- PrimeIntellect-ai/verifiers#1756: SDKs own retries; drop framework per-call model/runtime
  retries (removes RetryingClient/RetryingRuntime/CallRetryConfig). RetryConfig + the rollout
  retry (RolloutRetryConfig) are kept.

prime-rl imports none of the removed retry names and never references RetryConfig/.model/.runtime,
so no edits. Verified: config validates + reverse-text RL smoke (2 steps) trains clean
(Error 0.0%, Training finished).

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

* chore(v1): bump verifiers pin (interception env isolation + in-sandbox channel retries)

Bump deps/verifiers 2474b054 -> e002e80d:
- PrimeIntellect-ai/verifiers#1758: keep the interception endpoint out of agent-inheritable env.
- PrimeIntellect-ai/verifiers#1759: retry in-sandbox /state + /task channel fetches; name us in
  the prime expose error.

Internal to harnesses/runtimes/mcp - no prime-rl serve/client/trace surface, no edits. Verified:
reverse-text RL smoke (2 steps, default harness + subprocess runtime) trains clean (Error 0.0%,
Training finished).

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

* chore(v1): bump verifiers pin (ModalRuntime read path fix)

Bump deps/verifiers e002e80d -> 8c9f284b: PrimeIntellect-ai/verifiers#1761 makes
ModalRuntime.read resolve relative paths and stops retrying the tail tool logs. Modal-runtime
internal only - no prime-rl surface, no edits.

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

* chore(v1): bump renderers pin to clean tag renderers-v0.1.8.dev49

057f0087 (renderers-v0.1.8.dev40-2) fails a fresh hatch-vcs editable build
("0.1.8.dev40 can't be bumped"), so only grandfathered venvs built. dev49 is an
exact tag → builds cleanly, unblocking fresh venvs (e.g. running from /shared).

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

* chore(v1): set partition=all + scaleswe prime-sandbox pre_run_command

The SlurmConfig default partition "cluster" doesn't exist on this cluster (only
"all"), so generated sbatches failed to schedule. Set partition=all in the
scaleswe + hendrycks-sanity sources. Add scaleswe's prime-sandbox cleanup as a
pre_run_command (runs on the head node before launch) instead of editing the
sbatch template.

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

* fix(v1): scaleswe deployment 2+2 nodes

Source had num_train_nodes=1/num_infer_nodes=1 (the unconfirmed 30B-A3B starting
point); the run that reached step 36 used 2+2. A single train node OOMs the
35B-A3B trainer. Restore 2 train + 2 infer nodes (32 GPUs).

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

* chore(v1): hendrycks-sanity on modal runtime, 200 steps

Switch the hendrycks-sanity train + eval envs from subprocess to modal (offloads
scoring to modal sandboxes), cap max_steps at 200 (was 5000), rename job to
hendrycks-modal.

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

* chore(v1): bump verifiers pin to 94b7df1 (swebench /testbed workdir, malformed-json tool-args, container-test fix)

Brings in feat/nano-as-v1 #1762 (mark swebench_verified_v1 container-only),
#1763 (feed malformed tool-call JSON back to the model instead of crashing the
rollout), #1765 (pin swebench_verified_v1 task workdir to /testbed).

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

* chore(v1): scaleswe on mini-swe-agent + SWE-Bench-Verified eval (100 tasks)

Switch the scaleswe train harness rlm -> mini-swe-agent (prime sandbox), and re-add a
SWE-Bench-Verified online eval: mini-swe-agent on the prime runtime, use_prime_registry=true,
first 100 tasks (num_examples=100, group_size=1), interval 20, rollout timeout 3600s.

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

* fix(rl): mkdir parent for namespaced env-server config path

A namespaced env id (e.g. "primeintellect/wiki-search") makes the env-server
config filename a nested path; setup_env_servers opened it for writing without
creating the parent dir → FileNotFoundError at launch (slash-free ids were fine).
mkdir(parents=True, exist_ok=True) before the write.

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

* chore(v1): bump verifiers pin (sandbox lifetimes, reasoning state, tau2, harbor CLI)

Bump deps/verifiers 94b7df16 -> 6ac5a3b5:
- PrimeIntellect-ai/verifiers#1749: separate v1 sandbox lifetimes from rollout timeouts (caps
  harness timeouts at the 24h sandbox max). TimeoutConfig fields (setup/rollout/finalize/scoring)
  unchanged.
- PrimeIntellect-ai/verifiers#1748: preserve provider reasoning state across turns (dialects).
- PrimeIntellect-ai/verifiers#1692: migrate the Tau2 benchmark to v1 (new env, additive).
- PrimeIntellect-ai/verifiers#1745: install the pinned Harbor CLI on demand.

prime-rl consumed surface intact (TimeoutConfig, dialects via clients); no edits. Verified:
reverse-text RL smoke (2 steps) trains clean (Error 0.0%, Training finished).

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

* chore(v1): lock the tau2-bench-v1 editable env from the verifiers bump

uv sync picked up the new tau2_bench_v1 workspace member (verifiers#1692, in the last pin bump)
as an editable lock entry. Lockfile-only follow-up.

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

* chore(v1): bump verifiers (final touches #1770, v1 e2e CI green #1771)

#1771 greens the v1 e2e suite and runs it in CI (host+docker only; prime+modal local-only): per-axis matrix marks, assert reward not is_truncated, terminus refuses the host runtime, eval in-process by default. #1770 is the guide/config final touches (0.2.0).

* chore(v1): bump verifiers (ruff-format test_envs)

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

* chore(v1): bump verifiers (drop feat/nano-as-v1 CI trigger)

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

* chore(v1): bump verifiers (test triggers → main only)

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

* chore(v1): bump verifiers (code-golf-v1/aime24-v1 verifiers dep)

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

* chore(v1): add gsm8k v1 config (train + test eval) under configs/debug/v1; drop old configs/v1

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

* chore(v1): bump verifiers to latest feat/nano-as-v1 (276ed743)

30 commits — v1 performance optimizations (zero-copy ZMQ relay, off-event-loop trace persistence, lazy bridged prompts, reduced trace/completion copies) and stateless-JSON MCP servers (#1822). No dependency changes (uv.lock unchanged).

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

* chore(v1): point verifiers submodule to main (post feat/nano-as-v1 merge)

verifiers feat/nano-as-v1 was squash-merged to main; retarget the submodule (8d52bc8e) and .gitmodules branch to main. main's #1826 moved the built-in tasksets/harnesses into the verifiers package, so drop prime-rl's now-defunct standalone harnesses/tasksets deps + editable sources (provided by verifiers.v1 now); compact and the -v1 env pins are unchanged. uv.lock re-resolved (425 pkgs).

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

* fix(tests): migrate unit tests to the bumped verifiers v1 API

The verifiers bump (8d52bc8e) changed several public APIs; these nano unit
tests still used the old surface and failed. Test-only changes:

- OpenAIClientConfig -> EvalClientConfig (test_teacher_logprobs)
- vf.Task(instruction=...) -> prompt=... (test_filters)
- client-config shape: client_type/api_base_url/extra_headers ->
  EvalClientConfig/TrainClientConfig type/base_url/headers/renderer
  (test_client, test_elastic)
- rebuild rollouts as v1 Trace objects with branches, asserting against
  production's actual parquet columns (test_prime_monitor)

(test_advantage's equivalent fix landed in the merge commit.)

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

* feat(trainer): restore main's bin_cost FLOP-balanced packing

The main->nano merge had over-reverted the trainer pipeline to its pre-bin_cost
version. Restore main's packing/distribution so the trainer tracks main; the
only nano-side trainer delta is now the token_ids TrainingSample interface plus
multimodal.

- batch.py: main's bins-based packing (_MicroBatchBin, _materialize_bin,
  _expand_bins_by_splitting, bin_cost-weighted balanced_partition within each
  modality group); keep nano's token_ids prepare_sample + _truncate_mm /
  _slice_encoded image-block-aware truncation.
- transport/types.py: MicroBatch.sequence_lengths (the bin_cost weight input).
- packer.py: thread bin_cost through setup_packer -> prepare_batch; keep nano's
  token_ids sample validation.
- data.py / train.py / token_export.py / utils.py: now identical to main -
  build_bin_cost(model.config) wiring + the precomputed sequence_lengths logprob
  split, dropping nano's redundant get_response_lengths path.
- tests: test_batch / test_packer pass bin_cost=build_bin_cost(None); the
  balance test classifies real vs dummy micro-batches by content (the FLOP
  balanced_partition interleaves dummies rather than appending them).

Verified: 484 unit tests pass (only the 4 GPU-toolkit tilelang model tests fail,
environmental); reverse-text-v1 RL smoke runs 3 clean steps end-to-end.

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

* test(trainer): carry over main's bin_cost packing tests

The bin_cost restore brought the packing code but the fork had patched nano's
test_batch instead of adopting main's, so main's bin_cost-specific tests were
left behind. Port them, token_ids-adapted: randomized packing invariants,
FLOP-aware balancing, FLOP-aware heavy-bin split-to-align, token-cost fallback
distribution, split-to-align avoids dummy micro-batches, and pad_micro_batch
preserves explicit sequence_lengths. 18 test_batch tests pass.

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

* chore: drop deps/prime submodule, revert .gitmodules to main

deps/prime was only referenced from .gitmodules (not pyproject/uv.lock/code);
removing it and resetting .gitmodules to main's version so the PR carries no
submodule-metadata churn. deps/verifiers stays pinned at 8d52bc8e.

* chore: pin verifiers floor to dev357, drop compact env + narrating comments

- verifiers floor -> >=0.1.15.dev357 (latest dev on PyPI = current submodule pin):
  root dependency + override-dependencies, plus prime-rl-configs dependency
- drop the `compact` example env (envs extra + its [tool.uv.sources] entry)
- remove edit-narrating comments (transitive-deps note, envs-list description)

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

* chore: keep renderers/prime-pydantic-config sources below verifiers (match main order)

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

* revert: drop merged gc.collect() in orchestrator trim_process_memory (nano uses malloc_trim only)

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

* chore: unquote forward-ref type annotations + small cleanups

- replace string-literal type annotations with real types via
  `from __future__ import annotations` (+ existing TYPE_CHECKING imports):
  Rollout in orchestrator/filters.py and utils/monitor/{base,multi,prime,wandb}.py,
  EventLoopLagStats in utils/async_utils.py; drop the now-unneeded F821 noqa
- prime monitor: rollout.task/timing.model_dump_json() instead of
  json.dumps(...model_dump(mode="json")) (single Rust-backed serialization)
- drop redundant comments (TrainingSample field comments, renderer passthrough)

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

* chore: drop EnvConfig docstring + redundant id/args fields

id and args are already on vf.EnvServerConfig; prime-rl's bare redefinition of id was shadowing the base's _validate_env_id AfterValidator. Removing both restores inheritance (incl. id validation).

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

* feat(advantage): adopt main's per-env Linear advantage (adapted to vf.Trace)

This PR is only about vf-v1 integration; the RL advantage should match main, not
nano's Tokens/Turns efficiency shaping.

- config: LinearLengthPenaltyConfig (coef, gate_by_correctness) +
  DefaultAdvantageConfig(length_penalty, length_weighted_baseline); per-env
  TrainEnvConfig.advantage + top-level OrchestratorConfig.advantage default
- advantage.py: main's default_advantage_fn / setup_advantage_fn(config, max_seq_len),
  adapted to vf.Trace (r.reward / r.completion_len instead of dict access; Traces
  passed through assign_advantages, advantage written back onto each Trace)
- per-env wiring: TrainEnv.advantage_fn = setup_advantage_fn(config.advantage,
  max_seq_len); TrainEnvs(max_seq_len); train_sink does per-env
  assign_advantages(survivors, env.advantage_fn)
- tests: main's Linear / length-weighted / per-env / max_seq_len-threading
  advantage tests, adapted to nano's vf.Trace _make_rollout
- drop the now-unused get_tool_response_len (only served nano's Tokens advantage)

Verified: 486 unit tests pass; reverse-text-v1 RL smoke 3 clean steps end-to-end
through the per-env advantage path.

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

* chore(v1): relock flash-linear-attention to current HEAD

flash-linear-attention is an unpinned git source (tracks HEAD, as on
main); its HEAD moved e8e791f -> bd67d11, leaving the locked commit stale
so CI's `uv sync --all-extras --locked` re-resolves it and fails. Relock
to the current HEAD.

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

* fix(rl): address e2e review findings

- env-server: forward legacy extra_env_kwargs (rollout timeout / completion
  token budget / max_seq_len) for v0 envs on the rl.py path. The standalone
  env-server CLI dropped them, so legacy envs ran uncapped; the orchestrator
  _spawn path already passed them.
- envs: re-type the wire vf.Trace into Rollout via model_construct instead of
  a model_dump -> model_validate round-trip, avoiding a per-rollout copy of the
  node pixel_values / routed_experts tensors (the server already model_constructs).
- train_sink: keep a running token total for token-batched runs instead of
  re-summing the uncached Trace.total_tokens over the whole pending batch on
  every arrival.
- config: drop dead ClientConfig.timeout / connect_timeout (not wired into the
  v1 rollout clients).
- restore gc.collect() before malloc_trim in trim_process_memory; emit
  Trace.info in the prime-monitor parquet (both match main).

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

* chore(v1): bump verifiers submodule to main (b841e53a)

The v1 work merged into verifiers main; the prior pin 8d52bc8e is an ancestor
of main, so this is a clean fast-forward. verifiers is an editable path dep
with unchanged declared deps, so uv.lock is unchanged. Verified with the
reverse_text v1 debug run (reward 0.11 -> 0.77 over 20 steps, no errors).

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

* fix(rl): correct gibberish/repetition filter logprob alignment

GibberishFilter paired masked completion token_ids with logprobs from the
start of node.logprobs (misaligned on nodes mixing context + sampled tokens);
RepetitionFilter streaked over all logprobs including context. Both now zip
token_ids/logprobs/mask together and process only sampled (mask=True) tokens.

Also document the v1 integration's breaking config changes (env taskset/
harness shape, empty train.env default, num_workers->pool, required renderer,
client timeout removal) in CHANGELOG.md.

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

* fix(rl): require at least one training env at config time

TrainConfig.env defaulted to an empty list with no check (only eval envs were
validated non-empty), so a config with no [[orchestrator.train.env]] parsed
and only failed later in TrainSource during setup. Add a non-empty-env
validator (mirroring EvalConfig) and make OrchestratorConfig.train a required
field (no default), so the failure surfaces at parse / --dry-run.

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

* feat(v1): scaleswe -> rlm harness + router replay

Switch the scaleswe debug config to the rlm harness on prime sandboxes for
both train (scaleswe-v1) and eval (swebench-verified) envs, and enable router
replay (trainer.enable_router_replay + inference.enable_return_routed_experts,
mirroring configs/debug/r3.toml) to cut trainer/inference MoE routing mismatch
on the A3B model. Rename run/job to the -rlm variant and sync the prime
sandbox cleanup labels. Header comment corrected (prime, not modal).

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

* chore(v1): revert config-time train-env-required check (too broad)

The train-required validation (60e824247) broke ~18 config-propagation tests
in test_configs.py that construct OrchestratorConfig/RLConfig without a train
env, plus two checked-in configs that omit one (configs/debug/orch.toml,
examples/glm5_pd_disag/rl.toml). A config-level validator is the wrong place —
the codebase widely constructs train-less OrchestratorConfigs. Reverting to
green CI; a non-empty-train guard belongs at orchestrator setup (fail fast
before TrainSource) instead.

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

* chore(v1): bump verifiers to latest main + drop stale prime-env TODO

- Bump deps/verifiers b841e53a -> 7169d02d (latest verifiers main, clean
  fast-forward, ...#1838). Editable path dep with unchanged declared deps, so
  uv.lock is unchanged. Verified with reverse_text v1 (reward 0.13 -> 0.75 over
  10 steps, no errors).
- Remove the stale "no prime-env hub install" TODO from the orchestrator — it
  never loads environments (the env server imports them in its child process),
  so the note no longer applies.

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

* chore(v1): remove dead prime-env-install path

Namespaced legacy env auto-install was removed (the v1 env server loads envs
directly via serve_env), leaving dead code with no callers/readers: the
`env_install_prerelease` flags (OrchestratorConfig + EnvServerConfig), the
`install_env` helper, and `get_env_ids_to_install`. Drop them and the now-
orphaned `subprocess` / `EnvConfig`,`EvalEnvConfig` imports.

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

* chore(v1): drop in-process env-server spawn, require address

The orchestrator no longer spawns env servers in-process (the mp.Process +
os.dup2 fd-redirect path). It only attaches to a server at EnvConfig.address,
now mandatory at orchestrator runtime - Env.start errors if it's unset. The rl
launcher already spawns one env-server subprocess per env and assigns address,
so launcher-driven runs are unaffected; standalone `uv run orchestrator` must
now be paired with separately-launched env-server(s) and an explicit address
per env.

Removes _run_env_server, Env._spawn, Env/Envs.shutdown, _env_server_process,
and the now-dead mp/os/queue/sys/atexit imports + ENV_SERVER_SPAWN_TIMEOUT.
Updates the standalone-orchestrator docs (training.md, scaling.md --bench) and
the CHANGELOG.

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

* chore(v1): bump verifiers pin (dashboard per-rollout timer includes setup)

51701f4c (#1846).

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

* Revert "chore(v1): drop in-process env-server spawn, require address"

This reverts commit d77546155.

Restore the in-process env-server spawn (orchestrator sidecar-spawns when
address is unset) to mirror main for now. The address-required / attach-only
cleanup is deferred - revisit later.

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

* chore(v1): orchestrator always spawns env servers in-process (mirror main)

Drop the launcher's env-server management: setup_env_servers (which
pre-assigned each env an address + spawned an env-server subprocess), the
per-env subprocess spawn loop in rl_local, the ENV_SERVER_KIND_STRIDE constant,
and the env_server_base_port config field. With no address pre-assigned, the
orchestrator spawns its own v1 EnvServer in-process per env (Env._spawn),
exactly as on main. The env-server CLI and EnvConfig.address are kept for the
optional user-managed external-server path.

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

* fix(trainer): contiguous routed_experts slice for glm4_moe under compile (#2860)

Router replay passes routed_experts[:, :, layer_idx, :] (a strided view of
[tokens, layers, topk], dim-1 stride = layers*topk) into the MoE forward. Under
torch.compile the inductor kernel asserts a contiguous input, so it crashed with
`assert_size_stride ... stride 8==368` on GLM-4.5-Air. Make the slice contiguous.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(v1): bump verifiers pin (robust _ENSURE_UV for old base images)

7c347f61 (#1848).

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: S1ro1 <matej.sirovatka@gmail.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
Co-authored-by: Codex <codex@primeintellect.ai>
2026-06-23 18:04:57 -07:00
e035135126 feat: llm-d (EPP+Envoy) router backend (#2697)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* refactor: drop client-side DP-rank pinning for external-LB

With external-LB data parallelism each DP rank is its own API server on its
own port (the URL is the rank selector), so the client no longer needs the
hybrid-LB `X-data-parallel-rank` header to pin a rollout to an internal DP
shard. Remove the `dp_rank_count` client field + its auto-setup and the
per-rank client expansion: one client per base URL, no rank header. The
router (vllm-router or llm-d EPP) balances across the per-rank endpoints.

This also fixes llm-d routing: the EPP forwards the header to the dp=1
backend, which rejected it ("data_parallel_rank N is out of range").

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

* feat: llm-d (EPP+Envoy) router backend

Add llm-d as a second router backend alongside vllm-router, selected via
`[inference.deployment.router] type = "llm-d"`. Built on the external-LB
launch substrate — the per-rank vLLM engines launch identically; only the
router control plane differs.

- `LlmdRouterConfig`: discriminated-union member with `scorers` (base) +
  per-profile `prefill_scorer_overrides`/`decode_scorer_overrides`,
  `non_cached_tokens`, `decode_sidecar_port`, and a known-scorer validator.
- `launch_router` helper gains an llm-d branch: renders per-replica EPP +
  Envoy + file-discovery endpoints and launches `epp` + `envoy` instead of
  vllm-router. Call sites stay router-agnostic.
- pd-sidecar on each decode node (P/D) for remote-prefill orchestration + NIXL.
- Entrypoints pass the `router` config object to the templates.
- Reject `enable_return_routed_experts` with llm-d (breaks P/D, unverified
  for multi-node).
- SLURM cleanup also clears stale `epp`/`envoy`/`pd-sidecar` processes.
- Presets under `templates/llmd/` + `scripts/install_llmd.sh`; docs + install skill.

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

* fix(inference): mooncake-store + llm-d EPP coexistence on SLURM P/D

- per-rank VLLM_RPC_BASE_PATH: external-LB runs one engine per process (all
  data_parallel_rank_local 0), so the mooncake-store lookup ipc socket collided
  on a node-shared dir; key it by $port. Also avoids an absent submit-node TMPDIR.
- EPP --grpc-health-port 9003 -> 9013: 9003 collided with mooncake_master's
  metrics server on the shared replica-head node, which killed the EPP.
- mooncake_master -default_kv_lease_ttl=3600000: KV blocks were expiring (5s
  default) before the decode side reused them.
- envoy circuit_breakers raised to 100000 on backend + epp clusters: the default
  (~1024) overflowed at high inflight concurrency -> "reset reason: overflow" 500s.
- pd-sidecar launches on every decode node (not just the replica head), else
  decode nodes past the head advertise endpoints nothing serves.

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

* Feat: dockerless llmd install

* chore(configs): add GLM-5.1 llm-d disaggregated RL config

End-to-end RL config used for the GLM-5.1-FP8 llm-d (EPP+Envoy) P/D run:
12 train nodes + 16 inference nodes (8 prefill x2 / 8 decode x2), mooncake KV
store, r2e env. Lives alongside the existing glm5 disaggregated inference preset.

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

* chore(configs): move GLM-5.1 llm-d RL config to dedicated configs/glm5_llmd/

Relocate the end-to-end GLM-5.1-FP8 llm-d (EPP+Envoy) P/D RL config into its own
configs/glm5_llmd/rl.toml (out of glm5_disagg_inference) and refresh it to the
latest tuned version.

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

* feat(inference): per-role prefill/decode vLLM overrides for disaggregated P/D

Add `prefill_vllm_overrides` / `decode_vllm_overrides` to the disaggregated
inference deployment config (mirrors the existing `*_env_overrides`): extra
vLLM config options merged into the per-role `--vllm-extra` JSON for prefill
vs decode ranks on SLURM. Rendered via a small `vllm_overrides_fragment` helper
into the `ROLE_EXTRA` string in the inference / multi-node-RL sbatch templates.

Needed by configs/glm5_llmd/rl.toml (sets `decode_vllm_overrides`), which
otherwise fails `extra="forbid"` validation in test_load_configs.

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

* chore(configs): enable prefill dual-batch-overlap in glm5_llmd config

Set prefill_vllm_overrides = {enable_dbo = true} (the inference-side perf knob
tuned during the GLM-5.1 run). Batch size / num-concurrent / node-scale knobs
left as-is — those are run-specific, not portable config.

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

* chore(configs): tune glm5_llmd prefill/decode replicas (4 prefill / 1 decode)

num_prefill_replicas 2->4, num_decode_replicas 2->1 — the disaggregation split
found to perform best for GLM-5.1 (prefill is the bottleneck; one wide decode
replica maximizes decode KV/batching).

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

* docs: add GLM-5 llm-d example (16-node / 131K trainer) (#2854)

* docs: add GLM-5 llm-d example (16-node / 131K trainer)

Move the glm5_llmd config from configs/ into examples/glm5_llmd/ with a
README, mirroring the other GLM-5 example. Frame llm-d as the faster
router for GLM-5 and document the placeholders users must tweak
(output_dir, slurm partition, mooncake device_name).

Tune the example for a 16-node trainer: seq_len=131072, num_train_nodes=16,
cp=4, and adamw optimizer.

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

* docs: reword GLM-5 llm-d example entry as one-line SLURM deploy

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

* docs: highlight GLM-5 llm-d one-line SLURM deploy in Overview

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: faresobeid <fares@primeintellect.ai>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
2026-06-22 16:08:07 -07:00
samsjaandGitHub efeddae6bb add rlm uuid ctf env (#2832)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-06-18 16:00:38 -07:00
941019f2e3 [feat] multiplex trainer token export and agg to prime monitor on orch side (#2641)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* multiplex trainer output

* update skill

* test: cover multi-run token exports

* feat: export token metrics from orchestrator

* refactor: store token export run fields on microbatch

* refactor: send microbatches without payload wrapper

* test: cover orchestrator token-export metric collection

Adds an integration test asserting the orchestrator's per-step read path
(collect_token_export_metrics) surfaces finite mismatch_kl/entropy mean/max
from real multi-run exports. Complements the file-writing coverage in
test_token_exports_are_run_local; reuses the existing fixture.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: defer token-export STABLE until run step fully consumed

A single orchestrator run_step can span multiple trainer steps when the
packer splits its samples across packs (token budget). mark_stable() ran
every trainer step and marked any dir touched that step, so the orchestrator
could read a run step's exports as complete from only the first pack's
sequences and advance its cursor, never aggregating the remainder.

Mark a run's export dir STABLE only once that run step is fully consumed —
gated on the same ready_to_update signal that drives its optimizer step.
Dirs for runs not yet ready carry over to a later trainer step. run_id=None
(single-run export) never spans trainer steps, so it is marked immediately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: stamp token-export metrics with their trainer step

Token exports lag the orchestrator step they're logged under (the trainer
runs behind), so on the default W&B step axis mismatch_kl/entropy appear
shifted right. Log the run step the exports actually belong to as
`trainer/step` so the metrics can be plotted against a lag-corrected axis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: fold token-export metrics into MetricsBuilder under trainer/

Move the token-export collection from the orchestrator mainline into
MetricsBuilder.build, which now owns the last-logged-step cursor (seeded from
the resumed step via start_step). Namespace the metrics under trainer/
(trainer/mismatch_kl/*, trainer/entropy/*) alongside trainer/step so they
group in W&B and can be plotted against a lag-corrected axis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: drop redundant max_step from token-export reader

Exports always lag the orchestrator (the current step's batch is shipped just
before metrics are built and trained afterward), so no stable export at or
beyond the current step can exist on disk. The `step <= max_step` filter was
always satisfied; the last_logged_step cursor alone drives correctness.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: return log-ready dict from token-export reader

Drop the TokenExportMetricsResult dataclass that was unpacked into a dict one
line later. collect_next_token_export_metrics now returns the trainer/-prefixed
metrics (including trainer/step) directly, so the builder just updates the log
dict and reads trainer/step back to advance its cursor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: guard token-export log update under the truthiness check

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: drop redundant run_idx guard in SinglePacker

The receiver always stamps batch.run_idx from used_idxs (a key of idx_2_id),
so the is-not-None/in-idx_2_id check was always true. Index directly, matching
MultiPacker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: mark token-export STABLE with a barrier instead of all_gather

The all_gather_object did barrier + dir-union + rank-0 write. Replace it with a
plain dist.barrier() (so STABLE only lands after every rank flushed its
rank_*.jsonl), then each rank touches STABLE for the dirs it wrote. touch is
idempotent, so ranks sharing a (run, step) dir converge harmlessly, and the
union is covered without shipping dir lists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: barrier at the call site, drop participate_in_stable_marking

The barrier lived inside the exporter, so the disabled variant needed a
participate_in_stable_marking flag to opt into it. Move the barrier to the
single train-loop call site, gated on token export being enabled (uniform
across ranks): every rank barriers together, then writers touch STABLE and
disabled ranks no-op. DisabledTokenExporter is a pure no-op again and the
exporter does no collectives.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: drop dist.is_initialized guard before token-export barrier

train() always calls setup_torch_distributed before the training loop, so dist
is initialized by the time the barrier runs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: drop redundant comments around token-export barrier

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: derive token-export root from output_dir.parent

root_output_dir was just output_dir.parent of self.output_dir and used in one
place; drop the redundant attribute.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: skip malformed token-export records instead of aborting the step

Token-export metrics are best-effort monitoring read inside MetricsBuilder.build
every step. A malformed JSONL line or a loss_mask/value length mismatch raised
ValueError, which would abort the orchestrator step. Guard each record, skip and
count failures, and warn once per step dir; good records still aggregate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: drain trailing token-export metrics after max_steps

Token exports lag the orchestrator, so the last shipped steps are finalized by
the trainer after the main loop ends — and build() no longer runs to log them,
dropping the tail. Add an end-of-run drain that polls for the remaining stable
steps up to max_steps-1 and logs each under its own trainer/step (a local W&B
step axis, leaving progress.step for the final checkpoint untouched). Gated on
token export being on for the run; early-returns when build() already kept up;
bounded by a timeout. Shared collection extracted to
MetricsBuilder.next_token_export_metrics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* make token export a top-level trainer flag

* chore: fold token export into multi-run integration config

* chore: revert multi-run trainer config override

* chore: remove token export unit tests

* docs: document token export config migration

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:05:10 -07:00
samsjaandGitHub 632ef2b318 chore: remove private configs submodule (#2741)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Remove the configs/private submodule (research-configs) and all
references to it throughout the codebase:

- Remove submodule from .gitmodules and git tracking
- Simplify install.sh: use plain git submodule update --init --recursive
  now that no private submodule can fail for users without access
- Update skills/install/SKILL.md to reflect simplified submodule init
- Remove configs/private/ entry from skills/configs/SKILL.md key files
- Simplify test_configs.py: no longer need to filter out private/ path
2026-06-09 19:31:08 -07:00
samsjaandGitHub 563b37a9c7 fix: preserve Qwen3.5 broadcast weight names (#2690)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* exp: add qwen35 kl debug configs

* exp: lower qwen35 wordle kl drift

* fix: preserve qwen3.5 broadcast weight names

* chore: keep qwen35 debug configs local

* chore: clarify qwen3.5 weight naming bypass

* fix: use upstream qwen3.5 conversion mapping

* chore: use released transformers package

* chore: drop qwen3.5 cp patch

* chore: remove wordle env packaging
2026-06-03 07:50:18 -07:00
samsjaandGitHub badd2b0fe2 feat: write token exports per step (#2596)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
2026-05-21 21:09:57 -07:00
samsjaandGitHub e971d905a2 Add trainer token JSONL export (#2592)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: add trainer token jsonl export

* chore: use docstrings for token export config
2026-05-21 20:31:03 -07:00
851233e5de feat(release): automated tagging + release flow (#2573)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(release): add tag-and-release workflow, backfill release notes, expand release skill

Port the verifiers tag-and-release pattern: on version bump in pyproject.toml,
auto-tag main and create the GitHub Release using assets/release/RELEASE_v{tag}.md
as the body. Skip the PyPI publish steps since prime-rl is not on PyPI.

Backfill release-note files for v0.1 through v0.5.0 by copying each existing
GitHub Release body so the workflow has historical artifacts to compare against.

Expand skills/release/SKILL.md so an agent can prepare the full release PR
(version bump, release notes file, draft PR) — merging the PR is then enough
to publish the release.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(release): rename v0.1/v0.2 notes to v0.1.0/v0.2.0 for consistency

Aligns all backfilled release note filenames on a MAJOR.MINOR.PATCH suffix.
The historical GitHub tags (v0.1, v0.2) keep their original names; this only
touches the on-disk filenames.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(ci): rename release.yaml to docker-push.yaml; exclude dev tags from tag-and-release

The old release.yaml only builds and pushes the Docker image; the new
tag-and-release.yaml is now the canonical "release" workflow. Renaming
removes the ambiguity.

Add a trigger filter to tag-and-release so '*dev*' tags do not flow through
the release path. devx_tag.yaml creates dev tags via GITHUB_TOKEN, which
already does not retrigger workflows; this exclusion is defensive for any
manual dev-tag pushes. Skill note updated to clarify the two workflows
coexist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): check release notes before tagging, and retry on tag-without-release

Two bugbot fixes in tag-and-release.yaml:

1. Move the assets/release/RELEASE_*.md presence check into auto-tag-on-main,
   before the tag is created and pushed. Missing notes used to fail in
   release-from-auto-tag, but only after the tag was already on the remote,
   blocking a clean retry.

2. If the target tag already exists (locally or on origin) but no GitHub
   Release exists for it yet, still emit created=true so release-from-auto-tag
   runs against the existing tag. This unblocks recovery from a partial
   failure (e.g. the release step crashed after the tag push) without
   requiring manual cleanup or workflow_dispatch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(release): drop in-repo release notes; promote pre-existing draft release on tag

Pivot the release flow:
- Release notes live as a draft GitHub Release created via `gh release create
  --draft` (no longer tracked in the repo). Removed assets/release/*.
- The release skill instructs an agent to (1) draft the release on GitHub
  with the notes inline and (2) open a draft PR that only bumps `version` in
  pyproject.toml.
- On merge, tag-and-release verifies the draft release exists for the new
  tag, pushes the tag, then promotes the draft via `gh release edit
  --draft=false --latest`. Recovery path: if the tag exists with a draft,
  the next main push (or workflow_dispatch) re-promotes it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 14:43:06 -07:00
7f7ce8a0f4 chore(skills): slim skills, rename, regroup under training/ (#2576)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore(skills): slim skills, rename, regroup under training/

Rename `config` -> `configs`, `installation` -> `install`. Move
`entrypoints` (as `start-run`) and `monitor-run` under a new
`training/` skill. Slim each skill (~37% fewer lines overall) and
fact-check paths/commands against the current codebase — most
notably the config-class paths now live under
`packages/prime-rl-configs/`, and rollouts are saved to
`{output_dir}/rollouts/step_N/` (no `run_default` prefix).

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

* chore(skills): drop tyro mention in configs skill

pydantic-config is now Pydantic-only (TOML + CLI), no tyro dependency.

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

* chore(skills): drop unsupported `@ toml --help` example

`pydantic-config` doesn't merge TOML into `--help` output; only the
class-level defaults are shown either way. Keep the plain `--help`
and `--dry-run` examples instead.

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

* chore(skills): summarize pydantic-config features in start-run; trim configs

- start-run: add a brief feature summary of `pydantic-config` so the
  config primitives are visible alongside the launch commands.
- configs: drop the SFT/RL domain notes (they belong with the
  respective training docs, not the config primer) and collapse the
  two config-package paths in "Key files" into one line.

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:27:48 -07:00
eaf95997f7 feat: first-class sft+opd training modes (#2546)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add student eval inference pool for SFT hard distillation

When teacher_rollout_model is configured for SFT distillation, the
orchestrator now supports a separate student inference pool for online
evals and weight sync. Previously, configuring [inference] alongside
teacher_rollout_model was forbidden — evals either ran on the teacher
or were skipped entirely.

Changes:
- Relax RLConfig validator to allow [inference] + teacher_rollout_model
- Create eval_inference_pool from config.client when teacher_rollout_model
  is set, pointing at the student vLLM server
- Route eval calls and weight updates to the student pool
- Add eval_inference_pool param to Scheduler for weight sync targeting
- All existing RL/soft-distill paths are unchanged (eval_inference_pool
  defaults to inference_pool when no teacher_rollout_model is configured)

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

* fix: keep hard distill student eval pool optional

* fix: scope teacher rollout routing

* fix: address teacher rollout review comments

* fix: clarify teacher rollout client routing

* fix: honor teacher rollout client type

* refactor(orchestrator): rename model/teacher_model to student/teacher

Consolidates 3 training modes (rl, opd, sft) under a unified config
structure: `student` (always present) and `teacher` (optional, role
determined by `training_mode`). Removes scattered flags (`use_sft_loss`,
`update_student_inference_weights`) in favour of a single discriminator.

Backward-compat aliases (`model` → `student`, `teacher_model` → `teacher`)
keep existing TOML configs parsing without changes.

Also adds `configs/reverse_text/debug_{rl,opd,sft}.toml` for local
mode debugging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(configs): cap reverse-text debug eval at 64 examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(configs): cap reverse-text debug eval completion tokens at 128

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(configs): use correct PI inference teacher model name

qwen/qwen3-4b-instruct doesn't exist on PI inference;
use Qwen/Qwen3-4B-Instruct-2507 instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(configs): use qwen3-30b-a3b-instruct as debug teacher model

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(configs): correct teacher model name to qwen3-30b-a3b-instruct-2507

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(client): add headers_from_env to ClientConfig

Maps header names to env var names, resolved at client setup time.
Analogous to api_key_var but for arbitrary headers. Useful for e.g.
X-Prime-Team-ID when hitting the PI inference API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(client): auto-inject X-Prime-Team-ID header for PI inference

When ClientConfig.base_url targets pinference.ai, auto-add a
headers_from_env mapping for X-Prime-Team-ID -> PRIME_TEAM_ID so team
billing works without each config repeating the boilerplate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(configs): set debug eval to 256 rollouts (64 examples x 4)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(configs): use local vLLM teacher for debug OPD instead of PI inference

PI inference is OpenAI-compatible but doesn't expose vLLM's
/inference/v1/generate prefill endpoint that compute_teacher_logprobs
needs - so OPD against PI inference 404s. SFT mode kept working
because that path only hits /chat/completions.

Switch debug_opd.toml to use the existing teacher_inference auto-setup:
set num_teacher_gpus = 1, and an empty [orchestrator.teacher] block to
satisfy the orchestrator validator (which runs before
auto_setup_teacher_inference can populate it). The validator chain
spins up a local vLLM teacher on port 8001 using the same reverse-text
student model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs+validate: training modes grid + cross-config constraints

- Add docs/training_modes.md with the rl/opd/sft role grid, implications
  (e.g. OPD needs local vLLM teacher, SFT teacher is any OAI-compatible
  endpoint), and minimal config per mode. Linked from mint.json nav.
- Add validate_training_mode_loss_consistency on RLConfig enforcing:
  sft mode <-> sft loss type, opd mode requires teacher_tau > 0,
  non-sft modes forbid sft loss type. These cross orchestrator and
  trainer fields so they live on RLConfig (per-component validators in
  OrchestratorConfig already cover the within-orchestrator constraints).
- Fix debug_sft.toml to set trainer.loss.type = "sft" (was relying on
  default loss which is now explicitly rejected).
- Make training_mode explicit in debug_rl.toml and debug_opd.toml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(configs): lift training_mode to RLConfig + point debug teacher at local vLLM

- Add shared training_mode field to RLConfig (rl | opd | sft). A mode="before"
  validator propagates it into orchestrator.training_mode and (for sft)
  trainer.loss.type before nested validation runs. Must be a before-validator
  because OrchestratorConfig.validate_training_mode would otherwise reject
  configs like training_mode = "opd" + [orchestrator.teacher] - the
  orchestrator-level default of "rl" would conflict with the teacher block
  before the after-validator could propagate the shared value.

- Point debug_opd and debug_sft at a manually-deployed teacher vLLM
  (Qwen3-0.6B-Reverse-Text-RL on localhost:8001). Add a comment with the
  exact teacher start command at the top of each config. Drop the
  num_teacher_gpus auto-launch from debug_opd since we now use the
  external teacher.

- Set student inference gpu_memory_utilization = 0.5 in all three debug
  configs (matches the teacher's mem budget, leaves room when both are
  co-located).

- Add configs/reverse_text/README.md with the start commands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: drop GPU-occupancy runtime check; teacher uses uv run inference

- Remove check_gpus_available in rl entrypoint - it raised RuntimeError
  when other processes held GPUs, which blocked iterating with a
  long-lived teacher inference server on a sibling GPU.
- Update debug_opd / debug_sft / README to start the teacher via
  uv run inference (the prime-rl variant) instead of raw vllm serve.
  Same port (8001), same model, same flags.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(configs): accept legacy flat [orchestrator.model.lora] layout

Pre-refactor, orchestrator.model was a ModelConfig directly (name, lora,
trust_remote_code, vlm). After the student/teacher rename it's a
RolloutModelConfig wrapping ModelConfig + ClientConfig, so existing
[orchestrator.model.lora] TOML sections stopped parsing because they
landed on the wrong nesting level.

Add a mode="before" validator on RolloutModelConfig that detects a flat
ModelConfig dict (any of {name, trust_remote_code, vlm, lora} at the top
level, no nested model/client keys) and re-nests it under "model". This
lets the three existing LoRA configs revert to their original syntax.

Also fix examples/alphabet_sort/sft_distill_hard.toml: hoist training_mode
to the top-level shared field so trainer.loss.type = "sft" gets auto-set
(previously the orchestrator-only flag triggered the new sft/loss
consistency validator).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(orchestrator): split into student_inference + teacher_inference pools

Replace the "one pool plus optional teacher-client overlay" model with two
explicit pools:

- student_inference: InferencePool | None
  - Required for rl/opd, optional for sft (set iff [inference] is configured)
  - Target for evals, weight broadcast, and inference metrics
  - When None, online evals and policy updates are skipped automatically
- teacher_inference: InferencePool | None
  - Set whenever orchestrator.teacher is configured (opd or sft)
  - Source of teacher logprobs in opd
  - Source of train rollouts in sft
  - Always MITO (chat completions) for simplicity; external OAI-compatible
    teachers (PI inference, OpenAI) work as drop-in endpoints

Scheduler now takes both pools and resolves the rollout target internally
(rollout_inference = teacher_inference if sft else student_inference).
The old _resolve_rollout_request_target overlay is gone - the rollout pool
serves rollouts directly. Fixes a latent bug where SFT-mode LoRA updates
would overwrite scheduler.model_name and route subsequent teacher requests
with the student's LoRA name.

Also:
- Drop setup_external_rollout_model (logic is now inline + clearer)
- Rename setup_rollout_inference_pool -> setup_student_inference_pool;
  always handles only the student pool, teacher is plain setup_inference_pool
- Log the resolved training_mode + one-line description at orchestrator start
- Update tests: cover both sft (rollout != student) and rl (rollout = student)
  LoRA paths; drop the now-obsolete teacher-overlay scheduler test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs+configs: legacy [orchestrator.client] shim + merge OPD doc into training_modes

- Add _accept_top_level_client validator on OrchestratorConfig: legacy
  [orchestrator.client...] re-nests under [orchestrator.student.client...]
  matching the existing _accept_flat_model_layout shim pattern. Revert
  configs/elastic/rl.toml back to the original [orchestrator.client.elastic]
  syntax.
- Revert configs/ci/integration/reverse_text_multi_run/orchestrator.toml
  [model.model] -> [model]; the flat-layout shim on RolloutModelConfig
  already handles it (verified).
- Merge docs/on_policy_distillation.md into docs/training_modes.md. The
  training_modes page is now the single entry point; OPD-specific details
  (external teacher, pure distillation, monitoring, VLM, params) live as
  subsections. Delete the standalone OPD page.
- Drop the redundant "Initializing static inference pool" / WandbMonitor /
  PrimeMonitor init logs - they duplicate the immediately-preceding
  per-pool init line.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(orchestrator): probe teacher for prompt_logprobs before training

In OPD mode, send a tiny probe request to the teacher's /inference/v1/generate
endpoint after the pool is ready. If the endpoint 404s or doesn't return
prompt_logprobs, raise an informative error pointing at docs/training_modes.md
instead of crashing mid-training with a 404.

Verified that PI inference fails this probe on all three plausible routes:
- /inference/v1/generate -> 404
- /v1/chat/completions with logprobs=true -> logprobs:null in response
- /v1/completions with echo=true,logprobs=1 -> 404

Also add configs/reverse_text/debug_sft_thinking.toml: SFT from
qwen3-30b-a3b-thinking-2507 via PI inference (sft path needs only
chat completions, so PI inference is fine here).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(orchestrator): deprecate use_token_client (server-tokenized TITO)

Drop the server-tokenized TITO path (``openai_chat_completions_token`` /
``/v1/chat/completions/tokens``). The orchestrator now picks between
renderer-backed TITO (``use_renderer = true``, default) and MITO
(``use_renderer = false``, fallback for VLMs and external teacher rollouts).

- Remove ``OrchestratorConfig.use_token_client`` field and its validators
- Drop the TITO branch in ``setup_rollout_inference_pool``
- Drop the obsolete TITO warning in ``setup_inference_pool`` and flip the
  default ``train_client_type`` to ``openai_chat_completions`` in
  ``StaticInferencePool`` / ``ElasticInferencePool``
- Strip ``use_token_client = false`` from configs/examples/docs that
  carried the no-op fallback line
- CHANGELOG entry documenting the breaking removal

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

* chore(inference): remove server-side TITO route

Drop the ``/v1/chat/completions/tokens`` endpoint and the
``OpenAIServingChatWithTokens`` / ``ChatCompletionRequestWithTokens``
wrappers now that no client routes to them. Also drop the obsolete
``base()`` helper and unused imports from ``server.py``.

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

* refactor: require student_inference in all training modes

Student inference was already required for rl/opd and optional for sft;
making it required everywhere simplifies the orchestrator + scheduler:

- Drop has_student_inference / enable_policy_updates gating
- student_inference: InferencePool (no longer Optional) in Scheduler.__init__
- Weight broadcast init, weight sync, metrics collector, eval routing, and
  shutdown all unconditionally use student_inference
- Drop the now-stale OPD probe (will revisit in a follow-up PR)
- Add is_vlm property on BaseModelConfig; replace local is_vlm vars in the
  orchestrator with config.student.model.is_vlm
- Merge the two legacy student-layout shims on OrchestratorConfig into one
  before-validator (_accept_legacy_student_layout) covering both
  [orchestrator.client.*] and flat [orchestrator.model.<k>] paths
- Drop redundant pool / WandbMonitor / PrimeMonitor init log lines
- Reorder OrchestratorConfig fields: training_mode > student > teacher
- Drop "OAI" from RolloutModelConfig.client description
- Update docs/training_modes.md: SFT student inference is now required;
  evals and weight sync are unconditional

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(configs): default OPD to pure distillation (teacher_tau=1, adv_tau=0)

auto_setup_training_mode now seeds trainer.loss defaults when training_mode
is opd: teacher_tau=1.0 and adv_tau=0.0 (pure distillation: drop the reward
signal, full weight on the teacher KL). User-provided values still win via
setdefault. Also accept training_mode set only inside [orchestrator] - same
auto-setup applies for both the shared top-level and orchestrator-local
forms.

Drop the redundant [trainer.loss] teacher_tau = 0.5 block from
configs/reverse_text/debug_opd.toml; verified the auto-setup applies
end-to-end (3 train steps, teacher logprobs computed each step, clean exit).

Also drop the now-redundant InferencePool type annotation on
self.rollout_inference - both branches assign a definite InferencePool now
that student_inference is non-Optional.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(configs): rename debug_sft_thinking -> debug_sft_external; drop examples/alphabet_sort/sft_distill_hard.toml

debug_sft_external describes the role better - external SFT teacher via
OAI-compatible endpoint (PI inference). The "thinking" label was about the
specific model the config picks (qwen3-30b-a3b-thinking-2507), not about
what the config demonstrates.

Drop examples/alphabet_sort/sft_distill_hard.toml: configs/reverse_text/
debug_sft* are the canonical SFT examples now.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): unbreak CPU tests after student/teacher rename + headers_from_env

- tests/unit/train/test_runs.py: orchestrator config attribute access
  changed from config.model.name to config.student.model.name after the
  RolloutModelConfig rename.
- tests/unit/utils/test_elastic.py: MagicMock client_config needs
  headers_from_env set to {} - the field was added in this PR and the
  test's hand-built mock missed it (pydantic rejects MagicMock as a dict).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(orchestrator): strip logprobs from train sampling in sft mode

The trainer in sft mode reconstructs teacher tokens via the student
tokenizer - it never reads inference-side logprobs from the teacher
endpoint. Stripping logprobs at runtime lets external reasoning-model
endpoints (openai/gpt-5*, etc.) accept the rollout request - they
reject logprobs with 400 invalid_request "logprobs are not supported
with reasoning models".

Done at orchestrator-startup time on each TrainEnv's sampling_args
rather than as a public config field, since this is a mode-specific
runtime concern.

Also: bump configs/reverse_text/debug_sft_external.toml to use
openai/gpt-5-mini (faster than qwen3-30b-a3b-thinking-2507).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(configs): bump debug_sft_external for gpt-5-mini reasoning budget

gpt-5-mini's max_completion_tokens budget includes reasoning tokens.
At 128 the model burned the whole budget on internal CoT before
producing the final answer, returning empty content. Raise to 2048
and set reasoning_effort=minimal so the chat-completions response
includes the actual output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: fix stale SFT references after the student/teacher refactor

- skills/config/SKILL.md: update the SFT hard distill section -
  orchestrator.teacher_model -> orchestrator.teacher, drop the
  "student inference is optional" guidance (the orchestrator now
  unconditionally sets up student_inference), and add a note that
  shared training_mode auto-propagates to trainer.loss.type.
- rl.py: auto_setup_inference_client docstring referenced the deleted
  setup_external_rollout_model function. Rewrite to explain what the
  validator actually does for each mode.

Also note the behavior change in the PR description: SFT now requires
[inference] (was previously optional).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(loss): batch-driven loss dispatch via TrainingSample.training_mode

Replace TrainingSample/MicroBatch.sft_loss bool with training_mode literal
(rl|opd|sft). The trainer's compute_loss reads training_mode from the
micro batch and dispatches:

- "sft"     -> sft_loss_fn (masked NLL on teacher tokens)
- "rl"      -> default_loss_fn with (adv_tau=1.0, teacher_tau=0.0)
- "opd"     -> default_loss_fn with (adv_tau=0.0, teacher_tau=1.0)

Taus move from trainer.loss config to compute_loss's mode->tau table and
flow into LossInputs per batch; DefaultLossConfig drops the teacher_tau /
adv_tau fields. The orchestrator stamps each sample with
config.training_mode at the same point it used to set sft_loss.

Packer enforces same-mode packing (samples with different training_mode
cannot share a micro batch). RLConfig drops the OPD tau auto-setup +
"opd requires teacher_tau > 0" validator + the validate_teacher_model
teacher_tau gate (all redundant under batch-driven dispatch).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(loss): dedicated opd_loss_fn instead of routing taus through inputs

Replace the per-batch adv_tau/teacher_tau routing through LossInputs with a
dedicated opd_loss_fn that lives alongside default_loss_fn and sft_loss_fn.
A bit of code dup in opd_loss_fn (clone of default's DPPO math) makes the
two paths read as separate losses rather than the same function with magic
multipliers.

- setup_loss_fn -> setup_loss_fns: returns a dict {training_mode: LossFn}.
  rl uses the configured loss (default/custom). opd uses opd_loss_fn (only
  available when loss_config is DefaultLossConfig). sft is always available.
- compute_loss takes loss_fns + training_mode, looks up the right fn.
- opd_loss_fn requires teacher_logprobs (raises otherwise).
- LossInputs no longer carries adv_tau/teacher_tau - those values are baked
  into each loss fn.
- Add validator: opd mode requires trainer.loss.type = "default".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(loss): drop trainer.loss type discriminator + shared training_mode

Now that loss dispatch is fully batch-driven (TrainingSample.training_mode),
the trainer.loss type union and the shared RLConfig.training_mode propagator
are redundant. Flatten:

- Delete SFTLossConfig (the mode implies it; no fields).
- trainer.loss: DefaultLossConfig = DefaultLossConfig() (flat, not a union).
- trainer.custom_loss: CustomLossConfig | None = None - optional override
  for rl-mode loss only; opd and sft always use opd_loss_fn / sft_loss_fn.
- setup_loss_fns(loss_config, custom_loss) always returns all three keys -
  mixed-mode batches dispatch correctly at the trainer level (orchestrator
  still stamps a single mode per run; that's a separate concern).
- Drop RLConfig.training_mode shared field, the auto_setup_training_mode
  before-validator, and validate_training_mode_loss_consistency. The
  orchestrator-level [orchestrator] training_mode is the single source.

Move training_mode = "sft" out of top-level into [orchestrator] in the
three SFT debug configs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(rl entrypoint): warn for missing [inference] in all modes (incl. sft)

After the always-require-student refactor, sft runs need a student
inference pool too (orchestrator unconditionally creates it for evals +
weight sync). The old "sft mode, using teacher for rollouts" info log
was correct under the old semantics but now silently puts the user on a
path where the orchestrator hangs waiting for a non-existent student
server at the default localhost:8000. Replace with a single warning
that prints the configured student base_url and flags the hang risk.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(loss): make opd_loss_fn's tau values explicit (adv_tau=0, teacher_tau=1)

Mirror default_loss_fn's structure literally: declare the two tau locals at
the top, then use them in the same `adv_tau * advantages + teacher_tau *
teacher_kl.detach()` expression. The "this is the default loss with those
specific knobs baked in" relationship is now visible in the code rather than
hidden in a substituted expression.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(loss): restore DefaultLossConfig.adv_tau + LossConfig union (rl-only)

- DefaultLossConfig regains adv_tau (= 1.0). default_loss_fn reads it.
- trainer.loss is back to a discriminated union of DefaultLossConfig |
  CustomLossConfig (drop SFTLossConfig stays dropped). type discriminator
  restored.
- trainer.loss only applies to rl-mode batches. opd and sft batches dispatch
  unconditionally to opd_loss_fn / sft_loss_fn - they don't read trainer.loss.
- opd_loss_fn is self-contained: the DPPO/KL knobs (dppo_mask_*, kl_tau)
  are baked in as module-level _OPD_* constants matching DefaultLossConfig's
  defaults. No loss_config parameter.
- Drop the trainer.custom_loss sibling field (subsumed by the union).

Also add debug_opd_lora.toml + bump lr to 1e-4 in both lora debug configs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(loss): inline opd_loss_fn knobs (no named locals/constants)

Drop the module-level _OPD_* constants and the local adv_tau/teacher_tau
bindings - inline the literal values into the math. Keeps the parallel
structure to default_loss_fn visible: `0.0 * advantages + 1.0 * teacher_kl`
in the same place default_loss_fn has `loss_config.adv_tau * advantages`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(loss): trim opd_loss_fn docstring

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: update reverse_text README — add lora configs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* polish: auto-disable renderer in sft + CHANGELOG + log/shim cleanup

- OrchestratorConfig auto-sets use_renderer=False when training_mode='sft'
  via an after-validator placed before the renderer validators in
  declaration order, so the user doesn't have to set it. Drop the rejecting
  branch in validate_training_mode + the explicit use_renderer=false lines
  in the three sft debug configs.
- CHANGELOG: add a "first-class training_mode + batch-driven loss dispatch"
  entry covering the breaking removals (orchestrator.use_sft_loss,
  orchestrator.teacher_rollout_model, trainer.loss.type='sft' /
  SFTLossConfig, trainer.loss.teacher_tau) with migration notes.
- _accept_legacy_student_layout: use set(ModelConfig.model_fields) instead
  of hardcoding the field list, so new ModelConfig fields are picked up
  automatically.
- Trim the orchestrator startup log to just '(<training_mode>)'; the
  prose description was redundant with docs/training_modes.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(configs): unbreak OPD auto-wiring when num_teacher_gpus is set

Add a mode="before" validator on RLConfig that stubs an empty
[orchestrator.teacher] block when deployment.num_teacher_gpus is set and
the user didn't write one. Without this, OrchestratorConfig.validate_training_mode
("opd requires orchestrator.teacher") fires during nested validation - before
auto_setup_teacher_inference can wire the teacher from teacher_inference.

Repro that now passes:

  RLConfig.model_validate({
      "deployment": {"num_teacher_gpus": 1},
      "trainer": {},
      "orchestrator": {"training_mode": "opd"},
      "inference": {},
  })

-> auto_setup_teacher_inference fills in orchestrator.teacher.client.base_url
   = ["http://localhost:8001/v1"] and model.name from teacher_inference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(training_modes): shrink mode-comparison table + add sft/opd teacher note

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(configs): move training-mode debug configs to configs/debug/training_modes/

The reverse-text debug configs are about exercising the training modes, not
about reverse-text specifically. Move to configs/debug/training_modes/ and
drop the debug_ prefix from each filename (the directory name carries it).

  configs/reverse_text/debug_rl.toml          -> configs/debug/training_modes/rl.toml
  configs/reverse_text/debug_opd.toml         -> configs/debug/training_modes/opd.toml
  configs/reverse_text/debug_opd_lora.toml    -> configs/debug/training_modes/opd_lora.toml
  configs/reverse_text/debug_sft.toml         -> configs/debug/training_modes/sft.toml
  configs/reverse_text/debug_sft_lora.toml    -> configs/debug/training_modes/sft_lora.toml
  configs/reverse_text/debug_sft_external.toml -> configs/debug/training_modes/sft_external.toml
  configs/reverse_text/README.md              -> configs/debug/training_modes/README.md

Update path references in each TOML's header comment, the README, and
docs/training_modes.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(configs): drop auto pinference team-id, rename student-shortcut shim

- ClientConfig.auto_setup_pinference_team_header dropped. The hostname-sniff
  was implicit magic. Configs that need the X-Prime-Team-ID header against
  PI inference set it explicitly under [...client.headers_from_env] now.
  Update configs/debug/training_modes/sft_external.toml accordingly and
  drop the auto-injection note from the file header.
- Rename OrchestratorConfig._accept_legacy_student_layout (with leading
  underscore + "backward-compat" framing) to fold_student_shortcuts. The
  shim is more than a back-compat: it's the ergonomic path for rl configs
  too, letting users write [orchestrator.model.name] / [orchestrator.client]
  rather than [orchestrator.student.model.name] / [orchestrator.student.client].
  Docstring reframed accordingly. Teacher has no equivalent shortcut on
  purpose: rl mode forbids teacher, so the same shortcut routing to two
  roles would be ambiguous.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): update multi_run CLI args after student rename

test_reverse_text_multi_run.start_orchestrator passes --client.base-url
and --model.lora.name as CLI flags to `uv run orchestrator`. After the
student rename, those tyro args don't exist anymore (they're now
--student.client.base-url and --student.model.lora.name). tyro rejects
them before the fold_student_shortcuts before-validator can re-nest the
dict, so the orchestrator process exits immediately and the test times
out waiting for "Step 11" to appear in the log.

Rename both CLI args to their new student-scoped form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Timothy Kostolansky <39891386+tim0120@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-19 10:39:58 -07:00
samsjaandGitHub 03f7feff14 Add pydantic-config submodule (#2556)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-05-18 21:46:40 -07:00
87ab84b666 chore(orchestrator): deprecate use_token_client (#2549)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore(orchestrator): deprecate use_token_client (server-tokenized TITO)

Drop the server-tokenized TITO path (``openai_chat_completions_token`` /
``/v1/chat/completions/tokens``). The orchestrator now picks between
renderer-backed TITO (``use_renderer = true``, default) and MITO
(``use_renderer = false``, fallback for VLMs and external teacher rollouts).

- Remove ``OrchestratorConfig.use_token_client`` field and its validators
- Drop the TITO branch in ``setup_rollout_inference_pool``
- Drop the obsolete TITO warning in ``setup_inference_pool`` and flip the
  default ``train_client_type`` to ``openai_chat_completions`` in
  ``StaticInferencePool`` / ``ElasticInferencePool``
- Strip ``use_token_client = false`` from configs/examples/docs that
  carried the no-op fallback line
- CHANGELOG entry documenting the breaking removal

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

* chore(inference): remove server-side TITO route

Drop the ``/v1/chat/completions/tokens`` endpoint and the
``OpenAIServingChatWithTokens`` / ``ChatCompletionRequestWithTokens``
wrappers now that no client routes to them. Also drop the obsolete
``base()`` helper and unused imports from ``server.py``.

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 18:22:07 -07:00
samsjaandGitHub 8106bf0a02 [codex] add custom qwen3 dense model (#2505)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add custom qwen3 dense model

* format qwen3 model files

* remove qwen3 unit test
2026-05-18 15:30:47 -07:00
46653c1d70 [codex] add per-env trainer metrics (#2478)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add per-env trainer metrics

* require env names for trainer batches

* address per-env metric review feedback

* reuse tensor stats for env metrics

* fix sft trajectory env-name fixture

* address trainer metric naming comments

* fix: reuse trainer ratio tensors for env metrics

* fix: derive dppo mask from shared ratio

* address PR review: drop precomputed loss inputs, use {all,env} keys

- compute importance-ratio / mismatch_kl inside the loss functions instead of
  passing them in via LossInputs (per Mika)
- compute mismatch_kl inline in train.py only for per-env logging
- rename trainer aggregate keys to entropy/all and mismatch_kl/all to match the
  orchestrator {all,env}/{mean,std,max} convention; drop the leftover bare
  entropy/* and mismatch_kl/* keys
- drop the overly defensive env_names length check in DataLoader

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

* guard mismatch_kl logging behind sft_loss flag

SFT batches don't have meaningful inference_logprobs (sft_loss_fn ignores
them), so computing and logging mismatch_kl for those microbatches is wasted
work and produces misleading numbers. Skip the inline mismatch_kl compute and
the per-env / debug-log emissions when sft_loss is True.

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

* address review: simplify probs_diff and move mismatch_kl/all to trainer loop

* reserve env_name='all' for aggregate metric keys

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 15:19:52 -07:00
c3c6b70f11 [codex] chore: bump vllm to 0.21.0 (#2519)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: bump vllm

* fix: adapt dp pause patch for vllm 0.21

* Drop deep_gemm ep_scatter and silu_mul_quant int64 monkey patches

Both int64-addressing carries are fixed upstream in vLLM 0.21.0.

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 13:55:08 -07:00
samsjaandGitHub 66ff00d117 make renderers default for rollouts (#2521)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-05-17 12:58:38 +02:00
897b935cae feat: turn prime-rl into a monorepo (#2507)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: turn prime-rl into a monorepo with submodules

Add verifiers, renderers, and research-environments as git submodules and
uv workspace members. Source edits in any of them now apply to prime-rl's
venv without a re-sync. Drops the PrimeIntellect PyPI index in favor of
installing env packages editable from the submodule trees.

- envs extra expanded from ~14 curated packages to ~98 env packages across
  verifiers/environments and research-environments/environments
- 11 envs excluded from the workspace due to upstream dependency conflicts
  (tau2 fork divergence, openenv-core unreleased, scicode protobuf clash,
  gem-wordle nltk pin, two envs with hardcoded verifiers git URLs)
- override-dependencies adds torch>=2.9.0 (to override verifiers[rl]'s
  torch<2.9 pin) and openenv-core (to avoid an unreleased version pin)
- scripts/install.sh now initializes submodules per-path so a missing
  private repo (e.g. configs/private) does not abort the install
- installation/config/entrypoints skills updated to mention submodules and
  the configs/private path

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

* chore: scope ruff to prime-rl source only

Submodules (verifiers, renderers, research-environments) have their own
ruff configuration and style. Excluding them from prime-rl's checks avoids
spurious CI failures on third-party code that we don't own.

- pyproject.toml: extend-exclude the three submodule paths
- style.yaml: don't fetch submodules in the ruff job (nothing to lint there)

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

* feat: add configs/private submodule pointing to research-configs

The private repo holds training/eval configs not meant for the public
prime-rl tree. People without access skip the submodule init via the
install script.

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

* chore: bump configs/private + lock CI to public submodules only

- configs/private: pulls in all 88 TOML configs from research-prod
- CI workflows: replace 'submodules: true' with explicit init of just
  verifiers/renderers/research-environments, so no CI run ever attempts
  to fetch the private configs/private submodule

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

* refactor: move submodules under packages/ + scope config tests

- packages/{verifiers,renderers,research-environments}: submodules now
  live alongside packages/prime-rl-configs as workspace members
- pyproject.toml: workspace members/exclude and ruff extend-exclude
  updated to the new paths
- CI workflows: revert to submodules: true (the GITHUB_TOKEN doesn't
  give access to configs/private, so it can't leak); the test fix
  below handles the in-tree case
- tests/unit/test_configs.py: skip configs/private/ when collecting
  TOMLs so private configs aren't loaded through public schemas
- scripts/install.sh: drop redundant -c url.insteadOf on clone; the
  later persistent git config line is what actually rewrites URLs
  for the submodule init step
- skills/installation/SKILL.md: point to packages/<submodule>/ paths

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

* refactor: scope envs extra to union of main + research-prod

Drop the "install everything" approach. The envs extra now installs only
the union of (1) envs prime-rl main shipped before this PR and (2) envs
referenced in research-prod TOMLs. The rest of the env packages remain
workspace members (installable via `uv add <name>`), but aren't pulled
in by `--extra envs`.

This trims the install set from ~95 to 27 packages — fewer transitive
dep conflicts to keep alive, and the install set actually matches what
our active configs use.

tau2-bench is un-excluded from the workspace and added as a source so
research-prod's tau2-bench configs install cleanly. The other tau2 forks
(tau2-bench-v1, tau2-synth, tau3-bench, tau3-bench-rlm) stay excluded —
they pull tau2 from divergent forks/commits that can't coexist in a
single venv.

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

* refactor: scope workspace members to installed envs only

The previous setup pulled every env subdir under packages/verifiers
and packages/research-environments into the workspace via globs, then
maintained an exclude list for envs that couldn't co-resolve. With the
envs extra now narrowed to the union of (prime-rl main + research-prod),
the workspace can list exactly those env packages and skip the rest —
no exclude list needed.

Also: extend-exclude in ruff config simplified to ["packages"] so
prime-rl's checks ignore anything under packages/. The submodules
have their own ruff configs.

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

* fix(ci): don't try to fetch the private configs/private submodule

The default GITHUB_TOKEN that actions/checkout uses is scoped to the
current repo only, so 'submodules: true' aborts with 404 when it
hits configs/private (the research-configs repo). Skip the checkout
action's submodule init and explicitly update just the three public
submodules.

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

* chore: strip noisy comments

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

* refactor: prune [tool.uv.sources] to installed env packages only

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

* fix(ci): rewrite SSH to HTTPS for submodule init

Runners have no SSH key, so cloning git@github.com:... fails. The
actions/checkout step handles this automatically when submodules: true
is set, but the explicit submodule update we run after submodules: false
doesn't. Set the insteadOf rewrite before the update.

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

* refactor: move third-party submodules from packages/ to deps/

packages/ is reserved for first-party prime-rl subpackages
(packages/prime-rl-configs). Vendored submodules live under deps/.
Ruff extend-exclude switches to deps/ so prime-rl-configs gets linted
again.

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

* fix(install): apply SSH->HTTPS rewrite in SKIP_CLONE path too

The rewrite was inside the else branch of the clone check, so users
running with SKIP_CLONE=1 without SSH access would hit the same submodule
init failures the rewrite was meant to prevent. Move it after the
clone/skip block so it runs in either path.

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

* fix(docker): copy deps/ and init submodules in release workflow

The submodule move from packages/ to deps/ left the Dockerfile and the
release workflow inconsistent: Dockerfile.cuda only COPYs packages/, and
release.yaml never initialized submodules. Add the deps/ COPY and the
explicit submodule init (matching the test workflows).

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

* docs: warn against --recursive submodule init, use explicit paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: remove note from submodule init step in README

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: pin renderers to v0.1.6 and verifiers to aa428f3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(verifiers): patch out renderers git source for workspace compat

uv requires workspace members to reference each other as workspace
sources. verifiers@aa428f3 still has renderers as a git source; this
local patch removes it so the workspace resolves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(verifiers): advance to latest main

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(renderers): advance to latest main (v0.1.8.dev2)

Required by verifiers main which now pins renderers>=0.1.8.dev0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert ruff pre-commit hook to v0.13.0 to match CI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 23:31:33 -07:00
samsjaandGitHub c654dc1d4d log masked advantage sign rates (#2481)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-05-14 19:17:32 -07:00
d2f36c9f65 feat: per-batch loss type override for hosted SFT hard distill (#2271)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: per-batch loss type override for hosted SFT hard distill

Add loss_type field to TrainingSample and MicroBatch transport types so
the orchestrator can stamp samples with a loss override (e.g. "sft")
that the trainer dispatches per-batch. This allows a shared multi-tenant
trainer to handle both RL and SFT distill runs on the same cluster.

When teacher_rollout_model is configured, the orchestrator sets
loss_type="sft" on each sample. The trainer's compute_loss checks the
field and swaps to sft_loss_fn for that batch, falling back to the
configured default when None (fully backward compatible).

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

* refactor: explicit loss_type field, sft_loss bool, no auto-derive

Address review feedback:
- Replace loss_type: str | None with sft_loss: bool on TrainingSample
  and MicroBatch (simpler, no string matching)
- Add explicit loss_type: Literal["rl", "sft"] on OrchestratorConfig
  instead of auto-deriving from teacher_rollout_model presence
- Orchestrator stamps sample.sft_loss based on config.loss_type, not
  teacher presence — user explicitly opts in
- Update validator: loss_type="sft" requires teacher_rollout_model
  (direction reversed from "teacher implies sft")
- Update example TOML with explicit loss_type = "sft"

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

* change to boolean

* conistency

* refactor: rename need_sft_loss to use_sft_loss and tighten hosted SFT invariants

- Rename `OrchestratorConfig.need_sft_loss` to `use_sft_loss` (clearer intent).
- Move the orchestrator-only SFT distill invariants (use_sft_loss paired
  with teacher_rollout_model, use_token_client coupling) from RLConfig onto
  OrchestratorConfig so the hosted `orchestrator` entrypoint enforces them
  too, not just the combined `rl` entrypoint.
- Shrink RLConfig.validate_external_rollout_inference to the one truly
  cross-config check (teacher_rollout_model vs self.inference).
- Drop redundant `[trainer.loss] type = "sft"` from the alphabet_sort
  example so `use_sft_loss` is the single obvious knob.
- Access micro_batch["sft_loss"] directly in train.py (required TypedDict
  field, no fallback needed).
- Document the override in skills/config/SKILL.md.

* test: cover hosted SFT loss override

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 15:12:58 -07:00
b194a6ed26 feat: save train and eval rollouts in verifiers format (#2248)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: save train and eval rollouts in verifiers format

Save rollouts to {output_dir}/rollouts/step_{x}/ as JSONL files using
verifiers serialization at every step. Also renames rollouts.bin to
train_rollouts.bin for consistency.

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

* fix: run save_rollouts in background thread to avoid blocking event loop

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

* refactor: replace rollout_executor with asyncio.to_thread + scaled default executor

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

* refactor: extract set_default_executor util, call in orchestrator init

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

* docs: document rollout JSONL files in monitor-run skill

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

* docs: fix rollouts path in monitor-run skill to include run_dir

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

* fix: save final eval rollouts to disk

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

* fix: await save_rollouts to prevent race with in-place rollout mutations

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

* fix: await final eval rollouts save to prevent data loss on shutdown

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 07:22:34 -07:00
adbf84ac9f feat: improve monitor-run skill (#2179)
Release / Push CUDA image to Docker (push) Canceled after 0s
* overhauled monitor run skill

* update monitor-run skill: metrics, errors, status format, tmux detection

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

* add post-restart verification step to monitor-run skill

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 08:59:57 +02:00
06c54dde73 feat: set process titles on all entrypoints (#2159)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: set process titles on all entrypoints for process tree visibility

Adds setproctitle dependency and labels every prime-rl process
(Launcher, Inference, Orchestrator, Trainer, SFT, EnvServer) so they
are identifiable in ps/htop/pstree. Bumps verifiers pin to include
the companion change (Verifiers::EnvServer, Verifiers::EnvWorkerN).

Updates the monitor-run skill with process tree documentation.

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

* fix: remove intermediate uv wrappers from local launchers

The launcher already runs inside `uv run`, so child processes inherit
the venv. Invoke entrypoints (inference, orchestrator) and torchrun
directly, eliminating one unnecessary process per subprocess.

Also bumps verifiers pin to 73deb26 (set_proc_title in __init__).

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

* docs: add vLLM process discovery to monitor-run skill

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

* chore: remove noisy log from set_proc_title

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

* chore: bump verifiers pin to adf8138 (merged companion PR)

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 02:48:51 -07:00
2a7bf998fa deepEP (#2119)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Extend DeepEP overlap support.

Add the DeepEP dispatch/combine runtime, configuration hooks, and tests, including LatentMoE support and the related benchmark plumbing.

* Delete tests/unit/train/test_deepep.py

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* Delete tests/unit/train/models/test_latent_moe.py

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* Revise CHANGELOG with recent model updates

Updated changelog to reflect recent changes in model configurations and features.

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* Remove tensor parallelism size attribute from trainer

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* Change default value from 24 to 20 for parameter

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* Update CHANGELOG with new configuration options

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* Document DeepEP token chunk config

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* address comments

* Handle empty DeepEP MoE batches

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* Delete tests/unit/train/models/test_moe_deepep.py

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* some refactoring

* fix

* Fix DeepEP combine finalization ordering

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* Revert "Fix DeepEP combine finalization ordering"

This reverts commit aaa6e7f5000192f98ac680de44dd0970b9e384b0.

* Revert "fix"

This reverts commit 46eb2fd55669b29ea8660ae39ac80a37e4ea8d8c.

* Revert "some refactoring"

This reverts commit 76d780c58931d1f72e5d48eaff18444651a2f0c9.

* ruff

* fix

* ruff

* refactor moe backend type import

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* Fix MoE import ordering

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

---------

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>
Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
2026-03-31 21:55:13 +01:00
1692a67d90 chore: unify log directories (#2150)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: unify log directories across local and SLURM deployments

Remove Python file logging (log.file config) — deployment-level capture
(stdout redirect for local, tee for SLURM) is sufficient. This eliminates
duplicate log files and simplifies the logging architecture.

Key changes:
- Remove log.file config option and JsonFileSink from logger
- Rename .stdout -> .log for deployment-captured logs
- Unify SLURM logs from slurm/ into logs/ (same as local)
- Trainer shows rank 0 only, all rank logs in logs/trainer/torchrun/
- Multi-node SLURM: logs/trainer/node_N.log, logs/inference/node_N.log
- Symlink logs/trainer.log -> trainer/node_0.log (multi-node)
- Historical per-job logs under logs/slurm/job_{id}/

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

* fix: update env log paths in docs to match actual structure

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

* docs: simplify env and torchrun logging sections

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

* chore: include per-node and per-rank log paths in log messages

Show where to find node-level logs (for multi-node) and per-rank
torchrun logs in the startup log messages for RL, SFT, and inference.

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

* refactor: extract format_log_message to shared utility

Move format_log_message from rl.py to utils/pathing.py and reuse it
in SFT and inference entrypoints, eliminating duplicated formatting logic.

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

* chore: remove historical per-job SLURM log copies

The job_* log copies in logs/slurm/ added complexity without much value.
SLURM's own job output log (job_%j.log) already serves as the historical
record.

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

* docs: move tmux helper section to bottom of logging.md

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

* chore: consolidate tmux.sh and slurm_tmux.sh into one script

Log paths are now unified across local and SLURM, so both scripts
were tailing the same files. Merge into a single tmux.sh with a Logs
window (4 panes tailing trainer/orchestrator/envs/inference) and a
Monitor window (nvtop + htop).

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

* docs: fix logger docs to match actual behavior

setup_logger doesn't raise when called twice (it reconfigures).
get_logger always works (auto-initializes a default if needed).

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

* docs: remove incorrect env_worker_logs reference

The env_worker_logs config field is defined but never read — env worker
logs are written unconditionally.

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

* chore: remove dead env_worker_logs config field

Defined but never read anywhere in the codebase.

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

* docs: add router logs to slurm monitoring section

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

* docs: mention per-node and per-rank trainer logs in performance section

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

* docs: generalize config path references to {output_dir}/configs/

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

* fix: template rendering bugs and improve log message labels

- Fix Jinja2 tags on same line as tee commands (broken bash output)
- Rename "Trainer:" to "Trainer (rank 0):" in log messages
- Rename "Nodes:" to "All nodes:" and "Per-rank:" to "All ranks:"
- Make per-rank log line a tail -F command following torchrun structure

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

* fix: include stderr in all-ranks log tail command

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

* fix: update stale log paths in examples, SFT tests, and pathing test

- Fix torchrun glob: **/*.log → */*/*/*.log (tail -F doesn't support **)
- Update 5 example READMEs from slurm/latest_* to logs/ paths
- Update SFT tests from logs/trainer/rank_0.log to logs/trainer.log
- Update pathing test fixture to match new log structure

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

* chore: clean up log message code and fix test bug

- Remove hardcoded "Showing rank 0 logs only" message from trainers
  (already communicated via format_log_message)
- Derive env_log_dir inside format_log_message instead of requiring
  callers to pass it
- Fix test_pathing double mkdir crash (FileExistsError)

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

* feat: split LogConfig into TrainerLogConfig and OrchestratorLogConfig

- TrainerLogConfig adds ranks_filter (configures torchrun
  --local-ranks-filter, defaults to [0]) and log_data
- OrchestratorLogConfig adds vf_level
- Base LogConfig retains level and json_logging
- ranks_filter is passed through to SLURM templates

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

* refactor: keep LogConfig as-is, only extend with TrainerLogConfig

Revert OrchestratorLogConfig — keep vf_level and log_data on the base
LogConfig for safety. Only TrainerLogConfig extends with ranks_filter.

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

* chore: remove "(rank 0)" from trainer log message

ranks_filter is now configurable so it may show more than rank 0.

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

* fix: use total_infer_nodes for log hint and add CHANGELOG entries

- Fix num_infer_nodes using per-replica count instead of total, which
  suppressed "All nodes" hint for multi-replica inference
- Add CHANGELOG entries for removed config fields and new ranks_filter

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

* fix: use `uv run sft` entrypoint in SFT integration tests

The SFT tests were calling torchrun directly, bypassing the SFT
entrypoint which handles stdout redirection to trainer.log. This caused
tests to read stale/wrong log files from the shared output directory.

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

* fix: add --clean-output-dir to initial SFT integration tests

The SFT entrypoint validates that output_dir doesn't contain stale
checkpoints. Since output_dir is session-scoped and shared across test
modules, the SFT tests need --clean-output-dir on the initial run.

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

* fix: add --clean-output-dir to RL integration tests too

All integration tests sharing the session-scoped output_dir should
clean on initial run to avoid stale checkpoint validation errors.

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:04:11 -07:00
5a68accde7 chore: overhaul skills and clean up AGENTS.md (#2149)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: replace toml-config skill with broader config skill

Replaces the narrow toml-config skill with a comprehensive config skill
covering TOML files, CLI overrides, config composition, inspection,
and all field type patterns (booleans, None, lists, dicts, unions, models).

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

* chore: add entrypoints skill, remove inference-server skill

Add entrypoints skill covering rl, sft, and inference commands.
Remove inference-server skill as its content is now covered by entrypoints.

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

* chore: streamline installation skill

Consolidate install commands into one code block with basic/advanced sections.

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

* chore: clean up AGENTS.md, add release skill

Move release notes instructions into a dedicated skill. Streamline
AGENTS.md: concise code guidelines, updated running code section,
removed CLI usage (now covered by config skill).

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

* chore: add monitor-rl-run skill

Covers finding output directories, log file locations (local vs SLURM),
node allocation, performance diagnostics (trainer wait, orchestrator wait,
env server event loop lag), and quick health checks.

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

* chore: rename monitor-rl-run to monitor-run, add RL section

Restructure to support future SFT monitoring section alongside RL.

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

* chore: restructure monitor-run into Check Logs and Check Performance sections

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

* chore: detail GPU allocation for single-node and multi-node RL runs

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 05:49:58 -07:00
c2dfc338c3 feat: add NemotronH (Nemotron-3-Super-120B-A12B) model support (#2046)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add NemotronH (Nemotron-3-Super-120B-A12B) model support

Implement hybrid Mamba-Transformer-MoE architecture with three distinct
layer types: Mamba-2 SSM (via HF NemotronHMamba2Mixer), LatentMoE with
non-gated experts and latent projections, and shared attention layers.

- Add NemotronHConfig with hybrid_override_pattern parsing
- Add NonGatedGroupedExperts, NemotronHRouter, LatentMoE to layers/moe.py
- Add bidirectional weight conversion (HF mixer.* <-> PrimeRL namespaces)
- Register model in AutoConfig and update FSDP/EP isinstance checks
- Add comprehensive tests (forward/backward, weight roundtrip, reverse conversion)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: NemotronH weight conversion, MoE forward pass, and HF model compat

Weight conversion (converting_nemotron_h.py):
- Handle backbone.* -> model.* prefix rename (HF uses "backbone", PrimeRL uses "model")
- Stack individual expert weights into fused 3D tensors (HF stores per-expert, PrimeRL uses fused)
- Unstack fused tensors back to individual experts for HF export
- Drop mtp.* (multi-token prediction) keys during conversion
- Support both backbone.* and model.* prefixes in layer type inference

MoE forward pass (moe.py):
- Apply routing scores AFTER expert computation (was before), matching vLLM and HF reference
- Apply routed_scaling_factor separately after expert output, before fc2_latent_proj
- Remove routed_scaling_factor from router scores (applied in LatentMoE instead)

Model loading (model.py):
- Support HF models with "embeddings" attr (not just "embed_tokens") in FSDP setup
- Support HF models with "norm_f" attr (not just "norm") in FSDP setup
- Guard all .mlp accesses with getattr for HF model compat (NemotronHBlock has no .mlp)

Modeling (modeling_nemotron_h.py):
- Handle backbone.* prefix in is_hf_state_dict detection
- Handle both model.* and backbone.* in layer type inference
- Per-layer HF conversion for weight broadcast (model.* -> backbone.*)

Configs:
- Add nemotron_4node/ and nemotron_debug/ run configs

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

* fix: remove spurious RoPE from NemotronH attention layers

NemotronH gets position information from Mamba layers, not RoPE.
Both HF and vLLM implementations confirm NemotronH attention does not
apply rotary embeddings. The spurious RoPE was causing ~0.5 KL mismatch
between vLLM inference and PrimeRL training; after removal KL drops to
near zero.

- Make position_embeddings optional in FlashAttention/SDPAAttention
- Remove RotaryEmbedding from NemotronHModel
- Add KL mismatch test suite for NemotronH
- Mark test_nemotron_h_reverse as xfail (pre-existing HF fused tensor issue)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use mamba_ssm Triton SSD kernels for NemotronH to match vLLM precision

The HF torch_forward computes softplus in bf16 while vLLM uses fp32
Triton kernels, causing ~0.4 KL divergence in Mamba layers. This patch
monkey-patches NemotronHMamba2Mixer to use mamba_chunk_scan_combined
from mamba_ssm (Triton, fp32 softplus) with PyTorch nn.Conv1d fallback.

- Add mamba_ssm Triton SSD patch for NemotronHMamba2Mixer
- Add mamba-ssm as optional dependency in pyproject.toml
- Update installation skill with mamba-ssm instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: update uv.lock for mamba-ssm and fix ruff formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: move mamba-ssm to dependency-groups to fix CI CPU tests

mamba-ssm requires nvcc to build from source. When it was in
[project.optional-dependencies], `uv sync --all-extras` tried to build
it in CI where nvcc isn't available. Moving it to [dependency-groups]
means it's only installed explicitly via `uv sync --group mamba-ssm`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: detect attention layers in is_prime_state_dict for weight broadcast

The per-layer is_prime_state_dict check missed attention-only layers
(which have self_attn.* keys), causing the HF conversion to be skipped
during weight broadcast. vLLM then received PrimeRL keys (self_attn.*)
instead of HF keys (mixer.*), failing with a 500 error.

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

* fix: update uv.lock and ruff formatting for NemotronH

- Reformat modeling_nemotron_h.py to pass ruff check
- Update uv.lock after mamba-ssm dependency group addition
- Add pre_run_command to nemotron config for mamba-ssm install

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

* fix: guard mamba_ssm import for CI environments without it

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

* fix: include mamba-ssm in Docker build for NemotronH support

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

* fix: address review feedback for NemotronH

- Add non-layer weight handling to convert_layer_to_prime (backbone.* prefix)
- Make embed_module fallback consistent (safe getattr for both attrs)
- Remove unused routed_scaling_factor from NemotronHRouter
- Remove dead get_max_layer_num function from converting_nemotron_h

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 16:44:08 -07:00
40da51a235 SFT distillation: bug fixes, VLM support, and pretokenization optimization (#2053)
Release / Push CUDA image to Docker (push) Canceled after 0s
* SFT distillation with teacher endpoint

* streamline SFT distillation rollout/eval model split

* fix sft reconstruction and default loss scaling regressions

* simplify SFT distillation by removing eval inference split

* chore: apply ruff formatting

* docs: add changelog entries for RolloutModelConfig, SFTLossConfig, and CustomLossConfig

Co-authored-by: will brown <willccbb@users.noreply.github.com>

* refine external SFT rollout path and cleanup tests

* refactor shared SFT chat-template tokenization logic

* fix: remove dead store in _tokenize_step_from_messages

full_ids was tokenized via _render_messages then immediately overwritten
by build_incremental_token_mask, wasting a tokenization pass per step.

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

* fix: remove unused _should_add_generation_prompt from trajectories

Duplicate of should_add_generation_prompt in utils/chat_template.py,
never called anywhere.

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

* fix: pass top_k and min_p for both token and non-token client paths

Explicitly disable top-k and min-p filtering on all vLLM requests,
not just the token client path.

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

* chore: remove redundant test_rl_config_external_rollout_mode_rejects_inference

Redundant with the Pydantic model validator definition.

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

* fix: correct CHANGELOG field name to teacher_rollout_model

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

* fix: pass tool definitions through pretokenize pipeline

When external teacher rollouts have tool_defs, convert them to OAI
format and pass through to build_incremental_token_mask so that
tokenization includes tool definition tokens from the chat template.

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

* fix: enable collapse_consecutive_tool_messages in pretokenization

Matches the SFT data pipeline behavior. Without this, parallel tool
call responses cause an assertion failure in incremental tokenization
when the chat template re-renders consecutive tool messages.

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

* fix: handle dict tool_defs in _convert_tools_to_oai_format

Tool definitions arrive as plain dicts after ZMQ msgpack serialization
(verifiers' msgpack_encoder calls model_dump() on Tool pydantic objects).
Use duck-typed accessor to support both dict and object forms.

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

* feat: VLM processor support in SFT distillation pretokenization

For VLM models, the tokenizer alone produces only 1 <|image_pad|> token
per image, but the model expects the count to match actual image patches.
Thread the processor through pretokenize → render_messages →
build_incremental_token_mask so that processor.apply_chat_template
(which expands image placeholders correctly) is used when available.

Also move pretokenize before build_vlm_image_cache in the orchestrator,
since the cache build strips image data from messages.

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

* perf: replace incremental token mask with direct completion masking

In the SFT distillation path, completion is always a single assistant
message (enforced by verifiers' parse_response_message), so the
completion mask is trivially all-True. Replace N incremental
tokenizer/processor calls from build_incremental_token_mask with a
single render_messages call. For VLM models this avoids redundant
image preprocessing on every incremental prefix.

Added assertion to guard the single-assistant-role assumption.

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

* chore: remove duplicate SFT distillation configs

Keep examples/alphabet_sort/sft_distill_hard.toml as the canonical
example config.

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

* fix: always request logprobs in sampling args

logprobs=True was only set when use_token_client=True, but non-token-
client paths (e.g. external APIs) also need logprobs for RL training.
return_token_ids remains gated behind use_token_client since it is
vLLM-specific.

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

* chore: remove test_rl_config_external_rollout_mode_rejects_token_client

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

* fix: set checkpoint_ready in non-policy-update path

When enable_policy_updates is False (SFT distillation), generate_batch
skipped calling checkpoint_ready.set(). This worked by accident because
the event starts set and is only cleared inside maybe_update_policy
(which is never called in this path), but would deadlock if anything
else ever cleared the event.

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

* Address PR review feedback

- Revert loss_scale regression: use loss_mask-based scaling unconditionally
- Move setup_external_rollout_model to orchestrator/utils.py
- Clarify log message to say "SFT distillation mode"

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

* fix: truncate prompt_ids to common prefix to prevent corrupted token sequences

When tokenizing trajectory steps from messages, the prompt-only and
full (prompt+completion) tokenizations can diverge at a boundary
(non-prefix split). Previously, the full prompt_ids was returned even
when split_idx < len(prompt_ids), producing corrupted sequences where
prompt_ids + completion_ids != full_ids. This broke interleaving
(extension property checks fail on mismatched prefixes) and fed
invalid token sequences to the trainer.

Fix: use full_ids[:split_idx] as prompt_ids so the concatenation
always equals full_ids exactly.

Verified across GLM-4, Qwen3, Qwen2.5, Qwen2.5-VL tokenizers and
tested end-to-end SFT distillation on alphabet-sort, wiki-search,
tic-tac-toe, and color-codeword (VLM) environments.

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

* fix: restore non-prefix tokenization debug log after prompt_ids truncation

The previous commit truncating prompt_ids to full_ids[:split_idx] made
the debug log condition always false (split_idx < split_idx). Track the
original prompt length before overwrite so the log fires correctly.

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

---------

Co-authored-by: William Brown <williambrown97@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: will brown <willccbb@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:49:00 -07:00
68e443b833 inference entrypoint (#1898)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add SLURM scheduling support for standalone inference entrypoint

Move inference entrypoint to src/prime_rl/entrypoints/inference.py following
the SFT/RL patterns. Add opt-in [slurm] and [deployment] config sections to
InferenceConfig for submitting inference as SLURM jobs. Supports single-node
and multi-node (independent vLLM replicas per node, no cross-node parallelism).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* use single inference template

* add dry run and remove launcher fields

* correctly resolve union/annotated types

* log msg

* export urls

* switch to 0.0.0.0

* fix vllm

* move

* update changelog

* pass seed

* align with sft/rl entrypoint

* use config dir helper

* update docs and skill for inference SLURM entrypoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* add back writing config

* add comment

* Revert "add comment"

This reverts commit 1481510decd244174049e1392ca51c1b7b29b294.

* Revert "add back writing config"

This reverts commit a67e8dfe3e57f5906fee0cb6f8fd299c148ecca5.

* remove non-user facing changelog items

* fix ruff

* fix infer entrypoint

* bump pydantic_config

* multi node is 2 nodes by default

* use rev

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:25:59 -08:00
09a6875f11 migrate config system to pydantic_config (#1915)
Release / Push CUDA image to Docker (push) Canceled after 0s
* migrate config system from pydantic-settings to pydantic_config

Replace the custom pydantic-settings wrapper (BaseSettings, parse_argv,
toml_files inheritance) with the external pydantic_config library which
provides tyro-backed CLI parsing, @ syntax for TOML files, and deep merge
of configs + CLI overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update pydantic-config to fix-tyro branch and fix benchmark CLI args for tyro

- Switch dependency from refactor-tyro to fix-tyro branch (includes
  validators moved upstream)
- Simplify config.py by removing validators now in pydantic_config
- Fix benchmark script to use tyro subcommand syntax for optional
  nested configs (compile, ac, ac-offloading)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update pydantic-config to include bare flag support for Optional configs

The benchmark script's --model.compile and --model.ac bare flags now
work without changes, thanks to upstream pydantic_config handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update pydantic-config to main (includes AvoidSubcommands fix)

Fixes dict[str, Any] tyro parser errors and union subcommand issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update pydantic-config to include sub-field override fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 08:37:24 -08:00
halleriteandGitHub 7d8da4cbcc add deep_gemm as dependency for GLM5 (#1884)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-26 19:18:57 +01:00
cae5532f5d chore: consolidate config modules into prime_rl.configs (#1871)
Release / Push CUDA image to Docker (push) Canceled after 0s
* consolidate config modules into prime_rl.configs subpackage

Move all scattered config.py files (utils, trainer, rl, sft, orchestrator,
env_server, inference, transport, rl_config) into a single prime_rl.configs
subpackage for better discoverability and organization. Update all imports
across 59 files and refresh skill docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* merge shared, transport, and utility configs into configs/shared.py

Move SharedLog/Wandb/Checkpoint/Model/WeightBroadcast configs, deployment
configs, transport configs, and common utility configs (ModelConfig,
ClientConfig, LogConfig, WandbConfig, etc.) into a single configs/shared.py.
Remove configs/transport.py and configs/utils.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* rename SFTTrainerConfig -> SFTConfig, sft_trainer.py -> sft.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* move shared configs into rl configs

* move trainer configs into shared.py

Merge configs/trainer.py into configs/shared.py since these configs
(model, optimizer, scheduler, checkpoint, LoRA, SLURM, etc.) are shared
across both SFT and RL trainers. Rename ModelConfig -> TrainerModelConfig
to avoid collision with the common ModelConfig.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* move some stuff

* update configs

* clean up config naming: move trainer configs, drop component prefixes

- Rename rl_trainer.py -> trainer.py, RLTrainerConfig -> TrainerConfig
- Move shared trainer building blocks (ModelConfig, optimizers, schedulers,
  checkpointing, LoRA, etc.) from shared.py into trainer.py
- Rename TrainerModelConfig -> ModelConfig, common ModelConfig -> BaseModelConfig
- Rename TrainerCheckpointConfig -> CheckpointConfig
- Drop Orchestrator/Inference prefixes from config classes
  (OrchestratorModelConfig -> ModelConfig, InferenceModelConfig -> ModelConfig, etc.)
  since the module name provides context; use aliases in rl.py for disambiguation
- Fix OrchestratorModelConfig inheriting from training ModelConfig instead of BaseModelConfig
- Fix broadcast module imports that had mismatched class names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update changelog with config consolidation entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:28:36 -08:00
1826b18927 unify rl and sft slurm entrypoints to enable single-node slurm deployments (#1859)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fuse rl-slurm and rl

* also migrate sft slurm

* Move SLURM templates to templates/ and rename to multi_node_*

- rl_slurm.sh.j2 → templates/multi_node_rl.sh.j2
- sft_slurm.sh.j2 → templates/multi_node_sft.sh.j2
- Remove src/prime_rl/slurm/ directory entirely
- Update template path references in rl.py and sft/train.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update

* add single node template

* allow setting env vars everywhere

* fixes

* fix

* rename to .sbatch

* update scripts

* update configs

* adopt deployment and slurm config for sft

* rename slurm.template -> slurm.template_path

* style

* make inference optional again and some misc bug fixes

* update examples

* fix configs

* rewrite slurm docs for unified entrypoints and fix slurm_sft.toml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix config

* deprecate hf hub offline in sft slurm

* only HF_HUB_OFFLINE in multi_node

* tail with -F

* exclude deployment

* update changelog

* move templates

* update branch

* fix output dir

* do not allow None partition

* fix

* revert env_vars

* remove env_vars entries from changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* address bugbot

* extract sft entrypoint

* move entrypoints

* cleanup logic in sft local

* fix single node sft slurm

* fix

* fix: resolve SLURM template path relative to package for editable installs

Co-authored-by: Cursor <cursoragent@cursor.com>

* add changelog line

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-24 03:11:21 -08:00
halleriteandGitHub 5cdada6457 add directory for skills & skill for starting prime-rl's vllm server (#1747)
* add skills dir & first skill for vllm

* remove unimplemented stuff

* make symlink relative

* make separate config skill

* update AGENTS.md & skills

* make more explicit
2026-02-08 21:13:07 -08:00