2224 Commits
Author SHA1 Message Date
5e6b641574 fix(deps): bump torchtitan to 23e4dfc to fix EP grad-clip crash with empty ep_grads (#2911)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Bumps torchtitan one commit forward (a1fdd7e -> 23e4dfc) to pull in
pytorch/torchtitan#1541, which guards _clip_grad_norm_with_ep against
calling .full_tensor() on a plain Tensor when ep_grads is empty.

This crash surfaces when EP is enabled but no trainable parameter is
EP-sharded — e.g. LoRA targeting only non-expert modules, or PP+EP
setups where some PP ranks own no MoE layers — causing
get_total_norm([]) to return tensor(0.) (a non-DTensor) and the
subsequent .full_tensor() to raise AttributeError at step 0.

The diff between the two torchtitan commits is exactly this one fix
(torchtitan/distributed/utils.py, +6/-1); all other prime-rl imports
from torchtitan (ExpertParallel, expert_parallel, TOKEN_GROUP_ALIGN_SIZE_M,
generate_permute_indices) are unchanged.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
v0.6.1.dev54
2026-07-03 12:28:37 -07:00
16f5c7222b feat: make step numbers 1-indexed (policy versions stay 0-indexed) (#2896)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: 1-index step counters (policy versions stay 0-indexed)

The first trainer/orchestrator step is now step 1 (was step 0). Policy
versions remain 0-indexed, with v0 the base model. Training step x consumes
batch x and produces policy version x; orchestrator step x samples that batch
from policy v(x-1).

Checkpoints/broadcasts now follow a completed-step convention: the trainer
writes the broadcast + checkpoint at the END of each step's iteration (model
= the version just produced), the loop breaks on step == max_steps, and a
checkpoint step_S means "step S finished". Resuming from step_S continues at
step S+1 (orchestrator, trainer, and per-run progress all advance one step on
load). broadcasts/step_S holds policy vS, so the watcher derives the policy
version directly from the directory label; the broadcast label is
mm.progress[idx].step - 1 because pack() has already advanced progress.

This is a pure relabeling: the number of steps, LR schedule, data, and
off-policy/async-barrier behavior are unchanged.

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

* chore: drop CHANGELOG entry for 1-indexed steps (not a config-field change)

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

* fix: align multi-run checkpoint step label with 1-indexed convention

MultiCheckpointManager.save derived its step from mm.progress[idx].step, but
pack() has already advanced that to the next step by the end-of-loop save
point — the same off-by-one the broadcast paths needed. It mislabeled the ckpt
dir step_{S+1} (vs the orchestrator's step_S), looked for the nonexistent
broadcasts/step_{S+1} when copying weights into the ckpt, and gated _should_save
on the wrong interval boundary. Subtract 1 to use the step just finished.

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

* docs: fix misleading checkpoint comment in RL trainer loop

The "skip it here / written after the loop" note applied only to the single-run
branch; move it onto that branch and clarify the multi-run branch has no
after-loop final save.

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

* docs: trim redundant async-pipeline sentence in algorithms.md

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

* fix: keep orchestrator resume step coordinated under ckpt.skip_progress

The resume increment ran on whatever progress.step held after load, but with
ckpt.skip_progress the orchestrator's CheckpointManager doesn't restore the
counter, so `+= 1` bumped the default (→ 2) while policy.version came from
resume_step — desyncing rollouts/checkpoints/dispatch-gate from the trainer and
mm.progress (both at resume_step + 1). Derive the step from resume_step so
skip_progress only resets the totals and the step stays coordinated.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev53
2026-07-03 10:06:58 -07:00
5c0a6dbdba chore(ci): drop uv extras that aren't required from CPU unit tests to fix disk exhaustion (#2940)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore(ci): drop --all-extras from CPU unit tests to fix disk exhaustion

The CPU unit-test job ran `uv sync --all-extras --locked`, pulling the
entire dependency universe (envs, flash-attn-3, disagg, quack, gpt-oss,
modelexpress) just to run `pytest tests/unit -m "not gpu"`. That ~2-3GB
of GPU kernels and env deps (spacy, rdkit, chromadb, opencv, onnxruntime,
...) overflows the runner's root disk — the last run died extracting
triton with "No space left on device (os error 28)".

No `tests/unit` test imports any of those extras: they only use base deps
(torch, transformers, vllm, verifiers.v1) plus dev (pytest). The one test
touching flash_attn skips gracefully when it's absent. Install base + dev
only.

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

* clean up comment

* fix(ci): install flash-attn extra for CPU unit tests

Dropping --all-extras entirely broke test collection: `ring_flash_attn`
(a base dep) hard-imports `flash_attn` at module load, and `flash_attn`
is provided only by the flash-attn extra. 12 model/train tests failed to
collect with `ModuleNotFoundError: No module named 'flash_attn'`.

Add back just the flash-attn extra (a prebuilt wheel on x86_64, no build).
The disk fix holds — we still skip envs/flash-attn-3/disagg/quack/etc.,
the ~2-3GB no unit test imports.

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

* fix(ci): add envs extra for CPU unit tests config loading

test_load_configs loads every config TOML; configs referencing a v1
taskset make verifiers.v1.loaders import the taskset package by name at
runtime (scaleswe_v1, math500_v1, aime24_v1, ...), which ships via the
envs extra. Static import analysis missed this, so the prior commit's
base+flash-attn install failed 15 config-loading tests.

The run proved the disk fix and the extras audit: 454 tests passed with
only flash-attn installed, and the sole failures were envs tasksets. So
install flash-attn + envs and skip the GPU-only extras (flash-attn-3,
disagg, quack, gpt-oss, modelexpress, flash-attn-cute) no unit test uses.

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

* clean up comment

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev52
2026-07-02 23:25:39 -07:00
dbe95b799a feat: optional per-node uv sync for multi-node RL (#2926)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: optional per-node uv sync for multi-node RL

Add a SlurmConfig.per_node_venv_sync flag (default False). When enabled,
the multi-node RL sbatch runs uv sync on every node via srun (one task per
node, blocking) instead of only the batch node.

This is needed when the venv is node-local (e.g. UV_PROJECT_ENVIRONMENT on
/tmp): a single batch-node sync would leave the other nodes without a venv.
The srun task re-sources .env so uv sees the node-local UV_PROJECT_ENVIRONMENT
/ UV_CACHE_DIR even if SLURM env propagation is disabled. With set -e, a failed
sync on any node aborts the job. Default keeps the original head-only behavior
for shared (NFS) venvs.

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

* feat: rename per_node_venv_sync to shared_fs, fix .env sourcing, extend to all multi-node templates

- Rename SlurmConfig.per_node_venv_sync (default False) to SlurmConfig.shared_fs
  (default True) with inverted logic, as suggested in PR review
- Fix .env sourcing in srun command to not fail when .env is absent
  (|| true guard), matching the rest of the script
- Fix comment: re-sourcing .env is needed because unexported vars don't cross
  srun even with normal SLURM env propagation, not because propagation is disabled
- Extend shared_fs to multi_node_sft.sbatch.j2 and inference.sbatch.j2
  since the flag lives in shared.py config

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev51
2026-07-02 18:30:46 -07:00
07e6bec87a feat: log time/wait_for_policy for dispatch gate stalls (#2938)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: log time/wait_for_policy for dispatch gate stalls

The dispatch gate (`dispatch_allowed`) pauses the orchestrator when it
would run more than TARGET_LAG batches ahead of the trainer's policy
version, but that pause was invisible in metrics — the only signal was
two info log lines. When the trainer is the bottleneck this stall is
exactly what we want to quantify.

Accumulate the wall-clock the gate spends closed across pause/resume
cycles and log it as `time/wait_for_policy` alongside the other
orchestrator `time/*` metrics, resetting each shipped batch.

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

* chore: drop redundant comment on wait_for_policy state

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

* feat: add time/wait_for_policy to the W&B overview performance section

Show the orchestrator's dispatch-gate wait next to time/wait_for_batch
in the curated overview view.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev50
2026-07-02 12:49:21 -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>
v0.6.1.dev49
2026-07-02 12:39:30 -07:00
d16981b533 fix: advance progress.step before gating so dispatch lead is correct (#2937)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
`update_dispatch_gate` computed `lead = (progress.step + 1) - policy.version`
at both call sites, but `progress.step` meant different things at each: at
ship time it was still the just-shipped step (so +1 = the batch being
collected, correct), but at `on_new_version` a prior ship had already advanced
it to the collecting batch, so the +1 double-counted and overstated the lead by
one. That kept the dispatcher paused one policy version too long and could
self-sustain into a stall (a paused dispatcher can't ship the batch the trainer
needs to produce the next version).

Advance `progress.step` immediately after shipping so it always names the batch
being collected, then gate on a single `progress.step - policy.version`. The
lead is now correct at both sites and never overstated, so the gate can't
falsely stall.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev48
2026-07-02 12:36:10 -07:00
b2b4f3f711 feat: bump vLLM 0.23.0 -> 0.24.0 (#2921)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: bump vLLM 0.23.0 -> 0.24.0

Base runtime bump. Changes:
- pyproject.toml: `vllm>=0.24.0` + the x86_64/aarch64 wheel URLs to v0.24.0
  (cu129 cp38-abi3); uv.lock regenerated (vllm 0.24.0 pulls humming-kernels
  0.1.6, prometheus-fastapi-instrumentator 8.0.2, starlette 1.3.1; drops gguf).
- weight_transfer.py: 0.24 turned `FusedMoE` into a factory returning a
  `MoERunner` and split its state -- the expert map now lives on
  `MoERunner.routed_experts` (RoutedExperts) and EPLB state on
  `MoERunner.router`. `isinstance(module, FusedMoE)` would raise TypeError.
  Rewrote `build_expert_map`/`_build_expert_source_indices` to match
  `MoERunner` and read both submodules. Keying by the MoERunner name still
  prefix-matches the nested `routed_experts.*` params in load_weights_kernel.
  (Only reached on the quantize_in_weight_transfer=True path.)
- patches.py: verified all 7 monkeypatches still apply on 0.24; only a docstring
  version ref updated (is_3d_moe_weight still defaults True in 0.24).

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

* fix(inference): rebase monkey_patch_no_moe_lora onto vLLM 0.24 __post_init__

0.24 made FusedMoEConfig.intermediate_size the ctor field and
intermediate_size_per_partition a -1 sentinel that __post_init__ must compute.
The patch replaced __post_init__ with a verbatim-0.23 copy that never set it,
leaving intermediate_size_per_partition=-1 (silent corruption of every
downstream consumer) and dropping the % tp_size assert + aiter/mori/platform
guards. Mirror 0.24's body verbatim, then flip is_lora_enabled off.

Found in a second-pass audit of all 16 active monkeypatches (registered across
patches.py, orchestrator.py, server.py, worker/__init__.py); the rest KEEP.

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

* refactor(inference): drop 2 LoRA reload monkeypatches for vLLM 0.24 native load_inplace

0.24's native OpenAIServingModels.load_lora_adapter reuses the existing
lora_int_id on a same-name reload and repoints the path, and its worker
LRUCacheWorkerLoRAManager.add_adapter force-reloads when lora_request.load_inplace
is True -- exactly what monkey_patch_load_lora_adapter and
monkey_patch_LRUCacheWorkerLoRAManager reimplemented by copying upstream bodies.

Replace both with the native path plus a small mechanism in prime-rl's
/load_lora_adapter endpoint:
- set load_inplace=True on the incoming request so 0.24 doesn't reject the
  same-name reload and the worker re-reads the new weights during add_lora;
- reset the *stored* LoRARequest's load_inplace back to False afterward, because
  it is a sticky field that _maybe_get_adapters hands to every generation request
  -- left True it would force a per-scheduler-step disk reload (the perf trap the
  old _apply_adapters(force_load=False) override avoided).

The orchestrator awaits this endpoint before dispatching rollouts for the new
policy version, so the reset lands before any generation resolves the adapter.

Also refresh stale "vLLM 0.23.0" version refs in comments to 0.24.0 where the
described behavior was re-verified against the 0.24 source (minimax gate dtype,
V2-runner routing rationale, NemotronH layerwise-reload shim -- the latter's
counting path is byte-identical in 0.24, so the shim stays needed).

Requires a live LoRA weight-sync run to validate before merge: confirm the
adapter picks up fresh weights each step AND that there is no per-step reload
regression.

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

* style: ruff format (unwrap lines within 120-col limit)

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

* refactor(inference): simplify monkey_patch_no_moe_lora to wrap upstream __post_init__

The previous version copied vLLM 0.24's FusedMoEConfig.__post_init__ body
verbatim (intermediate_size_per_partition compute, ROCm/aiter/mori guards,
platform checks) just to append `is_lora_enabled = False` -- carrying a
drift-prone "keep in sync with upstream" burden plus _aiter_ops/current_platform
imports.

`is_lora_enabled` is never read inside __post_init__ (only later during kernel
selection in modular_kernel.py / oracle/unquantized.py), so flipping it after
the original runs is equivalent. Wrap the original instead: it computes
intermediate_size_per_partition and runs every guard itself, so nothing can
drift and the -1 sentinel can never leak.

Verified against the 0.24 wheel: with tp_size=2, intermediate_size_per_partition
= 128 and is_lora_enabled = False.

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

* fix(inference): reset load_inplace unconditionally in /load_lora_adapter

Previously the sticky-flag reset ran only on success, so an ErrorResponse
returned before resetting. Not triggerable on vLLM 0.24 (native load_lora_adapter
stores the adapter only after add_lora succeeds, and builds a fresh request rather
than mutating the stored one), but the correctness relied on that vLLM-internal
invariant. Reset whatever is stored for the name regardless of outcome so a
lingering load_inplace=True can never force a per-scheduler-step disk reload,
independent of vLLM internals.

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

* fix(inference): remap flat MoE kernel wire names to vLLM 0.24 routed_experts params

vLLM 0.24 nests FusedMoE expert weights under MoERunner.routed_experts
(...experts.routed_experts.w13_weight), while the trainer's
convert_layer_to_vllm_kernel still emits the pre-0.24 flat names
(...experts.w13_weight). load_weights_kernel's 'name not in params' gate
fired before the expert-map prefix match, so the first fp8 kernel weight
update raised 'Kernel weight transfer skipped N weights not found in
model'. Wrap the incoming stream with upstream's remap_moe_expert_weights,
the compat shim vLLM ships for exactly this transition (covers w13/w2
weights and their _scale_inv variants; leaves gate/shared_experts names
untouched).

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

* chore(inference): drop NemotronH mixer.D reload shim, fixed upstream in 0.24

vllm-project/vllm#44814 did land in the pinned 0.24.0 release - in
reload/meta.py, which caps copied_numel at param.numel() to fix the
composed_weight_loader double-count that finalized layers early and
dropped Mamba mixer.D. The earlier audit diffed mamba_mixer2.py and
reload/layerwise.py (byte-identical) and missed it. The capture/restore
shim is now dead weight on every non-quantized weight update; remove it.

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

* fix(inference): LoRA/MoE patch hygiene for vLLM 0.24

- Drop monkey_patch_skip_lora_module_warnings: the per-module regex
  warning loop it skipped was removed upstream before 0.23, so it was a
  pure drift-carrier - its _load_adapter copy silently dropped 0.24's
  moe_ep_spec= passthrough (EP read-time expert filtering) and the
  lora.is_3d_lora_weight stamp (needed for enable_mixed_moe_lora_format).
  Stock _load_adapter now runs in workers.
- Re-derive _patch_lora_key_prefix's from_local_checkpoint copy from the
  0.24 original so the stock caller's moe_ep_spec= kwarg is accepted;
  keeps only the real payload (accept bare-suffix OR qualified expert
  module names) and picks up the EP remote-expert pruning + tensorizer
  hardening. Docstring rewritten: vllm#38522 was closed unmerged and the
  base_model.model. prefix case is handled upstream.
- Drop the MiniMax M2 forward patch: the MoERunner already all-reduces
  internally (_maybe_reduce_final_output), so the patched forward's extra
  tensor_model_parallel_all_reduce doubled the MoE output at TP>1.
  Upstream's forward needs no changes; the gate rebuild + hf_to_vllm
  mapper stay.
- Remove the dead transformers-v5 tie_word_embeddings shim (class attr
  exists on the pinned transformers, guard never fired) and refresh stale
  comments: DP coordinator upstream timeout is 120s not 30s; 0.24 routes
  MoE archs (DeepseekV2/Qwen2Moe/GraniteMoe) to the V2 runner by default
  too, making the forced V1 more load-bearing.

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

* chore(inference): rename transformers_v5_compat to apply_shared_vllm_patches

The function is the vllm.general_plugins entry point dispatching the six
patches that must run in every vLLM process; the transformers-v5 shim it
was named for was removed. Entry-point target updated in pyproject.toml
(vLLM swallows plugin load failures, so a stale target would silently
skip all patches - uv run re-syncs metadata automatically).

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

* fix(inference): restore 0.23 parser semantics + guard new 0.24 request validation

vLLM 0.24 behavior changes outside this branch's original diff surface:

- qwen3_coder (parser engine) now full-strips every tool parameter value where
  0.23 trimmed exactly one leading/trailing newline, corrupting
  whitespace-significant args (str_replace old_str/new_str, indented file
  content). Restore single-newline trim via monkey_patch_qwen3_coder_param_newline_trim
  (also covers nemotron_v3, which reuses qwen3_config).
- minimax_m2's engine swallows the literal </think> in CONTENT state and strips
  content on tool turns, breaking minimax_m2_append_think round-tripping. Drop
  the (CONTENT, THINK_END) transition and disable the strip.
- VLLM_ENFORCE_STRICT_TOOL_CALLING default flipped to True in 0.24: structural-tag
  constrained decoding for required/named/strict tools would sample a distribution
  the trainer never sees. Default it off in setup_vllm_env.
- 0.24 rejects temperature > 2.0 at request validation; mirror the bound in
  TrainSamplingConfig/EvalSamplingConfig so misconfigured sweeps fail at config
  load, not per-rollout with HTTP 400s.
- Fix stale 30s -> 120s DP-coordinator timeout comment.

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

* test(inference): cover plugin entry-point load, MoE kernel remap, MoE mismatch KL

CI could not see three load-bearing paths of the 0.24 bump:

- vLLM swallows vllm.general_plugins load failures, so a stale/misnamed entry
  point (renamed on this branch) silently drops every shared patch; load it
  exactly like vLLM does and assert the padded-input scrub applied.
- The MoERunner weight-sync rewrite (flat trainer names -> nested
  routed_experts params via remap_moe_expert_weights, expert-map prefix
  slicing) is only reachable via NCCL broadcast, which no CI config uses;
  exercise load_weights_kernel directly on a fake module tree.
- reverse_text_moe asserted exit code only; add a trainer/inference mismatch-KL
  bound so silent MoE weight corruption fails the job.

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

* chore: address review — drop test additions and comment flourishes

Per review: remove the plugin entry-point test, the weight-transfer kernel
unit tests, and the reverse_text_moe mismatch-KL addition; trim the vLLM-0.24
references from the temperature docstrings (the le=2.0 bound stays).

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: fares <fares@primeintellect.ai>
v0.6.1.dev47
2026-07-02 20:25:56 +01:00
50aeb3c7d6 chore(deps): bump research-environments + wire s1-deepresearch-v1/arxivmath-v1 (#2934)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore(deps): add s1-deepresearch-v1 + arxivmath-v1 environments to pyproject.toml + uv.lock

Bumps the research-environments pin to pick up the two new
bring-your-own-search v1 tasksets:

- s1-deepresearch-v1: ScienceOne-AI/S1-DeepResearch-15k closed-ended
  deep-research QA (6000 verifiable tasks, en/zh filter), binary semantic
  LLM judge.
- arxivmath-v1: MathArena/arxivmath-training research-level math
  (2605 tasks), in-runtime math-verify scoring of the boxed answer.

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

* chore(deps): bump research-environments for trace.last_reply scoring fix

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

* chore(deps): bump research-environments to merge with upstream main

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

* chore(deps): relock for research-environments verifiers pin bumps

The submodule merge brought main's env pyproject updates (verifiers pins
unified to >=0.1.15.dev411), which uv.lock records as requires-dist metadata.

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

* chore(deps): bump research-environments to merged main (s1-deepresearch/arxivmath #630)

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

---------

Co-authored-by: fares <fares@primeintellect.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
v0.6.1.dev46
2026-07-02 20:24:16 +01:00
4beb553525 feat: default per-env ratio to 1, drop natural-distribution mode (#2935)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Env sampling weight (`ratio`) now defaults to 1 (equal weight per env)
and no longer accepts unset/None. The None-for-all-envs mode that
sampled proportional to each env's dataset size is removed, along with
the all-or-none constraint — any subset of envs may set `ratio`, the
rest default to 1.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev45
2026-07-02 09:50:56 -07:00
halleriteandGitHub 51dc60a895 chore: dead-code sweep across trainer, orchestrator, utils, and configs (#2932)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev44
2026-07-02 09:49:14 +02:00
halleriteandGitHub a8f090b444 chore: delete dead get_adapter_state_dict from trainer/weights.py (#2929)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev43
2026-07-02 03:51:09 +02:00
halleriteandGitHub cdea189e3d chore(configs): remove dead max_retries knob from Env/Train/EvalConfig (#2930)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev42
2026-07-02 03:50:54 +02:00
halleriteandGitHub d5f218f708 chore(configs): remove empty *ExperimentalConfig placeholders (#2931)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev41
2026-07-02 03:14:56 +02:00
halleriteandGitHub a03c70f55b chore: delete dead utils/tensor_hashing.py (#2928)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev40
2026-07-02 02:21:33 +02:00
e48a53853e fix: weight-sync hardening + dead-code / get_max_layer_num cleanup (#2922)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix: correct weight-broadcast validation + prefix-cache docs

- validate_shared_weight_broadcast: the chained comparison
  `trainer.type != orchestrator.type != inference.type` only compared
  adjacent pairs, so a mismatched inference weight_broadcast type
  (e.g. trainer/orchestrator=nccl, inference=filesystem) passed validation
  silently. Check trainer vs orchestrator, then inference vs both.
- update_weights / load_lora_adapter docstrings claimed the server resets
  the prefix cache on weight update; it doesn't — the orchestrator salts
  the prefix cache per weight version (cache_salt, see orchestrator/envs.py).
  Fix the docs and drop the dead reset_prefix_cache_after_update state flag
  (set but never read).
- heartbeat: docstring said "2s timeout"; the request uses timeout=1.

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

* chore: remove dead code in trainer/utils

Grep-verified as unused across src/:
- qwen3_moe: load_balancing_loss_func (aux-loss-free routing is used instead)
- rl/loss.py: shift_logits
- perf.py: _count_trainable_params
- kernels/fp8_utils.py: align()
- kernels/fp8_indexer.py: dead `_weight_scale = weight_scale` assignment
  (kernel intentionally ignores weight_scale, per its NOTE)
- layers/moe.py: leftover commented-out forward variant
- utils/utils.py: capitalize, to_row_format, mean_normalize
- broadcast/nccl.py: import NCCL_READY_MARKER from utils.client instead of
  redefining the same constant

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

* refactor: consolidate get_max_layer_num into trainer/weights

Seven converting_*.py modules each defined their own get_max_layer_num —
six as a fragile `int(key.split(".")[2])` one-liner and afmoe as a regex
variant that returned the max index (its callers compensated with
`range(max_layer + 1)`). Replace all seven with the canonical, robust
implementation in trainer/weights.py (handles an arbitrary layer_prefix,
guards non-digit segments, already used by the NCCL broadcaster).

- afmoe: the canonical returns a count (max+1), so its two callers switch
  from `range(max_layer + 1)` to `range(num_layers)` — behavior-identical.
- No import cycle: weights.py imports neither trainer.models nor the
  converting modules.

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

* refactor: centralize flash-attn varlen import guard

afmoe and qwen3_5_moe each re-declared the identical three-way
try/except import guard for flash_attn_varlen_func / _3_ / _4_ that
already exists in trainer/models/layers/attn.py. Import the (None-able)
module-level names from attn.py instead; each model's `_funcs` dispatch
table is unchanged.

Note: their attention classes are genuinely model-specific (gated output,
local/global split, MRoPE, GatedDeltaNet), so they legitimately do NOT
subclass the shared FlashAttention — only the optional-dependency import
guard was duplicated.

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

* fix: break circular import from get_max_layer_num consolidation

The consolidation made the converting_*.py modules import trainer/weights.py,
but weights.py imports trainer/lora.py, which (via trainer/models/__init__)
imports the model modules and their converting_*.py — closing a cycle:

  lora -> models/__init__ -> afmoe/modeling -> converting_afmoe
    -> weights -> lora (partially initialized) -> ImportError

Move get_max_layer_num into a dependency-free leaf module
trainer/conversion_utils.py (imports only torch) and point the seven
converting modules + the NCCL broadcaster at it. weights.py no longer
defines it (it never used it internally). Keeps the single-source dedup
without the cycle.

Caught by the reverse_text integration tests (trainer crashed at import).

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: faresobeid <111092724+faresobeid@users.noreply.github.com>
v0.6.1.dev39
2026-07-01 19:12:57 +01:00
f3c85a947a exp: update swe ablation (#2925)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* exp: add glm45air scaleswe length-penalty ablation config

Length-penalty variant of configs/debug/v1/glm45air_scaleswe.toml: enables the
GRPO linear length penalty with output-token, input-token, and turns coefficients
all set to 0.1, using the current [orchestrator.algo.length_penalty] schema on main.
Distinct -lp SLURM job name, wandb run name, and prime sandbox labels.

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

* exp: move scaleswe length-penalty config to configs/glm45air/swe.toml

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

* exp: move glm45air scaleswe config to configs/glm45air/swe.toml, use rlm harness

Promote configs/debug/v1/glm45air_scaleswe.toml to configs/glm45air/swe.toml as a
move + update: switch the train and eval harness from default to rlm, enable the
GRPO linear length penalty (all coefs 0.1), and drop the -lp suffix from the SLURM
job name and prime sandbox labels (labels can't reference $SLURM_JOB_NAME — that
field is passed verbatim to the sandbox API — so the literal must match the job name
that the pre-launch cleanup deletes by).

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

* exp: drop -lp from wandb run name

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev38
2026-07-01 10:53:58 -07:00
f19ba721a9 chore(configs): bump dist_timeout_seconds default to 3600 (#2924)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The 600s default torch/NCCL distributed timeout was too tight for
large multi-node runs — startup collectives (step-0 evals, slow first
SWE batches) tripped the watchdog and SIGABRT'd the trainer. Bump the
default to 3600s for both RL and SFT trainer configs.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev37
2026-07-01 10:23:35 -07:00
fd5db5df6a chore(deps): add longpdfs-v1 environment to pyproject.toml + uv.lock (#2920)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The longpdfs-v1 environment was added to research-environments main
(commit f1bdab50f, PR #542) but was missing from this PR's pyproject.toml.

- Add longpdfs-v1 to envs optional dependencies and [tool.uv.sources]
- Add longpdfs-v1 package entry to uv.lock

Co-authored-by: Sami Jaghouar <sami@primeintellect.ai>
v0.6.1.dev36
2026-07-01 10:16:22 -07:00
halleriteandGitHub 7b7c7efdfa chore(configs): migrate v1 harness ids for the verifiers null/default rename (#2919)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev35
2026-07-01 06:38:52 +02:00
2e2accb121 fix(deps): enable verifiers[harbor] extra so swebench-verified eval loads (#2917)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The `swebench-verified-v1` (and other Harbor) tasksets require the Harbor
CLI, shipped via the `harbor` extra of the `verifiers` package. The root
project depended on plain `verifiers`, and `uv sync --all-extras` only
enables the root project's own extras (not a dependency's), so `harbor`
was never installed — the eval env-pool worker crashed in `load_tasks()`
with `RuntimeError: Harbor tasksets require the Harbor CLI`.

Switch the root dep to `verifiers[harbor]` so `harbor==0.14.0` is pulled
in (and lands on SLURM compute nodes via the sbatch `uv sync --all-extras`).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev34
2026-06-30 12:34:51 -07:00
436873190d fix: schedule tail eval rollouts before draining at max_steps (#2913)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix(dispatcher): wait for partly-scheduled eval groups before reporting idle

is_idle only checked the eval_source queue, but an eval example leaves the queue when its group
opens (next_fresh_group) while its group_size rollouts dispatch one at a time across fill_inflight
passes. In the window where the queue is empty, an eval group still has rollouts_to_schedule > 0,
and inflight/out_q are momentarily empty, is_idle wrongly reported drained — main_loop exits, the
tail eval rollouts are never scheduled, the eval batch never completes, and the eval point is
dropped. This hits hardest at max_steps, where the final eval triggers just as the train side is
cancelled.

Factor the eval-has-work predicate (queue OR any pending eval group) into a shared
RolloutDispatcher.eval_has_work property used by both is_idle and fill_inflight so they can't drift.

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

* test: drop dispatcher unit test — verify the tail-eval fix via e2e instead

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev33
2026-06-30 11:06:17 -07:00
f0c339a234 [ENG-4306] fix(docker): repair CUDA image build broken by uv 0.11.25 centralized project envs (#2906)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix(docker): pin uv project env to /app/.venv

uv's centralized/cached project environments (a preview feature as of uv
0.11.25, and a likely future default) make `uv sync` build the env in the
uv cache and leave `.venv` as a symlink into it. The runtime stage ships the
env via `COPY --from=builder /app /app`, which can't follow that symlink (the
cache store lives outside /app), so the venv goes missing and the build fails
at the `bin/python` relink.

Setting UV_PROJECT_ENVIRONMENT=/app/.venv forces uv to materialize a real
in-project venv directory regardless of that behavior, so the cross-stage copy
keeps working even if/when the feature graduates from preview to the default.

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

* fix(uv): drop vestigial `preview = true`

This flag was added in #1772 solely to silence a `uv run` warning on an
older uv (~Feb 2026). That warning no longer fires on uv >= 0.11.9 (verified
with and without preview on `uv run` and `uv lock`), so the opt-in is dead
weight.

It is not harmless dead weight: `preview = true` enables uv's *entire*
experimental feature surface, including features added in future releases.
uv 0.11.25 shipped the `centralized-project-envs` preview feature, which the
global opt-in silently activated — relocating the project env into the uv
cache and leaving `.venv` as a symlink into it. The Docker image build COPYs
only `/app`, so that symlink dangled in the runtime stage and the venv went
missing (`rm /app/.venv/bin/python` failed). Dropping the flag removes the
root enabler of that class of breakage.

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

* use system python intepreter and remove the re-linking steps

* clean up comments

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev32
2026-06-30 10:32:15 -07:00
9f425fffcb feat(metrics): unify train/eval rollout metrics over the all/effective matrix (#2907)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(metrics): unify train/eval rollout metrics over the all/effective matrix

Closes #2903.

Replace the two divergent rollout-metric paths — the pandas-heavy MetricsBuilder
(train) and the hand-rolled EvalBatchMetrics.to_wandb_dict (eval) — with one shared,
pandas-free, unit-tested function `compute_rollout_metrics`, logged over the matrix:

    {train,eval} / {agg,<env>} / {all,effective} / <metric> / <stat>

- `all` = every rollout that came back (errored + filtered included); `effective` =
  its non-errored, non-filtered subset (~ what actually trained). The gap between them
  is the filtering/error cost, now directly comparable per metric.
- Train retains the full arrival window (TrainSink.arrivals_window → TrainBatch.all_rollouts)
  so an `all` set exists; eval already kept its full cohort.
- All metrics apply to both train and eval except pass@k / pass^k (eval-only; pass^k is
  new) and the filter-pipeline rates (train-only — eval has no filters).
- Drop pandas from this path; aggregation is plain Python (flat means/max/min/rates,
  group-by only for solve rates).

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

* refactor(metrics): rename token metrics to num_*_tokens, drop no_response, top-level is_filtered

- seq_len / prompt_len / completion_len -> num_total_tokens / num_input_tokens /
  num_output_tokens, matching the renamed vf.Trace properties
- remove the no_response metric
- log is_filtered as a top-level rollout metric (was filters/is_filtered); per-filter
  detection rates stay under filters/<name>

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

* feat(metrics): add full timing phases, reward components, is_completed

- timing: add setup + finalize spans; timing/total now sums all four phases
  (setup + generation + finalize + scoring) instead of just generation + scoring
- rewards/<name>: per-reward-component breakdown (mirrors metrics/<name>)
- is_completed/mean: a finished-on-its-own-terms rate alongside is_truncated

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

* refactor(metrics): rename effective_batch_size -> solved_some

Names the mixed-reward-group rate consistently with its solve_none / solve_all siblings.

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

* refactor(metrics): solve_none/solve_all -> solved_none/solved_all

Consistent solved_none / solved_some / solved_all trio.

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

* feat(metrics): log eval reward as avg@<k> instead of reward/mean

Eval reports the mean reward under the conventional avg@<group_size> key (a single value via
the new reward_label arg); train keeps the reward mean/max/min distribution. Same value,
eval-friendly name.

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

* refactor(metrics): split into compute_train_metrics / compute_eval_metrics over a shared core

Replace the single flag-driven compute_rollout_metrics with two functions sharing
_common_metrics: train adds the reward distribution + filter-pipeline rates; eval adds the
avg@<k> score + pass@k/pass^k. Drops the include_filters / include_pass_at_k / reward_label
flags and the train/eval branching from the call sites.

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

* refactor(metrics): rename error_rate -> has_error/mean

Consistent with the other per-rollout boolean rates (is_truncated/mean, is_completed/mean).

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

* refactor(metrics): move rollout_metrics.py back into metrics.py

Reclaim the conventional module name vacated by the old MetricsBuilder. Rename the source +
test (rollout_metrics.py -> metrics.py, test_rollout_metrics.py -> test_metrics.py) and fix
the stale compute_rollout_metrics doc references left from the train/eval split.

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

* feat(metrics): rename progress/{samples,problems} -> progress/{rollouts,tasks}

Also the cumulative keys: progress/total_samples -> progress/total_rollouts,
progress/total_problems -> progress/total_tasks. Metric-key renames only; the internal
Progress counter fields are unchanged (they're pickled in the orchestrator checkpoint).

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

* refactor(types): TrainBatch.rollouts = all rollouts + .effective view (symmetric with EvalBatch)

TrainBatch.rollouts now holds the full arrival window (errored + filtered included), matching
EvalBatch.rollouts. Both expose an `effective` property — the non-errored, non-filtered subset
as a view (references, not copies), so each expensive trace is retained once. Drops the separate
TrainBatch.all_rollouts field.

Consumers repointed: metrics over rollouts (all) + effective; sample/distribution logging and the
success-line quality metrics over effective; disk/progress/efficiency over rollouts (all).

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

* refactor(metrics): inline the dist spec list; make helpers public (dist_stats, rate, common_metrics)

Drop the _DIST_SPECS (name, getter) table — the five distributional metrics are emitted inline
in common_metrics. Rename the module helpers to clearer public names: _dist -> dist_stats,
_rate -> rate, _common_metrics -> common_metrics.

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

* refactor(metrics): drop redundant TrainBatchMetrics fields derivable from batch.rollouts

With TrainBatch.rollouts holding the full arrival window, several aggregates are redundant:
- arrivals_by_env / errors_by_env — per-env arrival/error counts = grouping batch.rollouts
  (and errored ones) by env; derive them in log_train_batch instead.
- samples_shipped — equalled len(batch.samples) and had no consumers.

The sink no longer tracks the per-env counters. Kept n_trainable (shipped non-filtered count,
feeds the empty-batch guard) and num_prefill/decode_tokens (cohort totals including filtered
rollouts, so not a sum over samples).

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

* refactor(metrics): rollout-container API (TrainRollouts/EvalRollouts with .metrics, .effective)

Replace the functional compute_train/eval_metrics with list-like rollout containers:
- TrainRollouts / EvalRollouts own the rollouts (append/__len__/__iter__), expose .effective
  (clean subset, same container type — a view), .by_env (train), and .metrics.
- TrainMetrics / EvalMetrics (over RolloutMetrics) expose each distributional/rate metric as a
  Stat (rollouts.metrics.num_input_tokens.mean()) and build the full {prefix}/{subset}/... dict
  via .to_wandb(); special metrics (solve rates, stop_condition, pass@k, custom/<name>) are methods.
- TrainBatch.rollouts / EvalBatch.rollouts are now these containers; TrainBatchMetrics is dropped
  (n_trainable + prefill/decode token totals are fields on TrainBatch).

solve_rates uses each group's actual size as the full-solve threshold (config-free metrics).

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

* refactor(metrics): derive trainable count + token totals, slim TrainBatch to {rollouts, samples}

- Add Rollout.is_trainable (a nonzero advantage on some token ⇒ carries gradient) and a
  train-only is_trainable/mean metric; the trainable count is now derived from the rollouts,
  not carried as TrainBatch.n_trainable.
- Drop TrainBatch.{n_trainable, num_prefill_tokens, num_decode_tokens}: prefill/decode totals
  derive from batch.samples (the shipped payload — excludes filtered rollouts, so the usage
  reporter no longer over-counts), and the empty-batch guard keys on `not batch.samples` (the
  precise "nothing shipped to the trainer" stall signal) instead of a zero count.
- Rename TrainSink.arrivals_window → pending_rollouts (matches pending_batch / pending_groups).
- Compute num_tokens / rollout / unique-example counts once in finalize_train_batch (were
  computed twice).

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

* refactor(metrics): nest timing as a sub-metric (metrics.timing.setup.mean())

Collapse the five flat timing_* Stat properties into a TimingMetrics sub-object reached via
metrics.timing, so per-phase durations read as metrics.timing.setup.mean() / .total.mean().
wandb keys (timing/<phase>/<stat>, timing/total/<stat>) are unchanged.

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

* fix(metrics): solved_all counts only reward==1.0 groups

Restore the binary "fully solved" semantics: a group is solved_all when every rollout scored
exactly 1.0 (was: every rollout had a nonzero reward, which over-reported solved_all for
continuous / partial-credit rewards). Config-free (no env group_size lookup); unspecified for
non-binary reward ranges.

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

* refactor(metrics): derive prefill/decode tokens from effective rollouts, not samples

progress/prefill_tokens, progress/decode_tokens, and the training usage report now sum the
effective rollouts' Trace.num_input_tokens / num_output_tokens (the shipped subset — its
branches are exactly what `samples` concatenates) instead of summing masks over batch.samples.
No metric is computed over `samples` anymore. progress/tokens stays over the full window.

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

* refactor(orchestrator): build the eval success line from the metrics API

Replace the hand-rolled reward/turns/truncation/error/branches sums in finalize_eval_batch with
effective.metrics / rollouts.metrics Stat accessors. Stat.mean() returns 0.0 for an empty set,
so this also drops the per-field empty guards (and fixes a latent ZeroDivisionError on the
branches mean for an empty cohort).

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

* refactor: move compute_pass_metrics into orchestrator/utils.py, drop eval_utils.py

compute_pass_metrics was the only thing in eval_utils.py; fold it into the existing
orchestrator/utils.py and delete the one-function module.

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

* refactor(orchestrator): name token totals input/output (vf v1 convention)

Rename the per-step token breakdown from prefill/decode to input/output to match the vf v1
Trace token naming used across the metric matrix: progress/input_tokens, progress/output_tokens,
and the usage report sum r.num_input_tokens / r.num_output_tokens over the effective subset
(the same props the matrix reports), rather than deriving a prefill/decode split.

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

* refactor(metrics): add p10/p90 stats, derive eval group size, inline timing phases

- Stat gains p10/p90 (linear-interpolated percentiles); to_dict now emits mean/max/min/p10/p90.
- EvalMetrics derives the avg@<k> group size from the rollouts (largest group) instead of
  carrying a passed int, so EvalRollouts no longer needs a group_size argument — everything is
  derived from the rollout list.
- Drop the TimingMetrics._phase helper; inline the per-phase Stat into each phase property.

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

* refactor(metrics): generic StatGroup for timing/metrics/rewards; drop quoted forward refs

- Extract a StatGroup base (named Stats → {prefix}/<name>/<stat> via to_dict, group[name] access);
  TimingMetrics (fixed phases) and a new CustomMetrics (dynamic per-rollout dict keys) both subclass
  it. metrics.metrics / metrics.rewards are now nested StatGroups (like metrics.timing), replacing
  the shared custom(attr) helper.
- Drop the string-quoted forward refs (list["Rollout"], Iterator["Rollout"], "TrainRollouts", …) —
  the module already has `from __future__ import annotations`, so the annotations resolve unquoted.

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

* refactor(orchestrator): build the train success line from the rollout container

Drop the hand-rolled arrivals_by_env / errors_by_env dicts and per-env quality sums in
log_train_batch; derive everything from batch.rollouts (.metrics for the aggregate error rate,
.effective.metrics for quality, .by_env() for the per-env lines). Same output, no manual aggregation.

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

* refactor(metrics): trim tests; drop dead EvalRollouts.append + batch_share manual dict

- Tests: fold the fluent-access test into the to_wandb test, merge the two boolean-rate tests and
  the two train-only-metric tests, add a train_wandb() helper, drop the unused has_response field
  from the rollout fake. Same coverage, 222→184 lines.
- Remove EvalRollouts.append (eval wraps a finished list, never appends — unlike TrainRollouts).
- finalize_train_batch: build the per-env batch/<env> shares from rollouts.by_env() instead of a
  hand-rolled env-count dict (same as the log_train_batch cleanup).

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

* feat(metrics): error-type breakdown by count; fix eval avg@k key split; small cleanups

- Add an error/<type> breakdown (counts of errored rollouts by Trace error type, e.g. Cancelled /
  ProviderError), emitted on the `all` subset alongside has_error/mean (mirrors stop_condition's
  per-key breakdown, but by count to match the old cancelled_count/errored_count).
- Fix eval avg@<k>: derive the group size once from the full epoch in EvalRollouts and carry it onto
  .effective, so `all` and `effective` share one stable avg@<k> key (was derived per-subset, so an
  eval error could split it into avg@4 vs avg@3).
- Drop the dead is_filtered clause from EvalRollouts.effective (eval never filters); bind effective
  once in log_train_batch.

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

* fix(train_sink): preserve the rollout window across empty (no-ship) batches

process_batch reset pending_rollouts unconditionally, but the orchestrator drops an empty batch
(no samples) without logging it — so that window's metrics/record were lost and any overflow left
in pending_batch shipped a later step unattributed. Reset the window only when the batch ships, so
a no-ship batch's arrivals (and overflow) carry into the next shipped batch's window.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev31
2026-06-29 22:15:11 -07:00
16efd8afda feat(algo): linear length penalty (completion + context + turns) for GRPO (#2901)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(algo): linear length penalty (completion + context + turns) for GRPO

Port the length-penalty-context-turns branch onto current main's algorithm
abstraction as a new `linear` LengthPenaltyConfig variant. It subtracts a single
pass_rate-scaled penalty from each reward before the GRPO baseline: coef *
completion tokens + context_coef * non-completion (context) tokens over the
group's longest sequence, plus turns_coef * turns over the group's most turns —
each normalized by the group's own max, optionally gated to correct rollouts.

context_coef and turns_coef default to 0.1 (completion coef 0.25).

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

* feat(algo): make linear the only length penalty (remove tokens/turns)

Per review, the linear penalty replaces the existing efficiency-shaping
length penalties rather than coexisting with them:
- Remove TokensLengthPenaltyConfig / TurnsLengthPenaltyConfig; LengthPenaltyConfig
  is now just LinearLengthPenaltyConfig.
- Simplify GRPOAlgorithm.score_group to None vs linear.
- Remove the now-orphaned efficiency_shaping (delete algo/advantage.py) and its
  references in algo/__init__ and docs.
- Rewrite test_advantage.py: drop the efficiency_shaping / tokens / turns cases,
  add linear-penalty tests (completion / context / turns terms, gating, and the
  equal-length reduce-to-plain-GRPO invariant).

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

* refactor(algo): drop gate_by_correctness; compute turns term unconditionally

- Remove the gate_by_correctness option from the linear length penalty.
- Always add the turns term (it contributes 0 when turns_coef=0); drops the
  asymmetric guard so all three terms are handled uniformly.
- Remove the gating unit test.

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

* refactor(algo): rename linear length-penalty fields + per-term-max normalization

- Rename GRPOAlgoConfig.length_penalty -> length_pen; lp -> length_pen in grpo.
- Rename coef/context_coef/turns_coef -> completion_pen/input_pen/turns_pen.
- Normalize each term by its own group max: completion / max completion,
  input (= total - completion) / max input, turns / max turns (previously the
  completion and input terms shared the max-total denominator).
- Drop the explanatory comments in score_group; fix stale field/doc text.

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

* refactor(algo): rename input_tokens -> input for naming consistency

Matches the other bare locals (completion, total, turns).

* docs(changelog): note length_pen rename + tokens/turns removal

* chore: adopt consolidated num_ trace token properties + rename length penalty config (#2905)

* fix(template): orchestrator URLs use canonical model.client path (#2899)

The multinode RL sbatch template launched the orchestrator with
--student.client.{base-url,admin-base-url}, but OrchestratorConfig has no
`student` field — the canonical path is `model.client` (base_url /
admin_base_url on ClientConfig). The orchestrator-config rename left the
template stale, so every multi-node RL launch fails config parsing with
"Unrecognized arguments: <inference URLs>".

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

* fix: correct env log glob to logs/envs/<split>/<env>.log (#2898)

* fix: correct env log glob to logs/envs/<split>/<env>.log

Since the nano-as-v1 migration each env writes a single
logs/envs/{train,eval}/<env>.log file (two levels), but the launch
banner still printed three-level globs (logs/envs/*/*/*.log), which
match nothing. Fix the banner generator and the captured example
outputs.

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

* docs: drop captured launch-banner output from example READMEs

The "Output of the command" blocks duplicated the live launch banner
(now fixed in pathing.py) and drift out of sync. Remove them; the run
command stays.

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: configurable env vars (#2863)

* feat(env): consolidate component env vars

Add shared env var defaults and per-component env_vars plumbing across RL, SFT, and inference launch paths.

Update launcher filtering, SLURM templates, examples, and docs to match the consolidated env config surface.

* feat: add rl-wide env vars (#2897)

---------

Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>

* Update configs for renderer thinking retention (#2900)

* chore: migrate to consolidated Trace/Branch num_ token properties

Bump deps/verifiers to the property consolidation (verifiers #1894) and
rename every prime-rl access of the renamed Trace/Branch properties:

  completion_len / output_len -> num_output_tokens
  prompt_len                  -> num_input_tokens
  rollout total_tokens        -> num_total_tokens

progress.total_tokens, Usage.total_tokens and RunStats.total_tokens are
unrelated and left unchanged; num_turns is unchanged upstream.

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

* chore: rename length penalty config to num_*_tokens_weight + num_turns_weight

Align the linear length-penalty config (from #2901) with the consolidated
num_-prefixed trace property names:

  [orchestrator.algo.length_pen]  -> [orchestrator.algo.length_penalty]
  completion_pen                  -> num_output_tokens_weight
  input_pen                       -> num_input_tokens_weight
  turns_pen                       -> num_turns_weight

Updates grpo.score_group, the config class, docs, CHANGELOG, and tests.

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

* chore: bump verifiers + research-environments to main (#2904)

* 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>

* chore: re-pin deps/verifiers to merged verifiers main (#1894)

The Trace/Branch num_ consolidation landed on verifiers main; point the
submodule at the merge commit instead of the temporary cherry-pick pin.

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

* chore: require verifiers >=0.1.15.dev405 (Trace/Branch num_ consolidation)

The submodule is pinned at the consolidation commit (0.1.15.dev405); raise
the floor so the renamed Trace/Branch token properties are guaranteed.

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

---------

Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Co-authored-by: eligotts <78387377+eligotts@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Co-authored-by: eligotts <78387377+eligotts@users.noreply.github.com>
v0.6.1.dev30
2026-06-29 14:41:49 -07:00
7d5f2d74a6 exp: scaleswe ablation (#2862)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(v1): GLM-4.5-Air scaleswe SWE ablation config (router replay)

v1 RL config: GLM-4.5-Air (zai-org/GLM-4.5-Air, 100B MoE) on scaleswe-v1 (train)
+ swebench-verified (eval), bash harness on prime sandboxes. Router replay on
(trainer.enable_router_replay + inference.enable_return_routed_experts).

2 train + 2 infer nodes. Trainer: cp=8 ulysses, muon, + GLM-5.1 prod-run memory
improvements (LM-head chunking, AC + activation offload, optimizer CPU offload,
skip-gather/skip-optimizer ckpt). Inference: 2x tp=8 replicas, NO expert
parallelism (inference EP + router-replay capture deadlocked the engine via
cross-node EP all-to-all). Renderer/parsers auto-resolve from the official slug.

Relies on fixes already in main: the glm4_moe routed_experts .contiguous() slice
(torch.compile stride assert) and the verifiers always-install-uv bootstrap.

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

* fix(slurm): VLLM_CACHE_ROOT=/tmp in multi_node_rl template

vLLM's compile cache defaulted to NFS (~/.cache/vllm), which hung inference
startup on slow shared FS. Point it at node-local /tmp (matching inference.sbatch.j2).

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

* feat(swe-abl): online fp8 inference + 384 rollout concurrency for glm45air

Inference runs vLLM online fp8 quant (vllm_extra={quantization="fp8"}) over the
bf16 policy for faster generation; trainer/inference/orchestrator all use the
bf16 zai-org/GLM-4.5-Air. The per-channel GLM-4.5-Air-FP8 checkpoint is
incompatible with prime-rl's block-wise fp8 path (use_deep_gemm /
quantize_in_weight_transfer), so we use online quant instead. max_inflight_rollouts=384.

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

* feat(swe-abl): glm45air-scaleswe -lp variant (default length penalty)

Sibling of glm45air_scaleswe.toml with orchestrator.advantage.length_penalty
enabled at defaults (coef=0.25, gate_by_correctness=false). Distinct slurm
job_name + sandbox labels (glm45air-swe-lp) so it runs alongside the no-penalty
run without sharing prime sandboxes.

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

* fix(swe-abl): bump weight_broadcast timeout to 3600s for cold NFS loads

Cold-cache nodes read the 206GB bf16 model from NFS at ~50s/shard (~46min
total). The weight-broadcast store rendezvous default (1200s/20min) times out
before inference finishes loading (DistStoreError: 1/17 clients joined), killing
the trainer. 3600s covers the cold-load worst case with margin. Applied to both
the base and -lp ablation configs.

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

* exp(glm45air-scaleswe): kv-offload + fp8, drop router replay, bash_edit

- Drop router replay (trainer.enable_router_replay + inference.enable_return_routed_experts):
  mutually exclusive with inference.kv_cache_offload (rl.py validator — external KV cache hits
  don't carry routed-expert decisions).
- Enable native KV-cache offloading with a 128GB CPU tier (extends the prefix cache).
- FP8 trainer (DeepGEMM blockwise linear/MoE) — impl=custom is already set.
- Use the bash_edit harness (bash + local edit tool) for train + eval, replacing pure bash.
- Bump max_inflight_rollouts 384 -> 512.
- Keep LM-head token chunking + activation checkpointing explicit at the values that become
  trainer defaults in #2867 (not merged yet, so removing them would disable the features).
- Drop the -lp length-penalty variant.

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

* exp(glm45air-scaleswe): kv-offload + fp8, drop router replay, bash_edit

- Drop router replay (trainer.enable_router_replay + inference.enable_return_routed_experts):
  mutually exclusive with inference.kv_cache_offload (rl.py validator — external KV cache hits
  don't carry routed-expert decisions).
- Enable native KV-cache offloading with a 128GB CPU tier (extends the prefix cache).
- FP8 trainer (DeepGEMM blockwise linear/MoE) — impl=custom is already set.
- Use the bash_edit harness (bash + local edit tool) for train + eval, replacing pure bash.
- Bump max_inflight_rollouts 384 -> 512.
- Keep LM-head token chunking + activation checkpointing explicit at the values that become
  trainer defaults in #2867 (not merged yet, so removing them would disable the features).

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

* exp(glm45air-scaleswe): drop inference fp8 quant to lower mismatch

Run bf16 inference (remove vllm_extra quantization=fp8). fp8 inference added
~10x mismatch KL (~0.002 vs ~0.0002); bf16 inference lowers it. Trainer fp8 +
native KV-cache offload (and the now-disabled router replay) unchanged.

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

* exp(glm45air-scaleswe): bump context to 131072

seq_len + inference.model.max_model_len 65536 -> 131072.

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

* exp(glm45air-scaleswe): revert to 65k ctx, drop kv offload, 384 inflight

- seq_len + inference.model.max_model_len 131072 -> 65536
- Remove inference.kv_cache_offload (native CPU tier)
- max_inflight_rollouts 512 -> 384

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

* exp(glm45air-scaleswe): eval at step 0 (explicit skip_first_step=false)

Make the startup eval explicit so SWE-Bench Verified runs at step 0 before
any train rollouts (already the default; pinned for clarity).

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

* exp(glm45air-scaleswe): drop fp8 trainer

Remove trainer.model.fp8 (back to bf16 training).

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

* exp(glm45air-scaleswe): bring back router replay

Re-enable trainer.enable_router_replay + inference.enable_return_routed_experts.
Compatible again now that kv-cache offload and fp8 (both mutually exclusive with
router replay) have been dropped; replaying inference's routed-expert decisions in
the trainer cuts the train/inference mismatch by ~an order of magnitude.

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

* exp(glm45air-scaleswe): scale inference to 4 nodes / 4 replicas

num_infer_replicas 2 -> 4 (num_infer_nodes is per-replica, so total inference
nodes = num_infer_nodes * num_infer_replicas = 4). Total job = 2 train + 4 infer.

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

* exp(glm45air-scaleswe): bump max_inflight_rollouts 384 -> 512

Increase orchestrator rollout concurrency to better saturate the 4 inference replicas.

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

* fix(slurm): node-local FlashInfer JIT cache to avoid weka lock deadlock

FLASHINFER_WORKSPACE_BASE defaulted to $HOME/.cache/flashinfer on shared weka.
With concurrent GLM-4.5-Air/MoE runs every TP worker contends on the same
fused_moe_*.lock there and deadlocks in uninterruptible (D-state) filesystem
I/O during the CUTLASS fused-MoE JIT build, so inference never serves. Pin it
to node-local /tmp like the Triton/vLLM caches.

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

* glm45air-scaleswe: bump max_steps 400 -> 1000

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

* exp(glm45air-scaleswe): set node-local cache dirs via config env_vars

Move the cache-dir env vars out of the SLURM templates and into the config
so the PR only adds the TOML (the merged env-var feature, #2863, makes this
possible):
- [env_vars] TRITON_CACHE_DIR (trainer + inference)
- [inference.env_vars] VLLM_CACHE_ROOT, FLASHINFER_WORKSPACE_BASE

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

* exp(glm45air-scaleswe): migrate renderer preserve_all_thinking -> thinking_retention

Main #2900 replaced the renderer `preserve_all_thinking` bool with
`thinking_retention`; the merge left the config on the removed field, so it
failed the config-load unit test ("No config class could be parsed"). Switch
to `thinking_retention = "all"` (the documented equivalent).

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: Mika Senghaas <mail@mikasenghaas.de>
Co-authored-by: Mika Senghaas <mika@primeintellect.ai>
v0.6.1.dev29
2026-06-29 14:34:51 -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>
v0.6.1.dev28
2026-06-29 13:56:02 -07:00
eligottsandGitHub 4e7bc94fcd Update configs for renderer thinking retention (#2900)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev27
2026-06-29 11:51:46 -07:00
d70075381c feat: configurable env vars (#2863)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(env): consolidate component env vars

Add shared env var defaults and per-component env_vars plumbing across RL, SFT, and inference launch paths.

Update launcher filtering, SLURM templates, examples, and docs to match the consolidated env config surface.

* feat: add rl-wide env vars (#2897)

---------

Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
v0.6.1.dev26
2026-06-28 15:34:11 -07:00
064ee23a8c fix: correct env log glob to logs/envs/<split>/<env>.log (#2898)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix: correct env log glob to logs/envs/<split>/<env>.log

Since the nano-as-v1 migration each env writes a single
logs/envs/{train,eval}/<env>.log file (two levels), but the launch
banner still printed three-level globs (logs/envs/*/*/*.log), which
match nothing. Fix the banner generator and the captured example
outputs.

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

* docs: drop captured launch-banner output from example READMEs

The "Output of the command" blocks duplicated the live launch banner
(now fixed in pathing.py) and drift out of sync. Remove them; the run
command stays.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev25
2026-06-28 15:29:46 -07:00
7c8755d9d5 fix(template): orchestrator URLs use canonical model.client path (#2899)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The multinode RL sbatch template launched the orchestrator with
--student.client.{base-url,admin-base-url}, but OrchestratorConfig has no
`student` field — the canonical path is `model.client` (base_url /
admin_base_url on ClientConfig). The orchestrator-config rename left the
template stale, so every multi-node RL launch fails config parsing with
"Unrecognized arguments: <inference URLs>".

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev24
2026-06-28 15:24:29 -07:00
samsjaandGitHub bf3d381cfe refactor: remove "auto" option from fused_lm_head_token_chunk_size (#2890)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The "auto" value for fused_lm_head_token_chunk_size previously resolved
to 8192 for RL training via a config validator. This was redundant since
users can simply set the integer explicitly. Remove the "auto" option,
its validator (auto_setup_fused_lm_head_token_chunk_size), and update
docs/CHANGELOG accordingly.

The type changes from int | Literal["auto", "disabled"] to
int | Literal["disabled"]. Users who relied on "auto" should set
fused_lm_head_token_chunk_size = 8192 explicitly.
v0.6.1.dev23
2026-06-27 14:31:46 -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
v0.6.1.dev22
2026-06-27 21:15:02 +02:00
c5afcaa2e2 feat: default ep to auto for MoE models (#2868)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: default ep to "auto" for MoE models

ep now defaults to "auto" which resolves at trainer startup to the
largest valid EP degree up to 8. The resolution loads AutoConfig to
read num_experts, then picks the biggest divisor of num_experts that
also divides the FSDP island size (world_size // dp_replicate), is a
multiple of cp, and is <= 8. For non-MoE models, auto resolves to 1.

Changes:
- ModelConfig.ep type: int -> int | Literal["auto"], default "auto"
- Added resolve_ep() in parallel_dims.py, called before
  get_parallel_dims() in both rl/train.py and sft/train.py
- Fixed validators (validate_ep_comm_backend, ep_only_with_custom_impl)
  to handle the "auto" string without comparing to int
- get_parallel_dims() now asserts ep is resolved to int
- Updated docs/scaling.md and CHANGELOG.md

* fix: ruff format parallel_dims.py

* feat: enable memory-saving defaults (ac, ac_offloading, compile, optim_cpu_offload, chunk loss)

- model.ac: None -> ActivationCheckpointConfig() (full mode)
- model.ac_offloading: None -> ActivationOffloadingConfig()
- model.compile: None -> CompileConfig() (fullgraph=false)
- model.optim_cpu_offload: False -> True
- model.fused_lm_head_token_chunk_size: disabled -> 1024
- SFT silently disables fused_lm_head_token_chunk_size
- Multi-run CI config sets optim_cpu_offload=false
- Debug configs disable compile

* refactor: replace ep="auto" string with auto_ep boolean

- Replace ep: int | Literal["auto"] = "auto" with auto_ep: bool = True + ep: int = 1
- Update validators to check auto_ep instead of string comparisons
- Revert SFT changes to main (ep_only_with_custom_impl, sft/train.py)
- Keep SFT validate_and_disable_chunked_loss fix (silently disable)
- Remove isinstance assertion in get_parallel_dims (ep is always int now)
- Update docs and changelog

* fix: address review comments

- Rename resolve_ep to resolve_auto_ep (samsja)
- Add impl guard in resolve_auto_ep: skip EP for hf impl (bugbot)
- Add runtime check: raise if deepep resolves to ep=1 (bugbot)
- Revert configs/debug/moe/sft/train.toml to keep compile enabled (mika)

* fix: update benchmark baselines for memory-saving defaults

The new memory-saving defaults (ac, ac_offloading, compile, optim_cpu_offload,
fused_lm_head_token_chunk_size) reduce throughput. Update both 1-GPU and 4-GPU
baselines to the actual metrics from the CI run.

* refactor: replace auto_ep boolean with ep: int | Literal["auto"]

- Remove the auto_ep boolean field from ModelConfig
- Change ep type from int to int | Literal["auto"], default "auto"
- Rename resolve_auto_ep back to resolve_ep, check config.ep != "auto"
- Update validators to handle ep being a string (isinstance check)
- Add assertion in get_parallel_dims that ep is resolved to int
- Update docs/scaling.md and CHANGELOG.md

* fix(sft): handle ep="auto" in ep_only_with_custom_impl validator

The SFT validator used  which raises TypeError when ep is
"auto" (a str). Match the RL trainer's approach using != comparisons
to handle both int and str types.

* fix(sft): call resolve_ep before get_parallel_dims in SFT trainer

* Simplify resolve_ep: min(fsdp_island_size, 8) for MoE, 1 otherwise

Remove the magic auto-resolution that searched for the largest EP degree
satisfying num_experts divisibility, FSDP island divisibility, and cp
multiple constraints. Now just checks if the model is MoE and resolves
to min(fsdp_island_size, 8).

* docs(inference): document required NIXL/UCX from-source build for P/D disaggregation

---------

Co-authored-by: samsja <samsja@users.noreply.github.com>
v0.6.1.dev21
2026-06-26 16:17:13 -07:00
3cbeb5d0f1 feat: vLLM 0.23 bump + GLM-5.2 16-node P/D inference config (mooncake + llm-d) (#2883)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore: bump vLLM to 0.23.0 and prune/adapt monkeypatches

Bump vllm 0.22.0 -> 0.23.0 (pyproject + regenerated uv.lock).

Remove two now-redundant monkeypatches (verified against 0.23.0 source,
adversarially double-checked):
- monkey_patch_deep_gemm_silu_mul_quant_int64: upstream kernel already uses
  int64 pointer arithmetic, so the patch was a behavioral no-op.
- _patch_qwen35_lora (vllm#36372): the Qwen3.5 GDN LoRA IndexError is fixed
  natively in vLLM; the patch is redundant and would corrupt the native path.

Adapt two patches the bump moved/changed:
- serving_tokens: get_max_tokens moved out of the deleted vllm.entrypoints.utils
  to vllm.entrypoints.serve.utils.api_utils (import-time breakage otherwise).
- monkey_patch_minimax_m2_for_lora: the MoE gate is now GateLinear (was
  ReplicatedLinear); rebuild as GateLinear(out_dtype=float32) with a bf16 weight
  so the LoRA Triton kernel's bf16/fp16 assertion passes while router logits
  stay fp32.

Default VLLM_USE_V2_MODEL_RUNNER=0: vLLM 0.23.0 routes dense Llama/Mistral/Qwen3
to the V2 GPU model runner, which has no _preprocess hook for the padded-input
scrub and does not zero the padded decode tail itself, reproducing NaN logits.
Forcing V1 keeps the scrub effective for every model and is also required for
routed-experts capture. setdefault keeps it overridable.

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

* docs(inference): cite vllm#44814 as the NemotronH mixer.D reload fix

The _restore_reload_corrupted_params workaround's removal trigger was vague
("once the upstream bug is fixed"). The upstream fix is vllm-project/vllm#44814
(merged 2026-06-10), which is NOT in the pinned 0.23.0 release, so the workaround
is still required. Record the root cause (mixer.A's composed_weight_loader
double-count drops the trailing mixer.D) and the exact removal condition.

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

* feat(configs): add GLM-5.2 16-node P/D mooncake + llm-d inference config

Standalone `inference` deployment for GLM-5.2-FP8 on 16 nodes: disaggregated
8 prefill (4 replicas) + 8 decode, mooncake distributed CPU KV store, llm-d
router (EPP+Envoy), vLLM 0.23. Requires source-built NIXL/UCX 1.19.x
(scripts/install_nixl_from_source.sh) — the wheel UCX segfaults on P/D KV
transfer. Validated: 1000-req/500-concurrent burst, 0 faults / 0 RPC_FAIL.

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

* fix(inference): keep Qwen3.5-MoE on 2D per-expert LoRA format

Dropping _patch_qwen35_lora wholesale also removed the
Qwen3_5MoeForConditionalGeneration.is_3d_moe_weight = False override.
vLLM 0.23.0 defaults that flag to True, so the LoRA loader expects 3D
stacked-expert adapters, but our trainer emits the 2D per-expert layout
(MultiLoRAGroupedExperts.state_dict_for_adapter) which vLLM only reads
when is_3d_moe_weight is False (or enable_mixed_moe_lora_format=True).
Without the override Qwen3.5-MoE LoRA adapters fail to load.

Re-add it as a minimal standalone patch. The rest of the old shim
(in_proj_qkvz packed-mapping + N-slice can_replace_layer/slice_lora_a for
vllm#36372) stays removed -- 0.23.0 handles it natively via expand_packed_lora.

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

* feat(dockerfile): bake NIXL-from-source into base image

The PyPI nixl wheel ships its own UCX that segfaults on prefill->decode KV
transfer (#2883). Rebuild NIXL against the UCX 1.19 we already compile in
the builder stage so the disagg P/D path works without per-host rebuilds.

Adds ~5 min to the amd64 build. arm64 unchanged for now — NIXL upstream
should support it but hasn't been validated here.

* gate NIXL build behind INCLUDE_NIXL_FROM_SOURCE arg

Default off — base build stays identical. The hosted-rl workflow that builds
the disagg P/D variant passes --build-arg INCLUDE_NIXL_FROM_SOURCE=1 (and
should tag-suffix the result, e.g. prime-rl:<ver>-nixl-amd64, to keep image
streams disambiguated).

* fix(dockerfile): seed pip into venv before building NIXL wheel

uv-created venvs don't include pip by default. Mirror install_nixl_from_source.sh
which seeds it via 'uv pip install pip' before invoking 'python -m pip wheel'.
Also swap the final install to 'uv pip install' so we don't depend on the
.venv/bin/pip shim either.

* feat(dockerfile): opt-in disagg extras build (INCLUDE_DISAGG_EXTRAS)

Adds --build-arg INCLUDE_DISAGG_EXTRAS=0 (default) gating --extra disagg
in the uv sync step. The disagg extra installs deep-ep, deep-gemm and
quack — heavy source builds only the disaggregated-MoE inference path
needs (e.g. GLM-5.2 16-node P/D with deepep_high_throughput).

Default off so training-only / single-node inference builds are unaffected.
Enable via --build-arg INCLUDE_DISAGG_EXTRAS=1; pairs with --build-arg
INCLUDE_NIXL_FROM_SOURCE=1 (#2885) for full disagg P/D images.

---------

Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: faresobeid <fares@primeintellect.ai>
Co-authored-by: Jannik Straube <info@jannik-straube.de>
v0.6.1.dev20
2026-06-26 15:48:47 -07:00
f8660256f0 Qwen3.5 MRoPE VLM model (#2819)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix qwen3.5 mrope vlm model

* fix(qwen3.5): handle adjacent VLM image groups

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: eligotts <eligotts@users.noreply.github.com>
Co-authored-by: hubert-marek <hubert@uni.minerva.edu>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Hubert <163992334+hubert-marek@users.noreply.github.com>
v0.6.1.dev19
2026-06-26 15:47:42 -07:00
minh hoangandGitHub a66f8bed1b [ENG-4094] docker: include cuda toolkit with runtime image (#2826)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* docker: copy cuda toolkit from builder into runtime image

* use slim bookworm for glibc 2.36

* use nvidia cuda base image at runtime to avoid glibc mismatches; include cuda 13 runtime

* bug bot fixes

* fix groupadd collision

* include python3.12-dev in runtime image

* use cuda 13 runtime libs source

* trim cuda12 toolkit to just the nvcc JIT essentials
v0.6.1.dev18
2026-06-26 14:09:55 -07:00
d1f366b1bc chore: bump verifiers + research-environments to main (#2887)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore: bump verifiers + research-environments to main

Bump deps/verifiers (62dc38a5 -> aa95826d, 0.1.15.dev396 -> dev400; adds the
reusable vf.Judge) and deps/research-environments (0687a15c -> 99ebd2e1) to
their latest main, and follow the env ports / removals they shipped.

research-environments removed six v0 envs prime-rl pinned (ported to v1):
- code-env -> i3-code-v1
- ifeval -> ifeval-v1
- math500 -> math500-v1
- mmlu-pro -> mmlu-pro-v1
- science-env -> i3-science-v1
- simpleqa-verified -> simpleqa-verified-v1

Also drop v0 envs that nothing references anymore: hle, rlm-swe, rlm-search,
tau2-bench (tau2-bench-v1 stays).

Configs:
- Migrate the math500 eval env onto math500-v1 (hendrycks_math, nemotron_4node,
  nemotron_debug).
- Remove the stale env_mix and math_group configs.

Bump the verifiers floor dev396 -> dev400 and relock.

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

* chore: keep rlm-swe + rlm-search env deps

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev17
2026-06-26 11:29:56 -07:00
halleriteandGitHub eb89285418 fix(orchestrator): eval completion_len is always 0 on the token-less relay (#2880)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev16
2026-06-25 22:47:59 +02:00
halleriteandGitHub 9e1c011ce1 chore(utils): remove dead processor= path from chat_template (#2881)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev15
2026-06-25 21:19:26 +02:00
halleriteandGitHub d507aeafc0 chore(configs): remove dead BaseModelConfig.is_vlm property (#2876)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev14
2026-06-25 08:12:28 +02:00
halleriteandGitHub 3dd3b30e75 chore(client): remove dead InferencePool.get_metrics() (#2875)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev13
2026-06-25 08:12:15 +02:00
halleriteandGitHub 3a5f617969 chore(utils): delete unused duplicate utils/messages.py (#2874)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev12
2026-06-25 08:11:59 +02:00
halleriteandGitHub c268702f55 chore(filters): remove unconsumed FilterResult.detection_index (#2877)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev11
2026-06-25 08:11:05 +02:00
halleriteandGitHub 62702bafa7 docs(inference): correct stale serving_tokens.py docstrings for vLLM 0.22 (#2878)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev10
2026-06-25 08:10:26 +02:00
35b452b01c chore: bump verifiers + research-environments to main (#2873)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Bump deps/verifiers (b055799f -> 20abcd91) and deps/research-environments
(dbc58e14 -> 0687a15c) to their latest main, and follow the env
deprecations/ports they shipped.

research-environments removed several v0 envs and ported others to v1:
- drop dead v0 env deps (removed upstream): color-codeword,
  mini-swe-agent-plus, opencode-{cp,deepdive,math,science,swe}
- migrate ported envs v0 -> v1: deepdive, gpqa, livecodebench
- migrate the two multimodal color-codeword configs onto the
  color-codeword-v1 taskset (default harness, subprocess runtime)

Also bump the verifiers floor 0.1.15.dev388 -> dev394 to match the new pin
and relock.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev9
2026-06-24 21:36:03 -07:00
halleriteandGitHub 2e29c66fd7 fix(orchestrator): align gibberish/repetition filters to v1 branch streams (#2872)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev8
2026-06-25 06:02:41 +02:00
halleriteandGitHub d3765e289d chore(deps): bump verifiers to 0.1.15.dev388 (#2870)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev7
2026-06-24 22:52:46 +02:00
minh hoangandGitHub 9bf203c678 Fix Docker editable package version resolution (#2866)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
v0.6.1.dev6
2026-06-24 11:52:10 -07:00
46bcf628f6 chore: remove outdated math configs (#2865)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore: remove outdated config dirs

Prune four stale, unused config directories. None are referenced by
docs, skills, CI, or scripts, and each is a one-off experiment or
feature demo whose last substantive edit predates the recent config
sweeps:

- wordle: legacy v0-bridge demo, last real edit 2025-08-30
- deepscaler: old multi-stage experiment (README points at a
  configs/deepscaler/eval.toml that no longer exists)
- glm5_disagg_inference: one-off disaggregated-inference demo
- elastic: alphabet-sort elastic/DNS-discovery demo

All four still parse against the current schema; removal is about
disuse, not breakage.

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

* chore: remove outdated acereason_math configs

Prune the stale acereason_math experiment configs (stage1/stage2, last
real edit 2025-12-23). They reference the aime24-v1 eval taskset that is
no longer available, so they fail to load against the current schema.

The live nightly run (configs/ci/nightly/acereason_math.toml) is
unaffected; drop its now-dangling comment reference to the deleted dir.

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

* chore: keep wordle, elastic and glm5_disagg_inference configs

Narrow this PR to only the deepscaler and acereason_math configs.

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

* chore: remove acereason_math from nightly suite

Drop the nightly acereason-math config and its test. The nightly
workflow auto-discovers tests/nightly/test_*.py, so removing the test
file drops it from the matrix.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.6.1.dev5
2026-06-23 20:45:19 -07:00