* chore: remove fsdp_cpu_offload
The knob was effectively unusable: it breaks NCCL weight broadcast in RL
(state-dict tensors stay on CPU and the communicator asserts), muon rejects
it, it is mutually exclusive with optim_cpu_offload, and no config in the
repo uses it. Remove the field and all wiring instead of patching around it:
FSDP CPUOffloadPolicy selection, the buffer-migration helper, the gloo
backend plumbing in setup_torch_distributed, both muon validators, and docs.
optim_cpu_offload remains the supported CPU-offload knob. Default behavior
is unchanged: fully_shard's own default offload policy is OffloadPolicy().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: drop offload_policy kwargs from direct fully_shard calls
Three fully_shard call sites passed offload_policy=offload_policy directly
(not via fsdp_config) and were missed by the removal — setup_fsdp raised
NameError. fully_shard's default is OffloadPolicy(), so omitting the kwarg
is behavior-identical. Verified by importing the trainer modules and
checking setup_fsdp's symbol table.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* chore: bump verifiers + research-environments to latest main
verifiers -> 1cfdd39c (incl. docker-runtime entrypoint fix#2015).
research-environments -> dd80d75b (incl. terminal-bench-2 use_prime_registry
fix#668).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: carry provider usage in advantage test rollouts
verifiers #2040 made Trace token counts usage-based, so the synthetic
rollouts (which only had token ids) reported 0 output/input tokens and the
length-penalty tests failed. Attach provider usage to the final sampled
turn so num_output_tokens / num_input_tokens reflect the intended lengths.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(trainer): fuse relu2 MoE activation via torch.compile
F.relu(x).square() ran eagerly (the expert path graph-breaks out of the
layer-level compile at the @expert_parallel all-to-all and the _grouped_mm
custom op), materializing an extra full-size copy of the MoE intermediate —
the largest activation for high top-k models (NemotronH Super: top-22,
moe_intermediate 2688; 57.75 GiB at 65k tokens/GPU) and the empirical OOM
site. An explicit torch.compile on relu2 fuses relu+square into a single
pointwise kernel. Measured on Nemotron Super (2xH200 nodes, 16k tokens/GPU):
OOM -> fits at 126.5/139.8 GiB peak.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(trainer): ulysses CP beyond num_kv_heads via GQA KV-head replication
Ulysses CP head-shards Q/K/V, capping the CP degree at num_key_value_heads —
for hybrid-Mamba GQA models like NemotronH Super/Ultra/Nano (2 KV heads) that
means cp <= 2, i.e. at most 2-way context sharding regardless of node count.
(NVIDIA post-trained Super at 256k-512k with CP=64 on Megatron's
sequence-sharded, Mamba-aware CP; prime-rl's ring CP is softmax-only.)
Replicate each KV head cp/num_kv_heads times before the existing seq->head
all-to-all. GQA groups query heads contiguously, so rank r's query-head slice
[r*Hq/cp, (r+1)*Hq/cp) attends KV head floor(r*Hkv/cp) — exactly the replica
the all-to-all lands on rank r. Backward of repeat_interleave sums gradients
over replicas, the exact GQA KV gradient. Q path and the num_kv_heads >= cp
case are unchanged; the Mamba layers already head-shard independently via
cp_mamba (128 heads, n_groups=8 -> cp <= 8 for NemotronH).
New constraint: cp % num_kv_heads == 0 when num_kv_heads < cp (asserted).
Unlocks cp=4/8 for NemotronH on H200 where cp=2 made 131k context
memory-infeasible (65k tokens/GPU through a top-22/512-expert MoE).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: drop relu2 comment
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat: allow choosing between claude code and codex in tmux agent window
Add --agent flag (claude|codex, default claude) to scripts/tmux.sh.
The agent window now launches the chosen coding agent with the same
monitoring context (log paths, tmux session info).
* fix: use codex --yolo instead of --dangerously-bypass-approvals-and-sandbox
#3004 made the trainer/orchestrator startup weight sync unconditional.
The trainer broadcasts startup weights exactly once, for the runs
discovered at its first step, so multi-run orchestrators that register
later wait forever for broadcasts/step_0 and never start —
reverse_text_multi_run has timed out on every run since (beta/gamma/
alpha_resume start staggered). A fresh filesystem start with a [ckpt]
block but no wait_for_weights_timeout also raised FileNotFoundError
immediately instead of waiting.
Filesystem broadcast needs no startup rendezvous: a fresh orchestrator
already serves the base model, which is policy v0, and a resumed one
reads v{resume_step} from its checkpoint dir. Only NCCL has a receiver
that must rendezvous with a trainer-side send — and NCCL is never
combined with multi-run, since multi-run implies LoRA and NCCL+LoRA is
rejected at config validation (also added in #3004).
Gate the orchestrator's startup sync to resume-or-NCCL and the
trainer's first-step broadcast to NCCL, preserving #3004's resume
deadlock fix on the NCCL path while restoring the pre-#3004 filesystem
startup behavior.
* feat(sft): renderer-only SFT tokenization
SFT tokenization now goes exclusively through the renderers library:
- build_training_sample with a hand-coded renderer replaces the
incremental apply_chat_template masking path, which corrupted loss
masks under position-dependent chat templates (e.g. Qwen3 stripping
past thinking blocks across user turns). DefaultRenderer is rejected
in setup_renderer; fake data skips renderer construction entirely.
- [renderer] config defaults to auto-resolution from the tokenizer;
template controls (e.g. enable_thinking) are set run-wide via the
typed renderer config.
- Non-assistant roles opt into the loss via the renderer's body-only
path (content_sft_roles).
- _drop_null_fields strips Arrow phantom nulls before tool-call
deserialization so genuine nulls inside argument strings survive.
- Null-check rather than key-check for messages vs prompt/completion
resolution (Arrow schema union adds messages: null to prompt/
completion rows).
- seq_len default 256 (FakeDataConfig keeps 128); loss_impl defaults
to liger_fused; CI reverse-text configs pin [renderer] name=qwen3.
Breaking config changes are documented in each PR's ## Breaking section
instead; drop the file and the BugBot rule that enforced it.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat(orchestrator): support infinite tasksets
An env server may now report num_tasks=None (verifiers#1969: an
infinite, procedurally generated taskset). TrainSource streams a
monotonic task_idx for such an env - the server generates tasks on
demand, so every pull is a fresh task and there are no epochs to
shuffle - while finite envs keep their shuffled index table. An eval
env with an infinite taskset must set num_examples explicitly.
Dormant until the verifiers pin includes #1969: a finite taskset still
reports an int count and takes the existing paths.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers to main (infinite tasksets) + relock
Activates the orchestrator's infinite-taskset support: verifiers main
now includes #1969, so the procedural v1 tasksets report
num_tasks=None. The color-codeword-v1 configs drop their num_examples
taskset field (the knob no longer exists - the taskset is
unconditionally infinite and the train env streams); CHANGELOG entry
for the removed size knobs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: drop CHANGELOG entry
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
_SequenceChunkedLogProbEntropyFn.backward unconditionally allocated and
accumulated both grad_hidden and grad_weight, ignoring
ctx.needs_input_grad. With a frozen output head (e.g. LoRA without head
adaptation) this allocated a full vocab-size gradient buffer and ran the
weight-gradient matmuls for a result autograd discards. Allocate and
accumulate each gradient only when required; return None otherwise.
* chore: release v0.7.0
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: sync uv.lock to 0.7.0
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(config): allow prime-rl conversions to be stored separately from model
Add primerl_conversion_dir config field to decouple converted weight
storage from the (potentially immutable) model snapshot directory. When
set, HF<->PrimeRL format conversions are written there instead of inside
the model directory. Defaults to None (existing behavior).
Also fixes load_state_dict to always read from the original source_path
instead of the converted snapshot path's parent.
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
* chore: rename primerl_conversion_dir to conversion_dir
Address review: shorter field name and clarify the docstring that converted
weights land in a prime/hf subdirectory. Keep the /prime subdir layout.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(trainer): broadcast resumed policy weights before training loop
On resume, the orchestrator advances to v{checkpoint_step} and pauses
inference to receive those weights over NCCL. Since #2896 moved the
in-loop weight broadcast to the END of a step, the trainer would start
step {checkpoint_step+1} first — which blocks on rollouts the paused
inference engines cannot produce until they get v{checkpoint_step}.
Both sides then wait forever (confirmed on GLM-5.2 resume: orchestrator
"Created NCCL_READY marker" then silent, trainer stuck "Looking for
batches" for the next step).
Restore the pre-#2896 top-of-loop sync with a one-shot broadcast right
after checkpoint load. Runs are only registered during batch collection
(packer.discover_runs), so discover run 0 first (mirroring optim.py's
wait-for-run-0 pattern) to populate used_idxs before broadcasting.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(resume): broadcast startup weights on the first step (fresh or resume)
Address review: instead of a resume-only pre-loop broadcast, always sync
inference to the incoming policy on the first training step.
- trainer: broadcast v{step-1} at the top of the loop's first iteration
(fresh -> v0, resume -> v{checkpoint_step}), replacing the pre-loop block.
- orchestrator: always pause + sync inference at startup (previously
resume-only), so it rendezvouses with the trainer's first-step broadcast
in both cases and startup is symmetric.
- factor the "wait for run 0 to be discovered" loop into
MultiRunManager.wait_for_run(); reuse it in optim.py (dedupes the
copy that lived there) and the first-step broadcast.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(orchestrator): wait for startup broadcast on fresh start
The unconditional startup weight sync fell back to wait_timeout=None when
there was no ckpt block (from-scratch run). With filesystem weight broadcast
(check_exists=True), get_weight_dir then raised FileNotFoundError immediately
instead of waiting for the trainer to write broadcasts/step_0/STABLE.
Fall back to a default timeout so the orchestrator waits for the trainer's
startup broadcast, which is always coming.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(config): reject NCCL weight broadcast with LoRA
LoRA adapters are transferred via the filesystem (loaded from disk by the
inference servers); NCCL broadcast only writes a STABLE marker. The now
unconditional startup weight sync makes a fresh LoRA + NCCL run try to load an
adapter from a disk path NCCL never populates, hanging/failing during setup
(and LoRA over NCCL is broken for training-time updates too).
The auto weight-broadcast setup already falls back to filesystem for LoRA when
unset; enforce the same invariant for an explicitly configured NCCL broadcast
instead of failing at runtime.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Under Ulysses CP the DeltaNet layer built its fla CP context from a
fabricated single-sequence cu_seqlens, so the gated delta rule carried
state across packed documents. The causal conv used shard-local
cu_seqlens, resetting mid-document at every shard boundary even for
unpacked rows.
Build the CP context from the full pre-shard cu_seqlens published by
setup_cp_params (fla derives per-rank boundaries and document-aware
state passing from them) and run the convolution through fla's CP conv,
which resets at true document boundaries and exchanges tail tokens
across ranks for straddling documents.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
* fix: reset Nemotron-H CP state at packed boundaries
* chore: simplify packed-boundary plumbing in CP mamba
- read ULYSSES_PARAMS["cu_seqlens"] directly via a module-level import,
matching the ulysses attention path (no try/except wrapper)
- convert cu_seqlens to a boundary list once per forward and share it
between the conv and seq_idx helpers (one host sync instead of four)
- import cp_mamba as a normal package module in the test
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: drop unused final states from CP mamba scan
return_final_states=True computed and returned states the CP path
discards; return_final_states=False matches the non-CP varlen path
and skips the dfinal_states backward work. Flagged by Cursor Bugbot
(its assert/mishandling claim does not reproduce against mamba_ssm
2.3.1 — outputs and grads verified bit-identical on GPU either way).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
* feat: make research-environment envs uv workspace members
Research envs under deps/research-environments/environments/*/* are now
auto-discovered uv workspace members instead of being hand-registered in
the `envs` extra + [tool.uv.sources]. Adding a new research env needs no
pyproject.toml change - the glob picks it up and it's locked automatically.
They are opt-in: `uv sync` / `--all-extras` no longer install them; use
`uv sync --all-packages`. Env-running sites (sbatch training templates,
gpu/nightly CI, Docker image + entrypoint, nemotron config, example
READMEs) gain --all-packages; dev quickstart and cpu unit tests stay lean.
tau2-synth-v1 and tau3-bench-v1 are excluded - they pin `tau2` forks/revs
that conflict with the canonical tau2-bench-v1 in the workspace's shared lock.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: make verifiers envs workspace members, drop the envs extra
Extends the workspace glob to deps/verifiers/environments/*, so verifiers-repo
envs are auto-discovered members alongside the research envs. Removes the
now-empty `envs` optional-dependency and all its [tool.uv.sources] entries, and
drops the defunct `--extra envs` from cpu_tests, Dockerfile.cuda, and
docker-entrypoint.sh (env members install via --all-packages instead).
All 94 env members (66 research + 28 verifiers) lock, install, and import.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(ci): install all env packages in cpu_tests
test_load_configs parses every config, and parsing a v1-taskset config makes
verifiers import the env package to derive its taskset config type. With envs
now workspace members, the lean `uv sync --extra flash-attn` left them
uninstalled, so 28 config tests failed with ModuleNotFoundError. Add
--all-packages so the referenced env packages are importable.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
TrainSink filled the observation window (TrainBatch.rollouts) on arrival,
so a ready overflow batch triggered by the first rollout of a new,
incomplete group claimed that rollout in its window; the window then
reset, leaving the rollout missing from the window of the batch its own
group eventually shipped in. Metrics and persisted per-step traces could
therefore describe rollouts that belong to a different batch.
Window membership now follows group finalization: arrivals accumulate in
pending_groups only, a finalized group moves all its rollouts (errored,
filtered, and survivors) into the window, and batches only ship at
finalization points. Every rollout lands in exactly one batch's window.
Token-batched TrainSink accounting used Trace.num_total_tokens, which sums
over all branches — but trace_to_samples skips branches left with no
trainable tokens after fork dedup, so forked traces overcounted vs the
actual trainer payload. Count sum(len(sample.token_ids)) at both accounting
sites (accumulation and batch cut) instead. Linear traces are unchanged.
Zero-payload survivors (no trainable samples) fall back to the trace total
so they still advance the readiness check; a degenerate all-zero-payload
stream then ships empty batches and hits the orchestrator's
consecutive-empty-batch abort rather than stalling batching.
The RL integration tests (reverse_text, alphabet_sort, reverse_text_moe,
reverse_text_rl_opd, reverse_text_rl_sft) currently fail on the GPU CI
runners: the trainer subprocess exits with code 1 right at NCCL weight
broadcast init (orchestrator logs "Initializing NCCL broadcast", then
~5s later "Trainer failed with exit code 1"). SFT-only and unit tests
are unaffected because they don't use the trainer<->inference NCCL
weight-transfer path.
As a temporary workaround to get main CI green, switch these RL configs
to the already-supported `filesystem` weight-broadcast transport (the
same transport reverse_text_multi_run already uses and which passes).
The NCCL path itself will be fixed separately.
Launcher-written TOMLs (slurm rl.toml/subconfigs, sft, inference, and the
orchestrator's control/orch.toml) were dumped with exclude_none=True, so a
field explicitly overridden to None (e.g. --trainer.model.compile None) was
dropped and silently reverted to its non-None default when the file was
re-parsed by the sbatch job.
Add to_toml_dict(), which drops unset None fields as before but encodes
explicitly-set ones as the string "None" — the config system's TOML null
convention, converted back by BaseConfig on load. Serializing all Nones
would instead trip RLConfig's shared-vs-subconfig conflict validator
(shared defaults like log.level=None disagree with sub-config defaults),
hence the model_fields_set distinction.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* chore: drop v0 logic-env and math-env deps
These v0 environments are being removed from research-environments in favor of
their v1 tasksets (logic-env -> i3_logic_v1, math-env -> math-env-v1, the latter
already wired here). Remove the v0 editable path deps + relock so the build
doesn't break when deps/research-environments is re-pinned past their deletion.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: migrate standalone math configs off v0 math-env to v1 tasksets
Move the training configs that used the v0 math-env on an explicit dataset to
v1 env sections: gsm8k -> gsm8k-v1 (verifiers), and the Hendrycks/sanity configs
-> math-env-v1 (task-facing math_verify_timeout preserved where set). All use the
`null` harness + subprocess runtime. Drops the v0-only math_verify_max_workers.
qwen30b_math and examples/Intellect-3.1 use the v0 math-env DEFAULT (INTELLECT-3-RL
math), so they migrate to i3_math_v1 instead — deferred to the submodule bump.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: bump research-environments to latest main and fix moved env paths
Bump deps/research-environments 504bd2620 -> 54f30788f, which includes the
v0->v1 migration (#653), the environment grouping reorg (#655), frontierscience
v1 (#656), and swebench deprecation (#651). The reorg moved every env into a
category subdir (math/, knowledge/, search/, tool_use/, long_context/, code/,
reasoning/, science/, if/, terminal/), so update all 44 editable path deps in
[tool.uv.sources] accordingly, and relock.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: re-bump to research-environments with i3_math_v1; migrate qwen30b_math
Re-bump deps/research-environments 54f30788f -> 06232831f (adds i3_math_v1, #660).
Wire i3-math-v1 (INTELLECT-3-RL math) and i3-logic-v1 (INTELLECT-3-RL logic) as
editable path deps, and migrate examples/qwen30b_math (v0 math-env's INTELLECT-3-RL
default) to the i3_math_v1 v1 taskset. Relock.
examples/Intellect-3.1 is left on v0 for a dedicated recipe pass (it mixes 6 v0
envs — mini-swe-agent-plus/deepdive/math-env/logic-env/code-env/aime2025 — several
without a clean 1:1 v1 mapping); it still validates (v0 sections aren't imported).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: migrate remaining config/example env refs to installed v1 envs
Sweep every configs/ + examples/ env reference so all resolve to installed envs
(no Environments-Hub downloads, no removed v0 envs):
- mini-swe-agent-plus -> r2e-gym-v1 (default harness, prime runtime): Intellect-3.1,
qwen30b_swe, minimax_m2.5_swe, glm5_pd_disag
- Intellect-3.1 recipe fully to v1: deepdive->deepdive-v1 (rlm+search), math-env->
i3_math_v1, logic-env->i3_logic_v1 (filter max 0.874), code-env->i3_code_v1,
aime2025->aime25-v1
- aime2025->aime25-v1 (qwen30b_math eval)
- de-Hub primeintellect/*: wordle->wordle, alphabet-sort->alphabet-sort,
wiki-search->wiki-search, aime2024->aime24-v1 (hendrycks_sanity eval)
- general-agent-solver-rlm -> general-agent-v1 taskset (colocated tools; configs/general_agent/*)
All target envs are already in the `envs` extra (no lock change). All configs parse
under the schema; audit shows 0 unresolved env references.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: SWE eval -> swebench-verified-v1; lowercase Intellect-3.1 dir
- Point the SWE *eval* env at swebench-verified-v1 (train stays r2e-gym-v1) in
Intellect-3.1, qwen30b_swe, minimax_m2.5_swe, glm5_pd_disag.
- Rename examples/Intellect-3.1 -> examples/intellect-3.1 (lowercase) and update
the docs/configuration.md link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: drop "-quick" from SWE eval name (now full swebench-verified-v1)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: runtime labels use the run name, not the env name
Set the prime-runtime sandbox labels to each config's run identifier (its wandb
project) instead of per-env tags like ["deepdive"] / ["mini-swe-agent-plus"].
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: prime-runtime labels = [run name, env name]
Convention: tag prime sandboxes with both the run identifier (wandb project) and
the env name, e.g. ["intellect-3.1", "swe"] / ["intellect-3.1", "deepdive"].
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* ci: slim install parses an SFT [slurm] config (RL configs are now v1)
The slim "parse a real config" step parsed examples/Intellect-3.1/rl.toml, which
(a) was renamed to lowercase and (b) is now a v1 recipe — v1 env sections resolve/
import their taskset at parse (vf.EnvServerConfig), and those env packages aren't
installed in the slim (prime-rl-configs-only) env. Point it at an SFT [slurm]
config (no env sections) so it still verifies slurm/template_path handling.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* ci: slim install also parses the reverse_text RL config (v0 env, [slurm] compose)
Cover both paths on the slim install: the SFT [slurm] config and the reverse_text
RL recipe (rl.toml @ slurm_rl.toml). The RL one parses because reverse-text is a
v0 env id (resolved lazily, not imported at parse), so no env package is needed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Bridge a finished verifiers eval run to 'uv run sft': one row per branch
with a messages column (OpenAI chat wire shape) and a tools column
(Trace.tools, JSON-encoded) — the shape trainer/sft/data.py consumes.
Generation-errored traces always drop (scoring-only errors keep their
finished transcript); --min-reward / --drop-truncated select further.
Writes <run>/sft/train.parquet (data.name-ready) or pushes with --push.
Moved here from PrimeIntellect-ai/verifiers#1964 per review; requires the
verifiers release carrying Trace.tools (verifiers#1963).
Write checkpoints to a temp file then atomically rename into place, so a
killed process can't leave a corrupt progress.pt that breaks restarts.
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
* feat: adapt to verifiers task-centric Task/TaskData split
Companion to PrimeIntellect-ai/verifiers#1948: Trace is now generic over
TaskData (DataT), the wire task type is WireTaskData, and vf.Task is the
behavior class — placeholder wire tasks construct vf.TaskData. Taskset
knobs that moved onto TaskConfig nest under taskset.task in configs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (from_trace is an opt-in hook)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments to the task-centric port
All v1 envs in research-environments now speak the task-centric API
(PrimeIntellect-ai/research-environments#650); general_agent's tools
placement knob nests under taskset.task like the other moved knobs.
Full unit suite green against the pinned branch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat: adapt to the nested trace.task carrier
Companion to verifiers recording the producing task class on the trace
(trace.task -> {type, data}): dispatcher placeholders wrap their rows in
vf.TraceTask (type="Task" — no behavior class ever ran), readers nest
(.task.idx -> .task.data.idx), and the wandb sample tables keep showing
the row. Bumps both submodule pins.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (compact harness nested-task fix)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (simplify-API merge + review fixes)
Compat-audited: every surface prime-rl imports is unchanged or already
adapted; unit suite green (544) and 10-step reverse_text/gsm8k debug
runs healthy against the pinned tip.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(configs): glm45air search judges nest under taskset.task
main's new search config predates the task-centric knob move: plugged
judges live at taskset.task.judges and browsecomp's judge endpoint at
taskset.task.judge.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump submodule pins (codex feature-tool disable, sandbox version fix)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (replay recomputes from scratch)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers to main (task-centric tasks merged)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments (verifiers dev443 floors)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments (python floor + prerelease test fix)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments (port changelogs)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments (swe taskset ports)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments (stale comment)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/research-environments to main (v1 ports merged) + relock
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Only the master rank polls the filesystem for NCCL_READY markers; all
other ranks wait on a dist.barrier() instead. This eliminates redundant
filesystem polling across trainer ranks on multi-node setups.
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
The trainer skips the final NCCL weight broadcast (nccl_broadcast_unused
in train.py: step >= max_steps - 1) because the inference NCCL group is
torn down before that broadcast lands. As a result policy.version never
reaches the final step.
The orchestrator's dispatch gate (update_dispatch_gate) was unaware of
this: it pauses dispatch when lead > TARGET_LAG, waiting for a policy
version the trainer will never publish. Once the rollout buffer can't
cover the last batch on its own, the run deadlocks.
This mirrors the trainer's nccl_broadcast_unused condition in the gate:
when building the final batch under NCCL, let it through regardless of
lead. The last batch is meant to build on the penultimate policy anyway.
Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
* exp: GLM-4.5-Air RL configs for the search + terminal env domains
Two self-contained 2-train + 4-infer-node configs (configs/glm45air_search_terminal/) mirroring
configs/debug/v1/glm45air_scaleswe.toml (glm4_moe router replay, glm-4.5 renderer, cp=8 ulysses,
muon, LM-head chunking, AC/offload), with GRPO + linear length penalty, the rlm harness, and the
prime runtime for every env under a single per-run label:
- search.toml (label glm45air-search): rlm `search` skill; train deepdive-v1 / papersearchqa-v1
(split=train) / wideseek-v1 (split=hybrid), eval browsecomp-v1 / openseeker-v1 / redsearcher-v1.
- terminal.toml (label glm45air-terminal): rlm ipython; train scaleswe-v1 / r2e-gym-v1, eval
swebench-verified-v1 (use_prime_registry) / swebench-pro-v1 / terminal-bench-2-v1.
Both validate via RLConfig.model_validate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: correct search/terminal env sets
- search: openseeker-v1 + redsearcher-v1 are train sources (move from eval); deepdive stays train
(qa_rl; no held-out eval split). Eval is browsecomp-v1.
- terminal: SWE (scaleswe/r2e-gym) is a separate domain — train on the terminal sets instead
(openthoughts-tblite-v1 = terminal-bench-lite, uuid-ctf-v1 = synthetic forensic CTF). Keep the
sandbox-benchmark evals (terminal-bench-2-v1 primary; swebench-verified/pro as references).
Both pass RLConfig.model_validate; all env ids are locked in pyproject.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: full eval at avg@1 (drop num_examples/group_size caps); terminal evals tb2 only
Eval blocks now use the defaults (num_examples=-1 → all, group_size=1 → avg@1). Terminal evals on
terminal-bench-2-v1 only for now (dropped the swebench-verified/pro cross-domain evals).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: bump verifiers to forward_env; forward SERPER_API_KEY on search envs
Bump deps/verifiers 62ba2212 -> 842f6b18 (verifiers main incl. forward_env on
HarnessConfig) and set forward_env = ["SERPER_API_KEY"] on every search harness,
so the rlm search skill gets the key inside the prime sandbox. SERPER_API_KEY must
be exported in the launch environment.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: consolidate glm45air configs under configs/glm45air/; 131k ctx, node-local caches
Move search/terminal configs into configs/glm45air/ alongside swe.toml (rebased
from exp/scaleswe-lp). All three: seq_len/max_model_len -> 131072; drop default
inference args (gpu_memory_utilization, enable_prefix_caching) and eval
skip_first_step; node-local caches (/tmp/.{vllm,triton,flashinfer}-cache-$(whoami)).
search/terminal get the linear length penalty at 0.1 on all three terms.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: terminal-lego train env + Qwen3-235B judge for search envs
- terminal.toml: train env -> terminal-lego-v1 (drops openthoughts-tblite + uuid-ctf);
eval stays terminal-bench-2-v1 only.
- research-environments submodule -> feat/terminal-lego-v1-port (adds terminal-lego-v1);
registered in pyproject envs extra + tool.uv.sources; uv.lock updated.
- search.toml: judge -> Qwen/Qwen3-235B-A22B-Instruct-2507 (temperature 0) on all six
search envs (judge client already defaults to PI inference).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: add papersearchqa held-out test eval, cap large evals at 500, drop default project_dir
- search.toml: add papersearchqa `test` split as an eval env (held-out signal);
cap browsecomp (1266) and papersearchqa-test (5000) evals at num_examples=500.
- drop `project_dir = "."` from all three configs (it is the SlurmConfig default).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: split wandb projects (search-ablations / terminal-ablations); drop stale length-penalty comment
- search.toml -> wandb project "search-ablations"; terminal.toml -> "terminal-ablations".
- remove the stale "GRPO + linear length penalty (... default weights)" comment (weights are 0.1).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: static node-local cache dirs (drop $(whoami))
inference.env_vars are passed literally to vLLM (not shell-expanded), so
"$(whoami)" landed verbatim in the FlashInfer ninja build path and broke it
("bad $-escape"), disabling the allreduce-norm fusion. Nodes are exclusive, so
per-user suffixes are unnecessary: use static /tmp/.{vllm,triton,flashinfer}-cache.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: search judge uses default sampling (drop temperature=0 override)
Remove sampling={temperature=0} from the Qwen3-235B judge on all search envs;
keep the model override, let the judge use its default sampling.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: search+terminal batch_size 256->512, max_inflight 512->768
Raise per-step batch (256->512 groups) and inflight-rollout concurrency
cap (512->768) for both glm45air search and terminal ablations. The
prior 512 cap sat ~42% utilized under the weight-sync barrier, so lift
concurrency and grow the batch to keep inference busier per step.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: search v2 run — job/wandb name glm45air-search-v2
Fresh search ablation from step 0 on the pulled branch (vLLM 0.24 +
dispatch-gate fixes) with the new 512 batch / 768 inflight config.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: hardcode prime sandbox cleanup label in glm45air configs
Decouple pre_run_command's sandbox-delete label from $SLURM_JOB_NAME and
pin it to each run's harness label. Fixes search.toml, where job_name
(glm45air-search-v2) diverged from the harness label (glm45air-search),
so pre-run cleanup targeted a label no sandbox carried.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: search v2 — train openseeker+redsearcher, eval browsecomp, batch 256 / concurrency 512
Trim search train set to openseeker + redsearcher and eval to browsecomp
only. Drop orchestrator batch_size 512->256 and max_inflight_rollouts
768->512 to match the swe runs (was over-driving inference).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp: search v3 — rlm auto-compaction (train draw 65536-131072 per task, eval fixed 98304)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* exp: terminal train on tmax-v1; eval swebench-verified + terminal-bench-2
- swap terminal train env terminal-lego -> tmax-v1 (TMax Harbor taskset)
- eval both swebench-verified and terminal-bench-2 every 20 steps
- bump research-environments to latest main (adds the tmax-v1 taskset)
- bump verifiers to origin/main (dev422), required by latest research-envs
(browsecomp-v1 + others now pin verifiers>=0.1.15.dev422)
- register tmax-v1 in pyproject envs + sources; relock
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* exp: search v3 — migrate judge config to plugged judges list (post vf-bump schema)
openseeker/redsearcher: taskset.judge is gone; declare [[taskset.judges]] reference
entries (reward key 'correct', A/B verdicts, Qwen3-235B judge model). Note the
taskset-plugged BC-style prompt is replaced by the reference judge's stock prompt.
browsecomp keeps its taskset.judge field (still valid on BrowseCompConfig).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* exp: terminal v2 — bump job + wandb name to glm45air-terminal-v2
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* exp: keep base run names in configs — version suffix goes on the launch CLI
(--slurm.job-name / --wandb.name, e.g. glm45air-search-v3)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* exp(glm45air): terminal + search ablation config updates
terminal:
- terminal-bench-2 eval at avg@4 (group_size=4)
- add weight-0 rlm + swe rubric monitors (GLM-5.2 judge) on train + eval envs
- drop length penalty on output tokens (input/turns kept)
- run prime runtime as micro-VM (vm=true)
search:
- add weight-0 rlm rubric monitor (GLM-5.2 judge) on train + eval envs
- drop length penalty on turns + output tokens (input kept)
- run prime runtime as micro-VM (vm=true)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp(glm45air): trim header comment blocks from search + terminal configs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp(glm45air): drop tmax taskset inline comment
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp(glm45air): disable idle_timeout on vm prime runtimes
The Prime API rejects idle_timeout_minutes for VM sandboxes (HTTP 422),
and the prime runtime defaults idle_timeout to 1h. A debug eval rollout on
scaleswe-v1 + swebench-verified-v1 (vm=true, use_prime_registry) failed at
provisioning until idle_timeout was cleared. Set idle_timeout = "None" on
every vm=true prime runtime (coerced to None; VM lifetime stays bounded by
timeout_minutes). Re-ran both envs: VM provisions, image pulls from the
prime registry, rollout runs to the 10-turn cap.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp(glm45air): run swe config on prime micro-VM
Match the terminal/search ablations: run scaleswe train + swebench-verified
eval on vm=true prime runtimes with idle_timeout = "None" (the Prime API
rejects idle_timeout_minutes for VM sandboxes). Also set use_prime_registry
on the scaleswe taskset so its image resolves from the Prime platform
registry (pullable on the VM), matching swebench-verified.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* exp(glm45air): comment out rlm/swe rubric monitors (vm-only test)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix: register tmax-v1 taskset in pyproject
The terminal ablation config references the tmax-v1 taskset, but the
package was never added to the envs extra, so config loading failed
with ModuleNotFoundError.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* exp: align swe/terminal ablation configs with search
- swe: length penalty on input tokens + turns only (drop output-token
term), matching terminal
- terminal: batch_size 256 / max_inflight_rollouts 512, matching
swe and search
- swe + terminal: rlm auto-compaction like search — train draws a
per-task threshold in [65536, 131072], eval compacts at 98304
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Change the default weight_broadcast type from 'filesystem' to 'nccl' in
RLConfig. When no weight_broadcast is explicitly configured:
- Default to NCCL broadcast (in-memory GPU-to-GPU transfer)
- Fall back to filesystem when LoRA is enabled (not yet supported with NCCL)
- Fall back to filesystem when no inference server is configured
Sub-config defaults (TrainerConfig, OrchestratorConfig, InferenceConfig)
remain filesystem since they are always overridden by RLConfig propagation
in the rl entrypoint, and standalone usage shouldn't default to NCCL.
Pin explicit filesystem broadcast in the multi-run integration test configs
that use standalone entrypoints with LoRA.
Update docs to reflect the new default.
* chore(deps): bump verifiers to fab50d51
Picks up feat: record runtime info on the trace (verifiers#1959) — every
trace now carries its runtime's full config plus the provisioned resource
id — and the results.jsonl -> traces.jsonl rename (verifiers#1956).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(orchestrator): save all rollouts, not just the batched ones
Rollout traces move from rollouts/step_N/{train,eval}_rollouts*.jsonl to
traces/{train,eval}/{all,effective}/:
- all/traces.jsonl is a flat run-level stream appended the moment each
rollout completes — errored, filtered, and never-batched rollouts
included — so it is durable across crashes and drains.
- effective/step_N/traces.jsonl is written on batch finalize as before,
but now holds only the clean subset that shipped to the trainer (eval:
the non-errored epoch cohort; multiple eval envs share the step file).
Rollout.to_record() now includes the orchestration metadata (kind,
env_name, group_id, policy_version, eval_step) so records in the flat
all stream can be placed without relying on the file path. Together with
the verifiers bump, each record also carries the runtime info (config +
sandbox id), so sandbox errors can be correlated from the all stream.
The all streams have no per-step layout, so resume can't rewind them;
they are wiped on fresh runs only. The per-step effective files rewind
past the resume step exactly like the rollout dirs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor(orchestrator): nest trace files under per-step directories
traces/{train,eval}/... -> traces/step_N/{train,eval}/{all,effective}/
traces.jsonl. Train arrivals attribute to the batch window currently
collecting (progress.step), eval arrivals to their eval trigger step, so
the all files stay append-per-rollout. Per-step layout also lets resume
rewind traces past the resume step exactly like rollouts and broadcasts.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor(orchestrator): nest trace files under the rollout dir
traces/step_N/{train,eval}/... -> rollouts/{train,eval}/step_N/
{all,effective}/traces.jsonl. No separate traces/ top-level dir; the
per-kind subtrees coexist with the trainer-bound rollouts/step_N/*.bin
transport files and rewind on resume like the other step directories.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor(orchestrator): order trace files step-first under the rollout dir
rollouts/{train,eval}/step_N/... -> rollouts/step_N/{train,eval}/
{all,effective}/traces.jsonl, next to the step's train_rollouts.bin.
The existing per-step rewind on the rollout dirs covers the traces
again, so clean_future_steps needs no extra entries.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(examples): update disaggregated configs to use prefill/decode_nodes_per_replica
The derive inference node counts PR (#2959) renamed num_prefill_nodes →
prefill_nodes_per_replica and num_decode_nodes → decode_nodes_per_replica
in the config schema, and made deployment.num_infer_nodes auto-derive
from inference.deployment.num_nodes. The configs/ and docs/ were updated
but examples/ was missed.
- glm5_llmd/rl.toml: num_prefill_nodes=8 → prefill_nodes_per_replica=2
(8 ÷ 4 replicas), num_decode_nodes=8 → decode_nodes_per_replica=8,
remove num_infer_nodes (auto-derives to 16)
- glm5_pd_disag/rl.toml: num_prefill_nodes=4 → prefill_nodes_per_replica=4,
num_decode_nodes=4 → decode_nodes_per_replica=4, remove num_infer_nodes
(auto-derives to 8)
* refactor: remove backward-compat shim for old disaggregated node field names
The normalize_node_counts before-validator silently accepted the old
num_prefill_nodes / num_decode_nodes field names and converted them to
prefill_nodes_per_replica / decode_nodes_per_replica. This made it
impossible for CI to detect stale configs still using the old names —
parsing succeeded silently instead of failing with a validation error.
Now that all in-repo configs and examples have been updated to use the
new field names, remove the shim so old names are rejected as
extra_forbidden by pydantic, turning future regressions into CI failures.
* refactor: share trace_to_sample with verifiers in the prime monitor
Replace the monitor's hand-rolled v1-trace -> sample conversion in
`_rollouts_to_parquet_bytes` with `verifiers.v1.samples.trace_to_sample`, the same
canonical converter verifiers' eval `uv run eval --push` uses. Both producers now emit
one identically-shaped sample record; the RFT-only parquet columns (run/step/advantage/
problem_id/env_name) are layered on here. Behavior-preserving: the parquet schema and all
column values are unchanged (verified against the existing monitor unit tests).
Bumps the deps/verifiers submodule to the verifiers PR that adds `trace_to_sample`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: bump deps/verifiers (drop trace_to_sample unit test)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (run-metrics aggregation + main merge)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (inline push run-metrics)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (drop URL from push log)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (platform sample/metric shape fixes)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (compute_metrics docstring)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (per-rollout reward columns)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (crash-safe --push upload)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (drop trajectory reward + reward-name suffixing)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (num_examples in push metadata)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: bump deps/verifiers (trace_to_sample folded into push.py)
samples.py was dropped on the verifiers branch - trace_to_sample now
lives in verifiers.v1.push
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Bump both submodules to their current upstream main:
- verifiers: 50883f16 -> a497ee52
- research-environments: 404f0fa8 -> 3e3b5ac3
Reconcile pyproject/uv.lock with upstream changes:
- research-environments moved the SWE tasksets under environments/swe/,
so repath r2e-gym-v1, scaleswe-v1, swebench-pro-v1, swebench-verified-v1
and swelego-v1 to environments/swe/<name>.
- research-environments removed the v0 general_agent and rlm_search envs
(#646), so drop general-agent and rlm-search from the `envs` extra and
[tool.uv.sources]. general-agent-v1 is unaffected.
verifiers is consumed only via the verifiers.v1 namespace; the removed
verifiers.rl / verifiers-rl code and the RolloutContext->ModelContext
rename do not touch prime-rl. Verified `uv sync --extra envs` resolves,
all 64 env dists install, the moved SWE envs import, and prime-rl's
verifiers.v1 imports (incl. EnvConfig(vf.EnvServerConfig)) still work.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(orchestrator): train shared sampled nodes exactly once across branches
trace_to_samples built one sample per branch using branch.sampled_mask
directly, so a sampled node lying on N branches (a mid-trajectory fork)
was mask-True in N samples and received N x the gradient weight. Grant
each sampled node its mask only in the first branch containing it; later
branches carry its tokens as context (mask False). No behavior change
for traces whose branches share only input nodes.
* fix(orchestrator): keep echo branch/sample zip aligned under fork dedup
Extract the dedup'd branch selection into iter_trainable_branches and use
it in both trace_to_samples and EchoAlgorithm._weight_observations. When
a later branch's only sampled tokens are on an already-trained shared
node, it yields no sample; echo's old any(branch.sampled_mask) filter
would still count it, shifting the zip with rollout.samples on forked
traces.
* feat(trainer): fp32 MoE router gates via model.moe_router_dtype
Add model.moe_router_dtype = "float32" to run MoE router gates in fp32,
matching checkpoints trained with fp32 routing (e.g. GLM-5.x via Megatron's
--moe-router-dtype fp32):
- router gate weights are cast to fp32 and exempted from the FSDP bf16
parameter cast via a nested fully_shard unit with an fp32 mp policy
(gradients also reduce in fp32)
- TokenChoiceTopKRouter upcasts the gate GEMM input to fp32, so routing
logits are fp32 end-to-end in forward and backward (NemotronHRouter
already computes in fp32; it only needed the weight exemption)
- router FSDP units join the manual EP prefetch schedule
Default "bfloat16" preserves current behavior exactly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(inference): fp32 MoE router logits for DeepSeek-family models
Add inference.enable_fp32_router_logits (default off): sets
out_dtype=float32 on vLLM's DeepseekV2MoE gate via a monkey patch, so the
bf16xbf16 gate GEMM writes its fp32 accumulator out unrounded instead of
truncating router logits to bf16 before expert scoring (GateLinear's
cuBLAS tier on SM90+). Covers GLM-5.x (glm_moe_dsa), which was trained
with fp32 routing; pairs with trainer.model.moe_router_dtype="float32".
Unlike upstream's full fp32 gate (vllm-project/vllm#47410, not in the
pinned release), the gate weight stays bf16, so the LoRA Triton kernel
dtype assert and the bf16 weight-broadcast path are unaffected. Follows
the fp32_lm_head pattern: flag flows through additional_config and the
patch self-gates at model construction. No-op when something else (e.g.
the ROCm AITER branch) already set an out_dtype.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat: default fp32 MoE routing on (trainer + inference)
Flip model.moe_router_dtype to "float32" and
inference.enable_fp32_router_logits to true by default. Routing logits
are no longer rounded to bf16 anywhere: custom-impl MoE trainers run
fp32 gate weights/GEMM, and DeepSeek-family vLLM models emit fp32
router logits. apply_fp32_moe_router is now a silent no-op for non-MoE
and HF-impl models (previously raised), since the default makes absent
custom MoE routers the common case.
Set moe_router_dtype = "bfloat16" / enable_fp32_router_logits = false
to restore the previous numerics.
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>
Pulls in renderers#97 (laguna-xs-2.1 renderer variant: XS-2.1's template
drops the baked-in default system message) and renderers#94 (multimodal
payload through build_training_sample). No renderers dependency changes,
so uv.lock is untouched.
At the locked rev (bd67d11, June 22) fla's tilelang chunk_bwd_dqkwg fails to
JIT for sm_90a (tvm InternalError: Get different layout for b_dq), and the
Triton fallback is guard-blocked on Hopper (wrong dg/db/dk, fla#640) — so any
GDN model (Qwen3.5-MoE, Qwen3-Next) crashes at the first backward on H100/H200.
Upstream fixed the kernel in fla#975 (June 29). fla is an unpinned git dep, so
this is a lock-only refresh: bd67d11 -> a954753.
Co-authored-by: fares <fares@primeintellect.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>