For discussion: this is the MFU accounting used in the Qwen3-235B
prime-rl vs torchtitan benchmarks (#3753, #3754), so that both stacks
report comparable numbers. Opening it as its own PR so we can decide
whether to adopt it as the trainer's metric.
## What changes
1. **Attention FLOPs use the real head dim.** `PerfCounter` counted
attention as `12 * layers * heads * (hidden_size / heads) * seq`. For
models whose `head_dim` is not `hidden_size / num_attention_heads` that
undercounts: Qwen3-235B-A22B has head_dim 128 but hidden/heads = 64. The
new term is torchtitan's `quadratic_attention_flops_per_token`: `6 *
layers * heads * (qk_head_dim + v_head_dim) * seq`, with the MLA qk/v
head dims when the config has them. Identical to the old value when
head_dim == hidden/heads.
2. **SFT throughput and MFU are per step over the full step wall time**,
including the optimizer step, as torchtitan reports with `log_freq=1`.
Before, they came from a 10-step sliding window over forward/backward
time only. The RL trainer is unchanged and still reports over
forward/backward time.
## Effect
- Qwen3-235B-A22B at seq 8192: 167.3 -> 205.1 GFLOP/token; at 16384:
280.8 GFLOP/token. Logged MFU on such models goes up accordingly, so
dashboards and the benchmark tables in
`benchmarks/results/BENCHMARKS.md` are not directly comparable across
this change.
- Two expected values in `tests/unit/train/test_perf.py` updated
(Qwen3-0.6B: head_dim 128 vs hidden/heads 64; the debug MoE likewise).
## Caveat worth discussing
Both formulas charge dense causal attention. On packed short documents
with varlen attention the executed attention FLOPs are far lower, so
absolute MFU is overstated for both stacks (roughly 2x at seq 16k on the
235B bench). Counting executed FLOPs from the packed sequence lengths
would be a separate change.
Removes the full-offload `cpu_optimizer_backend = "torch"` path and
folds the two gradient offload managers in `trainer/optim/offload.py`
into one.
**Why:** there were two offload pipelines doing the same job. The native
backend covers the same optimizers (AdamW, SignSGD). `test_cpu_adam.py`
already checks native AdamW directly against fused torch AdamW. The
torch backend was only a debug/parity fallback (#3234).
**Changes**
- `GradientOffloadManager` is now the former
`BoundedGradientOffloadManager` (pageable FP32 accumulators, bounded
pinned transfer rings). The base methods it still used
(`optimizer_overlapped`, `gradient_scale`, `scale_`, `clip_grad_norm_`,
`load_cpu_chunk`) are moved into it. The base-only slab-pinned
accumulator/staging pipeline is deleted. `load_cpu_chunk` drops the
scale/assign/staging options that only the torch path used.
`release_chunk` is removed: on the native path it only cleared grads
that were already `None`.
- `FullCPUOffloadOptimizer`: removed the fused/foreach torch-AdamW step
(`_step_chunk`, `_prepare_fused_cpu_adamw`), the torch state warm-up
step, and all native/torch branching.
- `_create_cpu_master_weights`: removed the `pin_memory` option. FP32
masters are always pageable, as they already were on the native path.
- Removed `model.full_offload.cpu_optimizer_backend` from
`OptimizerInBackwardOffloadConfig`, plus its config test and the mention
in `skills/training/start-run/SKILL.md`.
Native AdamW and native SignSGD numerics and pipeline order are
unchanged.
**Breaking:** `model.full_offload.cpu_optimizer_backend` is removed. Any
value, including `"native"`, now fails config validation.
**Validation**
- `ruff check .` and `ruff format --check .`
- `pytest tests/unit/train/test_cpu_adam.py tests/unit/test_configs.py
tests/unit/train/test_state_offload.py -m "not gpu"`: 209 passed. This
includes the 3 `test_cpu_adam.py` tests (C++ extension built on CPU).
- Not run (no GPU on this machine). GPU checks still needed:
- `reverse-text-sft/full-offload-resume` integration test, including the
resume step
- one RL full-offload step each with AdamW and SignSGD: loss matches
main, and the `Offload pipeline` timing logs appear
- synchronous `step()` path at validation and checkpoint boundaries
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **High Risk**
> Large refactor of full CPU optimizer offload (gradients, stepping,
checkpoint load) with a breaking config removal; native numerics are
claimed unchanged but GPU integration tests are still needed.
>
> **Overview**
> Removes the debug **Torch** full-offload path and makes **native** CPU
AdamW/SignSGD the only implementation for `model.full_offload`.
>
> **Breaking:** `model.full_offload.cpu_optimizer_backend` is gone
(including `"native"`). `[model.full_offload]` now only exposes options
like **`numa_bind`**.
>
> The two gradient offload implementations are collapsed into a single
**`GradientOffloadManager`**: the old slab-pinned accumulator/staging
hook pipeline is deleted; the bounded pinned D2H/H2D ring with pageable
FP32 accumulators becomes the only manager.
**`FullCPUOffloadOptimizer`** no longer branches on backend—no fused
Torch `optimizer.step()` per chunk, no torch state warm-up, and
**`load_cpu_chunk`** is simplified.
>
> FP32 CPU master weights are always **pageable** (`pin_memory` removed
from `_create_cpu_master_weights`). Docs and the config test for the
torch backend are updated accordingly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
530cc3c380f44229c16374963a85ccf5bd0371bf. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Register all vLLM monkeypatches in one place: the `vllm.general_plugins`
entry point (`apply_shared_vllm_patches`).
Before this PR, patches in `inference/patches.py` were applied from
three places: the plugin, import-time calls in
`inference/vllm/server.py`, and import-time calls in
`inference/vllm/worker/__init__.py`.
`monkey_patch_nano_v3_reasoning_parser` ran twice. Having three places
makes it hard to see which patches are active in which process.
## Design
- `apply_shared_vllm_patches` now applies every patch: the existing
ones, plus `tokenize_params_validation`,
`strip_routed_experts_from_chat`, `dp_coordinator_startup_timeout`
(moved from server.py) and `minimax_m2_for_lora` and the
`PRIME_NO_MOE_LORA`-gated `no_moe_lora` (moved from worker/__init__.py).
- `server.py` no longer applies patches at import time.
`worker/__init__.py` is now empty.
- Patch bodies are unchanged. No patch was removed. One docstring was
reworded because it said "import time".
In vLLM 0.30 the plugin runs once per process (guarded by
`plugins_loaded`), in every vLLM process type:
- API server main process: `make_arg_parser` ->
`AsyncEngineArgs.add_cli_args` -> `load_general_plugins()`. This happens
inside `server()` after `PRIME_NO_MOE_LORA` is set and before arg
validation, so `reasoning_parser = "nano_v3"` is registered in time.
`server()` is the first point that loads plugins (checked on CPU).
- Extra API server processes (`api_server_count > 1`):
`AsyncEngineArgs.from_cli_args` -> `EngineArgs.__post_init__` ->
`load_general_plugins()`. This runs before the app and
`OpenAIServingChat` are built.
- Engine core: `v1/engine/core.py`. Workers:
`WorkerWrapperBase.init_worker`, before `worker_extension_cls` is
resolved. The worker module used to apply its patches only at that later
point.
Every patch replaces methods or attributes on vLLM classes, so it has no
effect in process types that do not use that class. The difference is
that some patches now also run in more process types than before. For
example, server-only patches now also run in engine and worker
processes, and the MiniMax LoRA patch now also runs in the API server.
Nothing needed an exception.
`no_moe_lora` stays on the `PRIME_NO_MOE_LORA` env var. The plugin takes
no arguments and runs before any vLLM config exists. The env var set in
`server()` is the simplest way to reach the engine and worker processes.
A config path would need a new channel into the workers.
## Breaking changes
None intended. Accepted and resolved configs are unchanged. The only
behavior change: the `PRIME_NO_MOE_LORA=1/0` info log line in workers is
gone. If `VLLM_PLUGINS` is set and does not include `prime_rl`, vLLM
skips all patches, and that now includes the server and worker patches.
Nothing in the repo sets `VLLM_PLUGINS`.
Also removed: the dead `logger = get_logger()` in `server.py`. The next
line overwrites it. The inference entrypoint already calls
`setup_logger` before it imports `server.py`, and `get_logger()` sets up
the logger lazily on first use anywhere else.
## Validation
- CPU script (not committed). It loads the `vllm.general_plugins` entry
points through `vllm.plugins.load_general_plugins()` and checks that the
moved patches are applied: TokenizeParams, OpenAIServingChat,
DPCoordinator, MiniMaxM2MoE/`hf_to_vllm_mapper`, nano_v3 parser
registered. With `PRIME_NO_MOE_LORA=1`, FusedMoEConfig is patched. With
`0`, it is not.
- CPU check: importing `prime_rl.entrypoints.inference` and
`prime_rl.inference.vllm.server` does not load plugins. So in the API
process, the plugin first runs at `make_arg_parser` inside `server()`.
- `pytest tests/unit/inference
tests/unit/transports/test_nccl_broadcast.py -m "not gpu"`: 20 passed.
- `ruff check .` and `ruff format --check .` pass.
- Not run: GPU and integration tests (no GPU on this machine). GPU
checks needed before merging:
- Single API server `rl` run: a prompt with prompt + max_tokens >
max_model_len is accepted, and chat responses contain no
`routed_experts`.
- `api_server_count > 1`.
- MiniMax-M2 LoRA, and non-expert LoRA (`no_moe_lora` reaches the
workers).
- Multi-node DP coordinator startup timeout is 300s.
- The server starts with `reasoning_parser = "nano_v3"`.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches every vLLM process startup path and timing of patch
application; mis-timed plugin load or a broken entry point would
silently skip all patches, including ones that previously ran only in
the API server or workers.
>
> **Overview**
> **Consolidates vLLM monkeypatches** so they all run from
`apply_shared_vllm_patches` (the `vllm.general_plugins` entry point)
instead of being split across `server.py` import time and
`worker/__init__.py`.
>
> Patches moved into the plugin include tokenize validation, stripping
`routed_experts` from chat completions, DP coordinator startup timeout,
MiniMax M2 LoRA fixes, and the `PRIME_NO_MOE_LORA`-gated `no_moe_lora`
path. **`server.py` no longer applies patches at import** (and drops the
dead duplicate logger); **`worker/__init__.py` is cleared** so workers
rely on the plugin. `server()` still sets `PRIME_NO_MOE_LORA` before arg
parsing so the plugin can honor it when vLLM loads general plugins.
>
> Patch logic is unchanged; the main behavioral shift is **where and
when** patches run (once per vLLM process via the plugin, including
process types that previously only got a subset). Worker info logs for
`PRIME_NO_MOE_LORA` are removed.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
dfaca8f493afeac2cf203f14e63bb1b0dbf43078. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Merged `main` at `e094f0860`. Main's expert parameters remain in the
transformer block's FSDP group; prefetching retains that behavior and
Qwen3.8's final hyper-connection mixer handling. Adds Qwen3.8 Flash Next
text training for `qwen4_exp` and `qwen4_exp_text`: hyper-connection
residual streams, Gated DeltaNet, indexed sparse attention, PLE N-gram
embeddings, and sigmoid-gated MoE, with HF checkpoint conversion.
## Head parallelism
PLE uses ordinary `nn.Embedding` parameters. `EmbeddingParallel`, an
external `RowwiseParallel` style, shards vocabulary rows across
`dp_shard_cp`, independently of EP. FSDP handles precision, replication,
and parameter lifetime on the complementary mesh. Packed token lengths
can differ across data ranks, so the style pads before collectives and
crops local outputs. The requested TODO marks the host synchronization
needed to size this padding.
When the head mesh has size one, the embedding follows ordinary FSDP and
no extra head dimension is created. The extra head axis is appended
after the existing world-mesh dimensions, preserving their indices.
Optimizer code is unchanged. Dion indexes each parameter's DTensor mesh,
not the root mesh; its momentum tensors retain the parameter placements.
Four-rank CPU/Gloo checks against main passed for six
DP/EP/CP/replication layouts, including momentum local shard sizes and
head-parallel state. Qwen3.5 and the shared MoE implementation are
unchanged; Qwen3.8's gated MoE lives in its own model package. Skills
and unrelated comments are unchanged.
## Required integration changes
- **Gradient clipping:** TorchTitan separates dense and EP gradients but
cannot combine the additional head mesh: its `aten.stack` raises “All
operands … must have the same mesh.” Resolve norms separately on each
DTensor mesh, then combine them into one global L2 norm and apply the
existing clipping formula. This is the same clipping mathematics; no
threshold, optimizer, `optimization_dtype`, or `reduce_dtype` changes.
The two-rank CPU/Gloo reproduction fails with the original helper and
matches the unsharded norm reference after mesh reductions. B300
gradient/update parity passed in SLURM 1440.
- **NCCL buffers:** a PLE-containing layer requires a 100.26 GiB
concatenation under the original protocol. Bound same-dtype groups to
512 MiB and send larger individual tensors without a concatenation copy.
Small groups retain the same collective count. Prior two-GPU A/B receive
medians were 0.365/0.367 ms at 128 MiB, 1.032/1.033 ms at 512 MiB, and
2.027/1.707 ms for a 1 GiB tensor plus small tensors (original/bounded;
SLURM 1347).
- **vLLM compatibility:** filter PLE checkpoint pieces with no overlap
on the local TP rank before vLLM's deferred loader buffers them. The
original loader still handles valid local pieces and malformed shards.
The generic reload machinery is unchanged. Real Qwen PLE reload values,
storage identity, and queue behavior passed on four GPUs (SLURM 1352).
- **Model setup:** register the config/model, freeze its sparse indexer,
wrap its final hyper-connection mixer with FSDP, and register its
indexed-attention operators with activation checkpointing. `vlm.py` only
supplies composite-config text-backbone lookup; this PR adds text
training, not a vision implementation.
## Validation
The merge with `e094f0860` was checked for unresolved conflicts and
whitespace errors; tests were not rerun. The results below remain from
their stated pre-merge commits/jobs.
SLURM **1442** completed successfully at cleanup commit `e50e42316`
(exit `0:0`, 3269 seconds including startup/shutdown). The prerequisite
four-B300 mesh/Muon-state/vLLM-reload check **1440** also passed.
- Official Qwen3.8 Flash Next checkpoint; 16 trainer B300 GPUs and TP8
inference.
- **20 math RL steps, batch 64**, group 4, `math-env` /
`PrimeIntellect/Hendrycks-Math` training split, debug algorithm, default
policy lag 8.
- **GPU memory utilization 0.85**, CUDA graphs and default vLLM
batching. Context 4096, completion limit 3072, thinking disabled;
SignSGD at `1e-6`, BF16 router projections on both sides, unchanged FP32
optimization/reduction defaults.
- GPU-resident PLE on vLLM 0.30 with explicit
`engram_config.cpu_offload=false`. NCCL transfers, no checkpoint saves
or filesystem weight transfer. `FLA_DISABLE_TENSOR_CACHE=1` is explicit
in the run environment; launcher defaults are unchanged.
- All 20 mean mismatch KL values are below **0.015**. Maximum
**0.001570820**; mean across steps **0.000701912**.
- Median warmed-up step **56.1s**, median broadcast **41.5s**.
- SLURM 1440 checked dense/EP/head norms, clipped gradients and
parameter updates against full-tensor references, plus uneven token
counts, replication/CP topologies, FSDP CPU offload, Muon momentum shard
sizes against main, and vLLM 0.30 PLE reloads. The original clipping
helper reproduced the mixed-mesh error; dense/EP-only norms matched the
original helper.
- Four config/checkpoint conversion cases, unchanged single-rank Muon
construction, Ruff and whitespace checks passed.
- Artifacts: `outputs/qwen38-validation/runs/qwen38-math20-main-gpu/`
(`validation-summary.json`, `mismatch-kl.md`, resolved configs and
logs); mesh log `outputs/qwen38-validation/rebased-head-1440.log`.
| Step | Mean mismatch KL |
| --- | ---: |
| 1 | 0.000282296 |
| 2 | 0.000228267 |
| 3 | 0.000326421 |
| 4 | 0.000275441 |
| 5 | 0.000435869 |
| 6 | 0.000398891 |
| 7 | 0.000725010 |
| 8 | 0.000521352 |
| 9 | 0.001052707 |
| 10 | 0.000689109 |
| 11 | 0.000823852 |
| 12 | 0.000369604 |
| 13 | 0.001008985 |
| 14 | 0.000577958 |
| 15 | 0.001168500 |
| 16 | 0.000841276 |
| 17 | 0.001036190 |
| 18 | 0.000672617 |
| 19 | 0.001570820 |
| 20 | 0.001033083 |
## Kernel dependency
[prime-kernels
#8](https://github.com/PrimeIntellect-ai/prime-kernels/pull/8) is merged
and released as
[v0.1.0-6f48176](https://github.com/PrimeIntellect-ai/prime-kernels/releases/tag/v0.1.0-6f48176).
Both x86_64 and aarch64 wheel URLs and SHA256 hashes are pinned in
`pyproject.toml` / `uv.lock`; the submodule matches release commit
`6f48176`. The release tree is identical to the `7bd1e89` source used in
the 20-step math run above, and the indexed-attention Python files in
both downloaded wheels match that source byte for byte.
The release wheel installed successfully with `uv sync --all-extras
--all-packages --frozen`; `uv lock --check` and `git diff --check`
passed. B300 validation of the installed x86_64 release wheel (SLURM
1468) passed forward/backward numerical comparisons, selection and tie
handling, fullgraph forward/backward compilation, and selective
activation checkpointing. The 20-step KL table above remains from SLURM
1442; it was not rerun for this wheel-only update.
The temporary Qwen overlap shim can be removed when pinned vLLM includes
the overlap check in `Qwen4ExpNGramEmbedding.load_weights`.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Large new model and head-parallel embedding path, plus mesh-aware
gradient clipping and NCCL bucketing that can affect any run using these
parallelism modes or very large PLE layers.
>
> **Overview**
> Adds a **native trainer implementation** for Qwen3.8 Flash Next
(`qwen4_exp` / `qwen4_exp_text`): hyper-connection residual streams,
Gated DeltaNet linear layers, **indexed sparse attention** (via
`prime_kernels`), PLE N-gram embeddings, and sigmoid-gated MoE, plus
HF↔Prime checkpoint conversion (including sharded `ngram_embedding`
weights).
>
> **Distributed setup** introduces vocabulary-parallel
**`EmbeddingParallel`** for PLE embeddings on a new **head** mesh
(`dp_shard_mod_head`), FSDP on those tables, freezing of
`SparseAttentionIndexer`, and FSDP/prefetch handling for the final
**`hyper_connection_mixer`**. Activation checkpointing now saves
**`prime_kernels`** indexed-attention ops.
>
> **Training/inference plumbing:** **`clip_grad_norm_`** computes norms
per DTensor mesh then combines them (replacing TorchTitan’s EP-only
helper). NCCL weight send/receive uses **`iter_tensor_buckets`**
(512 MiB) to avoid huge single concatenations. vLLM gets a **PLE shard
filter** patch so non-local TP pieces are skipped before load.
>
> Configs/models are registered in AutoConfig/custom LM/VLM maps;
`qwen4_exp` is listed in the VLM registry for composite configs (text
training only in this PR). Unit test covers config and checkpoint
round-trip.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e50e423169964b8e8a800a610cf8e77d4c56053f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: matejsirovatka <matejsirovatka@users.noreply.github.com>
Removes two small things:
- `trainer.model.fusions.raise_on_fail`. A requested fusion that no
module supports now always logs a warning and is skipped. The default
fusions list (`["gate_up", "qkv"]`) is applied to every model, including
models that lack those modules, so warning is the right single behavior
instead of a flag.
- Dead `ProgressTracker` class in `prime_rl/utils/logger.py`, plus the
`_progress` branch in `build_log_entry` that only it could reach.
Nothing in the repo, `deps/verifiers`, or `deps/prime-envs` references
them. JSON logging itself is unchanged.
**Breaking changes**
- `[trainer.model.fusions] raise_on_fail` is no longer a config field;
configs that set it will fail validation.
- `apply_model_fusions` no longer takes `raise_on_fail` and never raises
for unsupported fusions.
- `prime_rl.utils.logger.ProgressTracker` is removed.
**Validation**
- `ruff check .` and `ruff format --check .`
- `pytest tests/unit/train/models/test_fusions.py
tests/unit/test_configs.py tests/unit/utils -m "not gpu"` (CPU only; no
GPU on this machine, so GPU/integration tests were not run)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Config that set `raise_on_fail` will fail validation; fusion behavior
only softens (warn/skip). Logger removal is dead code with no callers.
>
> **Overview**
> Removes **`trainer.model.fusions.raise_on_fail`** and standardizes
runtime fusions: unsupported fusion names always **log a warning and are
skipped** instead of optionally failing startup.
**`apply_model_fusions`** drops the `raise_on_fail` argument and never
raises for missing module support; **`setup_model`** calls it without
that flag.
>
> Also deletes unused **`ProgressTracker`** and the JSON **`_progress`**
handling in **`build_log_entry`**—standard JSON logging is unchanged.
>
> Docs in **`advanced.md`** match the warn-and-skip behavior. Unit tests
now assert unsupported fusions return `{}` rather than raising.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ed70c99254a99460d4d582d001ce282ad2eb03b7. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Removes `configs/basic/` and the debug configs
`configs/debug/concurrency.toml` and `configs/debug/multi-env/`.
**Why:** `configs/basic/*` are dev-size copies of `examples/basic/*`,
and they have already drifted from them. For example,
`configs/basic/reverse-text/rl.toml` no longer has the eval block. The
remaining differences are GPU count, batch size and group size, which
can all be set from the CLI. No test runs these configs;
`test_configs.py` only checks that they parse, using a glob. Nothing in
the repo references the two debug configs, so they have no owner and
will drift the same way.
**Changes**
- Deleted
`configs/basic/{alphabet-sort,hendrycks-sanity,reverse-text,wiki-search,wordle}`,
`configs/debug/concurrency.toml`, and `configs/debug/multi-env/`. Kept
`configs/debug/{algo,eval,fake}`.
- `README.md`: the 2-GPU check now uses
`examples/basic/reverse-text/rl.toml`. That example already defaults to
1 trainer GPU + 1 inference GPU.
- `configs/README.md` / `examples/README.md`: removed the `basic/` and
`multi-env/` entries and the "smoke-tested" claim.
- `examples/basic/{wiki-search,wordle,hendrycks-sanity}/README.md`:
added the 2-GPU overrides `--deployment.num-train-gpus 1
--deployment.num-infer-gpus 1 --orchestrator.batch-size 128`. Inference
DP adjusts to the GPU count automatically.
**Breaking:** commands like `uv run rl @ configs/basic/...` no longer
work. Use `examples/basic/...`, with the overrides above for 2 GPUs.
**Validation**
- `rl @ examples/basic/{wiki-search,wordle,hendrycks-sanity}/rl.toml
--deployment.num-train-gpus 1 --deployment.num-infer-gpus 1
--orchestrator.batch-size 128 --dry-run`: all three resolve. For wordle,
the resolved inference has `data_parallel_size = 1`.
- `pytest tests/unit/test_configs.py -m "not gpu"`: 199 passed.
- `ruff check .` and `ruff format --check .`: clean.
- No GPU runs; this machine has no GPU.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation and config path removal only; users must switch to
example configs and optional CLI flags for 2-GPU dev runs.
>
> **Overview**
> Removes duplicate **`configs/basic/`** tutorial configs and two
unreferenced debug configs (**`concurrency.toml`**,
**`multi-env/rl.toml`**), so **`examples/basic/`** is the single source
for small end-to-end runs.
>
> **Breaking:** `uv run rl @ configs/basic/...` no longer works. The
root README’s 2-GPU stack check now uses
**`examples/basic/reverse-text/rl.toml`**. **`configs/README.md`**
documents **`debug/algo`**, **`fake`**, and **`eval`** only.
>
> For former 2-GPU **`basic`** setups, **`hendrycks-sanity`**,
**`wiki-search`**, and **`wordle`** READMEs document CLI overrides:
`--deployment.num-train-gpus 1 --deployment.num-infer-gpus 1
--orchestrator.batch-size 128`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4776cecdef44708f93c73075a5d57b5eb87a007f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Removes the KL penalty/regularizer term from the RL policy losses.
## What changed
- `IPOLossConfig.kl_tau` removed
(`packages/prime-rl-configs/.../configs/trainer.py`); `IPOLoss` no
longer adds `kl_tau * log_ratio^2` (`src/prime_rl/trainer/rl/loss.py`).
- `ref_kl_loss_fn`: removed the hard-coded `1e-3 * log_ratio^2` drift
regularizer. The `ref_kl` component itself (reverse KL to the reference
model as the PG signal for OPD/OPSD) is unchanged.
- `mismatch_kl` metrics are unchanged.
- Docs (`docs/algorithms.md` IPO formula + knob table, IcePop wording)
and `skills/configs/SKILL.md` updated.
- `tests/unit/train/rl/test_loss.py`: the IPO/IcePop reference test no
longer uses `kl_tau`.
No config or example in the repo set `kl_tau`, so there are no TOML
changes.
## Breaking / behavior changes
- **Breaking:** TOMLs that set `[trainer.loss] kl_tau` now fail
validation (extra field). Delete the line. `kl_tau` defaulted to `0.0`,
so runs that did not set it behave the same.
- **Behavior change (OPD/OPSD):** the `ref_kl` loss no longer has its
fixed `1e-3` squared-log-ratio regularizer. Gradients for `opd`/`opsd`
runs change slightly.
## Conflicts
Draft #3776 (removes PPO/CISPO) also touches `loss.py`,
`configs/trainer.py`, and the IPO default line in
`skills/configs/SKILL.md` (which mentions `kl_tau`). Expect a small
textual conflict there; resolve by dropping `kl_tau` from that line.
## Tests
- `pytest tests/unit/train/rl tests/unit/test_configs.py -m "not gpu"`:
214 passed, 25 deselected (GPU tests, including `test_loss.py`, which
needs CUDA, were not run).
- `ruff check` + `ruff format --check`: clean.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes core RL and on-policy distillation loss math; OPD/OPSD runs
will see different gradients, and TOMLs with `kl_tau` break at config
validation.
>
> **Overview**
> Removes squared log-ratio **KL penalty terms** from RL training so
policy losses are pure importance-weighted policy gradients (plus
existing trust-region masking).
>
> **IPO** drops `kl_tau` from `[trainer.loss]` and stops adding `kl_tau
* log_ratio²` in `IPOLoss`; configs that still set `kl_tau` will fail
validation. **OPD/OPSD** `ref_kl` keeps reverse-KL as the PG signal but
loses the fixed `1e-3 * log_ratio²` drift regularizer, so distillation
gradients change slightly. Docs (`docs/algorithms.md`,
`skills/configs/SKILL.md`) and unit tests are aligned; `mismatch_kl`
metrics are unchanged.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6e2f6f96f9aee85f66bed5d525ecac3ec6d4fe5b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Live MoE trace deltas contain binary `routed_experts` and
`sampling_mask` payloads. `FileMonitor.log_live()` currently serializes
those bytes through `default=str`, expanding them into escaped text and
adding serialization work to live monitoring.
Filter these two fields from copied node dictionaries inline before
writing live records, and omit `routing_repairs` since the corresponding
arrays are absent from those records. The original deltas and training
payloads remain unchanged; message content, token IDs, calls, semantic
links, dispatch metadata and scalar updates remain available to the live
reader.
Validation ran separately from this PR: two regression-test cases passed
against the deployed runtime dependencies, covering live-file
reconstruction, routing repairs, unchanged training inputs, and both
completion and discard cleanup. Ruff and `git diff --check` passed. A
saved trace with 188 deltas reconstructed successfully through the
patched `FileMonitor`. This PR contains only the inline logging fix; it
does not claim to resolve every source of orchestrator event-loop lag.
Additional CPU replay measurement on a saved routing-heavy delta:
serialization took **1.43–1.51 s before vs 0.040–0.055 s after**,
approximately **31× faster** at the median; serialized JSON shrank from
**306.8 MB to 31.8 MB**. These are serialization measurements, not an
end-to-end training speed claim.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Scoped to live-monitor serialization; training data and episode
logging are unchanged.
>
> **Overview**
> **Live trace JSONL writes no longer include MoE training payloads.**
>
> `FileMonitor.log_live()` now builds a display-only copy of each delta
before `orjson` serialization: it drops top-level `routing_repairs` and
strips per-node `routed_experts` and `sampling_mask`. Dispatch metadata
on open deltas is unchanged (`dispatch` is still attached when `"open"`
is present).
>
> Upstream deltas and training paths are untouched; this only shrinks
what lands under `traces/live/` and avoids turning large binary arrays
into escaped strings via `default=str`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ff8908b15dd2444474af8a4f3aaa04a1fa8e62ac. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## What does this PR do?
Moves `sign_sgd.py` from `prime_rl/trainer/` into
`prime_rl/trainer/optim/` so all optimizer implementations live in one
place. Pure file move — git detects a 100% rename so history and blame
are preserved. No functional changes.
Updated the three import sites:
- `trainer/optim/__init__.py`
- `trainer/optim/offload.py`
- `tests/unit/train/test_cpu_adam.py`
No other references to `prime_rl.trainer.sign_sgd` exist; configs, docs,
and example TOMLs use the `sign_sgd` optimizer type value, which is
unchanged.
## Validation
- `ruff check` and `ruff format --check` pass
- `tests/unit/train/test_cpu_adam.py` — 3/3 passed
- sign_sgd-related tests in `tests/unit/test_configs.py` — 13/13 passed
- Sanity-checked `SignSGD` imports and a full optimizer step from the
new path
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Import-path-only refactor with no logic changes; low risk if all call
sites were updated (verified no remaining `prime_rl.trainer.sign_sgd`
references).
>
> **Overview**
> **SignSGD** is relocated from `prime_rl/trainer/sign_sgd.py` into
`prime_rl/trainer/optim/sign_sgd.py` so it sits alongside the other
optimizer implementations. Behavior is unchanged; imports are updated in
`trainer/optim/__init__.py`, `trainer/optim/offload.py`, and
`tests/unit/train/test_cpu_adam.py` to use
`prime_rl.trainer.optim.sign_sgd`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
943a774d6ff8996476ef736a0f7ed8bb4d0df334. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
`model.moe_router_dtype` gains an `auto` value, the new default,
resolved per trainer at config-validation time:
- **RL → `float32`** (unchanged): keeps matching the fp32-routed
checkpoints RL trains from (e.g. GLM-5.x via Megatron
`--moe-router-dtype fp32`).
- **SFT → `bfloat16`** (new default): the gate GEMM runs in the model
compute dtype and the router no longer gets its dedicated fp32 FSDP unit
or fp32 full-offload policy.
Explicit `float32` / `bfloat16` still win in both trainers. Because
resolution happens in the `SFTConfig` / `TrainerConfig` validators,
`setup_model`, `setup_fsdp`, and the full-offload dtype policy needed no
changes, and the resolved-config JSON dump records the concrete dtype
(resume/repro never sees `auto`).
### Testing
- `uv run pytest tests/unit/test_configs.py`: 208 passed (includes
`test_load_configs` over every checked-in config file).
- End-to-end via `cli`: GLM-5.3 SFT (`base + math-10k`) → `bfloat16`;
wordle RL, GLM-5.3 `swe.toml`, GLM-4.5-air RL → `float32`; explicit
`--model.moe-router-dtype float32` on an SFT config is kept.
- `ruff format --check` / `ruff check` clean.
### Behavior change
MoE SFT runs (GLM-5.3 SFT, Qwen3.6 VLM SFT, Qwen3-30B SFT examples) now
train with a bf16 router by default; pin `moe_router_dtype = "float32"`
to keep the old behavior. RL behavior is unchanged.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> MoE SFT runs change default router numerics and FSDP layout; RL stays
fp32. Pin `moe_router_dtype = "float32"` on SFT to preserve prior
behavior.
>
> **Overview**
> Adds **`auto`** as the default for `model.moe_router_dtype`, resolved
at **config validation** in trainer-specific validators so dumps and
runtime never see `auto`.
>
> **RL (`TrainerConfig`)** still ends up on **`float32`** routing
(unchanged behavior vs the old default). **SFT (`SFTConfig`)** now
defaults to **`bfloat16`** for the MoE gate GEMM, avoiding the dedicated
fp32 router/FSDP path unless you set `moe_router_dtype` explicitly.
>
> Explicit **`bfloat16`** / **`float32`** overrides are unchanged. A
unit test locks in per-trainer resolution.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
bbbfc02947c60ab8e81b0fad853667d1633341c8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Why
Under expert parallelism the EP experts were their own FSDP unit nested
inside each transformer block. FSDP2 wraps its hooks in
`torch._dynamo.disable`, so dynamo graph-broke at the experts and the
MoE dispatch/combine glue and the activation-checkpointing policy ran
eagerly. On the Qwen3-235B SFT profile against torchtitan that was ~2.7
s/step of unfused elementwise and index kernels plus 3.4x the kernel
launches, and `compile.fullgraph=true` failed outright (job 1180).
torchtitan avoids this by sharding the experts over the EP-complement
mesh from the block's own `fully_shard` call.
## What
- The block's `shard_placement_fn` returns a `ShardPlacementResult` with
the `dp_shard_mod_ep` mesh for expert parameters. FSDP2 in torch 2.13
groups one unit's parameters by process group, so the experts still
all-gather and reduce-scatter over the EP-complement mesh, with no
nested unit and no hook inside the compiled block.
- The gradient divide factor is set on the block. With an fp32 reduce it
is the dense parameters' default divisor (`ReduceOp.AVG` over the shard
group), so dense numerics are unchanged; the experts keep dividing by
the full data-parallel size as before.
- Explicit EP prefetch lists drop the experts module.
- `compile.fullgraph=true` on a custom MoE model now requires
`moe_router_dtype="bfloat16"`: the fp32 router is still its own FSDP
unit inside the block. `setup_fsdp` raises early with that message. The
fp32-router default is unchanged.
## Benchmark
Qwen3-235B-A22B-Thinking-2507 SFT, 4 nodes x 8 B300, FSDP over 32 GPUs,
ep=8, seq 16384 (one packed sample per GPU per step), balanced routing,
AdamW fp32 states, full AC, 20 steps, steady state = steps 5..20, same
MFU formula in every row (280.8 GFLOP/token). Measured together with the
FA4 custom op (#3676 / the sibling `mario/optimize-fa4-custom-op` PR),
which fullgraph also needs on B300.
| run | s/step | MFU | tok/s/GPU | peak GiB |
|---|---|---|---|---|
| torchtitan 9e159aed7, fullgraph | 5.01 | 40.9% | 3273 | 144 |
| prime-rl before, graph breaks at the expert unit | 6.98 | 29.3% | 2347
| 140 |
| **prime-rl after, fullgraph** | **4.40** | 46.5% | 3726 | 141 |
| prime-rl before, real routing (job 1184) | 9.51 | 21.5% | 1724 | 142 |
| **prime-rl after, fullgraph, real routing (job 1461)** | **6.11** |
31.2% | 2681 | 141 |
Per-step losses match the previous runs on the same data order (balanced
and real routing). A rank-0 torch-profiler trace of the new step (4.46
s) vs the old one (7.26 s): eager MoE glue went from 2.95 s elementwise
+ 1.09 s index kernels to 0.62 s of inductor kernels, kernel launches
from 33.9k to 9.9k, and the per-op Python AC dispatch mode is gone. The
remaining step is GEMM 47%, the EP all-to-all 22% (still on the compute
stream, fully exposed), fused glue 14%, attention 7%. prime-rl is ahead
of torchtitan because torchtitan's compute stream idles 1.55 s waiting
on its 1.34 s all-to-all, while prime-rl's inline all-to-all takes 0.99
s.
Caveat: the MFU formula charges dense causal attention, but packed
documents make attention 0.2 to 0.3 s of the step in both stacks, so
absolute MFU is about 2x overstated for every row; the comparison is
unaffected. A 1-node Qwen3-30B-A3B fullgraph smoke run and
`tests/unit/train/models/test_moe.py` pass.
## Open
- fp32 router under fullgraph needs the router out of its own FSDP unit
(ignored params with a replicated fp32 gate and a manual grad
all-reduce, or a bf16 gate). Not decided here.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes distributed FSDP sharding and gradient divisors for EP MoE
blocks, which affects training numerics and performance paths;
misconfiguration now errors at setup instead of silent graph breaks.
>
> **Overview**
> **MoE + expert parallelism (EP) no longer uses a nested FSDP unit on
`experts`**, so `torch.compile(fullgraph=True)` can capture whole
transformer blocks without dynamo breaking on FSDP hooks inside the
block.
>
> Under EP, expert weights still shard on the EP-complement mesh via a
per-block `shard_placement_fn` that returns `ShardPlacementResult` for
expert parameters, while dense block params use the usual placement.
Gradient scaling moves to the **transformer block**
(`set_gradient_divide_factor`) instead of the removed experts submodule.
EP forward/backward **prefetch** lists drop explicit `experts` prefetch
and only add the fp32 **router** when it remains its own FSDP module.
>
> **Config/docs:** `CompileConfig.fullgraph` documents that custom MoE +
fullgraph needs `moe_router_dtype="bfloat16"`. **`setup_fsdp` fails
fast** if `compile.fullgraph=true` is combined with the default fp32
router, since that router must stay a separate FSDP unit inside the
compiled block.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d2f76357ccc0d893e3e7db69848738d3bf29b688. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Same change as #3676 on a `mario/optimize-*` branch, so the fullgraph
work lands as independent PRs; supersedes #3676.
## Why
FA4's `flash_attn_varlen_func` is a Python `autograd.Function` that
calls `torch._guards.active_fake_mode()`, which dynamo refuses to trace.
Under activation checkpointing each block is one checkpointed region, so
that graph break drops the whole block to eager for every FA4 model,
dense or MoE, and `compile.fullgraph=true` fails (job 1175).
## What
- Wrap FA4's varlen forward and backward in a
`prime_rl_attn::flash_attn_4_varlen` custom op with fake impls and
registered autograd, dispatched through `FlashAttention._funcs` like the
other versions.
- Add the `prime_rl_attn` namespace to the selective activation
checkpointing save list so attention is not recomputed in backward.
Needed, together with the sibling `mario/optimize-fsdp-expert-fold` PR,
for the Qwen3-235B result of 4.40 s/step vs torchtitan's 5.01 s at seq
16k on 4 nodes.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes the FA4 attention forward/backward path and autograd behavior;
incorrect custom-op wiring would affect training correctness, but scope
is limited to FA4 + compile/checkpointing.
>
> **Overview**
> Flash Attention 4 varlen is no longer called via FA4’s untraceable
Python `autograd.Function`. Forward and backward are wrapped in
**`prime_rl_attn::flash_attn_4_varlen`** (and a matching backward op)
with fake kernels and registered autograd, and **`FlashAttention`**
version 4 now dispatches through **`flash_attn_4_varlen_op`**.
>
> That avoids Dynamo graph breaks inside activation-checkpointed blocks
(which previously forced whole blocks to eager and broke
**`compile.fullgraph=true`**) and lets selective activation
checkpointing treat attention as an opaque op.
>
> **`prime_rl_attn`** is added to the selective checkpoint **save**
namespace list so FA4 attention outputs can be saved instead of
recomputed on backward.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
37cdea5d1e3eddcd99fab64c54101cf1c5c96833. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: sami jaghouar <sami.jaghouar@gmail.com>
**What**
- README Models-support table: CP for Qwen3 / Qwen3.5 VLMs was listed as
not supported (red cross) — changed to supported.
- Removed the stale 'Other HF causal LMs' row from the README table.
- Updated the same Qwen VLM CP claim in docs/advanced.md for
consistency.
**Why it's true**
CP works for the Qwen VLMs since #3099 (CP for hybrid + VLM SFT) and
#3103 (pack multimodal samples with CP): Qwen3_5ForCausalLM is the
unified class for the qwen3_5 / qwen3_5_moe VLM configs, cp_support()
returns ring + ulysses for them, and image grids / positions are sharded
under CP.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation-only changes to support matrices; no runtime or config
behavior is modified.
>
> **Overview**
> Updates the **Models support** tables in `README.md` and
`docs/advanced.md` so **Qwen3 / Qwen3.5 VLMs** show **context
parallelism (CP) as supported** (✅), replacing the outdated ❌ that no
longer matches trainer behavior after recent CP + multimodal work.
>
> The README also **drops the “Other HF causal LMs” row**, which was
redundant/stale relative to the family-specific table above it.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1f56cb4438ed93bf387a43019c4bd1982aa7f7f6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
SFT validation runs between backward and `clip_grad_norm_` (deliberate:
`torch.compile` sees the training graph first, and `eval_on_start`
evaluates untrained weights). The `[lm_head, norm]` FSDP2 group opts out
of `reshard_after_forward`, so the no-grad validation forward leaves it
unsharded. FSDP2 keeps the reduced gradients on the *sharded*
parameters, so `clip_grad_norm_` — which walks `model.parameters()` —
sees the grad-less unsharded parameters and skips them. The gradient
norm is too low on validation steps, and the skipped gradients are not
scaled.
Fix: reshard the FSDP modules right after `run_validation` (one call to
the existing `reshard_module` helper), before clipping. Affected runs:
SFT with `optim.max_norm` set and `[val]` enabled, on the GPU optimizer
or `optim_cpu_offload` (the `full_offload` path disables clipping by
config validation, and the RL trainer has no validation step between
backward and clipping, so both are unaffected).
Seen on prime-rl `7f9de649aa80` (GLM-5.3 SFT): on validation steps the
norm was 13.7% low (66.6 vs 77.2) and clipping saw 112 of 114
parameters.
- [ENG-6447](https://linear.app/primeintellect/issue/ENG-6447)
## Testing
- The GPU test that originally accompanied this fix was removed on
request; coverage of the reshard-before-clipping behavior now relies on
the external GLM-5.3 SFT run and the code-path trace in the ticket
below.
- `ruff check` + `ruff format` (v0.13.0, as pinned by pre-commit) pass
on the changed file.
- No CUDA locally, so the suite was not run here; nothing else in the
diff is behaviorally load-bearing beyond the 5-line fix.
## Notes for reviewers
- The 13.7% figure was measured on an external GLM-5.3 SFT cluster; we
could not reproduce it locally and did not try — the mechanism is
confirmed from the code path (see the Linear ticket for the full trace).
- `reshard_module` already existed in `trainer/model.py` but had no
callers.
## Summary
- add `[data.columns]`, which names the dataset columns the SFT trainer
reads. `messages`, `prompt`, and `completion` hold lists of OpenAI chat
messages and `tools` holds OpenAI function-calling schemas; each
defaults to today's name. `SFTDataset` reads the configured names per
row, so no dataset is rewritten up front. The defaults are optional
because a dataset carries either `messages` or `prompt`/`completion`; a
name set in the config must exist in the dataset
- add `[data.columns.renderer]`, a `renderer field = dataset column`
mapping that sets any renderer template control per sample, e.g.
`reasoning_effort = "effort"` for a dataset whose column is named
differently from the renderer field. It defaults to `reasoning_effort =
"reasoning_effort"` on the config. `RendererResolver` reads the mapped
columns per row and merges a row's non-null values through
`merge_chat_template_kwargs`, so the renderer's config validates them
and custom renderers' fields work too. Rows and datasets without a
mapped column use the configured renderer unchanged
- the trainer reads `tools` as OpenAI schemas as is (a list of dicts or
a JSON-encoded string of one); it no longer rewrites other shapes
- docs in `training.md`; unit tests for the resolver with default and
mapped renderer columns, for a renderer without the field, for mapped
message columns, and for tools passing through from the mapped column
## Breaking
- The trainer no longer falls back to a `tool_defs` column when `tools`
is absent, and no longer converts verifiers-shaped tool entries
(`name`/`description`/`parameters` at the top level) into OpenAI
function-calling schemas. Provide the `tools` column in OpenAI format,
under any name via `[data.columns] tools = "..."`.
## Verification
- `tests/unit/test_configs.py` and `tests/unit/train/sft`: 284 passed;
the two `test_prime_monitor.py` failures also fail on `main` in this
setup
- SFT e2e on 2 GPUs with the renderer mapping in place (reverse-text, 10
steps, custom renderer, dataset without a `reasoning_effort` column):
loss 4.64 → 3.56, matching the run without the mapping step for step
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Breaking SFT dataset contract for `tool_defs` and non-OAI tool shapes;
column mapping misconfiguration fails at dataset init or render time.
>
> **Overview**
> Adds **`[data.columns]`** so SFT can read chat data and tool schemas
from differently named HF columns (`messages`, `prompt`/`completion`,
`tools`) without rewriting datasets. **`[data.columns.renderer]`**
generalizes per-row renderer overrides: any renderer template field can
map to a dataset column (default still `reasoning_effort`), merged via
`merge_chat_template_kwargs` in **`RendererResolver`**.
>
> **Breaking:** the trainer no longer accepts a **`tool_defs`** fallback
or converts verifiers-style tool dicts to OpenAI function-calling
format—**`tools`** must be OpenAI-shaped (list or JSON string),
optionally under a custom name via **`[data.columns]`**.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a07ffb838c5c6cbf1e9ab9f20662078c85b69ebf. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
## Summary
- pin `deps/renderers` to `d43c430`, the PrimeIntellect-ai/renderers#168
merge on `main`, which adds `CustomRendererConfig` and
`renderers.custom`. `[renderer] name = "custom"` with `import_path =
"my_module.Class"` or `"path/to/file.py:Class"` selects a renderer that
lives outside the renderers package, for SFT and for RL via
`[orchestrator.renderer]`. The renderer's own `config_class` validates
the remaining `[renderer]` keys, which sit inline like every other
renderer config; the key names match `type = "custom"` + `import_path`
on custom losses and filters
- SFT applies a `reasoning_effort` column through
`merge_chat_template_kwargs`, so custom renderer configs honour the
column and renderers without the field reject it with the renderers
error
- docs in `training.md` and `algorithms.md`; unit tests for a custom
renderer in SFT and orchestrator configs, unknown fields rejected, and
the SFT resolver with a custom renderer's `reasoning_effort`, each
against a toy renderer written to `tmp_path`
#3744 stacks on this PR with a `[data.columns]` mapping.
## Verification
- `tests/unit/test_configs.py`, `tests/unit/inference`,
`tests/unit/train/sft`, `tests/unit/orchestrator/test_clients.py`: 308
passed (config tests rerun after the fixture change: 204 passed); the
two `test_prime_monitor.py` failures also fail on `main` in this setup
(they read source files by package path)
- the e2e runs below use a PrimeIntellect Qwen3 subclass that appends an
`instruction` template control to the system prompt (not checked in).
Rendered with the real `PrimeIntellect/Qwen3-0.6B` tokenizer, the
instruction lands in the system turn, and a conversation without a
system message gets one whose tokens carry message index -1 while the
user and assistant tokens match the base renderer exactly
- loaded the renderers README's GLM-5.3 no-thinking custom renderer
through an SFT config on this branch: it resolves and renders the
generation prompt as `<|assistant|><think></think>`
- SFT e2e on 2 GPUs (the reverse-text SFT config with that renderer as
`[renderer]`, 10 steps, evals at 5 and 10 with 8 rollouts): loss 4.64 →
3.56, no errors. Re-rendering the first dataset row with the run's
resolved config shows the instruction appended to the dataset's system
prompt
- RL e2e on 2 GPUs (the reverse-text RL config with that renderer as
`[orchestrator.renderer]`, 5 steps, 32-rollout eval at steps 0 and 5):
train reward 0.22 → 0.56, eval reward 0.05 → 0.74, no errors. Decoding
the prompt tokens of every trace in the run's stream: all 781 train
rollouts carry the instruction, the 64 eval rollouts (chat-completions
through vLLM's template) do not
- a downstream custom renderer passes 88 of its 94 tests against this
branch; the 6 per-sample column tests pass with #3744🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Changes are config/docs plus SFT renderer resolution; behavior for
built-in renderers should stay equivalent via
`merge_chat_template_kwargs`, with risk limited to misconfigured custom
`import_path` at launch.
>
> **Overview**
> Adds **custom renderer** support documented end-to-end: set
`[renderer]` or `[orchestrator.renderer]` to `name = "custom"` with
`import_path` pointing at a user class (`module.Class` or
`path/to/file.py:Class`). Extra TOML keys are validated by that class’s
`config_class`, matching the pattern used for custom losses/filters.
>
> SFT **per-row `reasoning_effort`** now goes through the renderers
helper `merge_chat_template_kwargs` instead of hand-rolled Pydantic
checks, so custom configs that declare `reasoning_effort` (via
`_template_fields`) honor the dataset column and invalid values fail at
validation time.
>
> **Tests** cover SFT and orchestrator config loading with a toy
renderer on disk, rejection of unknown renderer keys, and
`RendererResolver` caching when `reasoning_effort` overrides a custom
config.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b051050d57b2acd707b07346081d8f229e2227b8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Adds a multi-node SFT example for `Qwen/Qwen3-30B-A3B-Instruct-2507` on
**2 train nodes**. It uses the same layout as the GLM-5.3 SFT example
(`examples/advanced/glm-5.3/sft/h200/`).
### Files
- `examples/advanced/qwen3-30b-a3b/sft/h200/base.toml`: custom MoE
implementation, `ep = 8`, FA3, full AC with offloading, AdamW (lr 1e-5,
linear schedule, 50 warmup steps), `multi_node` with `num_train_nodes =
2` and a `[slurm]` block. Trains only, with no inference nodes.
- `sft/h200/math-10k.toml`: data overlay for
`PrimeIntellect/INTELLECT-3-SFT-10K` (math split), seq_len 32k,
batch_size 16.
- `sft/h200/fake.toml`: fake-data smoke test with
`force_balanced_routing`.
- README: adds a table row and an `## SFT` section.
```bash
uv run sft @ examples/advanced/qwen3-30b-a3b/sft/h200/base.toml @ examples/advanced/qwen3-30b-a3b/sft/h200/math-10k.toml
```
### Testing
- Both `base + math-10k` and `base + fake` parse and validate against
`SFTConfig` (slim `prime-rl-configs` package). The renderer
auto-resolves to `qwen3` for this checkpoint.
- **Not run on a cluster yet.** Memory and throughput on 2×8 H200 are
unverified.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Example TOML and documentation only; no changes to training,
inference, or auth paths.
>
> **Overview**
> Adds a **supervised fine-tuning (SFT)** example for
`Qwen/Qwen3-30B-A3B-Instruct-2507`, mirroring the GLM-5.3 `sft/h200/`
layout: **`base.toml`** (custom MoE, `ep = 8`, FA3, activation
checkpointing with offloading, AdamW, **2 train nodes** only),
**`math-10k.toml`** (`PrimeIntellect/INTELLECT-3-SFT-10K` math split,
32k seq, batch 16), and **`fake.toml`** for smoke tests.
>
> The Qwen3 README gains a config-table row and an **`## SFT`** section
with `uv run sft @ ...` compose instructions, cluster tweaks
(`partition`, `HF_HOME`), and notes on longer context via `model.cp`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
565709d38fe835c161c984f26f0810e23029b3bf. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds `model.moe.compute.backend = "sonicmoe"` for BF16 MoE expert
computation. Sonic consumes already-dispatched expert rows and fused
gate/up weights; dispatchers retain routing-score application and
combination.
`GroupedExperts` owns its parameters and delegates execution through the
structural `ExpertCompute` protocol. Concrete backends do not inherit
from the protocol. `set_compute()` validates compatibility before
assignment: Sonic requires fused gate/up weights, standard SwiGLU, and
bias-free experts. Unsupported structures, including DeepSeek V4's
clamped SwiGLU, raise during setup without replacing the active backend.
Native BF16, DeepGemmFP8, and MXFP8 share the grouped-GEMM
implementation. Sonic uses its fused expert pipeline. Selective
checkpointing saves `quack::gemm_out`, `quack::gemm_gated_out`, and
`quack::gemm_act_out`; compiled expert traces verify that saving
eliminates the repeated gate/up GEMM.
```toml
[trainer.model]
name = "Qwen/Qwen3-30B-A3B"
ep = 8
[trainer.model.moe.compute]
type = "bf16"
backend = "sonicmoe"
[trainer.model.moe.dispatch]
type = "torch"
```
Install with the `sonic-moe` extra, also included in `all`. Uses default
gate/up fusion and retains optimization/reduction dtype defaults.
Rebased onto main `9eacd477f`. Pins SonicMoE's EP-aware token bucketing
at `0bf06ac` and [QuACK's checkpoint-isolation
fix](https://github.com/Dao-AILab/quack/pull/204) at `f62009f`, based
directly on QuACK 0.6.5 and compatible with main's vLLM 0.30 / CUTLASS
4.7.1 stack.
Validation:
- After rebase and dependency update: 224 MoE, checkpoint, and
configuration tests pass; Ruff, formatting, whitespace, lockfile
consistency, and all-extras installation pass.
- After the QuACK 0.6.5 update: six realistic-shape GPU comparisons pass
at 32,896 and 65,664 routed rows (16 experts, dimensions 2048/768),
including uneven routing, eager execution, and fullgraph compiled
selective checkpointing with/without GEMM saving. Zero graph breaks;
maximum output and gradient relative errors were 0.454% and 0.402%.
- Before this rebase: 18 realistic expert-shard comparisons passed
across 8,192–65,664 routed rows, 16 local experts, dimensions 2048/768,
eager and compiled selective-checkpoint paths. Maximum relative errors
were 0.454% for outputs and 0.402% for gradients.
- Paired full-model B300 EP8 runs completed 20 Qwen3-30B-A3B math SFT
steps with sequence length 8192, batch 8, seed 42, selective
checkpointing, and SignSGD 1e-5. FA4, FA2, and a separate FA4 experiment
with #3676 all produced finite losses/gradients and readable final
checkpoints. These E2E runs used the pre-rebase QuACK 0.6.4 stack; #3676
was only an experimental overlay and is not included here.
Performance follow-up: Sonic's later-step overhead was 14.3% with
original FA4, 16.9% with FA2, and 21.1% in the #3676 FA4 experiment.
These are separate pairs of single runs, not controlled cross-backend
attention comparisons. Shared compilation breaks prevented compiled
checkpointed-block execution: #3676 removed the attention break, then
both expert backends hit the FP32 router's nested FSDP hook. This limits
conclusions about effective Sonic GEMM saving in E2E. It does not
establish that fixing the shared breaks eliminates all Sonic overhead.
Sonic also retains long first-step autotuning and occasional
approximately 37-second bucket-transition steps without a Dynamo
recompile. These remain performance follow-ups; no correctness blocker
was found in the realistic-shape and E2E checks.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes core MoE forward/backward paths and adds a new optional kernel
backend with strict structural requirements; misconfiguration fails at
setup, but numeric parity depends on the pinned Sonic/QuACK stack.
>
> **Overview**
> Adds an optional **SonicMoE** path for BF16 routed-expert compute via
`model.moe.compute.backend = "sonicmoe"` (default remains `"torch"`).
Install with the new `sonic-moe` extra; `quack-kernels` is pinned from
git for Sonic’s dependency stack.
>
> MoE execution is refactored from injectable **grouped GEMM** objects
to an **`ExpertCompute`** protocol: `GroupedExperts` delegates forward
to `set_compute()`, which runs **`validate()`** before switching
backends. Torch BF16, DeepGEMM FP8, and MXFP8 share
**`GroupedGemmExpertCompute`**; Sonic uses a fused
**`moe_general_routing_inputs`** path and rejects unfused gate/up,
non-SwIGLU activations, and expert biases at setup.
>
> Runtime wiring in **`configure_moe_runtime`** picks the backend from
config; selective activation checkpointing now retains
**`quack::gemm_*`** ops for recomputation with Sonic/QuACK. Docs and
unit tests cover config defaults, Sonic compatibility checks, and
unchanged BF16 fallback when layers are excluded by **`apply_to`**.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0609006b661abe2a79de59a02b66fac2c24d91e9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: matejsirovatka <matejsirovatka@users.noreply.github.com>
## What
- **Templates:** both P/D sbatch templates (`inference.sbatch.j2`,
`multi_node_rl.sbatch.j2`) export `VLLM_USE_BREAKABLE_CUDAGRAPH=0` on
prefill nodes. It's set before `prefill_env_vars`, so a config can still
override it.
- **Example configs:** the GLM-5.3 P/D examples
(`examples/advanced/glm-5.3/swe.toml`, `infer/pd.toml`,
`infer/pd-llmd.toml`) set it explicitly in their prefill env vars. The
setting then travels with the config to launchers that don't use these
templates (rl-k8s, fft#103).
## Why
vLLM 0.29 auto-enables breakable CUDA graphs for `GlmMoeDsaForCausalLM`.
On prefill ranks, which these templates pin to `all2all_backend =
"deepep_high_throughput"`, capture then includes the internode DeepEP
dispatch and every prefill engine dies at startup:
```
RuntimeError: DeepEP error: timeout (dispatch CPU)
torch.AcceleratorError: CUDA error: capturing stream has unjoined work
```
**Root cause (vLLM bug, present identically in v0.29.0 and v0.30.0).**
vLLM has a guard that disables CUDA graphs for `deepep_high_throughput`
("not CG compatible") in `CompilationConfig.set_splitting_ops_for_v1`,
but it sits below the early return taken when `mode != VLLM_COMPILE` —
and enabling breakable cudagraph sets exactly that
(`_maybe_enable_breakable_cudagraph()` sets `mode = NONE`, before
`set_splitting_ops_for_v1` runs). The guard never fires, so
`use_breakable_cg` still captures the HT dispatch. With the flag set,
the guard runs and sets `cudagraph_mode=NONE` — the state vLLM intends
for HT prefill. Decode (`deepep_low_latency`, `FULL_DECODE_ONLY`) is
unaffected and keeps breakable.
**Interim.** This is a workaround for the guard-skip, not the final fix.
Upstream has the same defect filed for a different guard (vllm#53030,
fix in flight vllm#53061 — it hoists only that guard, not this one).
Drop these settings once the DeepEP-HT guard is hoisted, or when HT is
retired for `deepep_v2` (vllm#46887).
## Test plan
- [x] `infer/pd.toml` and `infer/pd-llmd.toml` validate as
`InferenceConfig` with the new key
(`prefill_env_vars["VLLM_USE_BREAKABLE_CUDAGRAPH"] == "0"`). `swe.toml`
gets the same one-line addition to its prefill env map; its full local
validation needs the `r2e-gym` taskset package installed.
- [x] GLM-5.3 10-node P/D (EP16 prefill + EP16 decode, DeepEP) on H200
via FFT/telus, image `commit-cef7100c7-amd64` (vLLM 0.29.0):
- Without the setting, all 16 prefill ranks hit the error above.
- With `VLLM_USE_BREAKABLE_CUDAGRAPH=0` on prefill, all 16 reach
`Application startup complete`, and a chat request through the PD router
returns correctly with successful NIXL KV transfers (ENG-6348).
- This was set through the FFT chart's prefill env, not these templates.
The templates only need the same `export`.
## Summary
- **Overview keeps its scroll position across re-renders.** Every new
eval episode (and every new metric key on a training run) rebuilt
`#overview-body` and snapped it to the top, which made analysing
anything below the fold on a live eval impossible. `renderMetricsBody`
now restores `scrollTop` after the rebuild.
- **One filter shared by the overview, the traces table and the trace
viewer.** The filter menu (status, kind, env, outcome) is a single
`<template>` cloned into the three toolbars over one `state.filter`; a
change in any copy applies in all, and the traces tab reloads when it
opens with a filter set elsewhere. On the overview the env / kind pair
narrows the sections and summary tiles; for an eval run the outcome pair
(`ok` / `error`, replacing the per-pane `include errors` toggle) picks
the episodes the distributions read. The server's `errors_only` episode
filter becomes a three-way `ok` parameter.
- **Live rollouts obey the filter.** Live rows arrive by their own poll
and were spliced into the traces table and the viewer's list whatever
the filter said, so `live + eval` still listed the in-flight train
rollouts. They now pass the same kind / env / outcome check as finished
episodes (an outcome filter hides them, since theirs is still open), and
the "N live" count follows.
- **Eval overview is multi-env.** With no env filter every env renders,
one block after another, each headed by its env name and set off by a
rule; the composition panes hold one model per pane instead of two
globals.
- **Train overview leads with a step bar and summary tiles, like the
eval pane.** One cell per step (click opens that step's batch in the
traces tab) with `done/total (share)` beside the bar; a run without
`max_steps` reads `N/∞` over cells that grow instead of a bar that
always looks full. The tiles keep to results: the reward of each train
env and the avg@k of each eval env, each with its change from the first
logged value beside the number (green when it moved the right way), the
error / truncation / timeout rate of the shown scope, and the step time.
An SFT run shows loss, val loss, eval scores, total samples and tokens,
throughput and MFU. Panes default to 300 × 170px (four per row on a
14-inch laptop), a saved pane size still wins. Tiles are the eval pane's
`tileHtml` / `blockBarHtml`, share its hover cards, and wrap for runs
with many envs.
- **Flat, per-env sections with readable panel names.** The overview
reads top to bottom: no collapsible `details`, no collapse / expand
buttons (the Metrics tab keeps its folding sections), one train section
per env with the cross-env aggregate left to the Metrics tab. Panels are
named in caps for reading (`MEAN REWARD`, `MEAN TURNS`, `ERROR RATE`,
`AVG@4`, `GRAD NORM`, `KV CACHE USAGE`, ...) with an `i` mark beside the
title whose hover card says how the value is computed and shows the raw
key; the latest value reads larger in the corner. Pane order stays keyed
by the raw title, and the Metrics tab keeps every key as logged.
- **Eval sections show `avg@k` alone as the score**: it is the mean
reward over the same traces `reward/mean` averages, so the reward panes
only repeated it.
- **SFT sections**: `val loss` / `val perplexity` appear only once a
validation value is logged (the server's `has_validation` meta field
goes); stability adds `max vio` (expert load imbalance) when an MoE
model logs it; performance drops the step and checkpoint time panes.
- Smoke test asserts the step bar, tiles, info marks and the mounted
filter menus; the dashboard skill documents the new overview and the
shared filter.
## Verification
Ran a multi-env RL run (`configs/debug/multi-env/rl.toml`: two
reverse-text train sources + an online eval with a base eval at step 0,
10 steps), a 20-step SFT run (`examples/basic/reverse-text/sft.toml`
with validation and an online eval) and a two-source gsm8k eval against
Prime Inference, served all three from this branch's dashboard, and
drove it with playwright (no console errors):
- Before: scrolling the eval overview to 600px and re-rendering (what a
landed episode triggers) reset `scrollTop` to 0. After: it stays at 600.
- Setting `env = gsm8k-b` in the overview's filter narrows the overview
to that env, and the traces tab then lists only `gsm8k-b` rows with the
same badge; `error`-only narrows the table through the new `ok` param.
- Live rows: with two synthetic live rows (train + eval) injected, `live
+ eval` lists only the eval one, an env filter keeps only its env's, and
an outcome filter hides both.
- Train overview: `10/10 (100%)` bar; tiles `reverse-text-a reward 0.781
▲ +0.606`, `reverse-text avg@1 0.849 ▲ +0.737` (base eval at step 0),
`truncation rate 2% ▼ -72%`; clicking step cell 2 opens the traces tab
in step mode at step 2; with `env = reverse-text-a` only that env's
train section (plus stability / inference / performance) and tiles
remain. A synthetic 20-env run wraps its 25 tiles over four rows with no
horizontal overflow.
- SFT overview: `loss 3.196 ▼ -1.415` (lower is better reads green),
samples 2.2K and tokens 2.6M match the trainer's counters (32 × 4096 ×
20 steps), throughput 19.6K tok/s, MFU 31%.
### Eval overview, two envs (filter unset)

### Eval overview narrowed to one env from the same filter

### The traces tab picks the filter up (env + badge)

### Train overview: step bar, summary tiles with base deltas, flat
per-env sections

### Info mark on a panel

### Train overview narrowed to one env

### Open-ended run (no `max_steps`) and a synthetic 20-env run


### SFT overview (20-step reverse-text SFT with an online eval)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches episode listing/filter query params and a large front-end
state refactor; incorrect filter wiring could hide episodes or desync
overview vs traces, but changes are UI/read-path focused with no auth or
training logic changes.
>
> **Overview**
> Introduces a **single run filter** (status, kind, env, outcome) cloned
from one template into the overview, traces table, and trace
viewer—replacing separate env pickers and an “errors only” checkbox.
Episode APIs now take **`ok`** (`true` / `false` / unset) instead of
**`errors_only`**, and live rollout rows honor the same filter.
>
> **Eval overview** shows **every filtered env** as stacked blocks (not
one env at a time); distributions respect the **ok/error** outcome
toggles. **Training/SFT overview** adds a **clickable step bar**,
**summary tiles** with delta-from-first-logged-value, **readable panel
titles** with **`i` tooltips** (raw metric keys on hover), flat per-env
sections, and **scroll position preserved** on live re-renders. SFT
panel layout tweaks (val metrics when logged, optional MoE `max_vio`,
trimmed performance panes); run meta drops **`has_validation`**.
>
> Docs and smoke tests updated for the shared filter and new overview
chrome.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6bb87a7a0fd6e94922154649307167a41645913d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
## Summary
- Add `SourceGroupConfig`, the one base of every source group:
`[orchestrator.train]` (`TrainConfig`), `[orchestrator.eval]` and the
SFT `[eval]` block (`ScheduledEvalConfig`), and the top level of `uv run
eval` (`EvalConfig`). It has one rule: every field that a group and its
source type both declare is a default. Each source inherits the fields
that the group sets, merged under its own with `vf.merge_defaults`:
nested blocks merge key by key, a source's own values win, and a block
whose `type`/`id` differs is the source's alone.
- Remove the four earlier mechanisms: the group `env` merge, the shallow
group `select` merge, and the after-validators that copied `sampling`,
`group_size` (eval) and `interval` onto sources. Adding a shared field
is now one field on the group.
- Move `group_size` and `algo` from `OrchestratorConfig` into the train
group, so train sources inherit them from their group like eval sources
do. `TrainSourceConfig.algo` defaults to `grpo` instead of `None`, which
removes the `algo is not None` guards.
```toml
[orchestrator.train]
group_size = 16
[orchestrator.train.algo]
type = "echo"
```
- Let each train source use its own `group_size` over the group's
(source > group, like every default). The runtime already dispatches and
finalizes each group at its env's size. The config checks now require
`batch_size` to be divisible by every train source's group size, and
`concurrency.max_inflight`/`initial_inflight` to cover the largest one;
before, they checked only the group default. The platform run records
the largest source group size as `rollouts_per_example`.
- Migrate the shipped configs (47 TOMLs plus the k8s orchestrator
example), the docs and the `configs` skill (which now also describes the
group-default rule). Every rewritten TOML parses to exactly the old data
with the two keys moved.
- Pin `deps/verifiers` to its main, which merged
PrimeIntellect-ai/verifiers#2709 (`vf.merge_defaults` replaces
`vf.merge_env_defaults`). Raise the `verifiers` minimum to
`0.3.2.dev158`, its first release, in both `pyproject.toml` files, so
the slim `prime-rl-configs` install gets it.
## Breaking
- `orchestrator.group_size` moves to `orchestrator.train.group_size`
(`--orchestrator.train.group-size`). A standalone orchestrator config
moves `group_size` into `[train]`.
- `[orchestrator.algo]` moves to `[orchestrator.train.algo]`
(`--orchestrator.train.algo.*`).
- A source `algo` that sets params without a `type` now keeps the
group's algorithm with those params changed. Before, it meant `grpo`
with those params. A source that sets a `type` still runs its own
algorithm.
- A source's `select.include`/`exclude` now merges with the group's
block key by key (e.g. a group `include.idx` and a source
`include.names` both apply). Before, the source's block replaced the
group's. Lists still replace.
- Nested dicts in a group `sampling` block (e.g. `extra_body`) now merge
with a source's instead of being replaced.
## Verification
- Resolved every shipped config on `origin/main` and on this branch, and
compared what each source ends up with (`name`, `group_size`, `algo`,
`sampling`, `select`, `interval`, `env`): 77 configs, 95 sources, 0
differences. (9 configs need taskset packages that are not installed in
the test env, on both sides.)
- `uv run rl @ <config> --dry-run` on `configs/debug/algo/echo.toml`,
`configs/debug/algo/mixed_grpo_opd.toml`,
`configs/debug/multi-env/rl.toml` and
`examples/basic/reverse-text/rl.toml`: each source resolves the group's
`group_size` and `algo` (or its own `opd`), and the resolved
orchestrator config has no top-level `algo`/`group_size`.
- The slim-install check, run locally: the `prime-rl-configs` wheel
installed outside the workspace resolves `verifiers 0.3.2.dev158`, the
workflow's import script passes, and a train group's `group_size`,
`sampling` and `env` defaults reach its source through
`vf.merge_defaults`.
- `uv run pytest tests/unit/test_configs.py tests/unit/eval
tests/unit/orchestrator tests/unit/test_dashboard_timeline.py`: 303
passed (2 vLLM-only tests deselected). New tests: sources inherit unset
group fields for each kind of default (blocks, a `-r` alias, `interval`)
and round-trip; train sources with group sizes 16 and 8 resolve, and a
batch size or in-flight cap that does not fit both is rejected; each
group field's default equals its source field's.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Breaking config paths and merge semantics can silently change resolved
training/eval settings; batch and concurrency validation is stricter
when sources use different group sizes.
>
> **Overview**
> Introduces **`SourceGroupConfig`** so train/eval source groups share
one inheritance rule: any field declared on both the group and its
sources (`env`, `sampling`, `select`, `group_size`, `algo`, `interval`,
…) becomes a default merged into each source via `inherit_defaults` /
`vf.merge_defaults`, replacing the old separate env/select merges and
post-validators that copied fields onto sources.
>
> **Breaking config moves:** `orchestrator.group_size` and
`[orchestrator.algo]` move under **`[orchestrator.train]`** (same for
standalone orchestrator TOMLs: `[train]`). Shipped configs, docs, and
the configs skill are updated accordingly. Per-env **`group_size`**
overrides are first-class; validation now requires `batch_size`
divisible by **every** train source’s group size and concurrency limits
≥ the **largest** group size. Platform monitoring reports the max source
`group_size` as rollouts per example.
>
> **Semantics changes:** Source `algo` blocks without a new `type`
inherit the group algorithm with partial overrides (not implicit
`grpo`). Group/source **`select`** and nested **`sampling`** dicts
key-merge instead of wholesale replace where applicable. **`verifiers`**
minimum bumped to `0.3.2.dev158` for `merge_defaults`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
536cc3e1190f8f9fc06419af9dffb1eda331168f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Qwen shared-expert gates can have weight shape `[1, hidden_size]`.
Default FSDP row sharding gives some ranks empty local tensors, which is
incompatible with the equal-shard layout needed by the distributed Muon
update.
Shard 2D single-row parameters along dimension 1 when their width is
divisible by the parameter-sharding degree, obtained directly from
`parallel_dims.get_mesh("dp_shard_cp").size()`. Other parameters retain
the existing fused-parameter placement callback or default placement.
FSDP still uses the HSDP mesh; the divisibility check excludes
replication ranks. The placement rule applies during model setup
regardless of optimizer selection.
There is no additional optimizer-setup validation. Non-divisible layouts
retain the existing placement and failure behavior in Muon.
Validation performed locally:
- Two-rank CPU/Gloo DTensor reproduction with PyTorch 2.8.0: `[1,128]` /
`[0,128]` under `Shard(0)` versus equal `[1,64]` shards under the
placement callback, with exact reconstruction.
- Isolated placement checks across shard degrees 1/2/4/8/16,
non-divisible widths, 1D/3D parameters and fallback delegation.
- Ruff lint/format and `git diff --check` passed. Local diagnostic
scripts are not added to the repository. These checks do not exercise a
full FSDP + Muon GPU update on current main.
Remaining merge blocker: the NIXL weight sender currently assumes
dimension-0 shard offsets. Its handling of column-sharded gates must be
fixed or the incompatible transport/layout combination rejected before
merge. Checkpoint-layout compatibility also needs review.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Alters FSDP/DTensor layout for a narrow class of MoE gate weights;
downstream weight sync or checkpoint code that assumes row-wise sharding
may need matching updates.
>
> **Overview**
> **FSDP setup** now uses a custom `shard_placement_fn` instead of
passing the fused-parameter callback directly. For **2D weights with a
single row** (e.g. Qwen shared-expert gates shaped `[1, hidden_size]`),
parameters are sharded along **column dimension 1** when the hidden
width is divisible by the **`dp_shard_cp`** mesh size, so every rank
holds an equal local shard for **Muon’s all-to-all**. All other
parameters still use the existing fused `shard_fused_on_dim1` placement
or PyTorch’s default.
>
> The change pulls in `Shard` from `torch.distributed.tensor` and reads
shard degree from `parallel_dims.get_mesh("dp_shard_cp").size()`
(parameter sharding only, not HSDP replication).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
159c63d852ad37cdeb9e49ed9439fb2cfba47a2c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Problem
Since #3664, eval runs beat the Better Stack heartbeat on every landed
episode. `Heartbeat` only coalesced *concurrent* requests (at most one
in flight), so once a ping returned, the very next landed episode fired
a new one. A busy eval lands many episodes per second and blows past
Better Stack's heartbeat rate limit:
```
WARNING BetterStack heartbeat failed with status code: 429
```
The trainer/sft/orchestrator beat once per batch and stay under the
limit only because of step duration.
## Changes
- `Heartbeat` now rate-limits itself: at most one ping every
`min_interval` seconds (default 30), counted from when a ping *starts*,
so a failed ping (429, network error) throttles retries too instead of
retry-storming on every landed episode.
- New `heartbeat.min_interval` config field (default 30, `> 0`
enforced); `Heartbeat` is constructed from the `HeartbeatConfig` object
directly at all four sites (eval runner, orchestrator, rl/sft trainers).
- Beats that arrive within the interval (or while a ping is in flight)
are dropped without an HTTP request. `beat()` stays non-blocking and
event-driven: no startup ping, and the heartbeat still goes stale when
episodes stop landing.
Better Stack monitors only need pings well within their period + grace,
so pinging at most every 30s loses nothing. Size `min_interval` under
the monitor's period if it is unusually short.
## Verification
- `uv run ruff check` and `uv run ruff format --check` pass on the
touched files.
- Throttle behavior checked with a mocked `requests.get` and fake clock:
first beat pings immediately; in-flight and within-interval beats are
dropped; a beat after the interval pings; a failed 429 ping is not
retried within the interval.
- `uv run pytest tests/unit/test_configs.py tests/unit/eval
tests/unit/utils`: failure set identical before/after the change on this
tree — all 67 pre-existing failures are `ModuleNotFoundError`s for
optional taskset packages in a non-GPU sync.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Observability-only change with a safe default interval; no impact on
training, auth, or data paths beyond fewer external heartbeat HTTP
calls.
>
> **Overview**
> Fixes Better Stack **HTTP 429** errors when eval runs call `beat()` on
every landed episode while only coalescing concurrent pings.
>
> **`Heartbeat`** now takes full **`HeartbeatConfig`** (not just the
URL) and enforces **`min_interval`** (default **30s**): surplus `beat()`
calls are dropped with no HTTP request; interval is measured from when a
ping *starts*, so failed pings also throttle retries. In-flight
coalescing is unchanged; `_pending` is cleared in a `finally` block.
>
> New config field **`heartbeat.min_interval`** (`> 0`, default 30) with
eval config docs updated. Eval runner, orchestrator, and RL/SFT trainers
construct `Heartbeat(config.heartbeat)`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b32a69252b8e393e933952e53e30ea7a9b78d67c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- Bump `vllm-router` from 0.2.1 to
[0.2.2](https://github.com/PrimeIntellect-ai/router/releases/tag/v0.2.2)
(amd64 and arm64 release wheels).
- The new router picks up PrimeIntellect-ai/router#58. The default
health-check interval drops from 60s to 20s, and every health-check
cycle refreshes `/v1/models`. Workers that are still loading at startup
no longer stay under `unknown` and miss model-filtered traffic for
minutes.
## Verification
- `uv lock` resolves with `vllm-router v0.2.1 -> v0.2.2`.
- Installed router reports version `0.2.2` and
`RouterArgs.health_check_interval_secs == 20`.
- Ran 5 steps of `configs/basic/reverse-text/rl.toml` single-node on
SLURM (H200) through the router: 5/5 steps, 0% rollout errors, no
tracebacks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches the disaggregated inference routing dependency only, but the
new router changes health-check timing and worker/model discovery
behavior on the critical vLLM serving path.
>
> **Overview**
> Upgrades the pinned **`vllm-router`** wheels from **0.2.1** to
**0.2.2** for Linux **x86_64** and **aarch64** in `pyproject.toml`, with
matching **`uv.lock`** updates (version, download URLs, and wheel
hashes).
>
> Installs that use the **`disagg`** extra (and related GPU/disagg
resolution paths) will pull the new router release instead of 0.2.1. No
in-repo application code changes—only dependency resolution.
>
> The **0.2.2** router (PrimeIntellect-ai/router#58) shortens the
default health-check interval (**60s → 20s**), refreshes
**`/v1/models`** on each health cycle, and avoids workers staying
**`unknown`** while still loading at startup (so model-filtered traffic
is not skipped for long periods).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f8087add142c2f5a8b27b669902335c60d186cc1. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## What
A bare `<= 8` in the Expert Parallelism prose of `docs/scaling.md` (line
97) is parsed by MDX as the start of an HTML tag, failing compilation
with:
> `Unexpected character '=' (U+003D) before name, expected a character
that can start a name, such as a letter, '$', or '_'`
This breaks the Mintlify build of the page imported into **public-docs
PR #219** — the preview deploy 404s `/prime-rl/scaling`, so merging #219
before this fix would publish the broken page.
## Change
Reworded `and is <= 8` → `and is at most 8` (one line). Rewording was
chosen over an inline-expression escape (`{'<='}`) because it is robust
in both MDX pipelines and reads naturally in the sentence. Audited the
rest of the file for bare `<`/`>`/`{`/`}` outside code spans: the only
other occurrences are a `>` blockquote (line 185) and an inline `>`
(line 152), both valid MDX; every remaining `<`/`{`/`}` sits inside
backtick code spans.
## Verification
- Compiled with `@mdx-js/mdx@3` (same compiler family Mintlify pins):
- pre-fix file: `MDX FAIL: Unexpected character '=' ...`
- fixed file: `MDX OK`
- Rendered meaning is identical to the original sentence.
Blocks #219 (public-docs) — merge this first, then re-run the #219
preview build.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation-only wording change with no runtime or config behavior
impact.
>
> **Overview**
> Fixes **Mintlify/MDX compilation** for the Expert Parallelism section
in `docs/scaling.md` by rephrasing the EP auto-resolution rule so prose
no longer contains a bare **`<= 8`**, which MDX treats as the start of
an HTML tag and fails to parse.
>
> The sentence now says the chosen EP degree **is at most 8** instead of
**`is <= 8`**; meaning is unchanged. This unblocks the public-docs
preview for `/prime-rl/scaling` (merge before dependent doc PRs).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fda404ad8bea01b8afbd24b16f32c38d98846d65. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Motivation
Hosted SFT runs (the dedicated FFT path) currently report nothing to the
platform: `SFTConfig.monitors` was the base `MonitorsConfig` (wandb/file
only), so a hosted SFT trainer has no platform run — no metrics, no
billing surface, no "view on platform" link. RL runs get all of this
through `PrimeTrainMonitor` (wired in the RL orchestrator); this PR
gives the SFT trainer the same platform integration.
## What it adds
- **Config**: `SFTConfig.monitors` is now `TrainMonitorsConfig`, so
`[monitors.prime]` (and `--monitors.prime`) is a valid SFT config block.
`monitors.prime.name` defaults to `run.name`, mirroring the
orchestrator's and eval config's name inheritance.
- **Monitor**: `PrimeTrainMonitor.init` learns the SFT registration
shape — base model, no environments (SFT trains on a dataset),
`TrainingSpec(max_steps, batch_size, seq_len)` from the data block, no
rollouts per example, full resolved config dumped to the platform run
record. The RL registration path is unchanged.
- **Trainer** (`trainer/sft/train.py`): passes `monitors.prime` to
`monitors.setup` and calls `monitors.finalize()` after training,
matching the RL trainer's call sites. The existing per-step metric
logging (train loss/perplexity, `optim/lr`, grad norm, throughput,
progress, time) and `[val]` losses now fan out to the platform unchanged
— the platform's existing internal RFT endpoints work as-is.
- **Launcher** (`entrypoints/sft.py`): `build_online_eval_config`
converts the trainer's `TrainMonitorsConfig` into `EvalMonitorsConfig`
for the online-eval process (the platform monitor switches to the
evaluation flavor under the same name). Without this, an `[eval]` +
`[monitors.prime]` run would fail `SFTOnlineEvalConfig` validation.
- **Docs**: platform-monitoring section covers `sft`; SFT launch section
links to it.
Env surface mirrors RL exactly: the monitor reads `$RUN_ID` (attach to
the launcher-pre-created platform run), `$PRIME_API_BASE` and
`$PRIME_API_KEY` — the values the fft chart injects into trainer pods —
and `PRIME_RUNS_MODE=disabled` stays the opt-out. No trainer-side usage
POST is needed: RL's per-step `PI_USAGE_*` billing posts were removed in
#3275; usage/GPU-hours for hosted runs is derived platform-side from the
run record, which the SFT monitor now registers (config dump includes
the deployment topology).
## Tests
- `uv run pytest tests/unit/train/sft/test_prime_monitor.py` — 6 passed
(mocked `prime_runs.init`: registration kwargs for SFT, name
inheritance, W&B project passthrough, `monitors.setup` fan-out of
metrics + finalize, online-eval monitors conversion). This file is
torch-free and runs on macOS.
- `uv run pytest tests/unit/test_configs.py` — identical result to a
clean `origin/main` baseline (67 pre-existing failures on this macOS env
from missing GPU/harness packages — env-dependent, unrelated to this
change; diff of failing tests verified identical).
- `uv run sft @ <minimal sft.toml> --dry-run --monitors.prime` —
resolves; `monitors.prime.name` inherits `run.name` in the resolved
config dump.
- `uv run ruff check` / `ruff format --check` — clean.
Note: the fft validator service picks this schema change up
automatically once a GHCR image is built from a commit containing this
PR (per-image schema venvs install `prime-rl-configs` from the image's
commit). No validator-side change needed.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches platform run lifecycle and cross-process shared state on the
run directory; training continues if dashboard record persistence fails,
but incorrect merging could break platform links for SFT+online-eval
runs.
>
> **Overview**
> Adds **`--monitors.prime` / `[monitors.prime]`** to SFT so hosted runs
register on Prime Lab, stream trainer metrics (including validation),
and call **`monitors.finalize()`** on exit—same flag shape as RL, with
**no rollout episode uploads**.
>
> **Config wiring:** `SFTConfig.monitors` is **`TrainMonitorsConfig`**;
online eval uses **`EvalMonitorsConfig`** plus
**`build_online_eval_monitors`** so the launcher maps the trainer’s
platform block to **`PrimeEvalMonitorConfig`** for the eval subprocess.
**`monitors.prime.name`** defaults to **`run.name`**. SFT online eval
shares the trainer’s **`run_dir`**; the dashboard platform JSON is
updated via **locked merge**, not separate dirs.
>
> **`PrimeTrainMonitor`:** For **`SFTConfig`**, registration sends
dataset **`TrainingSpec`** (`max_steps`, `batch_size`, `seq_len`), empty
environments, and the resolved config dump. Docs clarify **best-effort**
finalize (SIGKILL/OOM may skip crash reporting).
>
> **Concurrency:** Platform **`run.json`** writes use **PID-suffixed
temp files**, a **persistent flock lock** with bounded timeout,
**`update_platform_record` / `_merge_platform_record`**, and
**`asyncio.to_thread`** so eval + trainer don’t clobber each other’s
dashboard link. Lock/storage failures are **logged and skipped**, not
fatal.
>
> New unit tests cover SFT registration, monitor fan-out, eval monitor
conversion, record merge/lock behavior.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
bc33cb262d141c2d788acc5694aec85aea7b9ad4. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Problem
Image builds on `main` have failed since #3667 merged. Every
`build_image.yaml` run since 2026-09-28 dies in the
`INCLUDE_NIXL_FROM_SOURCE` step, so no amd64/arm64 image is published.
The failing command is the step's own linkage check — the wheel builds
and installs fine:
```
ldd .../.nixl_cu13.mesonpy.libs/plugins/libplugin_UCX.so | grep -q /opt/ucx/lib/libucp.so
```
## Cause
The NIXL wheel build is not reproducible: NIXL's `[build-system]
requires` is an unpinned list, so pip's build isolation resolves the
newest backends at build time.
`meson-python 0.22.0` (uploaded 2026-09-26 08:33Z — after the
from-source images were built 09-25 01:53Z/02:11Z and validated on FFT,
before the first failing main build 09-28 02:35Z) added "support for
removing build RPATH entries added by Meson" plus RPATH/relocation
fixes. NIXL links UCX with bare `-L/opt/ucx/lib -lucp -lucs -luct` and
sets no `install_rpath`, so Meson's build-tree RPATH (the
`RUNPATH=/opt/ucx/lib` the step's comment and the FFT pods' runtime
check rely on) was the only thing making the installed libraries resolve
the image's UCX. 0.22.0 drops it, the check fails, and the registry
image would not resolve `/opt/ucx` at runtime either.
Evidence: identical step text passes on the 09-25 branch builds and
fails on every build from 09-28; the wheels differ by ~3 KB
(rpath/metadata, not content); `origin/main`'s step is unchanged, so the
failure persists.
## Fix
Constrain `meson-python==0.21.1` for the NIXL wheel via `pip wheel
--build-constraint` — the backend the from-source images were validated
with. Same pin in `scripts/install_nixl_from_source.sh`, whose SLURM
path builds the same wheel and drifts the same way.
Also make the linkage check diagnostic: it now prints `readelf -d`
RUNPATH and the `ldd` output before exiting, instead of `grep -q`
failing with no output (the failure above was silent).
## Notes
- Verified without a full image build: the step's shell, joined the way
Docker joins continuations, passes `sh -n` and `bash -n`; the check's
failure path prints diagnostics and exits 1; the skip path
(`INCLUDE_NIXL_FROM_SOURCE=0`) is unchanged.
- Verified with a real build: [run
36518545933](https://github.com/PrimeIntellect-ai/prime-rl/actions/runs/36518545933)
(amd64, `fix/nixl-build-constraints` @ 5e3cc4982) passed, image
`commit-5e3cc4982-amd64` pushed. The NIXL step ran
(`INCLUDE_NIXL_FROM_SOURCE=1`) and the linkage check passed; the wheel
is exactly the size of the wheels from the 2026-09-25 builds (3 467 198
bytes, vs 3 470 315 for the failing 0.22.0 build).
- The rest of NIXL's build-system set (`pybind11`, `patchelf`, `pyyaml`,
`build`, `setuptools`) stays unpinned; only the backend whose behaviour
broke is pinned. The constraint file is the lever if we want these
wheels fully reproducible.
- Durable alternative to the pin: set the RPATH explicitly at link time
(`-Wl,-rpath=/opt/ucx/lib` via Meson link args, or `patchelf
--add-rpath` on the installed libraries) so the artifact does not depend
on backend RPATH policy. Not included: it cannot be validated without a
full image build.
## Summary
- Replace `prime-sandboxes>=0.3.2` with `prime>=0.8.0` in the core
dependencies. `prime` 0.8.0 drops its `verifiers==0.2.0` pin
([prime#940](https://github.com/PrimeIntellect-ai/prime/pull/940)).
`prime-sandboxes` now comes in transitively and stays locked at 0.3.2.
- Remove the separate `uv pip install 'prime>=0.7'` step and its
`verifiers` override from `Dockerfile.cuda`. `uv sync` now installs the
CLI into `/app/.venv` at the locked version.
- Remove the same replay step from the `PRIME_RL_REF` source overlay in
`scripts/docker-entrypoint.sh`.
- Remove `uv tool install prime` from `scripts/install.sh`. `uv sync`
installs the CLI into the project venv.
- Lock changes: add `prime` 0.8.0, `prime-evals` 0.2.4 and
`gitignore-parser` 0.1.13. Bump `prime-traces` 0.0.4 → 0.0.7.
## Verification
- `uv lock` resolves. `uv sync --all-packages --locked` succeeds.
- `uv run --no-sync prime --version` prints `Prime CLI version: 0.8.0`.
- `verifiers` still imports from the editable `deps/verifiers`.
`prime_rl.configs.orchestrator` imports.
I did not build the image.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes how the Prime CLI and sandbox stack are installed in Docker
and dev venvs; wrong resolution could still break editable `verifiers`
imports, though the explicit override path is gone.
>
> **Overview**
> **Switches the project’s direct dependency from `prime-sandboxes` to
the `prime` CLI (`>=0.8.0`)**, so the CLI is installed via `uv sync` at
the locked version instead of a separate install path. `prime-sandboxes`
remains available transitively through `prime`.
>
> **Removes the Docker/runtime workaround** that ran `uv pip install
'prime>=0.7'` with a `verifiers` overrides file after sync (in
`Dockerfile.cuda` and `scripts/docker-entrypoint.sh`). That existed
because older CLI versions pinned `verifiers==0.2.0` and could replace
the editable `deps/verifiers` wheel; `prime` 0.8.0 drops that pin.
>
> **Simplifies local setup** by dropping `uv tool install prime` from
`scripts/install.sh`—developers use `uv run prime` from the project
venv.
>
> Lockfile updates add `prime` 0.8.0 and its new deps (`prime-evals`,
`gitignore-parser`) and bump `prime-traces` to 0.0.7.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
696ae027e29ff470d9f7d40a0d82e3797704f2a1. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
- Bump vLLM to
[v0.30.0](https://github.com/vllm-project/vllm/releases/tag/v0.30.0).
- Bump the `nvidia-cutlass-dsl` override to 4.7.1. vLLM 0.30.0 and its
quack-kernels 0.6.5 require it.
- Set `--enable-scale-out` on the inference server. vLLM 0.30.0 no
longer registers `/inference/v1/generate` on `vllm serve` without it,
and the orchestrator generates through that endpoint. Set
`inference.vllm.enable_scale_out = false` to opt out.
- Remove two DeepSeek V4 patches that upstream now covers:
- `monkey_patch_deepseek_v4_per_layer_rope`: fixed by
vllm-project/vllm#54815. The reference RoPE test now checks upstream
directly.
- `monkey_patch_deepseek_v4_bf16_o_proj`: upstream
`deep_gemm_fp8_o_proj` has a bf16 path since vllm-project/vllm#56228.
The other patches in `prime_rl/inference/patches.py` stay: their
upstream code is unchanged, or the upstream fix is not released yet.
## Relevant upstream changes
- vllm-project/vllm#54901: MRV2 compacts sampling masks on the GPU. This
fixes an about 2x RL step-time regression with `--return-sampling-mask`.
- vllm-project/vllm#53187: `/inference/v1/generate` returns prompt
metadata. This unblocks #3710.
- vllm-project/vllm#52957: pause and sleep no longer run 32 dummy
forwards per DP rank.
- vllm-project/vllm#56706: fixes stale QK-norm weights after a weight
refit.
- vllm-project/vllm#51485: sleep mode releases NCCL communicator memory.
- vllm-project/vllm#54646: MRV2 CUDA graph capture freezes gc (engine
init 28.9s → 8.2s on H200).
- vllm-project/vllm#54518: NIXL no longer asserts when it cleans up a
failed transfer twice.
- vllm-project/vllm#55548: rsLoRA scaling in MoE expert packing.
## Verification
Ran 5-step RL smoke runs on SLURM (H200) against this branch:
- `configs/basic/reverse-text/rl.toml`, single-node (1 trainer GPU + 1
inference GPU): 5/5 steps, no errors.
- `configs/basic/reverse-text/rl.toml`, multi-node (1 trainer node + 1
inference node): 5/5 steps, no errors.
- `examples/advanced/glm-4.5-air/swe.toml` (2 trainer nodes, 4 × TP8/EP
inference replicas, router replay), with `batch_size = 32`, `group_size
= 8`, and no eval, checkpoint, or wandb. Ran the same config on `main`
(vLLM 0.29.0) for comparison:
| | main (vLLM 0.29.0) | this branch (vLLM 0.30.0) |
|---|---|---|
| Steps completed | 5/5 | 5/5 |
| Tracebacks | 0 | 0 |
| Mismatch KL | 1e-4 – 2e-4 | 1e-4 – 2e-4 |
| Grad norm | 0.33 – 0.87 | 0.26 – 0.44 |
| Reward (steps 1–5) | 0.28, 0.31, 0.13, 0.34, 0.34 | 0.34, 0.34, 0.38,
0.25, 0.41 |
| Trainer peak memory | 110 – 112 GiB | 110 – 113 GiB |
Both runs have a few `scaleswe` harness-setup failures (`uv python find
--script` is unsupported by the sandbox image's uv). This is a verifiers
runtime issue and is independent of the vLLM version.
Unit tests: `tests/unit/inference` and `tests/unit/test_configs.py` pass
(212 tests).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **High Risk**
> Major inference-engine upgrade touches RL generation, router replay,
and DeepSeek V4 serving; remaining monkey patches and new scale-out
default can change runtime behavior across deployments.
>
> **Overview**
> **Bumps the GPU inference stack from vLLM 0.29.0 to 0.30.0**,
including lockfile updates for CUTLASS DSL 4.7.1, quack-kernels 0.6.5,
FlashInfer 0.6.18.post1, and huggingface-hub 1.32.0 on Linux.
>
> **Inference defaults:** vLLM args now turn on **`enable_scale_out`**
when not overridden, so `/inference/v1/generate` stays available for the
orchestrator under 0.30 (opt out with `inference.vllm.enable_scale_out =
false`).
>
> **Patch cleanup:** Removes
**`monkey_patch_deepseek_v4_per_layer_rope`** and
**`monkey_patch_deepseek_v4_bf16_o_proj`** because upstream 0.30 covers
those paths; DeepSeek V4 RoPE unit tests assert against stock
`build_deepseek_v4_rope` instead of the old monkey patches.
>
> **Docs:** Router-replay text no longer pins “vLLM 0.29”; it states
standard deployments use the V2 runner.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3c6229d9b08a7f32f74d5cab1dfd1fbb83c43482. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
- Give every train and eval source a `select` block (`EnvConfig.select`,
a `vf.SelectConfig`): `include`/`exclude` by task `idx`, `ids`, `keys`
or `names`, then `shuffle`, `skip` and `limit`. The orchestrator loads
each source's tasks with `vf.load_taskset(...).select(source.select)`.
prime-rl no longer shuffles or slices tasksets itself, so it picks the
same tasks as `vf-eval` for the same selection.
```toml
[[orchestrator.train.source]]
env.taskset.id = "gsm8k"
select.exclude.idx = [":100"] # hold out the first 100 tasks
[[orchestrator.eval.source]]
env.taskset.id = "gsm8k"
select.include.idx = [":100"]
```
- Every source group (`[orchestrator.train]`, `[orchestrator.eval]`, SFT
`[eval]`, the top level of `uv run eval`) takes a shared `select` block.
The same before-validator that layers the group `env` block layers it
under each source, field by field, and a field that the source sets
wins. A source's `include` or `exclude` replaces the group's whole
block. A source `select` that does not validate keeps its own block, so
its error surfaces. For example, this evaluates 128 tasks of each
taskset:
```toml
[orchestrator.eval.select]
limit = 128
```
- Only `uv run eval` has the `-n`/`-s` short flags
(`select.limit`/`select.shuffle`), through `vf.SelectCLIConfig`. The
`rl`, `orchestrator` and `sft` CLIs have several `select` blocks, so
they get no short flags.
- The dashboard derives the expected episode count from `select.limit`,
per source and for vf-shaped configs.
- Migrate the configs, examples and docs from `num_examples` to
`select.limit`. Group-level blocks use `[... .select]` tables.
- Update the eval docs and skill: resume no longer checks the config
(#3690), and a resume matches landed episodes to the new `select` by
`task.key`.
- Update the `configs` skill (`[select]`, `-s`). Update the eval skill:
the `select` shorthands, and common patterns (a random subset, tasks by
position or name, dropping broken tasks, contiguous and random
train/test splits via `include`/`exclude` and `skip`).
- Pin `deps/verifiers` to its main, which merged
PrimeIntellect-ai/verifiers#2695 (`Taskset.select`, `vf.SelectConfig`).
Raise the `verifiers` minimum to `0.3.2.dev152`, its first release, in
both `pyproject.toml` files, so the slim `prime-rl-configs` install gets
it.
Companion PRs: PrimeIntellect-ai/verifiers#2695 (merged),
PrimeIntellect-ai/prime-envs#852 (independent; `compile_statements`
stops calling `head()`).
## Breaking
- `EnvConfig.shuffle` is removed. Use `select.shuffle`.
- `EvalSourceConfig.num_examples` and the group-level `num_examples` are
removed. Use `select.limit` on the source or on the eval block.
- The shuffle seed changes from 42 to verifiers' default 0
(`select.seed`). Existing `shuffle = true` configs pick other tasks, so
eval numbers before and after this change are not comparable.
- Default task keys change for tasksets that never set `idx` (see
verifiers#2695). An interrupted eval of such a taskset cannot resume
across this change.
## Verification
- The slim-install CI check, run locally: the `prime-rl-configs` wheel
installed outside the workspace resolves `verifiers 0.3.2.dev152`, and
the workflow's import script passes.
- `uv run pytest tests/unit/test_configs.py tests/unit/eval
tests/unit/orchestrator tests/unit/test_dashboard_timeline.py`: 296
passed (2 vLLM-only tests deselected; `vllm` is not installed on the
test box). `test_load_configs` loads every migrated TOML.
- Real configs and CLI calls against a local mock OpenAI server (no
inference spend). The mock counted the model calls, and the selected
task `idx` matched an independent oracle:
- `uv run eval @ configs/debug/eval/single-turn.toml`: tasks 0–7 × 2, 16
calls.
- `uv run eval @ configs/debug/eval/resume.toml`: first run 16 calls.
`--resume --select.limit 10` restored 16 episodes and ran only tasks 8–9
(4 calls). `--resume --select.include.idx 0:5` kept the landed episodes
of tasks 0–4 and made no model calls.
- `uv run eval gsm8k -n 4 -s --select.exclude.idx '[0]'`: the oracle's 4
tasks, 4 calls.
- A two-source TOML that splits gsm8k into `[:50]` and the rest under a
group `select` default: both sources match the oracle, 5 calls.
- Config checks: train and eval group `select` defaults reach every
source, a source's own fields win, and the resolved `OrchestratorConfig`
re-validates to the same values. `uv run rl -h`, `orchestrator -h` and
`sft -h` list no `-n`/`-s`; `uv run eval -h` does.
- `uv run rl --dry-run` on `configs/debug/algo/grpo.toml`,
`examples/basic/reverse-text/rl.toml` and
`configs/debug/multi-env/rl.toml`, and `uv run sft --dry-run` on
`examples/basic/reverse-text/sft.toml`: group eval limits (128, 64, 32)
resolve onto each source, a per-source `select.limit = 256` is kept, and
train sources default to all tasks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Breaking config renames and verifiers-driven
selection/shuffle/task-key semantics affect every train/eval run and
eval resume comparability across the upgrade, though runtime logic is
largely delegated to verifiers.
>
> **Overview**
> Replaces **`num_examples`** and per-source **`shuffle`** with
verifiers' **`select`** block on every train/eval source (and
group-level `[select]` / `[orchestrator.eval.select]` /
`[eval.select]`). **`select.limit`** caps how many tasks run;
**`include`/`exclude`**, **`shuffle`**, **`skip`**, and **`seed`**
follow verifiers' ordering so prime-rl matches **`vf-eval`** for the
same selection.
>
> The orchestrator now loads tasks with
**`vf.load_taskset(...).select(source.select)`** instead of client-side
shuffle (seed 42) and **`islice`**. Group config merging layers shared
**`select`** onto each source like **`env`**. **`uv run eval`** maps
**`-n`/`-s`** to **`select.limit`/`select.shuffle`**; eval resume no
longer validates config against the interrupted run—landed episodes are
matched by **`task.key`** to the new **`select`**.
>
> All example/debug/CI TOMLs, docs, and skills are migrated.
**`verifiers`** minimum is raised to **`0.3.2.dev152`**. The dashboard
expects **`select.limit`** when estimating episode counts.
>
> **Breaking:** rename configs from **`num_examples`** →
**`select.limit`**, **`shuffle`** → **`select.shuffle`**; default
shuffle seed and task keys may differ from pre-change runs
(resume/comparability implications).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f30798a0a6d20e3a474cb58a6dd48a8a85eb6ace. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Port of torchtitan based chunked loss, which greatly imporves perf on
hopper for smaller models:
<html>
<head>
</head>
<body>
<html>
<head>
</head>
<body>
Model | Old chunked head | New chunked head | Gain
-- | -- | -- | --
Qwen3-30B-A3B, 8×H200, no AC, chunk 1024 | 6.71s | 6.20s | −7.6% step
time (+8.2% throughput)
Qwen3-235B-A22B, 4×8 H200, full AC, chunk 2048 | 14.09s | 14.00s | −0.6%
step time
</body>
</html>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes core LM-head autograd and SFT loss computation; RL/temperature
paths are mostly untouched but shared head code affects all training
modes using injected heads.
>
> **Overview**
> Adds a **torchtitan-style chunked summed cross-entropy** path on the
fused LM head when `labels` are passed **without** `temperature`, so SFT
no longer fakes unit temperature and negates logprobs (or materializes
full logits on the vanilla path).
>
> **`FusedOutputLinear`** now branches: no temperature →
`_ChunkedCrossEntropySumFn` returns scalar `loss` and folds
softmax-minus-one-hot grads into hidden/weight during forward (one token
chunk’s full-vocab logits at a time; backward only scales by the
upstream scalar). With temperature, behavior stays on the existing
logprob/entropy path.
>
> **Vanilla and Gemma** heads mirror the same contract
(`cross_entropy_sum` or Gemma’s chunked logprob sum). SFT **`train.py`**
is unified to masked `IGNORE_INDEX` labels and `out["loss"]`. Config
docs now describe SFT fused-head behavior instead of claiming it is
disabled.
>
> New unit tests check loss and gradients across fused/vanilla/Gemma
heads and chunk sizes, plus that temperature still uses logprobs.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c4d2601e4cc55d6a921d80a33d19eb2e1407a230. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Motivation
The trainer exposes IPO and IcePop but has no built-in PPO or CISPO loss
for controlled math-RL comparisons. PPO clips the token importance-ratio
surrogate; CISPO clips a **detached** importance weight multiplying the
current log probability, so an out-of-band ratio still has a policy
gradient. Both need to operate on the trainer's existing eligible-token
masks and optional per-token weights.
## Design
- Add `PPOLossConfig` / `PPOLoss` with a sign-aware clipped surrogate
(`ratio_low=.8`, `ratio_high=1.2` by default). A separate
`max_importance_ratio=1e4` bounds the otherwise unbounded side while
preserving its capped gradient; metrics report clipped and capped
fractions.
- Add `CISPOLossConfig` / `CISPOLoss`:
`-stop_gradient(clip(p_trainer/p_inference, low, high)) * advantage *
log p_trainer` on eligible tokens. The default lower bound `0` disables
lower clipping; the default upper bound is `5`. Metrics report the
clipped fraction.
- Register both as explicit `trainer.loss.type` choices. Existing loss
defaults and model precision fields are unchanged. #3696 is merged into
main and supplies the stable ratio arithmetic used by the new losses.
## Validation completed
- On the pre-restack head, the GPU loss and config suite had **213
passed**, covering PPO/CISPO values, advantage signs, clipping
gradients, masks, and config validation. Focused rerun after metric
cleanup: **4 passed**. Ruff check/format and SLURM dry run passed.
- At the current #3697 head, 192 config tests, a CPU PPO/CISPO
forward/backward smoke check, and Ruff check/format passed. Four focused
PPO/CISPO GPU tensor tests passed on GPU 7 of
`prime-nebius-puku-h200-gpu-059`, covering clipping, gradients, extreme
ratios, and masks. No full model test was run.
- One-node CISPO smoke job `1575` completed two optimizer updates with
finite loss, entropy, and mismatch KL; orchestrator reward was `0.3125`
then `0.4062` on 32 trainable traces per step, with no episode errors.
It was intentionally stopped after that validation: [W&B
run](https://wandb.ai/primeintellect/qwen30b-math/runs/0c0bb28ed7734551b600cbe52253d7f5).
## Ongoing experiment and private TOML provenance
CISPO job on math qwen3-30b-3a is pending validation. The long-run
reward and stability outcome remains pending.
## Motivation
Packed RL batches can contain masked tokens with invalid or extreme log
probabilities. IPO, IcePop, and ref-KL previously formed importance
ratios before removing those tokens, so a nominally excluded token could
still produce `0 * inf` or `0 * NaN`. Accepted rare actions could also
overflow `exp(log p_trainer - log p_inference)`, including in
mismatch-KL diagnostics.
## Design
- Select eligible tokens before ratio and KL arithmetic; IcePop and
ref-KL also select accepted tokens before exponentiating their policy
terms.
- Compute IPO's absolute probability-difference gate using `exp(max(log
p, log q)) * -expm1(min(log p, log q) - max(log p, log q))`, retaining
the same `eps` decision with better behavior for nearby small
probabilities.
- Add `IPOLossConfig.max_importance_ratio` (default `1e4`) and cap
accepted IPO/ref-KL forward weights while retaining the capped
policy-gradient coefficient. Bound squared-log-ratio terms and mismatch
diagnostics so they remain finite for extreme finite log ratios.
- Keep masked/unmasked diagnostics, namespace ref-KL metrics, and treat
the shared mismatch-KL helper as internal; leave model precision
settings unchanged.
## Validation completed
- GPU loss tests: **17 passed**, including extreme-ratio forward and
gradient cases. Expanded config suite: **205 passed**. Ruff check and
format passed.
- The stacked CISPO and IPOv2 two-update smoke runs both completed with
finite trainer metrics and no episode errors:
[CISPO](https://wandb.ai/primeintellect/qwen30b-math/runs/0c0bb28ed7734551b600cbe52253d7f5),
[IPOv2](https://wandb.ai/primeintellect/qwen30b-math/runs/3ab7fbd7805d4ebca1d7ff2d1dc0cc84).
These validate this fix in downstream training paths; there was no
standalone PR1 training run.
## Ongoing experiments and config provenance
The 300-step CISPO and IPOv2 runs use this fix through stacked commits.
[IPOv2](https://wandb.ai/primeintellect/qwen30b-math/runs/9045de5680a44a1d9a9f6bd84e9c30f2)
is running; the CISPO job is queued for an 8-GPU node. Long-run outcomes
are pending.
The actual run TOMLs at
`docs/study/examples/qwen3-30b-a3b/math16k_slurm.toml`,
`math_cispo.toml`, and `math_ipov2.toml` are **local and uncommitted**.
Relative to the checked-in [advanced math
example](https://github.com/PrimeIntellect-ai/prime-rl/blob/f87fd0eb3372cded4cf6cfb20e41189796354eae/examples/advanced/qwen3-30b-a3b/math.toml),
the shared local base uses one 8-H200 node (2 trainer, 6 inference GPUs)
instead of two trainer plus two inference nodes; 16,384 sequence tokens
and 15,000 completion tokens instead of 32,768 each; EP 2 + Ulysses CP 2
instead of EP 8; batch size 32, zero allowed off-policy steps, and 64
inflight episodes instead of batch size 512, eight off-policy steps, and
1,024 initial inflight episodes (group size 8 is shared); and vLLM TP 2
/ DP 3 instead of TP 8. It runs 300 steps without the example's AIME
eval source. The model, math taskset, AdamW learning rate (`1e-6`), and
W&B project are shared. The private overlays select CISPO
(`ratio_high=5`) or IPOv2 (`eps=.3`, `ratio_cap=5`, entropy floor `.15`)
and point SLURM at this worktree.
## Summary
- Bump Verifiers to
[`c35ebd32`](https://github.com/PrimeIntellect-ai/verifiers/commit/c35ebd320126ee17f6a570a4f3fb8ef0fe0b0ae1).
This includes [the merged timeout
fix](https://github.com/PrimeIntellect-ai/verifiers/pull/2697): an unset
agent rollout timeout no longer falls back to four hours.
- Bump prime-envs to
[`565e8a74`](https://github.com/PrimeIntellect-ai/prime-envs/commit/565e8a74c001b25706d7c958f36d7bb0cd504ddc).
Its Lean helper now works with Verifiers' taskset API.
## Breaking
- An unset agent rollout timeout now inherits the task timeout, or has
no separate limit. Set a positive `env.<agent>.timeout.rollout` to
retain a stage limit.
- `env.<agent>.timeout.rollout = 0` is rejected. Remove the field to
request no separate stage limit.
## Verification
- `uv lock --check --offline` passed with the updated submodules.
- A focused UV smoke test confirmed that an unset agent timeout resolves
to no limit, a positive override resolves as given, and zero fails
validation.
- `git diff --check` passed.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Behavior change to rollout timeout defaults affects how long agent
stages can run; misconfigured envs may run longer or fail validation
until configs are updated.
>
> **Overview**
> Updates **Verifiers** and **prime-envs** dependency pins to pick up
upstream fixes and API alignment.
>
> The Verifiers bump fixes agent rollout timeout resolution: an
**unset** `env.<agent>.timeout.rollout` no longer silently defaults to
four hours—it now follows the task timeout or has no separate stage cap.
**`env.<agent>.timeout.rollout = 0` is now invalid**; omit the field
instead of using zero to mean “no separate limit.” Configs that relied
on the old default or zero need an explicit positive rollout timeout if
they still want a stage limit.
>
> The **prime-envs** bump updates its Lean helper for Verifiers’ taskset
API.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
dead789c54f98ce0e57ab3fe47f9e819a9b802eb. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
Reworks the entrypoint's `PRIME_RL_REF` runtime source override so the
prime-rl-fft chart can run a branch on hosted FFT without building an
image for it. Inert unless `PRIME_RL_REF` is set; the default `docker
run` / chart path is unchanged.
The hook already existed (#2850) but was tuned for long-lived
containers: it cloned the full repo (~700 MB of `.git`) and `cp -a`'d
the 20 GB baked venv into a per-ref dir before syncing. As a per-pod
startup step that is unusable. Kubernetes `command:` also replaces the
image ENTRYPOINT, so the fft chart never ran this script at all; the
companion chart PR (PrimeIntellect-ai/fft#101) routes every prime-rl
container through it with a dispatcher-pinned sha.
## Changes
- **Shallow fetch by ref.** Fresh `git init` + `fetch --depth 1 origin
<ref>` + `checkout FETCH_HEAD`, then `submodule update --init
--recursive --depth 1` for the same four public submodules
`build_image.yaml` inits. GitHub serves branches, tags and full shas
alike; abbreviated shas are not fetchable and the comment says so. The
checkout is always fresh: a container is, and the fetch is seconds.
- **Sync into the baked venv instead of copying it.**
`UV_PROJECT_ENVIRONMENT=/app/.venv uv sync --inexact --locked ...` from
the checkout, with the same extras list as `Dockerfile.cuda`. uv
re-points the first-party editables at the checkout and reinstalls only
third-party pins that differ; flash-attn, deep-ep, mamba-ssm and friends
stay as baked. The chart's `uv run --no-sync <entrypoint>` commands
resolve the project from the new cwd.
- **Heavy-pin preflight.** Before syncing, compare the checkout's
`uv.lock` against `/app/uv.lock` for torch, torchvision, torchaudio,
triton, vllm, vllm-router, flash-attn, flash-attn-3, flashinfer-python,
tilelang, deep-ep, deep-gemm, mamba-ssm, nixl, prime-kernels and
quack-kernels. Any difference exits with a message to build an image
instead. The validator in fft runs the same check at dispatch
(PrimeIntellect-ai/fft#102); this is the backstop.
- **Pretend versions like the image build.** The shallow submodule
clones carry no tags, so hatch-vcs stamped verifiers/renderers
`0.0.1.dev1` and every `verifiers>=…` floor in the tree was unmet.
Resolve the same versions the Dockerfile does
(`docker-editable-pretend-versions.sh`), bake them into
`fallback-version` and drop the submodules' git metadata so the fallback
applies. (setuptools-scm's per-dist env vars turned out not to be
honored by hatch-vcs.)
- **Replay the image's prime CLI install, with its verifiers pin
overridden.** `Dockerfile.cuda` installs `prime>=0.7` after its lockfile
sync, which pulls prime-traces / prime-sandboxes / openai past the
lock's pins; the `--locked` sync here rolled them back and `prime env
install` could no longer import. The CLI also pins `verifiers==0.2.0`,
which replaces the editable with the PyPI wheel and breaks prime-rl's
own imports (see below). The replayed install passes `--overrides` with
a one-line file containing `verifiers`. **Workaround, marked
`FIXME(prime#940)` in the script:** remove the override once the prime
CLI drops verifiers as a dependency (PrimeIntellect-ai/prime#940),
together with the matching override in `Dockerfile.cuda` (#3705).
- **Git URL rewrite via `GIT_CONFIG_*` env** instead of `git config
--global`, so pods whose `HOME` is not writable by their uid still clone
the ssh-listed submodules.
- **`PRIME_RL_SOURCE_COMMIT`** is exported and logged so runs record
what actually ran.
## Found along the way: published images ship a broken verifiers
Since #3635 (2026-09-22) the Dockerfile's `uv pip install 'prime>=0.7'`
step replaces the submodule verifiers (0.3.x) with the PyPI
`verifiers==0.2.0` wheel that every prime release since 0.6.30 pins. On
the pristine image and on main-built `v0.9.1.dev128`, `uv run --no-sync
orchestrator --help` and `env-server --help` fail at import
(`verifiers.v1` has no `SingleAgentEnvConfig`; no
`set_base_sandbox_labels`). Runs that install a Hub env at pod start
survive by accident, because that install pulls verifiers 0.3.x back in;
baked-env runs like the nightly FFT configs do not, and nightly FFT has
failed daily since 9/24. The same override fixes the Dockerfile in
#3705.
## Verified on telus (namespace `minh-dev`, image built from this branch
at 478481593, later revisions of the script fetched into the same image)
Overlaying main tip `b94487324`, which adds `get_global_moe_stats` to
the trainer model module, a marker the baked source lacks:
| Check | Result |
|---|---|
| depth-1 fetch + four submodules | 9 s |
| container start → pod command, including the CLI install | ~35 s; ~60
s with a Hub env install |
| `prime_rl`, `verifiers`, `renderers` import from the checkout; marker
present in the overlay, absent in `/app/src` | pass, as root and as uid
1000 (`HOME` on an emptyDir, like the chart's env-servers) |
| vllm / torch / flash-attn versions and site-packages mtimes untouched
| pass |
| editables report `verifiers 0.3.2.dev137`, `renderers 0.1.12.dev2` |
pass |
| `prime --version`, `prime env install --help`, `uv run --no-sync prime
env install primeintellect/wordle` | pass; the install swaps the baked
`wordle` for the Hub's and leaves verifiers alone |
| `uv run --no-sync orchestrator --help`, `env-server --help` | pass
(they fail on the pristine image, see above) |
| `uv pip check` | 7 incompatibilities, down from the image's 107: six
are the image's own lockfile inconsistencies (mamba-ssm/tilelang,
torch/cudnn, vllm/transformers, openai-agents/openai and
python-multipart, flash-attn-4/tvm), the seventh is the intentional
`prime requires verifiers==0.2.0` |
| ref whose lock pins vllm 0.28.0 vs the image's 0.29.0 | refused in 9
s, before any sync, naming `flashinfer-python, vllm` |
| a `PRIME_CLI_SPEC` knob tried in one revision | removed: a
caller-supplied env var must not choose what gets installed into a
hosted pod |
Not exercised: a GPU workload through the overlay (the pods were
CPU-only), and the chart path end to end (needs fft#101 deployed).
## Related
- fft: chart `source` values (PrimeIntellect-ai/fft#101) and validator
`source.ref` resolution with the same lockfile preflight
(PrimeIntellect-ai/fft#102).
- platform `sourceRef` on the dedicated run dispatch and `prime train
--ref` / `--pr` follow.
- Dockerfile fix for the verifiers clobbering: #3705.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes how chart/FFT pods bootstrap Python when `PRIME_RL_REF` is set
by mutating `/app/.venv` at startup; mis-synced lockfiles or override
logic could break training entrypoints, though heavy-pin preflight and
the default no-ref path limit blast radius.
>
> **Overview**
> When **`PRIME_RL_REF`** is set, the Docker entrypoint no longer does a
full repo clone and a 20 GB venv copy into `/tmp`. It
**shallow-fetches** the ref (depth‑1 + four submodules), exports
**`PRIME_RL_SOURCE_COMMIT`**, and **`uv sync`s the checkout into the
baked `/app/.venv`** so editables point at the overlay while heavy GPU
wheels stay untouched.
>
> Startup adds **guardrails and parity with the image build**: compare
checkout vs image **`uv.lock`** for torch/vllm/flash-attn-style packages
and **exit early** if they drift; apply
**`docker-editable-pretend-versions.sh`** so shallow submodules satisfy
`verifiers`/`renderers` floors; **reinstall `prime>=0.7`** with a
**`verifiers` pip override** so the CLI does not clobber editables.
GitHub SSH URLs are rewritten via **`GIT_CONFIG_*`** (writable without a
global git config), and the process **`cd`s into the checkout** instead
of swapping **`VIRTUAL_ENV`** to a per-ref venv.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b2fddf150dcaadfbe66cc7945ac34dac649d2fc6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Raises the pyproject floor to `prime-sandboxes>=0.3.2` and refreshes the
lock accordingly (resolves 0.3.2, wheel/sdist hashes cross-checked
against PyPI).
## Why
The hosted-eval stress runner bootstraps this repo with `uv sync
--no-dev --frozen`, so the 429-retry fixes in prime-sandboxes 0.3.2
(status-aware backoff on platform API and gateway retries) only reach
eval rollouts through this lock. 0.3.0 satisfied the old `>=0.3.0` floor
indefinitely - `lock-check` enforces consistency, not freshness - so the
behavioral fix could not arrive without either this bump or a new
automation mechanism.
The floor raise (rather than a lock-only refresh) encodes the actual
requirement: the runtime depends on the 429-retry semantics, and any
future lock regeneration can no longer backslide below 0.3.2. Precedent
for this shape: #3571 (`chore: require prime-runs 0.1.3`).
## What changed
- `pyproject.toml`: `prime-sandboxes>=0.3.0` -> `>=0.3.2`
- `uv.lock`: the matching specifier line; the prime-sandboxes resolution
entries already point at 0.3.2
## Validation
- `uv lock --check` passes (581 packages)
- `uv sync --no-dev --frozen` resolves prime-sandboxes 0.3.2
- `uv run pytest tests/unit/eval -v`: 9 passed
- Regenerated with uv 0.12.19 (older uv reorders unrelated lock tables)
Linear: ENG-5966 (eval-based stress testing).
## What
- **NIXL from source (default on).** `Dockerfile.cuda` builds NIXL
0.10.1 against the baked `/opt/ucx` (UCX 1.19.1) by default. The wheel
is renamed to `nixl-cu13` before building, and the build asserts the UCX
plugin links `/opt/ucx/lib/libucp.so`.
`scripts/install_nixl_from_source.sh` gets the same rename for the SLURM
path.
- **prime CLI as an isolated uv tool.** It's installed into
`/app/.tools` instead of `uv pip install`-ing it into `/app/.venv`, with
the executable linked into `/app/.venv/bin`. The build asserts the
workspace `verifiers` is still the one installed.
## Why
**NIXL.** The PyPI `nixl-cu13` wheel bundles its own UCX, which
segfaults on the prefill→decode KV transfer (#2883). The existing
`INCLUDE_NIXL_FROM_SOURCE` option was:
1. **Off by default, never enabled in CI.** Every published image ships
the PyPI wheel. On SLURM, research works around this with a
`pre_run_command` reinstall after each `uv sync`.
2. **Broken when enabled.** NIXL 0.10.1's pyproject names the package
`nixl-cu12`, so the `nixl_cu13-*.whl` glob matched nothing.
3. **A no-op even when installed.** The `nixl` shim imports `nixl_cu13`
before `nixl_cu12`, so the source build sat unused. Upstream's
`contrib/build-wheel.sh` renames via `contrib/tomlutil.py --wheel-name
nixl-cu<major>`, and this PR does the same.
The plugin has `RUNPATH=/opt/ucx/lib`, so it doesn't depend on
`LD_LIBRARY_PATH`.
**prime CLI (regression from #3635).** Every `prime` 0.7.x on PyPI pins
`verifiers==0.2.0`. Running `uv pip install 'prime>=0.7'` into the app
venv resolves against it and replaces:
- workspace `verifiers` (0.3.2.dev) → 0.2.0
- `openai` 2.54 → 3.15
- workspace `prime-pydantic-config` → the PyPI one
- `prime-sandboxes` / `prime-traces` → newer versions
As a result, `prime_rl.configs.orchestrator` fails to import (`module
'verifiers.v1' has no attribute 'SingleAgentEnvConfig'`), and every
component crashes at startup. This affects every image built since
#3635.
## Test plan
- [x] Image `commit-0039ddc20-amd64` (NIXL fix only): the build passed,
and inference pods on telus confirmed the UCX plugin links `/opt/ucx`
1.19.1. The run then crashed on the `verifiers` downgrade above.
- [x] On `commit-a1822f7a0-amd64` (pre-#3635): `uv tool install
'prime>=0.7'` gives a working CLI 0.7.5, and `uv run --no-sync prime env
install primeintellect/reverse-text` installs into `/app/.venv`.
`verifiers` still has `SingleAgentEnvConfig`, and `openai` stays at
2.54.0.
- [x] Earlier, a GLM-5.3 10-node P/D run on FFT/telus with the same NIXL
build (installed in-pod): a chat request through the PD router
succeeded, with 1 NIXL KV transfer of 5.65 MB / 18.8 ms and no segfault
(ENG-6348).
- [x] Image `commit-cef7100c7-amd64` (both fixes, newest main): build
passed, including the new workspace-verifiers assertion. The GLM-5.3
10-node P/D run on telus used it with no in-pod bootstrap: the NIXL UCX
plugin links `/opt/ucx` 1.19.1, all components import cleanly, the
PD-router chat request returned correctly, and NIXL KV transfers
succeeded. Prefill also needed `VLLM_USE_BREAKABLE_CUDAGRAPH=0` on vLLM
0.29; that is separate, in #3669.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Scott Cabrinha <scott.cabrinha@primeintellect.ai>
## Summary
Published prime-rl images since #3635 (2026-09-22) ship the PyPI
`verifiers==0.2.0` wheel instead of the submodule editable, and the
orchestrator and env-server entrypoints fail at import as a result. This
installs the prime CLI with its verifiers requirement overridden so the
editable stays, and asserts that at build time.
## What's wrong
`Dockerfile.cuda` installs the prime CLI after the lockfile sync (`uv
pip install 'prime>=0.7'`). Every prime release since 0.6.30 (prime#879,
2026-08-31) pins `verifiers==0.2.0`, so that install uninstalls the
editable verifiers (0.3.x, pretend version `0.3.2.dev137`) and replaces
it with the 0.2.0 wheel. Observed on a pristine `v0.9.1.dev128` pod on
telus:
```
$ uv run --no-sync orchestrator --help
File ".../prime_rl/configs/orchestrator.py", line 160, in EnvConfig
env: SerializeAsAny[vf.EnvConfig] = vf.SingleAgentEnvConfig()
AttributeError: module 'verifiers.v1' has no attribute 'SingleAgentEnvConfig'
$ uv run --no-sync env-server --help
File ".../prime_rl/entrypoints/env_server.py", line 9, in <module>
from verifiers.v1.runtimes import set_base_sandbox_labels
ImportError: cannot import name 'set_base_sandbox_labels' from 'verifiers.v1.runtimes'
```
`uv pip check` on the image reports 107 incompatibilities, all `...
requires verifiers>=0.3.1, but 0.2.0 is installed`.
Runs that install a Hub env at pod start survive by accident: `prime env
install` pulls an env that requires `verifiers>=0.3.1`, which drags
verifiers 0.3.x from PyPI back in before the orchestrator imports it.
Runs on baked envs get no such repair. The nightly FFT configs are all
baked envs, and nightly FFT has failed every day since 9/24.
An older CLI is not an option: the last release without the pin (0.6.29)
needs a prime-sandboxes API that 0.3.0 removed, and prime-rl itself
requires `prime-sandboxes>=0.3.0`.
## Fix
- Install the CLI with `--overrides` on a one-line file containing
`verifiers`, so its `verifiers==0.2.0` requirement is ignored and the
editable is left alone. Everything else the CLI needs (prime-traces,
prime-sandboxes, openai, …) still installs as before.
- Assert in the same `RUN` that `verifiers` imports from
`/app/deps/verifiers`, so a regression fails the build rather than the
orchestrator.
- **This is a workaround, marked `FIXME(prime#940)` in the Dockerfile.**
The real fix is the prime CLI dropping verifiers as a dependency,
PrimeIntellect-ai/prime#940. Once that ships, remove the overrides file
and the `--overrides` flag here and in `scripts/docker-entrypoint.sh` on
#3686, which replays this step with the same override for the runtime
source overlay. Keep the import assertion.
## Verified
- The override was exercised on telus pods against the
`v0.9.1.dev127-4-gba81f7c5b-feat-runtime-source-overlay` image (whose
entrypoint runs the identical command after re-syncing the editables):
verifiers stays at `0.3.2.dev137` from `deps/verifiers`, `prime
--version` and `uv run --no-sync prime env install
primeintellect/wordle` work, `orchestrator --help` and `env-server
--help` start, `uv pip check` drops from 107 incompatibilities to 7 (six
pre-existing lockfile inconsistencies plus the intentional `prime
requires verifiers==0.2.0`). A full hosted run (reverse-text, 20 steps)
completed on that venv.
- This Dockerfile change itself: image build dispatched from this
branch, result below.
Build from this branch: dispatched, result pending.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes Docker venv composition for a dependency that prime-rl
entrypoints rely on; mitigated by a build-time import-path assertion,
but image builds and baked-env runs depend on the override staying
correct.
>
> **Overview**
> Published CUDA images broke **orchestrator** and **env-server**
because installing `prime>=0.7` after `uv sync` pulled PyPI
`verifiers==0.2.0` over the repo’s editable under `deps/verifiers`
(0.3.x APIs).
>
> The **prime CLI install step** in `Dockerfile.cuda` now writes a
one-line `uv pip install --overrides` file (`verifiers`) so the CLI’s
pinned verifiers requirement is ignored while other CLI deps still
install. A **build-time assert** checks `verifiers` resolves under
`/app/deps/verifiers`. Comments mark this as a temporary
**FIXME(prime#940)** until the CLI drops verifiers; the entrypoint
overlay in `scripts/docker-entrypoint.sh` is called out as needing the
same cleanup later.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
22c9bfd1c9907da4662665f225ca10c3cdf6a930. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
`uv run eval --resume` used to compare the resolved config against the
interrupted attempt's `eval.json`. It refused any change outside a short
allowlist, which left out the solver `model`, everything under
`source.*.env` (including where each judge is served) and
`tasks_per_minute`. So a paused eval couldn't move to a new endpoint
serving the same weights under another name, such as a self-hosted
router becoming a hosted API. The only way out was `--clean`.
This PR removes that validation (`RESUMABLE`, `config_diff`,
`check_config`, `previous_config`), so any field can be overridden on
resume. It's up to whoever resumes to keep the measurement consistent.
The resolved config is still written beside each attempt's episodes
(`stamp_config`), so every attempt records what it ran with.
`docs/eval.md` still says a resume that changes the model, sampling or
env stops with the differing paths. That's no longer true and needs a
follow-up.
## Test plan
- Removed the tests for the deleted functions. `pytest tests/unit/eval`
passes (7 tests).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Resume can now mix previously landed episodes with a different model,
sampling, or env configuration, which can invalidate eval comparability
if operators override carelessly.
>
> **Overview**
> **`uv run eval --resume` no longer compares the new resolved config to
the interrupted attempt's stamped `eval.json`.** The allowlist-based
guard (`RESUMABLE`, `config_diff`, `check_config`, `previous_config`) is
removed, so fields like model, sampling, env/judge endpoints, and source
layout can all change when resuming instead of forcing `--clean`.
>
> Resume still loads landed episodes from the trace stream and stamps
the current config per attempt via `stamp_config`; only the validation
step in `Eval.run` is dropped. Module docs now state that **any config
may be overridden** and consistency is the operator's responsibility.
>
> Unit tests for config checking and `previous_config` lookup were
removed; remaining resume tests (`plan`, `take_landed`, trigger
integration) are unchanged.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
06482534d862782e1a844ea9f8d5c3f5c37310ac. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
Companion to PrimeIntellect-ai/verifiers#2693, which stops a rollout
whose stage deadline expires as `<stage>_timeout` with
`Trace.is_timeout` set (scored, not errored).
- Training keeps main's semantics: the dispatcher records a `Timeout`
error on a timed-out train trace, so it stays out of the batch and
counts under `has_error`. Eval keeps the timeout as a scored outcome.
- Metrics: `is_timeout` joins the trace rates
(`<scope>/{all,effective}/<agent>/is_timeout/mean`) next to
`is_truncated`; `EpisodeMetrics.is_timeout` over the full cohort feeds
the console summary lines (`... | Truncation 0.0% | Timeout 100.0%`) for
train, online eval and standalone eval.
- W&B overview and dashboard metric sections plot
`all/<agent>/is_timeout/mean`.
- Trace index rows carry `timeout` (the episode's `is_timeout` or any
trace's); the dashboard series expose it.
- Dashboard: yellow (`--timeout`) marks for timed-out episodes on the
overview tile (`timeout rate`), episode cells, swarm points,
timing/token strips, episode table rows (with a `timed out (<stop>)`
title), trace tabs and the timeline state; the trace meta panel shows
`is_timeout`.
- Dispatcher: a timed-out eval trace with zero turns stays a timeout
instead of being promoted to an `EmptyTrajectory` error; it is scored
and counted under `is_timeout`.
- Bumps `deps/verifiers` to verifiers `main` with #2693 merged.
## Breaking
- In evals, a rollout that hits its `timeout.rollout` (or
setup/finalize/scoring) budget no longer counts under `has_error`: it
lands `ok` with `stop_condition = "<stage>_timeout"`, is scored, and
enters the `effective` subset like a truncated rollout does. Training is
unchanged: a timed-out rollout is still an error (now typed `Timeout`,
with `is_timeout` set alongside).
## Verification
Ran off this branch with the verifiers companion on `PYTHONPATH`:
```
uv run eval gsm8k -n 4 -r 1 -c 4 -m alibaba/qwen3.5-flash --env.agent.harness.id null --env.agent.runtime.type subprocess --env.agent.timeout.rollout 2
```
Before the dispatcher change: `Error 100.0% | Truncation 0.0% | Timeout
0.0%`, every trace re-labelled `EmptyTrajectory`. After: `Error 0.0% |
Truncation 0.0% | Timeout 100.0%`, metrics `is_timeout/mean = 1.0`,
`stop_condition/agent_timeout = 1.0`, index rows `ok=true,
stop_condition=agent_timeout, timeout=true`. A control run with the
default budget lands `agent_completed`, `timeout=false`, `Timeout 0.0%`.
Dashboard driven headlessly with playwright against both runs: `timeout
rate` tile `100%` in `rgb(255, 209, 102)`, every episode cell/row class
`timeout`, rows titled `timed out (agent_timeout)`, trace meta
`is_timeout true` / `ok true`; the control run shows `0%` and no marks;
no page errors.
`tests/unit/orchestrator`, `tests/unit/eval` and
`tests/unit/test_dashboard_timeline.py` pass.
## Screenshots
Eval with `--env.agent.timeout.rollout 2`: the overview tile and episode
cells read yellow, the traces table marks each row's edge yellow, and
the trace viewer lists the timed-out episodes with `is_timeout true` /
`ok true`.



🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Eval cohort semantics change (timeouts move off `has_error` onto
`is_timeout`), and the dispatcher path that promotes empty trajectories
to errors now explicitly exempts timed-out eval traces—worth validating
against downstream dashboards and monitors that assumed timeouts were
errors.
>
> **Overview**
> Rollouts that hit a stage deadline (`<stage>_timeout`) are now a
**distinct outcome** from errors and truncation, with **`is_timeout`**
tracked alongside **`is_truncated`** in orchestrator metrics, console
summaries, W&B/dashboard metric panels, and docs.
>
> **Training vs eval:** On **train**, the dispatcher still drops
timed-out traces from the batch by attaching a **`Timeout`** error and
marking the trace **`ok=false`** (same exclusion as before, now typed).
On **eval**, timeouts stay **`ok`** and scored; zero-turn timeout traces
are no longer relabeled as **`EmptyTrajectory`** errors.
>
> **Observability:** Trace index rows and eval series expose
**`timeout`**; the dashboard uses yellow styling for timeout rate,
episode cells, swarm dots, tables, timeline state, and trace meta
**`is_timeout`**. Eval success logs and standalone eval runner output
add a **Timeout** percentage next to truncation/error.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
83c0ce4c920aa0fb55eea97c251db18ec763053f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
## Summary
- **Group `env` block**: `[orchestrator.train]`, `[orchestrator.eval]`,
the `[eval]` block of `sft`, and the top level of `uv run eval` each
take an `env` block. Every source of the group inherits it through
`vf.merge_env_defaults`, and a source's own `env` values win.
- **Only shared knobs**: the block is typed as `vf.SharedEnvConfig`. It
takes `retries`, `timeout`, `max_concurrent_agents`, `interception`,
`taskset.task`, and `taskset.system_prompt`. Env ids, taskset ids, and
agent roles stay on each source and are rejected in the group block. So
one group can mix single-agent and multi-agent envs.
- **Eval shorthands**: `<taskset-id>` and `--env.<field>` keep their
single-source meaning. Next to a TOML that defines `[[source]]` blocks,
`--env.<field>` now sets the shared block instead of erroring, e.g. `uv
run eval @ sources.toml --env.retries.max-retries 3`.
- Pin `deps/verifiers` to the merged
[verifiers#2690](https://github.com/PrimeIntellect-ai/verifiers/pull/2690),
which adds `SharedEnvConfig` and `merge_env_defaults`. Raise the
`verifiers` minimum to `0.3.2.dev143`, its first release, in both
`pyproject.toml` files, so the slim `prime-rl-configs` install gets it.
- Update `docs/eval.md` and `docs/configuration.md`.
## Verification
- Composed `configs/basic/reverse-text/rl.toml` with an overlay that has
two train and two eval sources. Each group's `env` block sets
`retries.max_retries`, `retries.include`, `timeout.episode`,
`max_concurrent_agents`, and `taskset.system_prompt`. One source per
group overrides `retries.include` and `timeout.episode`. The other
source got every group value. The overriding source kept its two values
and inherited the rest. The same held after re-validating the resolved
`OrchestratorConfig` dump.
- Repeated the check with the same blocks in a `uv run eval` TOML, plus
a `proposer-solver` source. The multi-agent source inherited the shared
values and kept its `proposer` settings. The resolved `eval.json`
re-validates to the same dump.
- `--env.retries.max-retries 5 --env.retries.include A B` next to that
TOML reached every source, except that the overriding source kept its
own `include`.
- A group block with `id`, `agent.*`, `taskset.id`, or a misspelled
field fails with one error at `env.*`.
- `uv run eval gsm8k --env.agent.harness.id bash --env.taskset.split
test` still configures the single source.
- `pytest tests/unit/eval tests/unit/test_configs.py`: 202 passed.
- Built the `prime-rl-configs` wheel and installed it in a clean venv,
as the slim-install job does. It resolved `verifiers 0.3.2.dev143`, and
the configs imported with no heavy deps.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes how train/eval env configs are merged at parse time, so
misconfigured shared blocks or invalid shared-only fields could affect
every source in a group; scope is config/CLI rather than training logic
itself.
>
> **Overview**
> Adds a **group-level `[env]` block** on orchestrator train/eval source
groups (and standalone eval) so shared knobs—retries, timeouts,
concurrency caps, interception, shared taskset fields—apply to every
source, with per-source `env` still winning on conflict. Config
validation layers defaults through `merge_group_env` and verifiers’
`SharedEnvConfig` / `merge_env_defaults`.
>
> **Eval CLI behavior** changes for multi-source TOMLs: `--env.*` now
targets the shared block instead of being rejected (single-source
`<taskset-id>` shorthands are unchanged and still cannot mix with
`[[source]]` TOMLs). Docs and unit tests cover the new TOML shape and
shorthand routing.
>
> Pins **verifiers** to `>=0.3.2.dev143` in the root and
`prime-rl-configs` packages (lockfile updated).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8aef01e0cdd6baaf1275e06f33bf0091c548913a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
- Set `orchestrator.group_size = 8` in the INTELLECT-3.1 and Qwen3
math/SWE standalone RL examples.
- Prevent GRPO's default group size of 1 from giving every rollout a
zero group-relative advantage.
- Keep existing explicit group sizes, including GLM base configs used by
overlays.
## Verification
- Parsed each changed TOML through `RLConfig.model_validate`; all three
resolve to group size 8 for every train source.
- `git diff --check` passed.
Co-authored-by: Konstantin Dunas <git@hallerite.com>
## Summary
- Pin verifiers to `6a82e5d`, which includes the [Bash/Null certifi
fix](https://github.com/PrimeIntellect-ai/verifiers/pull/2614) and the
[nano-rlm certifi
pin](https://github.com/PrimeIntellect-ai/verifiers/pull/2688).
- Pin prime-envs to `647ff7a`, which includes the [GPQA judge
fix](https://github.com/PrimeIntellect-ai/prime-envs/pull/845), [DeepSWE
missing-test
scoring](https://github.com/PrimeIntellect-ai/prime-envs/pull/847), and
[Apex Compose host
images](https://github.com/PrimeIntellect-ai/prime-envs/pull/842).
- Refresh `uv.lock`. Exclude `tau2-bench` from the shared workspace
because its new Tau2 dependency requires LiteLLM below 1.82.7, while
Harbor requires 1.92.0 or newer.
## Breaking
- `uv sync --all-packages` no longer installs `tau2-bench`. Install and
run it in a separate environment until its Tau2 and Harbor LiteLLM
requirements can share one lock.
## Verification
- `uv lock --check` and `uv sync --all-packages --all-extras --locked
--dry-run --quiet` passed.
- The five-source Intellect 4 GLM-5.3 eval composition resolved with the
intended model, max reasoning effort, harnesses, group sizes, and
rollout timeouts.
- `uv run --no-sync eval @ configs/debug/eval/multi-env.toml --dry-run`
passed.
- `uv run --no-sync rl @ configs/basic/wordle/rl.toml --dry-run` passed.
- A one-task `pi-terminal-bench-2` financial-document rollout on
`internal/glm-5.3-fast` completed with reward 1.0, 55 turns, and 0.0%
error.
- `git diff --check` passed.
Apex remains excluded from prime-rl's shared workspace because it pins a
separate verifiers git revision. Its new Compose host images still need
an Intellect 4 rollout check before Apex rejoins that suite.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Breaking for anyone relying on `uv sync --all-packages` to install
`tau2-bench`; they must use a separate environment until LiteLLM
constraints align.
>
> **Overview**
> **`tau2-bench` is removed from the shared `uv` workspace** so `uv sync
--all-packages` can keep Harbor’s **`litellm>=1.92.0`** without fighting
Tau tasksets’ **`litellm<1.82.7`**. The workspace **`exclude`** list now
includes `deps/prime-envs/environments/tool_use/tau2_bench`, and the
comment documents that split (alongside the existing Apex / tau2_synth /
tau3 exclusions).
>
> **`uv.lock` is refreshed** accordingly: `tau2-bench` and the git
**`tau2`** package drop out of the lock, along with their former
transitive stack (e.g. gymnasium, matplotlib, langfuse, redis). Several
editable prime-envs packages show **patch version bumps** in the lock
(Lean/math envs, `gpqa`, `lean-common`, etc.) as part of the same
dependency refresh.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5f1504314e8e97d8e8bae5ebc49381cc30822106. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- Delete `CLAUDE.md`. It only imported `@AGENTS.md`, and Claude Code
reads `AGENTS.md` natively since v2.1.277
([docs](https://code.claude.com/docs/en/memory.md#agents-md)).
- Update the skills line in `AGENTS.md` to name both the
`.claude/skills` (Claude Code) and `.agents/skills` (Codex) symlinks.
Neither tool reads the other's skills folder, so both symlinks stay.
## Breaking
- Claude Code sessions older than v2.1.277 read only `CLAUDE.md`, so
they no longer load the repo instructions. On Bedrock or with telemetry
disabled, the minimum is v2.1.281. Migration: update Claude Code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation-only agent config changes with no runtime or application
code impact; the only caveat is older Claude Code versions losing loaded
instructions.
>
> **Overview**
> Removes **`CLAUDE.md`**, which only re-exported **`AGENTS.md`** via
`@AGENTS.md`, so agent instructions live in a single file now that
Claude Code reads **`AGENTS.md`** natively.
>
> The **Skills** section in **`AGENTS.md`** now documents both symlink
targets: **`.claude/skills/`** for Claude Code and **`.agents/skills/`**
for Codex, since each tool only loads its own folder.
>
> **Breaking:** Claude Code builds before native **`AGENTS.md`** support
(v2.1.277+, v2.1.281+ on Bedrock/telemetry-off) no longer pick up repo
instructions unless upgraded.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
205ca092421609d40c938a16c78a75051c67ec2e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
`max_vio` is intended to capture the largest expert routing violation
for each training microbatch across an entire EP group. The metric uses
expert token counts, not the number of tokens allocated to an EP rank.
For each microbatch, we take the maximum across MoE layers and EP
groups; `max_vio/mean` and `max_vio/max` then summarize those microbatch
maxima within the logged optimizer step.
### Why the old numbers depended on topology
The router records selections for every expert on each rank before
dispatch, but the original `get_load_balance_stats` computed violation
from that rank's **local** counts. With CP, each rank sees only a
sequence shard. At fixed EP, changing CP or DP changes the local token
population and the number of rank readings. SFT averaged layer
violations locally, took a world maximum, and averaged it over gradient
accumulation; RL's `/mean`, `/median`, `/std`, and `/max` summarized all
local layer/rank/microbatch readings. Those reductions did not describe
one EP group's routed traffic, so equal EP degrees could report
substantially different values.
### What changed
- Sum per-expert token counts and routing-confidence sums within the EP
group **before** computing per-layer violation and confidence. Reset
both buffers after reading them. Remove the unused `reset_stats` and
`try_to_avoid_padding_experts` switches while keeping their previous
default behavior.
- In RL and SFT, read routing statistics after **each microbatch**
through the shared `get_global_moe_stats` helper. Take the maximum
violation across layers, then across the `dp_cp` mesh. This preserves a
short-lived imbalance instead of pooling counts across microbatches.
- Aggregate those per-microbatch global maxima into `max_vio/mean` and
`max_vio/max` for each optimizer step. RL also retains the other
distribution statistics supplied by `Tensors.compute_stats`; SFT now
publishes `/max` alongside `/mean`.
- Clear SFT validation routing buffers before the next training step.
### Validation: same EP, more trainer replicas
These RL runs used Qwen3-30B-A3B-Thinking-2507, EP=4, CP=1, sequence
length 32,768, group size 8, and learning rate 1e-6. The experiment
configs were temporary; the tracked `math.toml` is restored and
`math2.toml` is not included in this PR.
| Run | Topology | `orchestrator.batch_size` | Average `max_vio/mean` |
Average `max_vio/max` |
| --- | --- | ---: | ---: | ---: |
|
[math1-v1](https://wandb.ai/primeintellect/qwen30b-math/runs/a2da2577b6c54320bc1d997022b0ebe7)
| 8 GPUs total: 4 train + 4 inference; one EP group, `dp_replicate=1` |
16 | 6.7774 | 7.7035 |
|
[math2-v1](https://wandb.ai/primeintellect/qwen30b-math/runs/d69f377a0cb5425b99b455e6c8101118)
| 16 GPUs total: 8 train + 8 inference; two EP groups, `dp_replicate=2`
| 32 | 6.8707 | 7.7897 |
Values are arithmetic averages of the logged metrics over the **shared
steps 1–99**, read from W&B. The two-group run is 1.38% higher on
`/mean` and 1.12% higher on `/max`. Its rollouts are different, so this
is a comparability check, not a paired-input equality test. This
comparison does not exercise CP. The shared-helper refactor followed
these runs and preserves their reduction arithmetic.
Relative to the original `examples/advanced/qwen3-30b-a3b/math.toml`,
the experiments used:
- **Math1:** single-node deployment with 4 train and 4 inference GPUs
instead of 2 train and 2 inference nodes; EP 4 instead of 8;
`orchestrator.batch_size` 16 instead of 512; inference TP 4 instead of
8.
- **Math2:** 1 train and 1 inference node instead of 2 each; EP 4
instead of 8; `dp_replicate=2`; `orchestrator.batch_size=32` instead of
512; inference TP 4 and DP 2 instead of TP 8. Its Slurm job name was
`math2-qwen30b` instead of `math-qwen30b`.
- **Both:** added `max_steps=400`, `orchestrator.group_size=8`, Slurm
partition `all`, and a run-specific `VLLM_CACHE_ROOT`; changed
`orchestrator.concurrency.initial_inflight` from 1024 to 64 and added
`max_inflight=128`. Other settings followed the original config.
### Remaining topology effects
At fixed EP, equal violation readings are not guaranteed. For
fixed-length packed SFT, the per-microbatch token population in one EP
group is `micro_batch_size × (EP / CP) × seq_len`. Increasing CP makes
that population smaller, and the relative count imbalance noisier,
unless `micro_batch_size` scales with CP. Increasing trainer nodes at
fixed EP creates more EP groups (`trainer_world_size / EP`); taking the
maximum over more groups tends to raise both logged `/mean` and `/max`
slightly through an order-statistics effect. With fixed CP and global
SFT batch size, adding DP ranks also reduces gradient accumulation steps
and the number of microbatch samples in each logged step.
For a stricter fixed-EP comparison, keep tokens per microbatch per EP
group constant (`micro_batch_size` proportional to CP) and scale the
global batch size with trainer world size. For example, double batch
size when trainer world size doubles, whether the added ranks come from
DP or CP. RL can still vary with actual sequence lengths and rollout
contents.
Checks: `uv run --no-sync pytest tests/unit/train/models/test_moe.py -q`
(15 passed), `ruff check`, `ruff format --check`, and `git diff --check`
passed for the PR changes.
## Summary
- Gate `attn='auto'` → FA4 on SM10x/SM11x (`major in (10, 11)`) instead
of `major >= 10`. FA4's own interface uses the same families for its
native tcgen05/TMEM Blackwell path.
- B200/GB200 (SM100) and B300/GB300 (SM103) keep FA4, so the goal of
#3655 stays intact. Hopper keeps FA3.
- Workstation Blackwell (SM12x, e.g. RTX PRO 6000) resolves to FA2
again. #3655 sent it to FA4 as a side effect.
- Update the `attn` comment in `docs/scaling.md`.
| GPU | CC | `attn: auto` |
|---|---|---|
| H100/H200 | SM90 | FA3 |
| B200/GB200 | SM100 | FA4 |
| B300/GB300 | SM103 | FA4 |
| RTX PRO 6000 | SM120 | FA2 (main: FA4) |
## Verification
5 steps of `configs/ci/integration/reverse-text/start.toml` on 2x RTX
PRO 6000 (SM120), same venv (vllm 0.29):
**Before (main `b963ceda3`)**: `Auto-resolved attn='auto' to
'flash_attention_4' (SM120)`
```
Step 1 | Mismatch KL 0.2967 | Grad. Norm nan
Step 2 | Loss nan | Entropy nan | Mismatch KL nan | Grad. Norm nan (run then stalls: NaN weights reach inference)
```
**After (this branch)**: `Auto-resolved attn='auto' to
'flash_attention_2' (SM120)`
```
Step 1 | Mismatch KL 0.0008 | Grad. Norm 0.8843 | Reward 0.19
Step 3 | Mismatch KL 0.0012 | Grad. Norm 0.8779 | Reward 0.15
Step 5 | Mismatch KL 0.0013 | Grad. Norm 1.6303 | Reward 0.46
Training finished!
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Small, targeted change to GPU-architecture gating at model setup;
lowers risk on SM12x by avoiding an incompatible FA4 path rather than
altering auth or data handling.
>
> **Overview**
> **`attn='auto'` no longer picks Flash Attention 4 on every SM10+
GPU.** Resolution now uses FA4 only when the compute capability major is
**10 or 11** (datacenter Blackwell, e.g. B200/B300), keeps **FA3 on
Hopper (SM90)**, and uses **FA2 for everything else**—including
workstation Blackwell (**SM12x**, e.g. RTX PRO 6000), which lack the
tcgen05/TMEM path FA4 expects.
>
> The **`resolve_auto_attn`** docstring and the **`attn`** comment in
**`docs/scaling.md`** are updated to match this split so docs and
runtime behavior stay aligned.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ab27534ec84dba23a2043dc65235e6b7ea57b41c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
The trainer, sft, and orchestrator already beat a Better Stack
heartbeat; evals (and the sft online-eval, which shares the
`EvalRunner`) were invisible to it. This gives the eval its own
`heartbeat` config: one ping per landed episode.
There is deliberately no startup ping: the first landed episode is the
first beat. The gap between run start and the first episode (pool boot,
env servers, the first episode's full duration) would otherwise sit
inside the ping stream as an abnormally long silence that flips a
healthy run stale. Until the first beat, the heartbeat has simply never
been pinged.
When episodes stop landing, the pings stop and Better Stack flips the
heartbeat stale after its grace period. Size that period + grace above
the longest legitimate gap between episodes. The `Heartbeat` never runs
more than one ping in flight (a `beat()` while one is pending is
dropped), so continuous landings cost at most ~one request per
round-trip.
The orchestrator keeps its existing per-batch heartbeat; nothing there
changes.
## Usage
```toml
[heartbeat]
url = "https://uptime.betterstack.com/api/v1/heartbeat/<token>"
```
Set it on the `eval` config (also available to the sft online-eval via
its `[eval]` block).
## Validation
- `ruff check` + `ruff format` clean.
- `uv run pytest tests/unit/test_configs.py
tests/unit/eval/test_cli.py`: identical to the unmodified tree (67
pre-existing failures in this env from missing verifiers hub plugins;
126 pass).
- Live 30-minute run against a real Better Stack heartbeat URL using the
exact `Heartbeat` class: 60 pings at a 30s cadence, all HTTP 200 (RTT
126-344ms); silence after stop, as the dashboard's staleness window
expects.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Optional observability hook with no change to eval logic, auth, or
data paths when `heartbeat` is unset.
>
> **Overview**
> Eval and SFT online-eval (shared `EvalRunner`) can now opt into Better
Stack uptime monitoring via an optional **`heartbeat`** block on
**`ServedEvalConfig`**, matching trainer/orchestrator/SFT.
>
> When configured, **`EvalRunner`** creates a **`Heartbeat`** at setup
and pings **once per successfully landed episode**—not on dispatch
failures or cancellations, and **not at startup**. The first beat is the
first landing so long boot/first-episode gaps do not look like stale
silence in Better Stack; if episodes stop (dead inference, hang, or
clean exit), pings stop and the monitor goes stale after grace.
>
> Configure with `[heartbeat] url = "..."` on the eval config (or SFT
`[eval]`); size Better Stack period + grace above the longest gap
between landed episodes.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
75add6ed9027ef8b2f2aab2a63c945db38633655. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Documentation and example TOML only; no changes to training, auth, or
runtime code paths.
>
> **Overview**
> Adds **supervised fine-tuning (SFT)** to the GLM-5.3 advanced example
alongside the existing RL/inference guides.
>
> New TOML overlays under `sft/h200/` target **8-GPU H200 nodes** (8
training nodes, `cp`/`ep` = 8, 131k `seq_len`): **`base.toml`** wires
`zai-org/GLM-5.3-BF16`, custom MoE training settings, `sign_sgd`, and
Slurm; **`math-10k.toml`** points at
`PrimeIntellect/INTELLECT-3-SFT-10K` (math split); **`fake.toml`** swaps
in fake data for dry runs.
>
> The README **SFT** section documents composing configs with `uv run
sft @ ...` and notes the existing dashboard can monitor SFT runs.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
81d7877b4e06ec9f3865006f6b309ac0b0e95aff. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Layout
The SFT overlays live under `examples/advanced/glm-5.3/sft/h200/` — an
`h200/` subfolder marks them as tuned for 8-GPU H200 nodes, and the
files drop the `sft-` prefix since the parent folder already says SFT:
- `sft/h200/base.toml` — base SFT config: `zai-org/GLM-5.3-BF16` on 8
training nodes with the same large-scale knobs as RL (custom impl,
`cp`/`ep` = 8, 131k context, AC offloading, `sign_sgd`, SLURM job
`glm53-sft`).
- `sft/h200/math-10k.toml` — data overlay:
`PrimeIntellect/INTELLECT-3-SFT-10K` (math split).
- `sft/h200/fake.toml` — fake-data overlay with `force_balanced_routing`
for dry runs.
Launch:
```bash
uv run sft @ examples/advanced/glm-5.3/sft/h200/base.toml @ examples/advanced/glm-5.3/sft/h200/math-10k.toml
```
The README SFT section documents the command, the fake-data variant, and
the dashboard. Both compositions validate with `sft --dry-run`.
## Summary
- Bump the `deps/prime-envs` submodule from `1213b7336` to `b677502a2`
(latest `main`). Pulls in:
-
[prime-envs#818](https://github.com/PrimeIntellect-ai/prime-envs/pull/818):
separate original OfficeQA from repaired PI-OfficeQA (new
`pi-officeqa-pro-v2` env).
-
[prime-envs#832](https://github.com/PrimeIntellect-ai/prime-envs/pull/832)
(+ [#835](https://github.com/PrimeIntellect-ai/prime-envs/pull/835),
[#836](https://github.com/PrimeIntellect-ai/prime-envs/pull/836)):
switch `swebench_pro` to SWE-bench Pro V2, constraining image repository
choices.
-
[prime-envs#824](https://github.com/PrimeIntellect-ai/prime-envs/pull/824):
SWE-Atlas Harbor environments (new `swe-atlas-qna`, `swe-atlas-rf`,
`swe-atlas-tw` envs).
-
[prime-envs#811](https://github.com/PrimeIntellect-ai/prime-envs/pull/811):
PI-DeepSWE while preserving original DeepSWE (new `pi-deepswe` env).
-
[prime-envs#801](https://github.com/PrimeIntellect-ai/prime-envs/pull/801):
APEX-Agents 1.1 with its reference harness and Harbor grading (new
`apex-agents` env).
-
[prime-envs#810](https://github.com/PrimeIntellect-ai/prime-envs/pull/810):
`pi-terminal-bench-2` with repaired QEMU task images.
-
[prime-envs#829](https://github.com/PrimeIntellect-ai/prime-envs/pull/829):
agentic Lean tasksets on a shared `lean-common` base (new cambench,
combibench, discover-and-prove, formalmath, kimina, matholympiadbench,
minif2f, numina, proofnet, proverbench, putnambench tasksets; removes
`deepseek-prover` and `goedel-pset`).
-
[prime-envs#838](https://github.com/PrimeIntellect-ai/prime-envs/pull/838):
raise Verifiers dev requirements to 0.3.2.dev137, matching our vendored
`deps/verifiers` pin.
- Relock `uv.lock`: new workspace members are auto-discovered via
`deps/prime-envs/environments/*/*`; `lean-common` joins as an editable
path source.
- Exclude `apex-agents` from the workspace: it pins `verifiers` as a git
rev (`328c0b1`), which conflicts with the editable workspace member —
same lock-conflict pattern as `tau2_synth` and `tau3_bench`.
## Validation
- `uv lock` and `uv lock --check` pass (581 packages resolved).
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Large dependency-graph churn and benchmark harness upgrades (e.g.
SWE-bench Pro V2) can affect eval/training env selection, though changes
are confined to workspace packaging and the lockfile.
>
> **Overview**
> Updates the monorepo lockfile and workspace rules after advancing
**`deps/prime-envs`**, so newly added Harbor/SWE/Lean/search env
packages resolve alongside the editable **`verifiers`** pin.
>
> **`pyproject.toml`** documents why **`apex-agents`** is excluded from
the uv workspace (it pins **`verifiers`** to a git rev, same conflict
pattern as **`tau2_synth`** / **`tau3_bench`**) and adds that path to
**`tool.uv.workspace.exclude`**.
>
> **`uv.lock`** registers many new auto-discovered workspace
members—including **`lean-common`**, agentic Lean tasksets (e.g.
**`cambench`**, **`proofnet`**, **`putnambench`**), PI variants
(**`pi-deepswe`**, **`pi-officeqa-pro-v2`**, **`pi-terminal-bench-2`**),
and **`swe-atlas-*`**—while dropping **`deepseek-prover`** and
**`goedel-pset`**. Several existing packages bump versions and tighten
**`verifiers`** requirements to **`>=0.3.2.dev137`** (notably
**`deep-swe`**, **`swebench-pro`**, and the migrated Lean envs).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5d592eccccbb09ad765d6663e12a91399a49e29b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<html>
<head>
</head>
<body>
<p class="p1">This PR changes the split representation to use CPU
tensors.</p>
<h3><span class="s1"><b>Performance</b></span></h3>
<p class="p4">Benchmarked on Qwen3-30B-A3B with 8× H200, EP 8, balanced
routing, bf16, and no activation checkpointing.</p>
Version | Step time (3–30) | Tok/s/GPU | MFU (head_dim 128)
-- | -- | -- | --
main (job 1426) | 7.59s | ~8,635 | ~32.8%
CPU-tensor splits, this PR (job 1434) | 6.95s | ~9,430 | ~35.9%
torchtitan (job 1422) | 6.58s | ~9,960 | 37.8%
<p class="p1">Compared with <code>main</code>, this PR reduces step time
from <span class="s1"><b>7.59s to 6.95s</b></span> (~8.4% reduction),
increases throughput from <span class="s1"><b>~8,635 to ~9,430
tok/s/GPU</b></span> (~9.2% improvement), and raises MFU from <span
class="s1"><b>~32.8% to ~35.9%</b></span>.</p>
</body>
</html>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Logic for split sizes is unchanged; this only alters tensor
layout/device timing for a performance path in distributed MoE routing.
>
> **Overview**
> Improves **MoE expert-parallel token dispatch** in
`TorchTokenDispatcher` by building `input_splits` and `output_splits`
together and moving them to **CPU once** before the all-to-all.
>
> Instead of two separate GPU reductions, the change **stacks** the
per-rank token counts from local and grouped expert histograms, sums
them, and calls `.cpu()` up front so `all_to_all_single` can read split
sizes (via `.tolist()`) **without an extra device sync** on the hot
path. Dispatch/combine still use the same split semantics; only where
the tensors live and when they are transferred changes.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e61d0bfdda7fe7ec7170b20eb60096d3552daa7a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Problem
`uv run trainer` calls `prime_rl.trainer.rl.train` directly, outside
torchrun, so the `env://` rendezvous has no
`RANK`/`WORLD_SIZE`/`MASTER_ADDR`/`MASTER_PORT` and the process dies
before any training starts:
```
ValueError: Error initializing torch.distributed using env:// rendezvous:
environment variable RANK expected, but not set
```
Every documented use of that entrypoint was therefore broken. Scott hit
it during onboarding on the README's own validation steps (#3633).
## Fix
Rather than defaulting the rendezvous env for a single-process group
(#3633), drop the standalone trainer from the docs — per the thread, it
isn't a path we want people on:
- **`README.md`** — removed "Validate your environment setup" step 4
(`uv run trainer @ configs/debug/fake/rl.toml`) and renumbered the
following steps. The remaining step 5 (`uv run rl @
configs/basic/reverse-text/rl.toml`) already exercises the trainer
end-to-end.
- **`docs/training.md`** — dropped the `uv run trainer` row from the
entrypoints table, and reworded the `uv run orchestrator` row that
pointed at a "separately-launched trainer".
- **`docs/scaling.md`** — the trainer-alone benchmark now launches under
torchrun, the way the `rl` launcher and
[`benchmarks/scripts/run_single_benchmark.py`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/benchmarks/scripts/run_single_benchmark.py)
(what the CI benchmark matrix runs) already do.
Docs only — no code or config changes, and the `trainer` entrypoint
itself is untouched.
## Follow-up, not in this PR
`k8s/README.md`, `k8s/prime-rl/values.yaml` (the `trainer.command`
example), and the k8s section of `examples/basic/reverse-text/README.md`
still drive the trainer pod with `uv run trainer`, and hit the same
failure — the chart sets no rendezvous env on the trainer StatefulSet.
Fixing that means changing how the chart launches the trainer, not just
the prose, so it wants its own PR from someone who can run the
deployment.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation-only edits with no runtime or config changes.
>
> **Overview**
> Documentation no longer recommends **`uv run trainer`**, which fails
on startup without torchrun/`RANK` because it invokes the RL trainer
outside distributed launch.
>
> The README **environment validation** checklist drops the standalone
RL trainer step and **renumbers** the inference and full **`uv run rl`**
checks. **`docs/training.md`** removes the trainer row from the
entrypoints table and updates the **`uv run orchestrator`** note so it
no longer assumes a separately launched trainer. **`docs/scaling.md`**
changes the “RL trainer alone” benchmark to **`torchrun …
src/prime_rl/trainer/rl/train.py`**, matching how the **`rl`** launcher
and CI benchmarks run it.
>
> The **`trainer`** CLI entrypoint is unchanged; this is prose-only.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
cb2aa3805b8e77dbb9e334961349c42a1c7462db. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
## Why
Section 3.1 of the README ("Optional: Install Flash Attention 3")
claimed FA3 "has no wheels prebuilt" and instructed a manual source
build from the `hopper` subdirectory. This is stale — **prime-rl already
installs FA3 as a prebuilt wheel from the lockfile**:
- `pyproject.toml` resolves `flash_attn_3 = { index =
"pytorch-cu130-test" }` → `https://download.pytorch.org/whl/test/cu130`
- `uv.lock` pins `flash-attn-3 == 3.0.0` from that index (real compiled
wheels: `flash_attn_3-3.0.0-cp39-abi3-manylinux_2_28_x86_64.whl`, ~402
MB, plus an aarch64 build)
- `uv sync --all-extras` (step 4 of the same install section) pulls it
in via the `flash-attn-3` extra — same as `Dockerfile.cuda` (`--extra
flash-attn-3`)
- This has been the case since at least May (the source was
`pytorch-cu128-test` before `70117046a` moved it to `cu130-test`)
Since step 4 already installs FA3, the section documents a step that
must not be followed: building from git would fight the lock (its "uv
sync will uninstall the package" warning was describing a self-inflicted
problem).
## What
- Remove section 3.1 entirely. Nothing is lost: `flash_attn_3` arrives
prebuilt with `uv sync --all-extras`, and the `flash_attention_3`
backend / `attn="auto"` picks it up on Hopper GPUs.
Docs-only change, no code touched.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> README-only edit with no runtime or dependency behavior changes.
>
> **Overview**
> Removes **README Manual Setup subsection 3.1**, which told Hopper
users to build Flash Attention 3 from the Dao-AILab git source and
warned that **`uv sync` / `uv run` would uninstall** that manual
install.
>
> That guidance is outdated for this repo: **`flash_attn_3` is already
pulled in via the lockfile and `uv sync --all-extras`** (optional extra
from the PyTorch test index), so the extra source-build step conflicted
with the pinned wheel and described a problem users only hit if they
bypassed the lock.
>
> Docs-only; install flow in step 4 is unchanged.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
921c72d02f42ab0a58fe4b10cd8fb227f1a3543f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Problem
`Orchestrator.start()` writes the orchestrator's own final checkpoint in
its `finally` block **after** `monitors.finalize()`. Finalize is what
tells the launcher the run is done: on the fft k8s path, the platform
marks the run COMPLETED and uninstalls the release. So the
orchestrator's final checkpoint races teardown.
## Fix
Save the final checkpoint first, then finalize. Clean and forced exits
both still save; only the order relative to `monitors.finalize()`
changes.
## Scope
This PR first also made the orchestrator wait for the trainer's final
checkpoint. Per review, waiting for both components is the launcher's
job, as the SLURM template already does with `.trainer.done` /
`.orchestrator.done`, so that part was dropped. The k8s launcher side is
platform#5817 + fft#92 (Linear ENG-6341): the platform marks a run
COMPLETED and tears it down only once both the trainer and the
orchestrator have finished.
With those in place, teardown already waits past the orchestrator's
finalize, so this change is **defense-in-depth** there. It still matters
for any launcher that tears down on finalize alone, and it makes the
orchestrator's own "I'm done" signal truthful.
## Testing
- `uv run pytest tests/unit -m "not gpu"` (as in `cpu_tests.yaml`,
x86_64, `--all-extras`): 616 passed, 1 skipped. CI CPU tests pass on
this head.
- Not exercised on k8s with an image built from this branch; the telus
runs for ENG-6341 used the stock prime-rl image. The GPU integration
tests (which run the orchestrator end to end from this branch) are the
coverage for the reordering.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Eager interleaved RoPE was a large share of each DeepSeek-V4 attention
layer: every site widened the
tables with `repeat_interleave`, rotated a copy of the 64 rope channels,
and rebuilt the whole
512-channel head with `torch.cat`. All five RoPE sites (q, kv,
compressed kv, indexer q, and the
inverse rotation of the attention output) now run one out-of-place
Triton kernel, adapted from
Megatron-LM and bit for bit with vLLM's `rotary_embedding`, making the
end-to-end SFT step 13-14%
faster on B300.
- RoPE tables were built every forward in bf16. They are now one static
fp32 `[cos | sin]` cache in
vLLM's layout, indexed by position inside the kernel.
- q was normed and rounded to bf16, then rotated and rounded again.
`dsv4_q_norm_rope` does both in
fp32 with one rounding: exact matches with vLLM rise from ~69% of rope
channels to 99.9997%.
- `dsv4_rope` is a functional custom op whose backward is the inverse
rotation. An in-place version
needs an `autograd.Function` wrapper, because `register_autograd`
rejects mutating ops.
- Passing fp32 tables through `PackedContext` failed multi-node: FSDP's
`cast_forward_inputs` cast
them to bf16. Hence the cache lives on one rotary module that every
attention layer shares.
DeepSeek V4 Flash SFT on 8 B300 nodes, full model, bf16, 256k tokens,
cp8/ep8, selective AC. Median step
over steps 6-20 of 20, which skips the sparse-attention recompiles both
real-data arms hit (removed by
#3644). tok/s/GPU is the 32,768 packed positions each GPU processes per
step, padding included, over that
median. Losses match `main` to 1.5e-3 on identical samples:
| Per step, 8 B300 nodes | Fake: main | Fake: this PR | Real: main |
Real: this PR |
|----------------------------------|------------|---------------|------------|---------------|
| Median step time | 16.896 s | 14.641 s | 19.203 s | 16.474 s |
| tok/s/GPU | 1939 | 2238 | 1706 | 1989 |
| MFU | 57.4% | 66.2% | 46.7% | 53.2% |
| Peak reserved GPU memory, rank 0 | 244.0 GiB | 246.6 GiB | 246.7 GiB |
247.0 GiB |
Fake data is one 256k document per row; real data is the scaleswe SFT
set, 4-9 documents per row.

**Figure:** Kernels on rank 0's main GPU stream during layer 2's
forward, in the last of five
`torch.profiler` steps of a 1-node, 6-layer run (256k tokens, cp8/ep8,
bf16). Both arms start at the
layer's first kernel, and the dashed line marks the end of its attention
block at the MoE router. The two
~7 ms `torch.cat` blocks per layer, which rebuild the heads around q's
RoPE and around the inverse
rotation of the attention output, are gone, shortening the block from
94.1 ms to 72.3 ms. The bottom panel
sums each kernel category over the whole step: `torch.cat` -180 ms and
the RoPE path's elementwise ops and
copies -145 ms, against +7 ms for the fused kernels, for -307 ms of
main-stream kernel time. The profiled
run explains the mechanism; the unprofiled full-model runs in the table
are the timing claim.
Before: [`main`
33e02a7](https://github.com/PrimeIntellect-ai/prime-rl/commit/33e02a7a183002aca0864c5afc1c2f5a50e48e37).
After:
[`04f7b8a`](https://github.com/PrimeIntellect-ai/prime-rl/commit/04f7b8a94e7d6482843eb871e938ded9f71427fb),
the in-place version this PR began as, with the
[fake](https://github.com/PrimeIntellect-ai/prime-rl/blob/2c671d77ed8fe639a568976c832e4ed00995542f/benchmarks/fp8_grouped_gemm/sft.toml),
[real](https://github.com/PrimeIntellect-ai/prime-rl/blob/2c671d77ed8fe639a568976c832e4ed00995542f/benchmarks/fp8_grouped_gemm/sft_scaleswe.toml)
and
[profiling](https://github.com/PrimeIntellect-ai/prime-rl/blob/2c671d77ed8fe639a568976c832e4ed00995542f/benchmarks/fp8_grouped_gemm/sft_1n_256k.toml)
configs. Real-data runs add #3544's tool-call fix
([`c7ba105`](https://github.com/PrimeIntellect-ai/prime-rl/commit/c7ba105d58b1d825c3f411bcaf6bd6c85db57ddd))
to both arms.
The out-of-place rewrite was checked only in per-kernel benchmarks,
where it is net ~90 µs faster per
layer forward than in-place, and has not been re-run end to end.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Advance the `deps/verifiers` submodule from `9e7ec2746` to `69cc0f948`,
the latest verifiers `main`, on top of prime-rl `origin/main`.
This picks up interrupted completion stream retries and the follow-up
refactor to tenacity. Dependency metadata is unchanged, so no lockfile
update is needed.
Validation: `uv lock --check --offline` passed. All four upstream
stream-retry regression cases passed with `uv run --no-sync pytest
--noconftest
deps/verifiers/tests/v1/test_e2e.py::test_chat_harness_preserves_streamed_reasoning
-q`. Shared integration fixtures were disabled because the local
environment lacks `prime_runs`. `git diff --check` passed.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Submodule pointer-only change with no prime-rl code or lockfile edits;
upstream behavior is limited to streaming/retry handling in verifiers
and was exercised by targeted tests.
>
> **Overview**
> Updates the **`deps/verifiers`** git submodule from `9e7ec2746` to
**`69cc0f948`** (current verifiers `main`). There are **no changes to
prime-rl source or lockfiles**—only the pinned submodule commit moves.
>
> The new verifiers revision adds **retries for interrupted completion
streams** and a follow-up refactor to use **tenacity** for that retry
logic. prime-rl still consumes verifiers the same way (CI initializes
the submodule; v1 config types extend `verifiers.v1`).
>
> Validation noted in the PR: `uv lock --check --offline`, targeted
stream-retry e2e tests under `deps/verifiers/tests/v1/test_e2e.py`, and
`git diff --check`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c23df2e4bfaa88decca20bdb1a26d4fe5f9bd23c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- pre-download Hub data in the SFT launcher, beside model predownload,
before trainer ranks start
- call data predownload only for SFT data, and skip generated fake data
in the launcher
- store the snapshot in the configured Hub cache and pass its local path
to the trainer
- log skipped local paths and download duration like model predownload
- add optional `data.revision` and honor it when loading data directly
## Verification
- before: research-prod debug job 1400 failed before its first step when
concurrent ranks received HTTP 429 from the Debug data tree API
- after: called the predownload utility with the pinned Debug data and
confirmed it resolved to the local snapshot
- ran Ruff lint and formatting checks on the changed Python files
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes SFT startup and mutates in-memory data config before
subprocesses start; low security impact but affects all real-data SFT
runs’ I/O behavior.
>
> **Overview**
> **Pre-downloads Hugging Face SFT datasets in the launcher** (alongside
model pre-download) so a single process hits the Hub before
`torchrun`/SLURM ranks start, avoiding concurrent dataset API traffic
that caused HTTP 429 failures.
>
> Adds `pre_download_data`, which no-ops for non-SFT/`fake` configs and
existing local paths, uses `snapshot_download` with optional
`HF_HUB_CACHE`, **rewrites `data.name` to the cached snapshot path**,
and logs timing like model pre-download. The launcher calls it for train
and validation data when not in `dry_run`.
>
> Adds optional **`data.revision`** on `SFTDataConfig` and threads it
through `load_dataset` when data is loaded directly (revision is ignored
for local paths).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6aa6aa6e37a3e777bfd61ec835f02ee7f1a360cd. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- Advance the `deps/verifiers` submodule from `9cf0df2` to `9e7ec27`,
the last VF main commit before Matej's retry fix.
- Include buffered SSE keepalives and retry replay from
[verifiers#2650](https://github.com/PrimeIntellect-ai/verifiers/pull/2650),
the empty-tools fix from
[verifiers#2669](https://github.com/PrimeIntellect-ai/verifiers/pull/2669),
and Prime job-output recovery from
[verifiers#2670](https://github.com/PrimeIntellect-ai/verifiers/pull/2670).
- Include the nano-rlm default revision bump from
[verifiers#2672](https://github.com/PrimeIntellect-ai/verifiers/pull/2672).
- Keep Matej's stream-consumption retry PR
[verifiers#2654](https://github.com/PrimeIntellect-ai/verifiers/pull/2654)
out of this pin. VF main merged it during this load test.
## Breaking
- VF streams now send keepalives while they buffer a model turn. They
send the completed response after the turn commits. Consumers that need
live provider token deltas must connect to the provider directly.
## Verification
- `uv sync --all-extras --all-packages --locked` completed. Both eval
configs passed `uv run --no-sync eval @ ... --dry-run`.
- Served `poolside/Laguna-S-2.1-FP8` on eight H200 nodes. Each node ran
one ETP=8 replica behind the default vLLM router with a four-hour
request timeout.
- Ran AIME26/null and Terminal-Bench 2 `fix-git`/Bash together on VF
`1e0b660`, the direct parent of the pinned `9e7ec27`. The intervening VF
diff changes only the optional nano-rlm harness default. Neither tested
harness uses nano-rlm.
- Each eval had 2,000 rollouts, fixed 2,000 inflight concurrency, and a
900-second rollout cap. Bash used 20 maximum turns. No eval-side rate
limiter was set.
The table excludes sandbox-creation HTTP 429 rollouts. It counts the
configured 900-second cap as **no error**.
| Eval | No error | Other infrastructure errors | Stream errors |
| --- | ---: | ---: | ---: |
| AIME26/null | 1,770/1,772 | 2 | 0 |
| TB2 fix-git/Bash | 1,857/1,859 | 2 | 0 |
| Combined | 3,627/3,631 | 4 | 0 |
- AIME had 779 cap exits. Its other failures were one sandbox missing
`dockerImage` and one terminated sandbox. Its 996 model calls had no
recorded call error. Of its fully completed calls, 339 exceeded 600
seconds; the longest lasted 894 seconds.
- Fix-git had 37 cap exits. Its other failures were one sandbox missing
`dockerImage` and one sandbox setup `apt-get` I/O error. Its 27,874
model calls had no recorded call error. Six fully completed calls
exceeded 600 seconds.
- Found zero terminal stream-disconnect signatures in trace errors,
model-call errors, or eval and environment logs. Both eval commands
exited successfully.
## Summary
Bumps the dion pin from `99e5f7e` to `6f9242d`, picking up samsja/dion#4
(merged into `sami/fix-ep`):
- **Uneven and empty FSDP shards in Muon**: local shards are padded to a
uniform peer-transfer size for the all-to-all and trimmed back
before/after orthogonalization, so the update is exactly the unpadded
Muon update. Previously the optimizer asserted the sharded dim is
divisible by the optimizer world size — full Muon failed on the first
step for matrices with e.g. 4 or 24 rows on a 64-rank FSDP group.
- **Partitioned-matrix fix**: per-row learning rates are now sliced with
chunk offsets matching DTensor's `Shard` (`torch.chunk`) layout;
`torch.tensor_split` disagrees with it at world size ≥ 3 and could
silently misassign or crash when a partition boundary fell inside an
uneven shard.
- Padding now uses `torch.nn.functional.pad` (no-op fast path when
shards are already uniform).
## Compatibility
- `Muon`'s constructor signature is unchanged; the call site in
`src/prime_rl/trainer/optim/__init__.py` is unaffected.
- The pinned tree is byte-identical to the dion branch validated with:
exact (`rtol=0, atol=0`) parity vs unsharded Muon across
uneven/empty/3D/partitioned shapes at world sizes 2 (NCCL) and 3 (gloo),
plus 170 pure-CPU padding round-trip cases.
## Changes
```
pyproject.toml | 2 +-
uv.lock | 4 ++--
```
Note: `uv lock` in a fresh clone needs the `deps/` submodules
initialized **with tags** (`git submodule update --init`, then ensure
tags are fetched) — `verifiers` and `renderers` derive versions from git
tags via hatch-vcs, and a tagless shallow checkout resolves them as
`0.0.1.dev1`, which fails workspace resolution.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Pins a new git revision of the distributed Muon optimizer used on
Linux GPU training; behavior changes in FSDP edge cases but no in-repo
code edits.
>
> **Overview**
> Updates the **dion** git pin from `99e5f7e` to `6f9242d` in
`pyproject.toml` and `uv.lock` only—no prime-rl source changes. Training
still wires **Muon** through `src/prime_rl/trainer/optim/__init__.py`
under the `gpu` extra.
>
> The new revision pulls in upstream fixes for **FSDP-sharded Muon**:
uneven or empty local shards are padded for all-to-all peer transfer and
trimmed so updates match unsharded Muon (avoiding first-step failures
when matrix rows aren’t divisible by optimizer world size), and per-row
learning rates are sliced with **DTensor**-consistent chunk offsets
instead of `tensor_split` (which could misassign rates at world size ≥
3).
>
> **Risk:** dependency-only bump, but it changes distributed optimizer
numerics/behavior on large FSDP runs where the old pin could assert or
silently wrong-rate parameters.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9ca26a11e000fb7ca8a374537af6a3858c1b1aed. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
`CompileConfig` only exposed `fullgraph`, so there was no way to opt
into `torch.compile`'s lower-overhead modes. This adds a `mode` field
that mirrors the `torch.compile` `mode` kwarg, and forwards it to each
layer's `.compile()` call in `apply_compile`.
- Accepts `reduce-overhead` (records CUDA graphs to cut kernel launch
overhead), `max-autotune`, `max-autotune-no-cudagraphs` (tune Triton
kernels, longer compile) and `lite`.
- `mode = None` (default) keeps the current behavior — layers compile
with PyTorch's default mode.
- CUDA-graph modes re-record on new input shapes, so runs with highly
variable shapes pay recompile churn.
## Usage
```toml
[trainer.model.compile]
mode = "reduce-overhead"
```
or on the CLI: `--trainer.model.compile.mode reduce-overhead`.
## Problem
Two GPU-capability gates in `src/prime_rl/trainer/model.py` matched
`(10, 0)` exactly, but B300/GB300 are **SM103** (compute capability
10.3, per https://developer.nvidia.com/cuda-gpus):
1. **`resolve_auto_attn`**: `attn: auto` on B300/GB300 resolved to
`flash_attention_2` instead of FA4, silently losing the Blackwell-native
attention kernels on every default-config B300 run.
2. **`apply_quantization` (MXFP8 gate)**: MXFP8 quantization raised
`requires SM100 (Blackwell)` on B300 even though Blackwell Ultra
supports it.
## Fix
Use `major >= 10` in both places, matching the existing Blackwell checks
in `fp8_utils.py` and `fp8_grouped_gemm.py`.
## Behavior after this PR
| GPU | CC | `attn: auto` | MXFP8 |
|---|---|---|---|
| H100/H200 | SM90 | FA3 (unchanged) | n/a |
| B200/GB200 | SM100 | FA4 (unchanged) | allowed (unchanged) |
| B300/GB300 | SM103 | **FA4 (was FA2)** | **allowed (was rejected)** |
| Other SM100+ parts | SM110+ | FA4 | allowed |
Note the previous code kept workstation Blackwell (SM120/121, e.g. RTX
PRO 6000) on FA2; with the simple `major >= 10` check those now
auto-resolve to FA4 too. If FA4 kernels aren't available on such a host,
set `attn` explicitly.
## Notes
- Verified SM103 device capability via NVIDIA's CUDA GPUs page; FA4 runs
on B300 with the pinned `flash-attn-4` rev (`0251105`), which is past
the SM103 JIT-compile-churn fixes reported in
Dao-AILab/flash-attention#2635/#2699.
- B300 runs can confirm the old behavior by grepping trainer logs for
`Auto-resolved attn='auto' to 'flash_attention_2' (SM103)`.
- No behavior change on Hopper or B200 hosts.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes GPU-specific attention backend auto-selection and MXFP8
eligibility at trainer setup; mis-gating could pick unsupported kernels
on some SM10x parts.
>
> **Overview**
> **Fixes B300/GB300 (SM103) being treated as non-Blackwell** because
capability gates in `model.py` matched compute capability `(10, 0)`
exactly.
>
> For **`attn: auto`**, `resolve_auto_attn` now picks **flash attention
4** when the device **major** compute capability is **≥ 10**, instead of
only SM100. SM103 runs get FA4 rather than silently falling back to FA2.
>
> For **MXFP8** in `apply_quantization`, the same **`capability[0] <
10`** rule replaces the exact SM100 tuple check, and the error text now
refers to **Blackwell (SM100+)**.
>
> Docstrings for auto attention resolution are updated to describe
**SM100+** (including SM103) rather than datacenter-only SM100 vs
workstation SM120 wording tied to the old `(10, 0)` branch.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fbd7387af8a54df4cb3829b29dcfbbc24c1a7d27. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- attach request-level tools to the first existing DeepSeek V4 system
message
- preserve vLLM's existing synthetic-system behavior when a request has
no system message
- cover both paths and ensure the caller's messages are not mutated
vLLM 0.29's Python DeepSeek V4 tokenizer prepends a synthetic tool-only
system message even when the request already has a system prompt. That
differs from DeepSeek's reference encoder, vLLM's Rust renderer, and
prime-rl's training renderer, producing a different token prefix at
inference time.
This is a temporary compatibility patch for
[vllm-project/vllm#51856](https://github.com/vllm-project/vllm/pull/51856)
(upstream commit `2909ad8f`). That fix is expected to ship in vLLM 0.31,
at which point this monkey patch can be removed.
## Tests
- `pytest tests/unit/inference/test_deepseek_v4_tokenizer_patch.py -q` —
2 passed
- `ruff check src/prime_rl/inference/patches.py
tests/unit/inference/test_deepseek_v4_tokenizer_patch.py`
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Inference-only tokenizer shim with idempotent guards; behavior is
covered by reference-encoding unit tests and should be removable after a
vLLM upgrade.
>
> **Overview**
> Adds a temporary vLLM monkey patch so **DeepSeek V4 inference prompts
match the reference encoder and training renderer** when requests
include tools plus an existing system message.
>
> On vLLM 0.29, the Python tokenizer **prepends a synthetic system block
for request-level tools**, putting `## Tools` before the caller’s system
text. The patch wraps `get_deepseek_v4_tokenizer` and
**`apply_chat_template`**: if the conversation already has a system
role, it shallow-copies the conversation, **attaches `tools` to the
first system message**, clears top-level `tools` so vLLM does not insert
the extra system message, and leaves **no-system** requests on stock
behavior. It is registered in **`apply_shared_vllm_patches`** and is
meant to be removed once the vLLM pin includes upstream **#51856**
(~0.31).
>
> Unit tests assert rendered prompts match **`encode_messages`**, that
only one `## Tools` section appears, and that **input `messages` are not
mutated**.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1acca7c9d1c503d0d497f05638d50e687ec714c8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- The dashboard marks an episode as failed only when `ok` is false.
Retry history no longer turns a successful episode red: the episode
table row, the rollout list item, the error-rate tile on the eval
overview, and the server's `errors_only` filter all read `ok` alone.
- Episode errors and trace errors render in different places, each
tagged with its scope. A failed episode's own errors sit above the agent
and branch selectors, since they belong to the whole episode. A failed
trace's errors sit at the top of that trace's transcript, only on its
tab, and the tab is red. A failure recorded on both the episode and its
trace shows once, as the trace's.
- Errors an ok episode or ok trace carries render as a collapsed
`recovered from N episode|trace errors in earlier attempts` list in the
same two places, each entry with its traceback. The table row and
rollout list item get a dotted left edge with the recovery count in
their tooltip.
## Why
Verifiers retries a whole episode when a retryable error such as
`SandboxError` ends an attempt, and on success it prepends the earlier
attempts' errors to the final record: `final.errors[:0] = history`, with
the comment "success is the `ok` stamp, never errors-emptiness". The
agent-level retry does the same on the trace. An episode that hit the
sandbox creation limiter once and then completed cleanly therefore lands
with `ok = true`, a full trace, and the limiter error in `errors`. The
dashboard treated `num_errors > 0` as failure, so such episodes showed a
red row, an error banner over a clean transcript, and inflated the error
rate, which is what a user saw after a run with `retries.include =
["SandboxError", ...]`. Episode errors also rendered inside the open
trace, so a multi-agent episode showed a red banner over a green agent's
transcript.
## Verification
A synthetic eval run was built from a real 4-episode gsm8k stream and
served by an isolated dashboard on this branch, driven headlessly with
Playwright:
| Line | Shape | Before | After |
|---|---|---|---|
| 1 | episode failed; trace `solver` failed with `SandboxError`, trace
`judge` ok | red row, `error` badge, both banners inside the solver
transcript, episode banner inside the judge transcript | red row; the
`episode error` banner above the tabs on both; the `trace error` banner
only in the solver transcript; `solver` tab red |
| 2 | episode ok after a retry; episode and trace carry `SandboxError`
as history | red row, `error` badge, red banner over the clean
transcript | plain `done` row with a dotted edge and a "recovered from 1
error" tooltip, no banner, collapsed "recovered from 1 trace error in
earlier attempts" list holding the SandboxError and its traceback |
| 3, 4 | plain ok | `done` | `done` |
| error-rate tile | 2 failures counted | 50% | 25% |
| `errors_only=true` | | lines 1 and 2 | line 1 |
No console errors in either state.
## Screenshots
Episode table: line 1 failed (red edge), line 2 recovered (dotted edge),
lines 3 and 4 plain.

Line 2, recovered after a retry: no banner, the SandboxError in the
collapsed recovered list (expanded here), `ok = true`.

Line 1, `solver` tab: the episode error above the selectors, the failed
trace's error at the top of its transcript, the tab red.

Line 1, `judge` tab: the episode error stays above the selectors; the
judge's transcript carries no banner because that trace completed.

Screenshots live on the `assets/dashboard-retry-errors` branch.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Dashboard display and filtering only; no changes to training, eval
recording, or auth paths.
>
> **Overview**
> Aligns the eval dashboard with Verifiers’ retry semantics: **success
is `ok`, not empty errors**. Episodes that recovered after retryable
failures no longer look failed or inflate error metrics.
>
> **Failure detection** now keys off `ok` only—the episode table,
rollout list, swarm **error-rate** tile, and server **`errors_only`**
filter no longer treat `num_errors` on successful episodes as failures.
Recovered episodes get a **dotted “retried”** row style and tooltips
instead of red error styling.
>
> **Error UI** splits episode vs trace scope: episode-level failures
render in a new **`#tm-episode-errors`** strip above agent/branch tabs;
trace failures stay at the top of that trace’s transcript, with failed
agent tabs highlighted. **`scopedErrors`** dedupes episode/trace
duplicates (trace wins) and separates **failed** errors from
**recovered** history on ok records, shown as collapsible “recovered
from N … errors” sections. **`resetTranscript`** clears the episode
error strip whenever the transcript is replaced.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c4f6e242745c085c4bac60388dfb8c775e7b65f4. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
## Summary
- Initialize Nemotron Mamba `A_log` and `D` parameters with the active
default dtype so FSDP units do not mix float32 and bfloat16 storage.
- Keep the existing float32 state-space computation by casting at use
time.
- Add a focused bfloat16 parameter-dtype regression test.
## Validation
- `ruff check src/prime_rl/trainer/models/nemotron_h/mamba.py
tests/unit/train/models/test_nemotron_h.py`
- Focused in-cluster GPU probe: `A_log=torch.bfloat16`,
`D=torch.bfloat16`
- One-step Nemotron 3.5 Super VLM + MATH + Dynamo run: optimizer
completed and policy v1 was applied over NCCL.
- Three-step Kubernetes run: all optimizer steps completed; policies v0
through v3 applied to Dynamo; Job succeeded.
- Trainer mismatch KL by step: `0.0274`, `0.0344`, `0.0309`.
W&B: https://wandb.ai/test232/nemotron35-vlm-rl/runs/jq06zl0l
## Summary
- Bump the verifiers submodule to main (`9cf0df22b`), which includes
PrimeIntellect-ai/verifiers#2657: creation limiters wait on backlog
instead of raising past 300s, and their bucket is scoped by
`$VF_RUN_ID`. `uv.lock` is regenerated; verifiers dropped its `lean`
extra.
- The env-server entrypoint sets `VF_RUN_ID` from `PRL_RUN_ID`, minting
a uuid only when neither is set. Its pool workers inherit it.
- The multi-node SFT SLURM script exports `PRL_RUN_ID` and
`PRL_RUN_NAME` unconditionally, as the RL script does. Only the W&B
shared-mode variables stay behind the wandb condition, now named
`wandb_shared` in the template.
## Why
With the bump, a run whose sandbox creation outpaces `creates_per_min`
throttles instead of failing every rollout past the 300s backlog.
Scoping the bucket by run id keeps one run's backlog from delaying
another.
The env server is the one prime-rl process that creates sandboxes, and
every launcher hands it `PRL_RUN_ID`: the `rl`, `sft`, and `eval`
entrypoints export it before spawning, and the SLURM scripts export it
at the top of the sbatch script, which `srun` propagates to the `uv run
env-server` tasks. Deriving `VF_RUN_ID` there covers every launch path
with one line. The SFT script previously exported the run id only for a
shared W&B run, so its online-eval env servers would otherwise each have
minted their own scope.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes run-id propagation for SLURM-launched env servers and sandbox
creation throttling behavior; mis-set env vars could affect multi-run
cluster behavior but not auth or data integrity.
>
> **Overview**
> Aligns prime-rl with verifiers’ run-scoped sandbox **creation
limiters** (keyed on `$VF_RUN_ID`) so throttling and backlog are per run
instead of shared across jobs.
>
> The **env-server** entrypoint now sets `VF_RUN_ID` from `PRL_RUN_ID`,
or mints a UUID when launched standalone, so pool workers inherit the
same scope on every launch path.
>
> **Multi-node SFT** previously exported `PRL_RUN_ID` only when shared
Weights & Biases logging was enabled, which left online-eval env servers
without a consistent run id. The SLURM template now always exports
`PRL_RUN_ID` and `PRL_RUN_NAME` (matching RL), while W&B shared-mode env
vars are gated on a new `wandb_shared` flag passed from `sft.py`.
>
> **Lockfile** metadata drops the removed `lean` extra from the bumped
verifiers dependency.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
364f0b58699ad556746116a1bf6208e37b5afc6b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Packed sequence lengths were causing repeated FP8-indexer autotuning
during training. Other DP groups then arrived late at the layer-4 FSDP
prefetch, making a normal ~1–3 ms parameter gather appear to take 1.78
s. Together with narrower checkpoint state, avoiding a query-layout
copy, and overlapping CP communication, the matched BF16 benchmark
improves from **22.741 s / 40.23% MFU** after #3638 to **18.999 s /
47.79% MFU**.
- Bucket the indexer's autotune key by compressed-key length, also
keying on head count and dimension. Exact key lengths still control
addressing and masks. An all-rank trace showed the last rank arriving
1.718 s late and completing the gather in 1.34 ms; it had been
benchmarking the first CSA indexer.
- Register the FP8 indexer as an opaque operation and make its final
int32 selection a mandatory checkpoint save. This preserves the top-k
replay requirement while retaining compact IDs and skipping indexer
scoring on replay.
- Apply query RoPE directly in the sparse kernel's `(batch, tokens,
heads, dim)` layout, removing the transpose/contiguous round trip in
attention and the indexer.
- Launch the main KV CP gather with PyTorch's asynchronous functional
collective before query/compressor computation, and wait just before
consuming KV. Its registered backward performs the corresponding sum
reduce-scatter. Compilation stays enabled; communication uses NCCL's
existing stream.
### SAC configuration
Exact configuration for the measured run:
```toml
[model.ac]
mode = "selective"
freq = 1
targets = [
"prime_rl::dsv4_sparse_attn",
"prime_rl_collectives::all_to_all_single_equal",
"aten::sort.stable",
]
```
`prime_rl::fp8_indexer` is saved automatically by the mandatory policy
in both full and selective checkpointing. The qualified stable-sort
overload matters: `aten::sort` does not match `aten::sort.stable`.
### Measurements
| Variant | Mean step time | Logged tokens/s | Logged MFU |
| --- | ---: | ---: | ---: |
| PR #3638 only (job 653) | 22.741 s | 86,890 | 40.23% |
| Indexer tuning buckets, full AC (665) | 20.718 s | 95,043 | 44.01% |
| Buckets + sparse-attention/EP-count SAC (675) | 20.042 s | 97,636 |
45.21% |
| All changes + SAC above (691) | **18.999 s** | **103,210** |
**47.79%** |
This is a **1.197× step-time speedup** over #3638 alone and **1.055×**
over the prior SAC run. Peak rank-0 reserved memory is **232.5 GiB /
267.7 GiB**. All five losses are finite. These are short benchmark
results, not a long-run convergence measurement. Measurements use the
pinned job-492 environment; this branch is rebased onto current main,
whose touched modeling files were identical to that baseline.
### Validation
- CPU checkpoint-policy tests: 4 passed on the PR branch, including
mandatory indexer retention under custom SAC targets. Ruff lint and
formatting checks passed for all changed files.
- Existing FP8-indexer GPU correctness cases: 2 passed. Changing key
lengths 1060 → 1064 → 1073 reused one autotune entry (2.015 s initial
tuning, then 0.919 ms and 0.634 ms).
- Existing sparse/eager attention parity cases: 9 passed, covering CSA,
HCA, sliding attention, packed documents, and empty compression.
- Existing CP packing checks: 6 passed across CP2/CP4 and all three
attention types; rerun successfully after inlining the gather and wait
calls directly in attention forward.
- Two-rank async-collective probe: outputs and input/weight gradients
passed with full/selective checkpointing, eager execution and
`torch.compile(fullgraph=True)`.
- Compiled two-rank BF16 attention checks: all three attention types
passed under full/selective checkpointing against the blocking
implementation; maximum relative L2 difference across outputs and
gradients was 0.026%. The sliding cases ran in a separate process after
the combined test harness reached its compiled-variant limit.
- Query-layout microcheck: bitwise-equal outputs and input gradients in
BF16/FP32, including the production query shape.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes touch CP collectives, compile/custom-op boundaries, and SAC
correctness for non-replayable top-k; numerics are covered by existing
kernel and CP tests but production timing depends on NCCL stream overlap
behavior.
>
> **Overview**
> This PR targets **DeepSeek V4 training step time** by cutting FP8
indexer autotune churn, overlapping context-parallel communication, and
tightening activation-checkpoint behavior around sparse indexing.
>
> The **FP8 Lightning indexer** is registered as `prime_rl::fp8_indexer`
and added to the **mandatory** selective-activation-checkpoint save list
so replay keeps the final int32 top-k without re-running scoring. Triton
autotune now keys on **`next_power_of_2(S_k)`** plus head count and
dimension so packed batches with slightly different compressed-key
lengths reuse one tuned config.
>
> In **attention**, queries stay in **`(batch, tokens, heads, dim)`**
through RoPE and into `dsv4_sparse_attn`, dropping the
transpose/contiguous path. Under CP, **KV all-gather** starts
asynchronously via `_c10d_functional.all_gather_into_tensor` before
query and compressor work, with **`wait_tensor`** immediately before KV
is consumed.
>
> Tests assert mandatory checkpoint retention for the new op and extend
CP parity mocks for the async gather path.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6449f9212c3430c812b9623a1b5bd274e350b780. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Optional config with default unchanged; reuses existing orchestrator
dispatch rate limiting with no auth or data-path changes.
>
> **Overview**
> Eval runs can now cap how fast episodes are dispatched via a new
**`tasks_per_minute`** setting on **`ServedEvalConfig`** (shared by
standalone eval and SFT online eval). **`None`** keeps the previous
behavior with no rate limit; a positive value throttles dispatch through
the existing **`Dispatcher`** **`AsyncLimiter`**, intended to pace
sandbox provisioning during autoscaling.
>
> The eval **`runner`** passes **`config.tasks_per_minute`** into the
dispatcher instead of hard-coding **`None`**.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
31f8041b908234dc4c45f128540af8e4daa6435b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
RL compares trainer and inference logprobs token by token, so any
disagreement between the two FP8
quantizers is model-independent noise. The trainer's per-token
activation cast is now bit-identical to
vLLM's production CUDA op, `torch.ops._C.per_token_group_fp8_quant`.
- Three kernels in `fp8_utils.py` floor `amax` at `1e-10` and use
`tl.math.div_rn` for scale and quotient.
Triton's `/` lowers to multiply-by-reciprocal, one fp32 ULP off the
correctly rounded value.
- The weight kernel is untouched: vLLM's weight path is itself a
reciprocal-multiply and already matched.
- A new GPU test pins the equality against the CUDA op; the trainer
still imports vLLM nowhere.
Share of 128-wide groups whose scale is bitwise equal to vLLM's, and
share of elements whose fp8 byte
is, on four 4096x4096 bf16 activation tensors on an H200:
| tensor | scales: before | after | bytes: before | after |
|---|---|---|---|---|
| randn x0.02 | 42.8329% | 100.0000% | 98.1890% | 100.0000% |
| randn x1.0 | 41.0797% | 100.0000% | 99.8822% | 100.0000% |
| randn x30.0 | 43.6028% | 100.0000% | 99.8869% | 100.0000% |
| randn heavytail 16ch x50 | 42.7979% | 100.0000% | 99.8999% | 100.0000%
|
Every pre-fix mismatch was exactly one e4m3 step, so weights stay at
100% and dequantization error is
unchanged. Agreement with vLLM's Triton fallback drops to about 42% on
scales, which is forced since
vLLM's two backends are not bit-identical to each other and only the
CUDA op runs in production. Costs
3.1% of quant-kernel time at 4096x4096 and 8.7% at [8192, 7168].
Verified on sm90 with
`use_ue8m0=False`; sm100 takes a different vLLM kernel.
## Effect on training gradients
The old floor applied to the scale, not to `amax`, so any 128-wide group
with `amax < 0.0448` was
quantized against an inflated scale: its values were squeezed into a
corner of the e4m3 range
instead of spanning it, and everything below `1e-7` rounded to zero.
Forward activations sit above
that threshold; gradients do not, and both the input-gradient (dgrad)
and weight-gradient (wgrad)
paths cast `grad_output` through these kernels. The error is one-sided
toward zero, so it shrinks
gradients rather than adding noise.
Measured end to end: a 131k-context SWE RL run with an FP8 trainer on
pre-fix code logged
`optim/grad_norm` averaging 0.0079 over 100 steps, against 0.0465 and
0.0528 for otherwise
identical runs with a bf16 trainer. A rerun of that config on the fixed
kernels is at 0.0421 over
its first 17 steps, where the pre-fix run read 0.0094 and the bf16
reference 0.0468 over the same
window. Mismatch KL is blind to all of this, since it depends on the
forward alone: lr = 0 probes
read 0.0089 before the fix and 0.0091 after.
### Why the floor's location matters
Per 128-element group:
```
# before
amax = max(|x|)
scale = max(amax / 448, 1e-4) # floor on the SCALE
y = x / scale
# after
amax = max(max(|x|), 1e-10) # floor on the AMAX
scale = div_rn(amax, 448)
y = clamp(div_rn(x, scale), -448, 448)
```
A floor exists only to keep an all-zero group from dividing by zero. The
correct scale, `amax / 448`,
maps the group's largest element to exactly 448 and spans the full e4m3
range. Pinning the scale at
`1e-4` makes it too large whenever `amax < 0.0448`, and a scale that is
too large makes `y = x / scale`
too small, so the group occupies a corner of the range.
Take a gradient group with `amax = 1e-5`:
- correct scale is `1e-5 / 448 = 2.2e-8`, giving `y_max = 448`, the full
range
- old scale is `1e-4`, giving `y_max = 0.1`, a sliver of it
- e4m3's smallest subnormal is `2^-9 = 0.00195`, so any `|y|` below
about `0.001` rounds to zero
- that is every `|x|` below `1e-7`, which is 1% of this group's maximum
- at `amax = 1e-6` the same `1e-7` cutoff erases everything below 10% of
the maximum
Two properties make this worse than rounding noise. It is one-sided,
always toward zero, so it biases
the gradient short rather than jittering it. And it is non-uniform:
groups above `0.0448` are exact
while groups far below it are gutted, so the surviving gradient also
points in a different direction.
AdamW's per-parameter normalization absorbs much of the magnitude loss,
which is why a run carrying
this bug trains through it while looking healthy.
## Launch-config retune
This PR also reconfigures the kernel launch specs for perf (for H200).
Measuring the cost of correct rounding exposed a separate problem: these
kernels were already launched
at block sizes that spill registers. The per-channel cast used a `[128,
128]` fp32 tile, and
`div.rn.f32` needs more live temporaries than `div.full.f32`, which is
why correct rounding looked
expensive there. Retuning `BLOCK_M`, `BLOCK_N` and `num_warps` in five
host wrappers, with no kernel
body change, recovers more than correct rounding costs.
Measured on an H200 at this model's dimensions (hidden 4096, MoE
intermediate 2048, 8 local experts
with ragged routing), 102 configs against a noise-control arm:
| kernel | wins | regressions | noise | best delta |
|---|---|---|---|---|
| `grouped_per_channel` k-major | 24 | 0 | 2 | -54.1% |
| `grouped_per_channel` row-major | 21 | 0 | 5 | -35.3% |
| `per_token` transposed | 6 | 0 | 6 | -44.8% |
| `grouped_per_token` | 7 | 0 | 19 | -12.0% |
| `per_token` | 3 | 0 | 9 | -12.4% |
Ragged expert groups gain more than equal ones: at K=4096 with 4096
tokens per rank, the k-major
per-channel cast is -28.5% on an equal split and -54.1% under realistic
routing. A launch config cannot
change the arithmetic, so bit identity against the CUDA op is
unaffected.
## Verification
```
uv run --no-sync python -m pytest tests/unit/train/models/test_fp8_utils.py -q
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
FP32 MoE routing uses a separate FSDP unit. Its post-backward hook can
request a reduce-scatter input buffer while the expert reduction is
still in flight; FSDP's default limit of one inserts a compute-stream
wait before attention backward can run.
Set `set_reduce_scatter_max_input_buffers(2)` on that router unit
immediately after sharding. FSDP resolves the shared buffer limit to the
maximum across its units, allowing the router to pack gradients while
the expert reduction completes. This adds two lines on top of main, with
no new configuration or numerical dtype changes. The tradeoff is
additional memory for in-flight reduction inputs.
### Measured timings
Same saved packed tokens and checkpoint, GLM-5.3 EP8/CP8 on 32 B300
GPUs, FP32 routing, full activation checkpointing, and activation
offloading enabled in both runs. Two warmup passes followed by one
profiled forward/backward; no optimizer update.
| Metric | One buffer | Two buffers |
| --- | ---: | ---: |
| Warm forward + backward, median across 32 ranks | 14.699 s | 12.649 s
|
| Profiled forward + backward, median across 32 ranks | 14.808 s |
12.717 s |
| Expert reduce-scatter overlap with main-stream compute, rank 0 | 11.1%
| 93.7% |
| Maximum reserved GPU memory across ranks/passes | 204.49 GiB | 205.29
GiB |
Warm forward/backward is **13.9% shorter**, equivalent to **16.2% higher
throughput**, at **0.80 GiB** more peak reserved memory in this run.
### Timeline of the stall
Actual CUDA kernel intervals for layer 77, rank 0. Each panel is aligned
independently to that layer's expert reduce-scatter launch. Blue is
other main-stream compute, green is attention backward, and orange is
expert gradient reduce-scatter.

With one buffer, the router's post-backward hook queues a compute-stream
wait while the **4.5 GiB expert reduction** is in flight. This creates a
**40.7 ms main-stream compute gap**. The router's own reduction is only
**6 MiB / 0.66 ms**. Attention backward starts **48.87 ms** after the
expert reduction launch; with two buffers it starts at **8.15 ms**
instead. The layer's expert-reduction overlap rises from **7.3% to
96.3%**. These layer-specific percentages differ from the aggregate
values in the table.
These are single-run comparisons, not repeated statistical benchmarks.
The measured experiment set the cap at the root; this PR applies the
same effective shared cap through the router unit. Ruff and `git diff
--check` pass; this exact main-based patch has not had a new distributed
run.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Two-line FSDP scheduling tweak in MoE setup only; no numerical or API
changes, with modest extra peak memory for reduction buffers.
>
> **Overview**
> When **FP32 MoE routers** are sharded as their own FSDP unit
(alongside expert-parallel expert shards), backward can stall: the
router’s post-backward reduce-scatter needs an input buffer while the
much larger expert gradient reduction is still using FSDP’s default
single buffer, forcing a **compute-stream wait** before attention
backward can proceed.
>
> Right after `fully_shard` on `block_mlp.router`, the PR calls
**`set_reduce_scatter_max_input_buffers(2)`** so the router can queue
its small reduction without blocking on the in-flight expert
reduce-scatter. FSDP’s shared limit becomes the max across units—same
effective behavior as raising the cap at the root, but scoped to the
router shard path. **Tradeoff:** slightly more memory for in-flight
reduction inputs; no new config or dtype changes.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
51a9e3daef8a53a254d7e7ff35d1ee3c8afce18c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Problem
Since #3585 removed the `prime` CLI as a prime-rl dependency ("Stop
installing the `prime` CLI with prime-rl. Run `uv tool install prime`
when the CLI is needed"), the published GHCR images ship no `prime`
executable. That breaks Hosted Training runs on these images at
bootstrap:
The platform's env-server and orchestrator pods prepend an
**authenticated** Hub env install to their pod command,
```
uv run --no-sync prime env install '<owner/name>' && ... && uv run --no-sync env-server @ config
```
because verifiers' own `ensure_installed` resolver fetches the Hub
**unauthenticated** and 404s on private environments — the pre-install
into the pod's venv is what makes v1 Hub tasksets resolvable at boot
(envs baked into the image never hit this path).
With the executable absent from `/app/.venv/bin`, every pod dies at
spawn and the run wedges at `CREATING`. Observed on
`ghcr.io/primeintellect-ai/prime-rl:v0.9.1.dev100` dispatching a run
with a Hub taskset:
```
error: Failed to spawn: `prime`
```
(the orchestrator's entire log is two lines: the no-checkpoints warning,
then that spawn failure).
## Fix
Install the CLI into the image venv at build time — **not** as a project
dependency, so #3585's "CLI as a separate tool" boundary stands for
library code; the image just ships the executable and its runtime deps
so the platform bootstrap can run.
- One `RUN` after the main `uv sync`, using the same uv cache mount as
the rest of the file.
- `prime>=0.7` — pure-Python CLI, few MB; most deps
(httpx/pydantic/etc.) are already in the venv.
- The runtime stage copies `/app` wholesale, and `PATH` already puts
`/app/.venv/bin` first, so `uv run --no-sync prime env install ...` and
direct `prime` calls both resolve.
## Alternatives considered
- Reverting #3585's dependency removal: rejected — keeps the boundary;
the image need, not the library, is what broke.
- Platform-side init container with a dedicated prime-cli image (cleaner
long-term: keeps the CLI out of the framework image entirely) — worth
tracking on the platform side; this PR is the minimal unblock for hosted
Hub-env runs today.
## Verification
- `VIRTUAL_ENV=<venv> uv pip install 'prime>=0.7'` smoke-tested locally
(CLI 0.7.0 boots).
- Placement reviewed against the builder stage: runs after the locked
sync chain, before the optional NIXL block; nothing downstream
overwrites the venv.
## Summary
- pin Verifiers `main` at the merge of [Verifiers
#2652](https://github.com/PrimeIntellect-ai/verifiers/pull/2652),
including the computed fields from [Verifiers
#2651](https://github.com/PrimeIntellect-ai/verifiers/pull/2651)
- read serialized token counts directly from completed episode and live
trace records
- remove dashboard-specific token reconstruction and prompt-token
summation
The previous implementation summed every full prompt in a multi-turn
trace.
This counted the shared conversation once per request and inflated long
rollouts.
## Verification
Before this change, a two-turn trace with prompt usages of 100 and 150
tokens
reported 250 input tokens. After this change, the serialized record and
both
dashboard paths report 130 input tokens and 50 output tokens.
- tested the dashboard flow end to end
- `ruff check` and `py_compile` passed for both changed modules
## Summary
- Bump the `deps/prime-envs` submodule from `1f1e050ab` to `1213b7336`
(latest `main`).
- Pulls in:
-
[prime-envs#791](https://github.com/PrimeIntellect-ai/prime-envs/pull/791):
strip v0 remnants.
-
[prime-envs#795](https://github.com/PrimeIntellect-ai/prime-envs/pull/795):
restore solver network access for training environments.
-
[prime-envs#797](https://github.com/PrimeIntellect-ai/prime-envs/pull/797):
500-trace SWE cheating recall benchmark (new `trace-cheating-recall-500`
judge env).
-
[prime-envs#796](https://github.com/PrimeIntellect-ai/prime-envs/pull/796):
run MCP Atlas and Enterprise Ops Gym services in VMs.
-
[prime-envs#798](https://github.com/PrimeIntellect-ai/prime-envs/pull/798):
fair-use solver prompts for SWE and terminal training tasksets.
-
[prime-envs#805](https://github.com/PrimeIntellect-ai/prime-envs/pull/805):
keep env CI evals off the platform.
-
[prime-envs#770](https://github.com/PrimeIntellect-ai/prime-envs/pull/770):
OfficeQA Pro V2 (new `officeqa-pro-v2` env).
-
[prime-envs#808](https://github.com/PrimeIntellect-ai/prime-envs/pull/808):
complete TMax platform hosting and source references.
-
[prime-envs#814](https://github.com/PrimeIntellect-ai/prime-envs/pull/814):
ask before changing repository skills.
-
[prime-envs#815](https://github.com/PrimeIntellect-ai/prime-envs/pull/815):
support renamed Verifiers eval CLI in CI.
-
[prime-envs#822](https://github.com/PrimeIntellect-ai/prime-envs/pull/822):
remove obsolete Prime VM configuration.
- Relock `uv.lock`: new workspace members `officeqa-pro-v2` and
`trace-cheating-recall-500` (auto-discovered via
`deps/prime-envs/environments/*/*`); env package version bumps.
## Validation
- `uv sync --all-extras --all-packages --locked` passes.
- `uv run pytest tests/unit -m "not gpu"`: 616 passed, 1 skipped.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Training and evaluation behavior can shift (solver prompts, network
access, VM-hosted tool services, new benchmarks) because many SWE,
terminal, and tool-use env packages change together.
>
> **Overview**
> Updates the **`deps/prime-envs`** submodule to the latest **`main`**
and refreshes **`uv.lock`** so the workspace picks up new and bumped
editable environment packages.
>
> The lockfile adds two auto-discovered members—**`officeqa-pro-v2`**
(search) and **`trace-cheating-recall-500`** (judge)—and bumps patch
versions across many existing env packages (SWE stacks like
**`openswe`**, **`multiswe`**, **`swesmith-env`**; terminal **`tmax`** /
**`terminal-lego`**; tool-use **`mcp-atlas`** /
**`enterprise-ops-gym`**; plus assorted math, lean, long-context, and
reasoning envs).
>
> Upstream **`prime-envs`** changes bundled with this bump include
stripping v0 remnants, restoring solver network access for training
envs, fair-use solver prompts for SWE/terminal tasksets, MCP Atlas and
Enterprise Ops Gym running services in VMs, TMax hosting completion,
CI/eval CLI fixes, and related housekeeping—not new logic in this repo
beyond the dependency pin and lock refresh.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
75422004f320992e134a1d188368f15637bf8193. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- increase the default inference readiness timeout from 30 minutes to 60
minutes
- keep the direct `check_health` default aligned with `ClientConfig`
Large models can exceed 30 minutes on a cold node while vLLM compiles
architecture-specific kernels and captures CUDA graphs. The previous
default can tear down an otherwise healthy launch just before readiness.
## Test plan
- `PYTHONPATH="$PWD/src:$PWD/packages/prime-rl-configs/src" pytest -q
tests/unit/orchestrator/test_clients.py` (10 passed)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Only increases startup wait defaults; no changes to auth, weight
updates, or runtime inference behavior once ready.
>
> **Overview**
> Raises the default **inference pool startup wait** from 30 to **60
minutes** so cold starts (e.g. vLLM kernel compile and CUDA graph
capture on large models) are less likely to fail right before `/health`
succeeds.
>
> The change updates `ClientConfig.wait_for_ready_timeout` in shared
config and the default `timeout` on `check_health`, keeping orchestrator
health polling aligned with the config default used by
`AdminPlane.wait_for_ready`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f9fdfe25be6d643d43e830121bf22b6a9bd036c1. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- Add `VllmRouterConfig.request_timeout_secs` (**default 1800 — the
router's own built-in default**, `ge=1`): the maximum lifetime of a
routed request, including streamed completions.
- Wire it through both router launch paths — the Python entrypoint
(`--request-timeout-secs`) and the `_launch_router.sh.j2` template. When
unset, the router behaves exactly as before.
- Long agentic rollouts set it explicitly, e.g. `request_timeout_secs =
3600` for one-hour SWE eval requests.
## Note on "no timeout"
The Rust router applies the value as its HTTP client's **total request
timeout unconditionally** (`server.rs`,
`.timeout(Duration::from_secs(...))`): plain `u64`, no disable sentinel,
and `0` would be an *immediate* timeout. So "no timeout" is not
expressible — a finite configurable value with the upstream default is
the right shape.
## Validation
- `VllmRouterConfig` default (`1800`) / set (`3600`) / `ge=1` rejection
all verified; both launch paths interpolate the same field (the template
already receives the `router` config object).
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Operational tuning of router HTTP client timeouts only; no auth or
data-path changes, though misconfigured values could still cut off or
hang long requests.
>
> **Overview**
> Adds **`request_timeout_secs`** on **`VllmRouterConfig`** (default
**1800s**, minimum 1) so the maximum lifetime of a routed
request—including streamed completions—can be set from inference config
instead of relying on implicit router defaults.
>
> Both managed router launch paths now pass
**`--request-timeout-secs`**: the local **`start_router`** entrypoint
and the SLURM **`_launch_router.sh.j2`** template read
**`router.request_timeout_secs`**. Long agentic or eval rollouts can
raise the value (e.g. via config override) without patching launch
scripts.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
adf7321a3604f2fc784ab961688a281ab6002165. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- `EnvConfig.shuffle` (`bool`, default `False`): shuffle the source's
finite taskset **once at startup** with a fixed seed
(`TASKSET_SHUFFLE_SEED = 42`).
- Defined in one place — `EnvConfig`, the shared base — so both
`TrainSourceConfig` and `EvalSourceConfig` inherit it: one knob covers
RL train envs, RL/SFT online evals, and standalone evals. Train
curricula and eval example selection both consume the shuffled order.
- Infinite tasksets reject `shuffle` at startup with a clear error.
- The eval resume allowlist now overrides `source.*.shuffle` (fixed seed
⇒ deterministic across resume).
```toml
[[train.source]] # or [[eval.source]]
shuffle = true
```
Mirrors the existing SFT-data convention (`shuffle: bool` + fixed seed).
## Validation
- `pytest tests/unit/orchestrator/ tests/unit/eval/
tests/unit/test_configs.py` — 288 passed, 1 skipped.
- Smoke: `TrainSourceConfig(..., shuffle=True)` and
`EvalSourceConfig(..., shuffle=True)` both parse; default is `False`;
resume allowlist updated.
- **Manual eval-selection run (real `Env.start()` path, gsm8k,
`num_examples = 50` of 1319 test tasks; only the env-server network
handshake stubbed — no GPU on the validating node):**
- `shuffle = false`, run 1 → `[0, 1, 2, ..., 49]` (natural source order)
- `shuffle = true`, run 1 → `[588, 1214, 57, 906, 1252, 618, 599, 289,
...]`
- `shuffle = true`, run 2 → identical to run 1 (same 50 tasks, same
order) ✔ reproduces
- `shuffle = false`, run 2 → identical to run 1 ✔ off is stable
- off vs on selections differ (set overlap 2/50, as expected for a
random 50-of-1319 subset) ✔
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Behavior is opt-in with a fixed seed and only affects task ordering at
startup; infinite tasksets are explicitly rejected.
>
> **Overview**
> Adds a **`shuffle`** flag on shared **`EnvConfig`** (default
**`false`**) so train and eval sources can reorder a **finite** taskset
once at env startup instead of always taking tasks in source order.
>
> When **`shuffle=true`**, the orchestrator materializes the taskset and
shuffles it with a fixed seed (**`TASKSET_SHUFFLE_SEED = 42`**), so the
same permutation holds for the whole run and eval example selection
stays reproducible. **Infinite** tasksets fail fast with a clear error.
>
> Eval **resume** may override **`source.*.shuffle`** alongside other
rollout knobs. New unit tests cover default order, changed selection,
reproducibility, full-taskset selection, and the infinite-taskset
rejection.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8358483c1144ed331f575a5e857fabe390de50c8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- A `reasoning_effort` column in the dataset overrides the `[renderer]`
config's `reasoning_effort` field **per row**, so one SFT run can mix
reasoning efforts with the configured renderer serving as the default
for rows that do not set one (or set null).
- Requires a typed renderer config that has the field: `renderer.name =
"auto"` and field-less renderers raise a clear `ValueError`. Renderer
configs are frozen, so resolved configs are cached and rows resolving to
the same config share one renderer instance.
- Doc paragraph in `docs/training.md`; dataloader and sft-dataset tests
updated.
```toml
[renderer]
name = "glm-5.3" # typed renderer; reasoning_effort = "max" is the row default
# dataset rows may carry reasoning_effort = "low" | "high" | "max" per row
```
## Validation
- `pytest tests/unit/train/sft/` — 47/47 pass.
- E2E with the real GLM-5.3 renderer: rendered prompts carry the per-row
effort preamble (`Reasoning Effort: Low` vs `Max`), invalid efforts
rejected by the config `Literal`, `None` rows fall back to the
configured renderer, and the resolver caches one renderer per distinct
config.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Changes are confined to SFT tokenization/renderer selection with
explicit validation for auto or unsupported renderers; misconfiguration
fails at load time rather than silently wrong training.
>
> **Overview**
> SFT can now **mix reasoning efforts in one run** via an optional
dataset **`reasoning_effort`** column that overrides the typed
`[renderer]` config per row; null/missing values keep the TOML default.
>
> **`RendererResolver`** (in `data.py`) builds and **caches** renderers
from `renderer_config` + row overrides instead of a single shared
renderer. **`SFTDataset`** takes a per-example renderer callable;
**`setup_dataset`** / **`train.py`** pass **`renderer_config`** and the
VLM **processor** rather than constructing one renderer up front (train
and validation use the same path).
>
> Docs in **`training.md`** describe the column, typed-renderer
requirement, and supported model families. Unit tests were updated to
pass `lambda _: renderer` into **`SFTDataset`**.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3408b9918dccf06d86ab732faa94a18f6233ca31. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
`PrimeEvalMonitor` attaches to an existing platform evaluation when
`$PRIME_RUNS_EVAL_ID` is set, instead of always registering a new one.
This mirrors how `PrimeTrainMonitor` already attaches to `$RUN_ID`.
Why: A hosted evaluation is created by the platform before its sandbox
starts: the platform owns billing, secrets, timeouts, cancellation and
the final "did every episode reach the platform" check, and it hands the
sandbox the evaluation's id, which the monitor reads from
`$PRIME_RUNS_EVAL_ID`. Today `uv run eval --monitors.prime` inside that
sandbox would call `pr.init(kind="eval", ...)` without an id, register a
second evaluation and leave the platform's one open forever.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes platform eval registration lifecycle for hosted runs;
misconfiguration (multiple sources or multiple epochs) fails fast with
explicit errors.
>
> **Overview**
> **Hosted eval sandboxes** can now stream to an evaluation the platform
already created instead of registering a duplicate that leaves the
platform run orphaned.
>
> When **`PRIME_RUNS_EVAL_ID`** is set, `PrimeEvalMonitor` calls
`pr.init` with that **`id`** (same attach pattern as training’s
**`$RUN_ID`**). Init requires **exactly one** eval source, and
**`open`** rejects a second epoch so one injected id maps to one epoch.
Logs note attachment when **`run.attached`** is true.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b4af11c50eb8201cbaf1b9a903b245a1bb8ed76e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Bumps vLLM from 0.28.0 to 0.29.0 and reconciles prime-rl's runtime
monkeypatches with 0.29's reorganized entrypoint layout. Three patches
are now obsolete and removed, each backed by a merged upstream PR.
- Rebound the API server layer onto `vllm.entrypoints.launchers.*`: on
0.29 the old `openai.api_server` path is a deprecation shim, so without
this the custom routes and the `PrimeRlServingTokens` swap would
silently not install.
- Dropped `monkey_patch_fp32_lm_head`: vLLM does the fp32 lm_head
projection natively via `head_dtype`
([#48390](https://github.com/vllm-project/vllm/pull/48390), LoRA path
[#48525](https://github.com/vllm-project/vllm/pull/48525)), so
`enable_fp32_lm_head` now injects `hf_overrides = {"head_dtype":
"float32"}`.
- Dropped the `PrimeRlServingTokens.serve_tokens` `kv_transfer_params`
bridge: upstream threads the params into the engine itself as of
[#42644](https://github.com/vllm-project/vllm/pull/42644), which landed
after the 0.28.0 cut.
- Dropped `monkey_patch_qwen3_coder_param_newline_trim`: upstream
restored the single-newline trim in
[#48846](https://github.com/vllm-project/vllm/pull/48846), making the
patch a byte-for-byte no-op.
- #48390 and #48846 already shipped in 0.28.0, so 0.29's role is to make
`fp32_lm_head` *fatal* via the new positional `skip_gather`; only #42644
is genuinely unlocked by the bump.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
## Summary
- Add an explicit `[[tool.uv.index]]` named `prime-hub` for
`https://hub.primeintellect.ai/primeintellect/simple/` with
`exclude-newer = false`. Hub wheels carry no upload time, so the repo's
7-day `exclude-newer` cooldown filtered all of them out.
- `uv pip install gsm8k --index prime-hub` and `uv add gsm8k --index
prime-hub` now resolve inside prime-rl. The index is `explicit`, so `uv
sync` never consults it and `uv lock --check` passes unchanged.
Only the named index inherits the setting: passing the same URL via
`--extra-index-url` still hits the cooldown (uv matches index config by
name). Other Hub owners need their own entry or `--no-config`.
Verified in a fresh checkout: `uv lock --check`, slim `uv sync`, then
install through `--extra-index-url` (rejected), `--index prime-hub`
(0.1.4 installed), and the per-environment install index (rejected).
Companion: PrimeIntellect-ai/prime#934 (`prime eval run` installs Hub
environments into a prime-rl sandbox; it uses `--no-config` so any owner
works).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Dependency-index configuration only; narrows the exclude-newer bypass
to an explicit, opt-in first-party index without changing default sync
behavior.
>
> **Overview**
> Adds a named **`prime-hub`** uv index pointing at the Environments Hub
with **`exclude-newer = false`**, so Hub wheels (which lack upload
timestamps) are no longer blocked by the repo-wide **7-day**
`exclude-newer` policy.
>
> The index is **`explicit`**, so default **`uv sync`** / lock checks
stay unchanged; Hub packages resolve only when you opt in (e.g. **`uv
add gsm8k --index prime-hub`**). Passing the same URL via
**`--extra-index-url`** still applies the global cooldown because uv
matches index settings by configured name, not raw URL.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1ac034977bbf2a54ef2977314fc87a9d2f6b1b5f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
### What & why
The prime-rl-fft chart runs a standalone read-only dashboard pod per
release (prime-rl-fft #75) that serves prime-rl's run dashboard (`uv run
dashboard`, port 7788) off the run's shared PVC. The chart image does
not include the `dashboard` extra (fastapi/uvicorn), so the pod
previously installed it at start with `uv sync --inexact` — which hangs
on some clusters, leaves the Deployment permanently unready, and times
out the whole release's helm `--wait` readiness gate after 90m, killing
every trainer/inference/orchestrator pod regardless of their own health.
The dashboard was disabled by default as a stopgap (prime-rl-fft #86).
This bakes the `dashboard` extra directly into the cuda image so the
dashboard pod serves straight from the image with no runtime install.
### Changes
- `Dockerfile.cuda`: add `--extra dashboard` to both `uv sync` calls
(third-party deps layer + first-party source layer).
### Notes
- `fastapi` + `uvicorn` are a few MB next to the ~20 GB GPU venv;
negligible size impact.
- Both syncs use `--locked` and `uv.lock` already resolves the
`dashboard` extra — no lockfile changes.
- Follow-ups (fft chart repo, separate PRs): drop the pod-start `uv sync
--inexact` command and re-enable the dashboard by default; expose it to
the platform backend over the tailnet.
### Testing
- No runtime code touched; image CI builds the image from this branch.
- `uv lock --check` equivalent verified: lock already contains the
dashboard extra deps with markers.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Build-only Dockerfile change that adds two small locked deps to the
venv; no application or runtime behavior changes in this repo.
>
> **Overview**
> **Bakes the `dashboard` optional extra (FastAPI + Uvicorn) into the
CUDA Docker image** so Helm FFT chart dashboard pods can run `uv run
dashboard` from the image without a startup `uv sync`.
>
> Both dependency install steps in `Dockerfile.cuda` now pass `--extra
dashboard` alongside the existing GPU/flash-attn extras, with a short
comment tying this to the chart dashboard pod. Lockfile is unchanged;
syncs stay `--locked`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
78fecdd68099796469bc2cecce1ad10142d9a76c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## What
- Adds a typed `inference.vllm.enable_ep_weight_filter` field defaulting
to `true`, so every vLLM server prime-rl launches now passes
`--enable-ep-weight-filter` (previously this flag only appeared as an
explicit pass-through in the GLM-5.3 advanced examples).
- Drops the now-redundant explicit `enable_ep_weight_filter = true` from
the GLM-5.3 examples (`examples/advanced/glm-5.3/swe.toml`,
`examples/advanced/glm-5.3/infer/pd-llmd.toml`).
- Asserts the default lands on the server namespace.
## Why
Under expert parallelism, vLLM's weight filter skips non-local
per-expert tensors **before** reading them from disk: each rank reads
only its own expert shard instead of the full checkpoint (experts are
~85-90% of MoE weight bytes). This cuts load I/O and startup time,
especially on shared storage.
The default is safe elsewhere — vLLM only activates the filter when the
model is MoE, `enable_expert_parallel` is on, and EPLB is off. It is a
silent no-op for dense models, fused-expert checkpoints (GPT-OSS style),
and EPLB runs. The repo pins `vllm>=0.28.0`, which has the flag.
Set `inference.vllm.enable_ep_weight_filter = false` to restore the old
behavior.
Note: #3604 relocates these GLM-5.3 examples to `configs/advanced/` and
its copies still carry the explicit line — drop it when rebasing on this
PR.
## Test plan
- `uv run pytest tests/unit/test_parsers.py tests/unit/test_configs.py`
- Verified `to_namespace()` emits `enable_ep_weight_filter=True` for a
real GLM-5.3 config, and that `--vllm.enable-ep-weight-filter false`
overrides it.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Behavior change is gated in vLLM to MoE + expert parallelism without
EPLB; dense models and other modes are no-ops, with an explicit config
escape hatch.
>
> **Overview**
> **Expert-parallel MoE loads now opt into vLLM’s EP weight filter by
default**, via a typed `inference.vllm.enable_ep_weight_filter` field
(default `true`) that flows through `to_namespace()` to
`--enable-ep-weight-filter`. That lets each rank read only its local
expert shard at checkpoint load instead of full expert tensors, reducing
I/O and startup time when EP is on and EPLB is off.
>
> The GLM-5.3 advanced TOML recipes **drop redundant**
`enable_ep_weight_filter = true` lines and rely on the default. A unit
test **asserts** the resolved server namespace includes
`enable_ep_weight_filter=True`. Set
`inference.vllm.enable_ep_weight_filter = false` to disable.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f26215dee423de2a19ec763106fd979183556cef. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## What
Reworks the GLM-5.3 RL examples as a **base + append** pair instead of
two standalone configs, and moves both variants onto the shared
`GLM-5.3-BF16` checkpoint with vLLM-side online FP8 quantization:
- **`swe.toml`** — the base config, carrying all the params that used to
live only in `swe-llmd.toml` (r2e-gym train source under the `rlm`
harness, `deepgemm_fp8` trainer, `cp = 4` / `ep = 8`, 16 train + 16
disaggregated-P/D infer nodes) behind the default **`vllm-router`**.
Inference serves the same **`zai-org/GLM-5.3-BF16`** checkpoint the
trainer broadcasts; vLLM quantizes it to per-block FP8 online
(`quantization = "fp8_per_block"`) — no separate FP8 release checkpoint.
- **`swe-llmd.toml`** — now a small **append overlay**: llm-d router
(EPP scorer tuning), Mooncake KV offload, and run-identity swaps (run
name / W&B project / SLURM job / sandbox runtime label). Launch:
```bash
uv run rl @ examples/advanced/glm-5.3/swe.toml # vllm-router
uv run rl @ examples/advanced/glm-5.3/swe.toml @
examples/advanced/glm-5.3/swe-llmd.toml # llm-d + Mooncake
```
- **`README.md`** — documents the base/append split, the composed launch
command, and which FILL INs live where.
## Why
- Two nearly-identical 100+ line configs drifted apart; a base + `@`
overlay keeps the llm-d variant a true delta (router + KV offload) and
makes the router the only difference between runs.
- Serving `GLM-5.3-BF16` with online per-block FP8 matches the trainer's
broadcast target and removes the dependency on the official block-FP8
serving release for both variants.
## Validation
Both launch paths resolve and validate end-to-end with `rl --dry-run`
(resolved per-process configs + sbatch generation): the base launches
`vllm-router --policy sticky_least_loaded`; the composed run swaps in
the llm-d router (EPP + Envoy) and enables Mooncake KV offload. Overlay
list-replacement semantics verified — the composed run keeps exactly one
train source, with the runtime label swapped to `glm5-llmd`.
Infer pre-flight configs (`infer/pd.toml`, `infer/pd-llmd.toml`) are
untouched.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Changes are limited to example TOMLs and documentation; no runtime or
library code paths are modified.
>
> **Overview**
> Reorganizes the GLM-5.3 RL examples so **`swe.toml` is the full base
stack** (r2e-gym / `rlm`, FP8 trainer, P/D inference behind
**`vllm-router`**, serving **`GLM-5.3-BF16`** with online block FP8) and
**`swe-llmd.toml` is a thin overlay** for llm-d router scorer tuning,
Mooncake KV offload, and sandbox runtime labels.
>
> Most settings that previously lived only in `swe-llmd.toml` move into
`swe.toml`; the llm-d file drops trainer/orchestrator/deployment
duplication. The README is updated to describe **base vs append**
launches (`rl @ swe.toml` vs `rl @ swe.toml @ swe-llmd.toml`), moves
“FILL IN” and Mooncake tuning notes to the right file, and states that
**neither RL file ships `[ckpt]`** by default (overlay to add
checkpoints). The old **`swe.toml` train-source-less / SWE-bench-eval
plane is replaced** by this composable layout—not removed entirely.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c9d87a57a24248945b3035d1cb87dee2f8f66a1a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- Remove the run-level aborts on consecutive empty train batches:
- The orchestrator raised after 10 consecutive no-sample train batches.
`MAX_CONSECUTIVE_EMPTY_BATCHES` and its counter are gone; an empty batch
now logs a warning and is skipped.
- The train sink raised after 10 batch-equivalents of finalized groups
that shipped no payload. The tally now only throttles the warning
(`_warn_zero_output`); there is no abort.
- Keep both warnings, so a run with no training signal stays visible in
the logs. A dead curriculum, an all-equal reward sweep, or an
infrastructure outage now stalls the run instead of killing it.
- Update the one `docs/algorithms.md` sentence that described the abort.
## Verification
- `uv run pytest tests/unit/orchestrator -q`: 82 passed, 1 skipped. The
8 failures are pre-existing `torch`/`vllm` import errors in a no-extras
env and fail the same way on `main`.
- `ruff check` / `ruff format --check` pass on both changed files.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Behavior change is limited to error handling: runs no longer fail fast
on sustained empty training signal, which may hide config issues but
avoids killing jobs on benign stalls.
>
> **Overview**
> **Removes run-killing guards** when training produces no shippable
data, so misconfigured curricula or transient all-zero-advantage groups
**stall with warnings** instead of crashing the orchestrator.
>
> In **`orchestrator.py`**, the **10 consecutive empty-batch abort** is
gone: empty `TrainBatch` samples log *"skipping empty train batch"* and
return without advancing the step. **`train_sink.py`** keeps counting
zero-output finalized units but **`_warn_zero_output`** only emits
throttled warnings—no **`RuntimeError`** after 10 batch-equivalents.
>
> **`docs/algorithms.md`** now says group-relative `group_size = 1`
empty batches are **skipped at runtime**, not aborted.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3160f47b861a2c9c6cb33fef4961336f9b6560e9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Compiled GLM-5.3 training fails on its first forward pass because `eps`,
`fp8_min`, and `fp8_max` reach the FP8 indexer quantization kernel as
runtime FP64 scalars. Their arithmetic promotes the quantization result
to FP64, and Triton rejects the resulting conversion with `Unsupported
conversion from f64 to f8E4M3FN with rounding mode rtne`.
Mark these three fixed scalar arguments as `tl.constexpr` so Triton
specializes them at compile time.
Validation: reproduced the failure on an 8-node H200 BF16 trainer with
`torch.compile`, activation checkpointing/offloading, full CPU offload,
and SignSGD. With this patch, the first forward/backward pass and
optimizer update completed, and the trainer began broadcasting policy
v1. The 20-step verification run is still in progress. `git diff
--check` passes.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Single-line Triton signature change with no API or logic changes; only
affects compile-time specialization of fixed FP8 bounds.
>
> **Overview**
> Fixes **compiled training crashes** on the first forward pass when the
FP8 indexer quantizes activations under `torch.compile`.
>
> The Triton kernel `_per_token_group_quant_fp8` now treats **`eps`,
`fp8_min`, and `fp8_max` as `tl.constexpr`** instead of runtime
arguments. Previously those scalars promoted quant math to FP64, and
Triton failed converting the result to FP8 (`f64` → `f8E4M3FN`).
Specializing them at compile time keeps the quant path in types Triton
can lower correctly; callers still pass the same module-level `FP8_EPS`
/ `FP8_MIN` / `FP8_MAX` constants.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
02f155d8ffb8776346c320be42a6be1f1f5299e9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
The advanced GLM presets now train GLM-5.3, but the directory was still
named glm-5.2. Rename it and update every inbound link and the
"GLM-5/GLM-5.2" prose in the READMEs and docs.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation and example path updates only; no training, inference,
or runtime code changes.
>
> **Overview**
> Renames the advanced GLM example from **`glm-5.2`** to **`glm-5.3`**
and updates every inbound link and launch snippet so docs match the
presets that target GLM-5.3.
>
> **README**, **docs** (`advanced.md`, `configuration.md`,
`scaling.md`), and **examples/README** now point at
`examples/advanced/glm-5.3/` and describe **`GLM-5`/`GLM-5.3`** instead
of 5.2. The **glm-5.3** walkthrough updates `uv run rl` / `uv run
inference` paths; **`infer/pd-llmd.toml`** only fixes its launch comment
to the new path (config content such as `GLM-5.2-FP8` model IDs is
unchanged).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fb2d99039d8719ff2bcdf2ac1e2c7baaa6f49946. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Johannes Hagemann <johannes@Johanness-MacBook-Pro.local>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
## Summary
PR #3588 centralized the model id for
`examples/advanced/glm-5.2/swe.toml` as a top-level
string (`model = "zai-org/GLM-5.3-BF16"`), but `RLConfig.model` is a
`SharedModelConfig`
table, so no config class could parse the file and CPU tests on `main`
failed
(`test_load_configs[examples/advanced/glm-5.2/swe.toml]`).
- Express the shared model as a `[model]` table with `name =
"zai-org/GLM-5.3-BF16"`, which
propagates to `trainer.model.name`, `orchestrator.model.name`, and
`inference.vllm.model`
(same intent as #3588).
- Update the `[inference.vllm]` comment: it now serves the shared BF16
checkpoint with online
per-block FP8 quantization, not a separate block-FP8 release.
Fixes the CPU Tests failure on `main` introduced by #3588.
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Example config-only change with no application code; verify the stack
resolves the correct vLLM checkpoint now that `[inference.vllm]` no
longer sets a separate `zai-org/GLM-5.3` id.
>
> **Overview**
> **Centralizes the Hugging Face model id** for the GLM-5.2 SWE advanced
example by adding a top-level `model = "zai-org/GLM-5.3-BF16"` and
dropping duplicate `name` / `model` entries under `[trainer.model]`,
`[inference.vllm]`, and `[orchestrator.model]`.
>
> Inference still uses the same vLLM settings (BF16 dtype,
`fp8_per_block` quantization, GLM tool parser); only the redundant
per-section model strings are removed so one field drives training and
orchestration.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4520df470f2417d4333f48fb80f40a2ed820574e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Documentation and example TOML checkpoint IDs only; no runtime or auth
logic changes.
>
> **Overview**
> Updates the **GLM-5.2** advanced SWE example presets and README so
runs target **GLM-5.3**: trainers load **`zai-org/GLM-5.3-BF16`**, while
disaggregated vLLM inference serves the **`zai-org/GLM-5.3`** block-FP8
checkpoint (with short comments explaining the train/serve split).
>
> **`swe.toml`** and **`swe-llmd.toml`** swap prior **`GLM-5` /
`GLM-5.1`** Hugging Face IDs on **`[inference.vllm]`**,
**`[trainer.model]`**, and **`[orchestrator.model]`**. The base
**`swe.toml`** plane also gains **`[orchestrator.renderer] name =
"glm-5.1"`** so it matches the llm-d stack’s rendering setup. Docs and
launch comments now describe **GLM-5.3** full-stack RL instead of 5.1;
inference-only table rows for **`infer/pd*.toml`** are unchanged in this
diff.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e02482573c596a0c7b575a710e8cf09e38ef4757. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## Summary
- make IPO use `eps = 0.3` by default
- disable the IPO KL regularizer by default with `kl_tau = 0.0`
- update the algorithm documentation to match
Explicit `[trainer.loss]` values continue to override these defaults.
## Test plan
- instantiated `IPOLossConfig` and the default `TrainerConfig.loss`,
confirming `eps == 0.3` and `kl_tau == 0.0`
- `ruff check packages/prime-rl-configs/src/prime_rl/configs/trainer.py`
## Summary
- Replace the full Prime CLI dependency with `prime-sandboxes` 0.3.0.
- Preserve API key and team discovery from `prime login` through the
sandbox SDK config reader.
- Advance the verifiers submodule to merged
[PrimeIntellect-ai/verifiers#2626](https://github.com/PrimeIntellect-ai/verifiers/pull/2626).
- Document the Prime CLI as a separate tool for login and sandbox
cleanup commands.
## Breaking
- Remove the Prime runtime `vm` and `guaranteed` fields. Delete these
fields from configs. Prime now always creates a VM sandbox.
- Stop publishing ports from Prime service runtimes. Colocate the
service and consumer, or use Docker or Modal for the service runtime.
- Stop installing the `prime` CLI with prime-rl. Run `uv tool install
prime` when the CLI is needed.
## Verification
- `uv lock --check`
- `uv sync --all-packages`
- `uv run ruff check src/prime_rl/orchestrator/clients.py
src/prime_rl/monitors/prime.py`
- `uv run pytest tests/unit/orchestrator/test_clients.py
tests/unit/test_configs.py -q` (199 passed)
- Confirmed `prime_sandboxes.Config` detects the existing CLI login and
team with `PRIME_API_KEY` and `PRIME_TEAM_ID` unset and the `prime`
distribution absent.
- `env -u PRIME_API_KEY -u PRIME_TEAM_ID uv run eval gsm8k -n 1 -r 1 -c
1 --run.name cli-login-smoke --output-dir /tmp/prl-cli-login-smoke`
(reward 1.0, no errors)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes how Prime credentials are loaded and sandbox SDK version;
misconfiguration could break Prime Inference headers or sandbox rollouts
until users install the CLI and log in separately.
>
> **Overview**
> Swaps the **`prime`** PyPI dependency for **`prime-sandboxes>=0.3.0`**
and points API key / team resolution at `prime_sandboxes.Config` instead
of `prime_cli.core.config` in the orchestrator client helpers and Prime
monitors.
>
> Advanced example READMEs now tell users to install the **`prime`** CLI
separately (`uv tool install prime` + `prime login`) rather than
assuming it ships with prime-rl. The lockfile drops the full **`prime`**
package and its transitive UI stack while bumping **`prime-sandboxes`**
to 0.3.0 (and related Prime packages where resolved).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9c37d34fc380e4c0a8d79159e8323c31fe605ff2. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
NCCL weight updates now always send HF checkpoint-format weights and use
vLLM's layerwise reload, letting inference apply its configured
quantization. Remove the trainer-side FP8 transfer switch from config
schemas, propagation, admin requests, and worker RPCs, along with its
unused kernel conversion and loading helpers and tests. No references to
the removed setting remain in tracked project files.
Update both GLM SWE configs to use their BF16 checkpoints, `dtype =
"bfloat16"`, and `quantization = "fp8_per_block"`; align the
orchestrator model names with those checkpoints. EPLB remains rejected
for RL weight updates because the remaining reload path has not been
validated with it.
Validation:
- 131 config and admin/Dynamo RPC unit tests passed, plus both changed
GLM config-loading tests (133 total).
- Full RL config smoke checks cover model-name alignment, NCCL settings
propagation, and EPLB rejection for both examples.
- Ruff lint/format, Python compilation, TOML parsing, and diff
whitespace checks passed.
- The broader config-file sweep was blocked by missing optional taskset
plugins. GPU weight reload was not exercised.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes the critical trainer→inference weight update path and removes
a large alternate loading implementation; misalignment between trainer
weights and vLLM quantization could cause silent drift until GPU reload
is exercised.
>
> **Overview**
> **Removes trainer-side FP8 kernel-format NCCL weight transfer** in
favor of always broadcasting HuggingFace checkpoint-format tensors and
reloading them in vLLM with layerwise processing, so inference applies
its own quantization settings.
>
> The `weight_broadcast.quantize_in_weight_transfer` flag is deleted
from shared/trainer/orchestrator schemas, RL propagation,
`/init_broadcaster` RPCs, Dynamo admin, and the NCCL broadcaster/worker
path. Related trainer conversion (`convert_layer_to_vllm_kernel`,
GLM-MoE-DSA kernel export, `quantize_to_vllm_kernel_format`) and
inference helpers (`load_weights_kernel`, EPLB expert remapping) are
removed along with their unit tests.
>
> **Example GLM SWE configs** switch from `*-FP8` checkpoints to BF16
base weights with `dtype = "bfloat16"` and `quantization =
"fp8_per_block"` on the vLLM side; orchestrator model names match.
>
> **EPLB** is no longer tied to quantized NCCL transfer—`enable_eplb`
now fails validation for any RL run with weight updates, since the
checkpoint reload path is not validated with EPLB.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
33bf980a95d5ee259f0f8d7b52a7e29b7d8e4a63. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-09-17 16:43:34 -07:00
256 changed files with 7949 additions and 5012 deletions
@@ -43,7 +43,7 @@ Namespaces are one honking great idea -- let's do more of those!
## Skills
Skills live in `skills/` and are symlinked to `.claude/skills/`. They teach agents how to handle specific workflows (e.g. starting the inference server, writing configs).
Skills live in `skills/` and are symlinked to `.claude/skills/` (Claude Code) and `.agents/skills/` (Codex). They teach agents how to handle specific workflows (e.g. starting the inference server, writing configs).
If a repository skill could benefit from an update, suggest the specific change, explain why it would help, and ask the user for approval before making it. Wait for approval before creating, modifying, renaming, or deleting skills, including their supporting files and symlinks. If the user has already explicitly requested or approved the skill change, proceed without asking again. Requests to change code, fix workflows, update documentation, or open a PR do not implicitly authorize skill changes. You may read and follow skills without changing them.
@@ -38,7 +38,7 @@ prime-rl is a framework for large-scale reinforcement learning. It is designed t
5. Multi-node deployment with Slurm and Kubernetes support.
6. Multimodal support for VLMs such as Qwen3-VL.
7. Hackable, modular, and extensible by design.
8. One-line SLURM deployment for frontier models — e.g. [`GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload](examples/advanced/glm-5.2/).
8. One-line SLURM deployment for frontier models — e.g. [`GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload](examples/advanced/glm-5.3/).
## Models support
@@ -53,15 +53,13 @@ With `[model] impl = "auto"` (the default), the trainer selects that custom stac
> *NOTE*: Environments are opt-in uv workspace members — `uv sync --all-extras` does not install them. To train on them, install all with `uv sync --all-extras --all-packages`, or a subset with `uv sync --package prime-rl --package <env>`.
3.1. Optional: Install Flash Attention 3 (on Hopper GPUs only, for flash_attention_3 attention backend)
> *NOTE*: This step will take a while, as it builds the Flash Attention 3 extension from source, as it has no wheels prebuilt.
> *NOTE*: After this step, you can't run `uv sync --all-extras` or `uv run` as it will uninstall the package, you can avoid it by running `uv sync --inexact` or `uv run --no-sync`
@@ -16,7 +16,7 @@ Minimal end-to-end configs for the algorithms against bundled verifiers envs, us
The policy inference server is auto-launched on GPU 0 at `http://localhost:8000/v1` with `gpu_memory_utilization=0.5`. The local frozen model (used by `opd*.toml`, `sft_distill.toml` / `sft_distill_lora.toml`, and `mixed_grpo_opd.toml`) is **not** auto-launched — start it manually on GPU 1.
Frozen models are declared inline on the algorithm, named where the model is used — `[orchestrator.algo.teacher]` for `opd`, `[orchestrator.algo.sampling.source]` for `sft` — with `name` + `base_url`. `opsd` declares none (it self-distills against the live policy). prime-rl never hosts them; only the trainable policy's server is managed by the `rl` entrypoint.
Frozen models are declared inline on the algorithm, named where the model is used — `[orchestrator.train.algo.teacher]` for `opd`, `[orchestrator.train.algo.sampling.source]` for `sft` — with `name` + `base_url`. `opsd` declares none (it self-distills against the live policy). prime-rl never hosts them; only the trainable policy's server is managed by the `rl` entrypoint.
-`type = "bf16"` (default), with `backend = "torch"` (default) or `"sonicmoe"`.
-`type = "deepgemm_fp8"` (requires DeepGEMM and SM90+)
-`type = "mxfp8"` (requires `prime-kernels`, torchao, and SM100)
SonicMoE uses the upstream `sonic-moe` package (`uv sync --extra sonic-moe`) for fused BF16 expert computation. The supported model is Qwen3 MoE with the `gate_up` model fusion enabled. Backend selection requires fused gate/up weights, standard SwiGLU, and bias-free experts; incompatible expert structures raise an error during setup. It uses the same router and local, torch EP, or DeepEP dispatch as other compute backends:
```toml
[trainer.model]
name="Qwen/Qwen3-30B-A3B"
ep=2
[trainer.model.fusions]
enabled=["gate_up"]
[trainer.model.moe.compute]
type="bf16"
backend="sonicmoe"
[trainer.model.moe.dispatch]
type="torch"
```
```toml
[trainer.model.quantization]
type="mxfp8"
@@ -119,7 +137,7 @@ With DeepEP, gradient clipping is currently not supported. (`optim.max_norm` is
enabled=["gate_up","qkv"]# [] disables
```
Fusions are runtime-only. Checkpoints keep the canonical parameter names and shapes, so a run can turn a fusion on or off at any point and still load its own checkpoints, and exported weights are unaffected. Only modules that support a fusion are packed; a requested fusion that no module supports logs a warning, or fails at startup with `raise_on_fail = true`. Fusions are skipped when LoRA is enabled.
Fusions are runtime-only. Checkpoints keep the canonical parameter names and shapes, so a run can turn a fusion on or off at any point and still load its own checkpoints, and exported weights are unaffected. Only modules that support a fusion are packed; a requested fusion that no module supports logs a warning and is skipped. Fusions are skipped when LoRA is enabled.
Muon receives the packed layout as matrix partitions and orthogonalizes each logical matrix on its own, so a packed parameter trains exactly as the parameters it replaces would — including per-projection learning-rate scaling for grouped-query attention — while keeping a single momentum tensor.
@@ -188,7 +206,7 @@ For large MoE serving, splitting prefill and decode onto separate vLLM groups ca
| Non-agentic (math, chat) | 1:2 | Short prompts, long generations → decode-heavy |
Example config: [`examples/advanced/glm-5.2/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-5.2/swe.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast, paired with an inference config from [`examples/advanced/glm-5.2/infer/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2/infer).
Example config: [`examples/advanced/glm-5.3/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-5.3/swe.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast, paired with an inference config from [`examples/advanced/glm-5.3/infer/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.3/infer).
@@ -30,7 +30,7 @@ This page covers the math and the configurable algorithmic components: the algor
## The Algorithm Abstraction
A training algorithm in `prime-rl` is configured under `[orchestrator.algo]`, where **`type` names the algorithm** (`grpo`, `opd`, `sft`, …) and the class defaults are its vetted setting. It has two parts:
A training algorithm in `prime-rl` is configured under `[orchestrator.train.algo]`, where **`type` names the algorithm** (`grpo`, `opd`, `sft`, …) and the class defaults are its vetted setting. It has two parts:
1.**Sampling** (`algo.sampling`) — how train rollouts are produced: which model generates them. `source` is a [model reference](#model-references): `"policy"` (the live policy, the default) or an inline frozen hosted model. Group sizing stays on the env config (`group_size`).
2.**The per-token training signal** — credit assignment and loss routing, fused; the algorithm's own parameters sit directly on `algo`. One mapping from a finalized rollout to per-token *(loss component, weight)* pairs — the credit a token gets and the loss that consumes it are two coordinates of the same output. Group-relative algorithms compute credit on the orchestrator and ship per-token advantage streams; reference-KL algorithms query a reference model at batch-ship time (bounded concurrency) and ship its prefill logprobs for the trainer to evaluate against the live policy. The `type` determines which loss component consumes the action tokens (`rl` / `ce` / `ref_kl`) and what happens to env-provided observation tokens in multi-turn rollouts (masked out by default; `echo` trains on them with weighted CE).
@@ -42,17 +42,17 @@ The trainer is algorithm-blind: the loss is a sum of three components (rl, ce, r
`prime-rl` hosts exactly one model: the trainable policy (`[orchestrator.model]`). Every other model an algorithm uses is an external OpenAI-compatible endpoint, declared *inline on the component that uses it*. A model reference is either the string `"policy"` (the live policy) or a frozen hosted model (`name` + `base_url`):
```toml
[orchestrator.algo]
[orchestrator.train.algo]
type="opd"
[orchestrator.algo.teacher]# opd's teacher: the frozen model it scores against
[orchestrator.train.algo.teacher]# opd's teacher: the frozen model it scores against
name="Qwen/Qwen3-32B"
base_url="http://localhost:8001/v1"
```
Model *roles* are algorithm-local vocabulary — each algorithm names its reference on the field where the model is actually used, and there is no shared `teacher` slot. `opd` declares a `teacher` field (the frozen model whose reverse KL the policy distills toward); `sft`'s teacher *is* its `sampling.source` (the frozen model it imitates); `opsd` self-distills against the live policy and names no model at all. No role exists outside the algorithm that declares it: the dispatcher, sink, and trainer branch on liveness alone, never on what an algorithm calls a model.
So for `opd` set `[orchestrator.algo.teacher]`; for `sft` set `[orchestrator.algo.sampling.source]`; `opsd` needs neither. `opd`'s teacher must be a frozen endpoint — it is typed `FrozenModelConfig`, so `"policy"` isn't representable (the KL would be identically zero); `opsd`'s teacher *is* the live policy by definition (self-distillation conditioned on a demonstration), so it exposes no reference to configure.
So for `opd` set `[orchestrator.train.algo.teacher]`; for `sft` set `[orchestrator.train.algo.sampling.source]`; `opsd` needs neither. `opd`'s teacher must be a frozen endpoint — it is typed `FrozenModelConfig`, so `"policy"` isn't representable (the KL would be identically zero); `opsd`'s teacher *is* the live policy by definition (self-distillation conditioned on a demonstration), so it exposes no reference to configure.
Liveness is a property of the reference, not of any role: rollouts sampled from `"policy"` get version-salted prefix caches, carry sampling logprobs for importance ratios, and age off-policy as weights update; rollouts and scores from frozen models get a stable prefix cache and never go stale. Frozen models are externally hosted (`base_url` is required) — `prime-rl` never launches or updates them, and each env's algorithm builds its own client pool to the endpoints it declares.
@@ -61,7 +61,7 @@ Liveness is a property of the reference, not of any role: rollouts sampled from
The `algo.type` names the algorithm, and each type's class defaults are its vetted setting — picking a type with no other keys IS the algorithm:
```toml
[orchestrator.algo]
[orchestrator.train.algo]
type="grpo"# the default
```
@@ -83,13 +83,13 @@ Every key beyond `type` is visibly your own assembly — there is no preset laye
```toml
# echo on tool AND user feedback tokens, each at its own weight.
# Setting any role replaces the whole table.
[orchestrator.algo]
[orchestrator.train.algo]
type="echo"
[orchestrator.algo.roles.tool]
[orchestrator.train.algo.roles.tool]
alpha=0.25
[orchestrator.algo.roles.user]
[orchestrator.train.algo.roles.user]
alpha=0.05
```
@@ -98,10 +98,10 @@ A new algorithm is a named class in code, not a config that points at an import
Echo also takes an optional user-supplied token filter that narrows the role selection per rollout — e.g. dropping warning lines from tool output, or tokens the sampler found unlikely:
Component compatibility is validated at config time: frozen-model sampling can only feed the `ce` loss component — the `rl` and `ref_kl` components need the live policy's own sampling logprobs for importance ratios — `opd` pointed at `"policy"` is rejected as degenerate (zero KL), `sft` without a frozen source is rejected (CE on the policy's own tokens is not a distillation target). A group-relative algorithm with `group_size = 1` produces all-zero advantages; the resulting empty batch is caught at runtime (the orchestrator warns and aborts after repeated zero-trainable batches), not at config time.
Component compatibility is validated at config time: frozen-model sampling can only feed the `ce` loss component — the `rl` and `ref_kl` components need the live policy's own sampling logprobs for importance ratios — `opd` pointed at `"policy"` is rejected as degenerate (zero KL), `sft` without a frozen source is rejected (CE on the policy's own tokens is not a distillation target). A group-relative algorithm with `group_size = 1` produces all-zero advantages; the resulting empty batch is caught at runtime (the orchestrator warns and skips it), not at config time.
### Per-Env Algorithms
Both components resolve per environment. Each env inherits `[orchestrator.algo]`unless it sets its own, so a single run can mix algorithms across envs — e.g. GRPO on math, ECHO on a terminal env:
Both components resolve per environment. Each env inherits `[orchestrator.train.algo]`like any other group default: an env that sets only some params keeps the group's algorithm with those params changed, and an env that sets a different `type` runs its own algorithm. So a single run can mix algorithms across envs — e.g. GRPO on math, ECHO on a terminal env:
```toml
[orchestrator.algo]
[orchestrator.train.algo]
type="grpo"
[[orchestrator.train.source]]
name="math"# inherits the top-level grpo
name="math"# inherits the group's grpo
env.taskset.id="math"
env.agent.harness.id="null"
env.agent.runtime.type="subprocess"
@@ -139,7 +139,7 @@ algo.type = "echo"
### The Algorithm Classes
At runtime, each env's resolved config builds two objects: a `GenerationSource` (`prime_rl.orchestrator.generation_source`) that resolves the `sampling.source` model into the inference pool used for train episodes, and one of the named algorithm classes in `prime_rl.orchestrator.algo` (one module per algorithm: `algo/grpo.py`, `algo/opd.py`, …) from the algorithm config. Algorithm dispatch is keyed on `algo.type` — it names the algorithm, and each config class's defaults are its vetted parameterization:
At runtime, each env's resolved config builds two objects: a `GenerationSource` (`prime_rl.orchestrator.generation_source`) that resolves the `sampling.source` model into the inference pool used for train episodes, and one of the named algorithm classes in `prime_rl.orchestrator.train.algo` (one module per algorithm: `algo/grpo.py`, `algo/opd.py`, …) from the algorithm config. Algorithm dispatch is keyed on `algo.type` — it names the algorithm, and each config class's defaults are its vetted parameterization:
| `algo.type` | Class | hook(s) — stage |
|---|---|---|
@@ -159,7 +159,7 @@ Algorithms operate on native verifier artifacts and annotate their message graph
The pipeline drives these through `finalize_episode` and `finalize_group`. Advantages, reference logprobs, and named loss weights stay on verifier nodes through admission. Only admitted traces are flattened into `TrainingSample`s.
Class-level declarations state what the algorithm needs: which loss component its action tokens feed (`action_loss_type`). Every class is constructed with its algorithm config plus the one host-owned resource it can't rebuild — the live policy clients (`self.clients`). Everything else an algorithm needs it builds from its own config in `setup()`: `opd` connects its frozen `teacher`; `opsd` builds the renderer for its demonstration hint (tokenizer is always the live policy's — self-distillation has no separate model). The pipeline only ever calls the two `finalize_*` methods — writing your own algorithm is subclassing `Algorithm` and overriding the hooks its signal needs (see [Authoring an Algorithm](#authoring-an-algorithm)). Shared math (efficiency shaping, prefill alignment) lives as plain functions in `prime_rl.orchestrator.algo.advantage`.
Class-level declarations state what the algorithm needs: which loss component its action tokens feed (`action_loss_type`). Every class is constructed with its algorithm config plus the one host-owned resource it can't rebuild — the live policy clients (`self.clients`). Everything else an algorithm needs it builds from its own config in `setup()`: `opd` connects its frozen `teacher`; `opsd` builds the renderer for its demonstration hint (tokenizer is always the live policy's — self-distillation has no separate model). The pipeline only ever calls the two `finalize_*` methods — writing your own algorithm is subclassing `Algorithm` and overriding the hooks its signal needs (see [Authoring an Algorithm](#authoring-an-algorithm)). Shared math (efficiency shaping, prefill alignment) lives as plain functions in `prime_rl.orchestrator.train.algo.advantage`.
## Async / Off-Policy Training
@@ -192,15 +192,12 @@ The orchestrator stamps each sample's component membership as per-token weight s
### IPO Loss
The default RL loss is Importance Policy Optimization (IPO). It combines an importance-weighted policy-gradient term with a squared log-ratio KL regularizer. A symmetric trust region removes tokens whose absolute probability change exceeds $\epsilon$:
The default RL loss is Importance Policy Optimization (IPO). It is an importance-weighted policy-gradient term. A symmetric trust region removes tokens whose absolute probability change exceeds $\epsilon$:
$\mu$ is the policy that generated the rollout. $\pi$ is the current trainer policy. $\hat{A}_t$ is the token-level advantage. The trust region uses the sampled token probabilities, not their ratio.
@@ -209,9 +206,8 @@ The knobs under `[trainer.loss]` are:
| Knob | Default | What it does |
|---|---|---|
| `eps` | 0.1 | Maximum absolute probability change before a token is masked. |
| `adv_tau` | 1.0 | Temperature on the advantage term. Set to 0 to drop the policy-gradient term, leaving only the KL regularizer. |
| `kl_tau` | 1e-3 | Temperature on the KL regularizer. Set to 0 to disable. |
| `eps` | 0.3 | Maximum absolute probability change before a token is masked. |
| `adv_tau` | 1.0 | Temperature on the advantage term. |
Omit `[trainer.loss]` to use these defaults. Set `type = "ipo"` when you specify the section. The `ce` and `ref_kl` components are fixed and unaffected by `[trainer.loss]`.
@@ -221,8 +217,7 @@ IcePop is an opt-in RL loss that drops tokens whose trainer-to-inference
importance ratio falls outside a fixed acceptance band, introduced to stabilize
MoE RL in [Every Step Evolves: Scaling Reinforcement Learning for Trillion-Scale
tokens retain the importance-weighted policy-gradient term, and there is no
separate KL penalty:
tokens retain the importance-weighted policy-gradient term:
$$
\mathcal{L}(\theta) = -\frac{1}{N}\sum_t
@@ -323,10 +318,10 @@ This is intentionally simple — it does the right thing for most envs. Write a
A **length penalty** (`length_penalty` on the `grpo`-family algorithms) can be layered on top to discourage rambling. The `linear` penalty subtracts a single `pass_rate`-scaled penalty from each reward before the GRPO baseline, combining output tokens (`num_output_tokens_weight`), input / context tokens (`num_input_tokens_weight`), and turns (`num_turns_weight`) — each normalized by the group's own max for that quantity, with `num_input_tokens_weight` and `num_turns_weight` defaulting to `0.1`.
```toml
[orchestrator.algo]
[orchestrator.train.algo]
type="grpo"
[orchestrator.algo.length_penalty]
[orchestrator.train.algo.length_penalty]
type="linear"
```
@@ -362,7 +357,7 @@ For example, if three solvers receive rewards `[1, 1, 0]` on one proposed proble
Configure which roles are compared within a single proposed problem with `episode_agents`. For `proposer-solver`, that role is `solver`:
```toml
[orchestrator.algo]
[orchestrator.train.algo]
type="hierarchical_grpo"
episode_agents=["solver"]
@@ -388,7 +383,7 @@ Group-relative baselines assume the group is exchangeable attempts by one agent.
`rae` implements SPIRAL's role-conditioned advantage estimation ([arXiv:2506.24119](https://arxiv.org/abs/2506.24119)): each agent keeps an exponential-moving-average baseline of its own rewards, and every trace's advantage is its reward minus its agent's baseline — measured against the *pre-update* baseline (the unbiased order), then folded in at `decay` (SPIRAL's α, default 0.95). The algorithm instance is per-env, so baselines are keyed per (env, agent) — the paper's per (game, role). Advantages are not normalized, and `group_size` is free (RAE needs no sibling rollouts; `group_size = 1` is fine). Baselines live in orchestrator memory and re-warm from 0 over ~`1/(1 − decay)` traces per agent after a restart.
```toml
[orchestrator.algo]
[orchestrator.train.algo]
type="rae"
decay=0.95
@@ -411,8 +406,8 @@ There is no config hook that points at user code — a new credit-assignment sch
@@ -436,7 +431,7 @@ Curriculum admission and metrics can inspect the resulting graph-native streams
-`opsd` — SDFT: prepend an expert demonstration as a leading system message (`template`, with a `{demonstration}` placeholder) and score the sample under that demo-conditioned context. The sample is scored verbatim (`hint_block + token_ids`, slicing the hint's logprobs back off), so the join is BPE-clean and it's robust to tool/multimodal prompts and any number of turns. The scoring reference *is* the live policy — self-distillation names no teacher. opsd builds its own renderer to tokenize the hint block: the tokenizer is always the live policy's (not configurable — there is no separate model), and only the `renderer` family is settable (defaults to `"auto"`, resolved from the policy tokenizer; set it to match a non-auto policy renderer). The demonstration is read from the example's `info[demo_key]`, falling back to a top-level rollout field of the same name (e.g. `answer`).
name="auto"# detect from tokenizer; pass an explicit name for fine-tunes
```
A renderer outside the `renderers` package loads as a custom renderer: `name = "custom"` with `import_path = "my_module.Class"` (or `path/to/file.py:Class`), see [Custom renderers](training.md#dataset-format).
For the full design rationale (failure modes ruled out, empirical token-identity comparison against `apply_chat_template`, when to write a hand-coded renderer), see [the renderers writeup on the Prime Intellect blog](https://www.primeintellect.ai/blog/renderers) — the canonical reference.
`ratio` is a training-source field: it defaults to `1` (equal weight per env), and values are relative weights normalized to probabilities across envs. Eval sources of a training run carry `interval` instead, the step interval at which they fire (inherited from the group-level `interval` when unset); a standalone eval has neither.
Each source group — `[orchestrator.train]`, `[orchestrator.eval]`, the `[eval]` block of `sft` and the top level of `eval` — holds defaults for its sources. Every field that a group and its sources both have is a default: `env`, `sampling`, `select` and `group_size`, plus `algo` on the train group and `interval` on the eval groups of a training run. Each source inherits the fields that its group sets. One rule applies to all of them: nested blocks merge key by key, a source's own values win, and a block whose `type` (e.g. of `algo`) differs from the group's is the source's alone.
```toml
[orchestrator.train]
group_size=16
[orchestrator.train.algo]
type="grpo"
[[orchestrator.train.source]]
env.taskset.id="math"
group_size=32# this source's own value wins over the group's 16
[orchestrator.eval.env]
retries.rules=[
{type="ProviderError",max_retries=3},
{type="SandboxError",max_retries=3},
]
timeout.episode=7200
[orchestrator.eval.select]# evaluate 128 tasks of each taskset
limit=128
```
The group `env` block holds only the knobs that every env and taskset has: `retries`, `timeout`, `max_concurrent_agents`, `interception`, and `taskset.task` and `taskset.system_prompt`. Ids and agents stay on each source. `select` picks which tasks of a source's taskset run: `include`/`exclude` by task `idx`/`ids`/`keys`/`names`, then `shuffle`, `skip` and `limit`, in that order.
`ratio` is a training-source field: it defaults to `1` (equal weight per env), and values are relative weights normalized to probabilities across envs. Eval sources of a training run carry `interval` instead, the step interval at which they fire; a standalone eval has neither.
Everything environment lives under the `env` block (verifiers' `[env]` shape): `env.taskset` configures the v1 taskset, and each agent is a field on the env — `env.agent.harness` selects how the single-agent env's tasks are run, and per-run caps are per-agent (`env.agent.max_turns`, `env.agent.timeout`, `env.agent.max_output_tokens`). A multi-agent env declares its own seats (`env.<role>.*`).
@@ -229,7 +255,7 @@ The shipped end-to-end examples in [`examples/`](https://github.com/PrimeIntelle
- [**Nemotron-3-Super**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/configs/advanced/nemotron-3-super) — `Nemotron-3-Super-120B` hybrid-Mamba MoE on SWE at 131k context.
- [**MiniMax-M2.5 SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/configs/advanced/minimax-m2.5) — `MiniMax-M2.5` on agentic SWE.
- [**INTELLECT-3.1**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/intellect-3.1) — reproduces our INTELLECT-3.1 training run.
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2) — large-scale `GLM-5`/`GLM-5.2` inference with P/D disaggregation and FP8.
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.3) — large-scale `GLM-5`/`GLM-5.3` inference with P/D disaggregation and FP8.
Single-source shorthands: `<taskset-id>` names the run's only source, `--env.<field> <value>` sets a field of that source's env block (`--env.agent.harness.id bash`, `--env.taskset.tasks '["fix-git"]'`), `-n`/`-r` set `num_examples`/`group_size`, `-m` the model, and `-c N` pins the concurrency band (`concurrency.min_inflight = max_inflight = N`). The shorthands cannot be combined with a TOML that defines `[[source]]` blocks. `uv run eval -h` lists them.
Single-source shorthands: `<taskset-id>` names the run's only source, `--env.<field> <value>` sets a field of that source's env block (`--env.agent.harness.id bash`, `--env.taskset.tasks '["fix-git"]'`), `-n`/`-s`/`-r` set `select.limit`/`select.shuffle`/`group_size`, `-m` the model, and `-c N` pins the concurrency band (`concurrency.min_inflight = max_inflight = N`). `<taskset-id>` cannot be combined with a TOML that defines `[[source]]` blocks; next to one, `--env.<field>` sets the shared [env block](#configuration) instead. `uv run eval -h` lists them.
Against a local vLLM deployment, set `min_inflight < max_inflight` in `[concurrency]` to dynamically adjust the number of concurrent episodes for maximum throughput. An external API exposes no vLLM `/metrics` to adapt to, so pin the concurrency there (`-c N`, i.e. `min_inflight = max_inflight`).
## Configuration
Multi-source runs use a TOML (`EvalConfig` in `packages/prime-rl-configs/src/prime_rl/configs/eval.py`). The eval block is flattened to the top level — `[[source]]`, `[client]`, `[concurrency]`, `[sampling]`, `num_examples`, `group_size` — and each source takes the same `env` block as `[[orchestrator.eval.source]]`:
Multi-source runs use a TOML (`EvalConfig` in `packages/prime-rl-configs/src/prime_rl/configs/eval.py`). The eval block is flattened to the top level — `[[source]]`, `[client]`, `[concurrency]`, `[sampling]`, `[select]`, `group_size` — and each source takes the same `env` block as `[[orchestrator.eval.source]]`:
```toml
model="Qwen/Qwen3-4B"
num_examples=32
group_size=4
[select]# every source inherits these
limit=32
[client]
base_url="http://localhost:8000/v1"
@@ -55,6 +57,10 @@ max_inflight = 256
[sampling]
max_completion_tokens=2048
[env]# every source inherits these
timeout.episode=7200
retries.max_retries=3
[[source]]
env.taskset.id="gsm8k"
env.agent.harness.id="bash"
@@ -63,9 +69,14 @@ env.agent.harness.id = "bash"
env.taskset.id="aime25"
env.agent.harness.id="null"
env.agent.runtime.type="subprocess"
select.include.idx=["0:30"]
```
Per-source `num_examples`, `group_size` and `sampling` override the top-level defaults. Every source's env server is spawned by the eval process unless the source sets `serve.address`, in which case the server is externally managed. A spawned server binds an OS-assigned loopback port and publishes it to `configs/attempt_N/resolved/envs/eval/<name>.address`, which the eval process reads, so concurrent runs on one host never collide on a port.
Per-source `group_size` and `sampling` override the top-level defaults. The top-level `[env]` block holds the env knobs that every source inherits (see [Environments](configuration.md#environments)); a source's own `env` values win.
Each field a source sets in its `select` overrides the same field of the top-level `[select]`. `select` picks which tasks of the taskset run: `include`/`exclude` by task `idx`/`ids`/`keys`/`names`, then `shuffle`, `skip` and `limit` (see verifiers' [Selecting tasks](../deps/verifiers/docs/v1/tasksets.md#selecting-tasks)). Train sources take the same `select`.
Every source's env server is spawned by the eval process unless the source sets `serve.address`, in which case the server is externally managed. A spawned server binds an OS-assigned loopback port and publishes it to `configs/attempt_N/resolved/envs/eval/<name>.address`, which the eval process reads, so concurrent runs on one host never collide on a port.
The previous attempt's `monitors/file` is kept as `monitors/file.attempt_N`; the resumed attempt writes a fresh one. Nothing is deleted, and a resume reads every attempt's stream.
A landed episode counts toward the task with its `task.key`, so `num_examples` and `group_size` may change between the two launches: kept episodes are matched to the new selection and the rest is owed. The model, the sampling and each source's env must match the config the landed episodes were measured with (kept beside them in `monitors/file/eval.json`); a resume that changes them stops with the differing config paths. Rollouts that complete a task's landed group join that group, so pass@k and the dashboard see one group per task. Use `--clean` to start over instead.
A landed episode counts toward the task with its `task.key`, so `select` and `group_size` may change between the two launches: kept episodes are matched to the new selection and the rest is owed. The resumed config is not checked against the interrupted one: any of it may be overridden, so keep the model, the sampling and each source's env the same when the landed episodes must stay comparable. Rollouts that complete a task's landed group join that group, so pass@k and the dashboard see one group per task. Use `--clean` to start over instead.
## Monitors
@@ -109,6 +120,7 @@ Eval metrics mirror the training rollout hierarchy under the `eval/<env>` scope:
|---|---|
| `eval/<env>/all/<agent>/reward/mean` | mean reward over the epoch |
| `eval/<env>/all/<agent>/is_truncated/mean` | share of rollouts cut by the length limit |
| `eval/<env>/all/<agent>/is_timeout/mean` | share of rollouts stopped by a stage deadline (`<stage>_timeout`) |
| `eval/<env>/all/<agent>/has_error/mean` | share of rollouts that raised |
| `eval/<env>/all/seq_len/mean` | mean episode length in tokens |
@@ -287,7 +287,7 @@ On the CLI the same keys are available as `--inference.vllm.max-num-seqs 256` (o
Router replay works by capturing the expert routing decisions into a buffer. This buffer then gets sent to the trainer, which can use it instead of re-computing the routing. This lowers the trainer↔inference mismatch by an order of magnitude, resulting in more stable training.
To enable router replay, you can set `inference.vllm.enable_return_routed_experts = true`. vLLM 0.28 uses the V2 model runner for standard deployments. Disaggregated P/D remains on V1 because NIXL routed-expert stitching is V1-only.
To enable router replay, you can set `inference.vllm.enable_return_routed_experts = true`. Standard deployments use the V2 model runner. Disaggregated P/D remains on V1 because NIXL routed-expert stitching is V1-only.
@@ -94,7 +94,7 @@ FSDP2 is the default model sharding strategy. By default the trainer fully shard
EP shards MoE expert weights across the EP mesh, dramatically reducing the FSDP communication volume per layer and improving the training throughput. EP is only available with the custom model implementation (`model.impl = "custom"` or `"auto"` for supported families).
`ep` defaults to `"auto"`, which resolves at startup to the largest valid EP degree up to 8. It loads the model config 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, resolves to 1 (no-op). Set `ep` to an explicit integer to override:
`ep` defaults to `"auto"`, which resolves at startup to the largest valid EP degree up to 8. It loads the model config 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 at most 8. For non-MoE models, resolves to 1 (no-op). Set `ep` to an explicit integer to override:
```toml
[trainer.model]
@@ -117,7 +117,7 @@ CP shards a single sequence across multiple GPUs along the token dimension — f
```toml
[trainer.model]
impl = "custom"
attn = "auto" # auto = FA3 on Hopper, FA4 on Blackwell; or flash_attention_2/3/4
attn = "auto" # auto = FA3 on Hopper, FA4 on datacenter Blackwell, FA2 otherwise; or flash_attention_2/3/4
cp = 2 # CP degree
cp_style = "ulysses" # "ring"
```
@@ -233,7 +233,7 @@ gpus_per_node = 8
Full multi-node configs ship under [`examples/advanced/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced):
- [`nemotron-3-super/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/configs/advanced/nemotron-3-super/swe.toml) — 4 trainer + 1 inference node RL on a 120B hybrid-Mamba MoE with NCCL weight broadcast.
- [`glm-5.2/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2) — large-scale and P/D-disaggregated inference across the GLM-5 family.
- [`glm-5.3/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.3) — large-scale and P/D-disaggregated inference across the GLM-5 family.
- [`glm-4.5-air/swe-2-node.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-4.5-air/swe-2-node.toml) — train a 100B+ MoE on only two nodes: a single-node sign-SGD trainer (full optimizer offload) paired with one inference replica at batch size 64. An overlay on the shared `swe-budget.toml` base — launch with `uv run rl @ swe-budget.toml @ swe-2-node.toml`.
For inference-only multi-node, set `[deployment] type = "multi_node"` on an inference TOML — each node runs an independent vLLM replica (TP and DP must fit within one node), fronted by a single global router on node 0. Point clients at the router URL the launcher prints.
@@ -274,8 +274,8 @@ To benchmark a parallelism config before committing a multi-day run, run a short
# SFT trainer alone
uv run sft @ sft.toml --data.type fake --max-steps 4
# RL trainer alone (no inference involved)
uv run trainer @ train.toml --data.fake --max-steps 4
# RL trainer alone (no inference involved) -- launch it under torchrun, like the `rl` launcher does
uv run torchrun --nproc-per-node=8 src/prime_rl/trainer/rl/train.py @ train.toml --data.fake --max-steps 4
```
Every step logs `Throughput`, `MFU`, and `Peak Mem.` to the console. For machine-readable numbers, the file monitor writes `monitors/file/metrics.jsonl` under the run's output directory by default (`monitors.file`); aggregate `perf/throughput`, `perf/mfu`, `time/step`, and `perf/peak_memory` from the run's `metrics.jsonl` — skip the first step, it is warmup. [`benchmarks/scripts/run_single_benchmark.py`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/benchmarks/scripts/run_single_benchmark.py) does exactly this and is what the CI benchmark matrix runs.
@@ -35,8 +35,7 @@ This page covers everything you need to launch, observe, checkpoint, and recover
| `uv run rl` | Wraps the trainer, orchestrator, and inference server in one launch from a merged TOML. | The default for any RL run. Runs locally for single-node experiments; submits to SLURM for single- or multi-node when `[slurm]` is set (see [Scaling § SLURM](scaling.md#slurm)). |
| `uv run sft` | Supervised fine-tuning on a HF dataset. | Launches torchrun internally; never call torchrun directly. |
| `uv run inference` | vLLM server. | Always use this entrypoint over `vllm serve` — it adds `/update_weights`, `/load_lora_adapter`, and `/init_broadcaster`. |
| `uv run trainer` | Standalone trainer process group. | Use only when launching the trainer separately from the orchestrator (e.g. multi-node RL without the `rl` wrapper). |
| `uv run orchestrator` | Standalone orchestrator process. | Pair with a separately-launched trainer, inference, and one `env-server` per source. |
| `uv run orchestrator` | Standalone orchestrator process. | Pair with a separately-launched inference server and one `env-server` per source. |
| `uv run eval` | Multi-env evals against a live inference server. | One epoch per source, pinned (or adaptive) concurrency, cursor checkpoints + `--resume`, dashboard + optional platform upload; see [Eval](eval.md). |
| `uv run env-server` | Standalone env server for one environment. | The `rl` launcher starts these automatically (one per train/eval source; each binds an OS-assigned loopback port and publishes it to `configs/attempt_N/resolved/envs/<split>/<name>.address` for the orchestrator); only needed when running the orchestrator standalone, or for sources with an explicit `serve.address` — those are externally managed (e.g. their own k8s pod) and the launcher expects the server to already run there. |
@@ -60,9 +59,9 @@ A condensed view of the knobs you'll most often tune. For trainer-side paralleli
|---|---|
| `orchestrator.batch_size` | Tasks per trainer step. |
| `orchestrator.constant_trainer_batch_size` | Keep trainer batches constant when samples have no training signal, such as zero advantage on all tokens. Enabled by default. Disable it for faster collection with variable trainer batch sizes. |
| `orchestrator.group_size` | Rollouts generated per task. |
| `orchestrator.train.group_size` | Rollouts generated per task. |
| `orchestrator.max_off_policy_steps` | Maximum staleness of a trained rollout (default 8): the version a batch trains on minus the oldest version that generated the rollout, queue time included. Episodes past the bound are dropped; a group shares one dispatch version, so its episodes age out together. The main off-policy dial on long agentic rollouts — bump for throughput, lower for tighter on-policyness. Watch `off_policy/*` and `mismatch_kl/all/mean` when tuning. |
| `[orchestrator.algo]` | Training algorithm — its `type` names it (`grpo` default, `max_rl`, `rae`, `hierarchical_grpo`, `opd`, `opsd`, `sft`, `echo`). See [Algorithms](#algorithms). |
| `[orchestrator.train.algo]` | Training algorithm — its `type` names it (`grpo` default, `max_rl`, `rae`, `hierarchical_grpo`, `opd`, `opsd`, `sft`, `echo`). See [Algorithms](#algorithms). |
| `[[orchestrator.train.source]]` | Training sources. List multiple tables for multi-env training; weight them via `ratio`. See [Configuration § Training sources](configuration.md#training-sources-orchestratortrainsource). |
| `[[orchestrator.eval.source]]` + `orchestrator.eval.interval` | Eval environments and cadence (default every 100 steps). |
@@ -87,7 +86,7 @@ A condensed view of the knobs you'll most often tune. For trainer-side paralleli
### Algorithms
The RL entrypoint supports several training algorithms, switched via `[orchestrator.algo]`'s `type` (see [Algorithms](algorithms.md#the-algorithm-abstraction) for the full reference, model references, and per-algorithm customization):
The RL entrypoint supports several training algorithms, switched via `[orchestrator.train.algo]`'s `type` (see [Algorithms](algorithms.md#the-algorithm-abstraction) for the full reference, model references, and per-algorithm customization):
| `algo.type` | Frozen model | Use case |
|---|---|---|
@@ -102,7 +101,7 @@ The RL entrypoint supports several training algorithms, switched via `[orchestra
A new algorithm is a named class in code, not a config — see [Algorithms § Authoring an Algorithm](algorithms.md#authoring-an-algorithm).
Frozen models are declared inline on the algorithm, named where the model is used — `[orchestrator.algo.teacher]` for `opd` (the frozen model scored against), `[orchestrator.algo.sampling.source]` for `sft` (the model it samples from) — each with `name` + `base_url`. `opsd` declares no frozen model: it self-distills against the live policy. The `rl` entrypoint only manages policy inference — start frozen-model servers yourself and point `base_url` at them:
Frozen models are declared inline on the algorithm, named where the model is used — `[orchestrator.train.algo.teacher]` for `opd` (the frozen model scored against), `[orchestrator.train.algo.sampling.source]` for `sft` (the model it samples from) — each with `name` + `base_url`. `opsd` declares no frozen model: it self-distills against the live policy. The `rl` entrypoint only manages policy inference — start frozen-model servers yourself and point `base_url` at them:
```bash
CUDA_VISIBLE_DEVICES=1 uv run inference \
@@ -119,6 +118,7 @@ Pulled from the console logs and mirrored to W&B.
- `reward/{all,env}/mean` — main signal. Should trend upward over hundreds of steps.
- `seq_len/{all,env}/mean` and `is_truncated/{all,env}/mean` — rollout length and truncation rate.
- `is_timeout/{all,env}/mean` — share of rollouts stopped by a stage deadline (`setup`/`agent`/`finalize`/`scoring``_timeout`). Training counts a timed-out rollout as an error, so it stays out of the batch; eval scores it.
- `num_turns/{all,env}/mean` — for multi-turn envs.
- `empty_rollouts/{all,env}`, `errored_rollouts/{all,env}` — non-zero is fine in small numbers; sustained > 5% is a smell.
- `eval/{env}/{avg@k,pass@k}` — eval scores when `[orchestrator.eval]` is set.
@@ -150,9 +150,15 @@ Two accepted layouts:
- **Prompt-completion**: a HF dataset with `prompt` and `completion` columns ([TRL format](https://huggingface.co/docs/trl/en/dataset_formats#prompt-completion)). The trainer masks out the prompt and computes loss only over the completion.
- **Messages**: a HF dataset with a single `messages` column containing a list of chat turns. The trainer interprets the whole conversation as one sample, applies role-based loss masking, and trains over all assistant turns.
If both columns are present, `messages` takes precedence.
If both columns are present, `messages` takes precedence. A dataset that stores these under other names maps them in `[data.columns]`; the trainer renames the columns at load time:
**Tool definitions and renderer controls.** For tool-use SFT, add a `tools` column (OpenAI function-calling format) or `tool_defs` ([`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) rollout format). Each row's value can be either a list of dicts or a JSON-encoded string of a list — both are accepted, and `tool_defs` rows are auto-converted to OAI shape before being passed into the renderer.
```toml
[data.columns]
messages = "conversation"
tools = "schemas"
```
**Tool definitions and renderer controls.** For tool-use SFT, add a `tools` column in OpenAI function-calling format. Each row's value can be either a list of dicts or a JSON-encoded string of a list.
Renderer-backed SFT reads template controls from the typed `[renderer]` config in the SFT TOML. For example:
@@ -162,8 +168,27 @@ name = "qwen3"
enable_thinking = false
```
Dataset columns can set renderer template controls per row, on top of the `[renderer]` config. `[data.columns.renderer]` maps renderer fields to columns and defaults to `reasoning_effort = "reasoning_effort"`, so a `reasoning_effort` column sets that field on renderers that have it (for example `gpt-oss`, `qwen3.8`, `deepseek-v4`). Rows with a null value use the configured renderer unchanged. This lets one run mix reasoning efforts, with the `[renderer]` value as the default for rows that do not set one:
```toml
# The renderer field is reasoning_effort; this dataset stores it in an effort column.
[data.columns.renderer]
reasoning_effort = "effort"
```
If a model needs another template control, add it to that model's renderer config in `renderers` (for example a new field on the relevant `*RendererConfig`) and consume it in the renderer implementation.
**Custom renderers.** A renderer can also live outside the `renderers` package. Set `name = "custom"` and point `import_path` at the class, as `my_module.Class` or `path/to/file.py:Class`; relative file paths resolve against the launch directory. The class sets `config_class` to its own `BaseRendererConfig` subclass, which validates the remaining `[renderer]` keys and declares its template controls:
The same config selects the renderer for RL under `[orchestrator.renderer]`. The [`renderers` README](https://github.com/PrimeIntellect-ai/renderers#custom-renderers) shows the class behind this example.
**Renderer-backed tokenization.** SFT tokenization is renderer-only. The [`renderers`](algorithms.md#renderers) package owns message-to-token conversion and loss attribution end-to-end, so position-dependent chat templates (for example templates that strip past `<think>` blocks across user turns) do not corrupt the loss mask. `[renderer]` defaults to `name = "auto"`; set a typed renderer config only when you need model-specific template controls. Hand-coded renderers ship for Qwen3, Qwen3.5, GLM-5, GLM-4.5, Kimi K2/K2.5, MiniMax M2, DeepSeek V3, Nemotron 3, GPT-OSS, and VLM families such as Qwen3-VL/Qwen3.5.
**VLM training requires a custom PrimeRL implementation.** Training a model with `[model.vlm]` set (SFT or RL) requires `model.impl = "custom"` and only works for models with a registered PrimeRL VLM class (currently Qwen3.5 dense and MoE).
@@ -180,14 +205,18 @@ uv run sft @ examples/basic/reverse-text/sft.toml --monitors.wandb
Multi-GPU and multi-node use torchrun under the hood (the `sft` entrypoint manages this for you — see [Scaling § SFT and Torchrun](scaling.md#sft-and-torchrun) for non-default layouts; multi-node SFT goes through [SLURM](scaling.md#slurm)).
`--monitors.prime` streams the run to the Prime Intellect platform — see [Platform Monitoring](#platform-monitoring).
### Online Evals
`uv run sft` can evaluate the model on rollout-based envs as it trains, reusing the RL orchestrator's eval machinery. Configure an `[eval]` block — the same shape as `[orchestrator.eval]`: multiple `[[eval.source]]` envs with per-source `interval` / `num_examples` / `group_size` / sampling overrides — plus an `[inference]` block for the vLLM server:
`uv run sft` can evaluate the model on rollout-based envs as it trains, reusing the RL orchestrator's eval machinery. Configure an `[eval]` block — the same shape as `[orchestrator.eval]`: multiple `[[eval.source]]` envs with per-source `interval` / `select` / `group_size` / sampling overrides — plus an `[inference]` block for the vLLM server:
```toml
[eval]
interval = 25
num_examples = 32
[eval.select]
limit = 32
[[eval.source]]
name = "reverse-text"
@@ -250,7 +279,7 @@ Pulled from the console log and mirrored to W&B.
- `optim/grad_norm` — spikes precede divergence.
- `optim/lr` — LR schedule.
- For MoE: `max_vio/mean` (load-balancing violation),`routing_confidence/mean` — both are logged when non-zero.
- For MoE: `max_vio/mean`, `max_vio/max` — mean and max over the step's microsteps of the largest load-balancing violation across layers and EP groups, computed from expert token counts summed across each EP group.`routing_confidence/mean` — mean routing confidence.
**Performance:**
@@ -379,6 +408,7 @@ Register a run on the Prime Intellect platform (Prime Lab) and stream training m
```bash
uv run rl @ rl.toml --monitors.prime
uv run sft @ sft.toml --monitors.prime # same flag on the SFT trainer
```
Or set it in TOML:
@@ -388,7 +418,9 @@ Or set it in TOML:
name = "my-experiment"
```
The monitor is a thin layer over the [`prime-runs`](https://github.com/PrimeIntellect-ai/prime/tree/main/packages/prime-runs) SDK (installed as `prime-runs[train]`): it registers the run, streams per-step metrics, uploads every 10th step's episodes (full conversations with rewards and advantages) to the run's sample viewer, and closes the run out. A process that exits without finishing is reported as crashed. Uploaded episodes are keyed to the platform run by the SDK; the orchestrator's own run id (the launcher's `PRL_RUN_ID`) stays on W&B and in the local records.
The monitor is a thin layer over the [`prime-runs`](https://github.com/PrimeIntellect-ai/prime/tree/main/packages/prime-runs) SDK (installed as `prime-runs[train]`): it registers the run, streams per-step metrics, uploads every 10th step's episodes (full conversations with rewards and advantages) to the run's sample viewer, and closes the run out. Finalization is best-effort SDK delivery: a process that exits without finishing is reported crashed when the SDK's atexit hook runs, but an abrupt kill (SIGKILL, OOM, node loss) skips the report and a lost finalize is not retried — the platform owns the terminal state of attached (`RUN_ID`) and managed runs. Uploaded episodes are keyed to the platform run by the SDK; the orchestrator's own run id (the launcher's `PRL_RUN_ID`) stays on W&B and in the local records.
On `sft` the monitor registers the run with the dataset-batched training fields (`max_steps`, `batch_size`, `seq_len`) and streams the trainer's per-step metrics and validation losses; SFT has no rollouts, so no episodes are uploaded.
Requires `PRIME_API_KEY` (`prime login` or the env var) and a team (`PRIME_TEAM_ID`, or the team selected with `prime login`) enabled for external runs. A configured monitor must work: a missing key or a team outside the allowlist fails the launch. `PRIME_RUNS_MODE=disabled` keeps the monitor configured but opens no platform run; `RUN_ID=<id>` attaches to an external run a launcher already created instead of registering a new one. Currently internal-only.
@@ -396,6 +428,6 @@ Requires `PRIME_API_KEY` (`prime login` or the env var) and a team (`PRIME_TEAM_
- **Start small.** Run `examples/basic/reverse-text/rl.toml` end-to-end on 2 GPUs before scaling. If the smoke run finishes cleanly, your install is good.
- **Batch size ≥ 64.** Smaller batches give noisy gradient estimates and the trainer's overhead-per-step dominates throughput. 64 is the practical floor; 128–512 is the range for quick ablations; production RL often runs at 1024+.
- **Group size ≥ 8.** Bigger groups (`orchestrator.group_size`) make it more likely that a task produces a mix of high- and low-reward rollouts, which is what gives the trainer a usable signal — if all rollouts in a group succeed or all fail, the within-group advantage collapses to zero and the trainer learns nothing from that task. Bigger groups also tighten advantage normalization. 8 is the floor; 16–32 is common.
- **Group size ≥ 8.** Bigger groups (`orchestrator.train.group_size`) make it more likely that a task produces a mix of high- and low-reward rollouts, which is what gives the trainer a usable signal — if all rollouts in a group succeed or all fail, the within-group advantage collapses to zero and the trainer learns nothing from that task. Bigger groups also tighten advantage normalization. 8 is the floor; 16–32 is common.
- **Runs never share a directory.** Every launch writes to its own run directory `<output_dir>/<run_name>`, auto-named `<envs>--<model>--<short-id>` by default. Name runs you want to find again or resume with `--run.name <name>`; re-using a name blocks unless you resume or pass `--clean`.
- **Use `--dry-run` before SLURM.** Validators (e.g. CP needs flash-attention) fail fast in dry-run and slow in queue.
@@ -10,7 +10,7 @@ Larger runs on frontier models, one folder per model, each with a launch README
- [`qwen3-30b-a3b/`](advanced/qwen3-30b-a3b/README.md) — `Qwen3-30B-A3B` RL on math (`i3_math`), SWE (`r2e-gym`), and agentic tool use (general-agent on Modal). 2 train + 2 infer nodes; the SWE config runs at 131k context with `ep = 8` + `cp = 2`.
- [`glm-4.5-air/`](advanced/glm-4.5-air/README.md) — `GLM-4.5-Air` (100B MoE) RL across search, SWE, and terminal domains at 131k context, with agents in sandboxes. 2 train + 4 infer nodes (SWE: 1 + 3).
- [`glm-5.2/`](advanced/glm-5.2/README.md) — the GLM-5 family at scale: 16 trainer nodes, P/D-disaggregated FP8 inference, and an llm-d router + Mooncake KV-offload variant. Also ships standalone `infer/` pre-flights.
- [`glm-5.3/`](advanced/glm-5.3/README.md) — the GLM-5 family at scale: 16 trainer nodes, P/D-disaggregated FP8 inference, and an llm-d router + Mooncake KV-offload variant. Also ships standalone `infer/` pre-flights.
- `intellect-3.1/` — reproduce the `INTELLECT-3.1` run: 4 train + 12 infer nodes on SWE.
All advanced configs submit through SLURM (the `rl` entrypoint writes the sbatch job when the config has a `[slurm]` table) and are monitored with `uv run dashboard`. See the per-model README for the full walkthrough.
@@ -35,4 +35,3 @@ Examples that don't follow the basic eval → SFT → RL walk-through pattern:
## Related config folders
- Frontier-model configs without launch walkthroughs (`minimax-m2.5`, `nemotron-3-super`, `deepseek-v4-flash`) live in [`configs/advanced/`](../configs/advanced).
- Dev-sized (2-GPU) counterparts of `basic/` live in [`configs/basic/`](../configs/basic).
@@ -15,10 +15,11 @@ Inference serves the bf16 checkpoint as-is (no quantization), with `tensor_paral
## Requirements
- A Slurm cluster with 8-GPU nodes and a shared filesystem. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path.
- **Sandboxes.** Rollout and eval agents run in sandboxes. These configs are wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default — if you use those, log the `prime` CLI in (it ships with prime-rl's dependencies), and each config's `slurm.pre_run_command`will clean up the run's orphaned sandboxes by label before launching:
- **Sandboxes.** Rollout and eval agents run in sandboxes. These configs are wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. Install the `prime` CLI separately and log in. Each config's `slurm.pre_run_command`then cleans up the run's orphaned sandboxes by label before launch:
```bash
uv run prime login # or: uv run prime config set-api-key <your-key>
uv tool install prime
prime login # or: prime config set-api-key <your-key>
```
To run on your own infrastructure instead, swap `env.agent.runtime` on each source for a runtime your environments support (e.g. a local Docker backend) and drop the `slurm.pre_run_command` cleanup line.
Large-scale RL and serving for the GLM-5 family — `zai-org/GLM-5`, `GLM-5.1`, and `GLM-5.2-FP8` — at 131k context: 16 trainer nodes on the custom MoE implementation (expert parallelism; the llm-d variant adds context parallelism) and P/D-disaggregated FP8 inference. The `-llmd` variants front the inference plane with the [**llm-d**](https://llm-d.ai) router (Endpoint Picker + Envoy): its `active-request-scorer` load-balances in flight — instead of reacting to delayed metrics like the default `vllm-router` — which, combined with prefix-cache affinity for grouped rollouts, keeps prefill and decode ranks evenly loaded under RL's bursty request pattern. They also offload KV to a Mooncake distributed CPU pool (1TB per node by default).
Large-scale RL and serving for the GLM-5 family — `zai-org/GLM-5.3-BF16` for training and serving alike, quantized to per-block FP8 online on the vLLM side — at 131k context: 16 trainer nodes on the custom MoE implementation (expert + context parallelism) and P/D-disaggregated FP8 inference. The [`swe-llmd.toml`](swe-llmd.toml) append fronts the same inference plane with the [**llm-d**](https://llm-d.ai) router (Endpoint Picker + Envoy): its `active-request-scorer` load-balances in flight — instead of reacting to delayed metrics like the default `vllm-router` — which, combined with prefix-cache affinity for grouped rollouts, keeps prefill and decode ranks evenly loaded under RL's bursty request pattern. It also offloads KV to a Mooncake distributed CPU pool (1TB per node by default).
| Config | What it runs | Topology |
|---|---|---|
| [`swe.toml`](swe.toml) | GLM-5 RL plane: 16 train nodes, eval on `swebench-verified` every 20 steps, default vLLM router over 2 P/D replicas (4 prefill + 4 decode nodes each). Declares **no train source** — compose yours on top with an `[[orchestrator.train.source]]` overlay. | 16 train + 16 infer nodes |
- A Slurm cluster with 8-GPU nodes, a shared filesystem, and at least **32 nodes** (16 trainer + 16 inference) for the RL configs. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path. If you have fewer nodes, drop `seq_len`, lower `num_train_nodes`, and reduce `cp` (llm-d variant) accordingly.
- InfiniBand/RDMA NICs for the Mooncake KV pool (llm-d variants).
- **Sandboxes.** Rollout and eval agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, log the `prime` CLI in — it ships with prime-rl's dependencies:
- A Slurm cluster with 8-GPU nodes, a shared filesystem, and at least **32 nodes** (16 trainer + 16 inference) for the RL configs. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path. If you have fewer nodes, drop `seq_len`, lower `num_train_nodes`, and reduce `cp` accordingly.
- InfiniBand/RDMA NICs for the Mooncake KV pool (llm-d append).
- **Sandboxes.** Rollout and eval agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, install the `prime` CLI separately and log in:
```bash
uv run prime login # or: uv run prime config set-api-key <your-key>
uv tool install prime
prime login # or: prime config set-api-key <your-key>
```
To run on your own infrastructure instead, swap `env.agent.runtime` on each source for a runtime your environments support (e.g. a local Docker backend).
@@ -24,9 +25,9 @@ uv run prime login # or: uv run prime config set-api-key <your-key>
- Environment variables, exported in the shell you launch from — the launcher passes its environment to every component:
- `HF_TOKEN` — the GLM-5 family checkpoints are gated models.
- `WANDB_API_KEY` — both RL configs log to W&B (`[monitors.wandb]`).
- `WANDB_API_KEY` — both RL variants log to W&B (`[monitors.wandb]`).
### Install llm-d (llmd variants only)
### Install llm-d (llm-d append only)
The llm-d router ships as vendored binaries (`epp`, `envoy`, `pd-sidecar`). Build them once into `third_party/llmd/bin`:
- `swe-llmd.toml` marks two `# FILL IN` values: `output_dir` (point it at your shared filesystem) and `[slurm] partition`.`swe.toml` needs `--slurm.partition <your-partition>` or `--output-dir` overrides on the command line.
- `[inference.kv_cache_offload] device_name` — the RDMA NIC list for Mooncake. Auto-detection is unreliable; set it by hand from `nvidia-smi topo -m` on your nodes.
- `[inference.kv_cache_offload.cpu] num_bytes` — 1TB per node by default; lower it if your nodes have less RAM.
- `swe-llmd.toml` ships without `[ckpt]` — add a checkpoint overlay if you want resume support.
- `swe.toml` marks two `# FILL IN` values: `output_dir` (point it at your shared filesystem) and `[slurm] partition`.
- `swe-llmd.toml``[inference.kv_cache_offload] device_name` — the RDMA NIC list for Mooncake. Auto-detection is unreliable; set it by hand from `nvidia-smi topo -m` on your nodes.
- `swe-llmd.toml``[inference.kv_cache_offload.cpu] num_bytes` — 1TB per node by default; lower it if your nodes have less RAM.
## Start the run
The `rl` entrypoint submits an sbatch job whenever the config has a `[slurm]` table — there is no separate launcher. From the shared checkout:
```bash
# GLM-5.1 RL with llm-d + Mooncake (recommended)
uv run rl @ examples/advanced/glm-5.2/swe-llmd.toml
# GLM-5.3 RL behind the default vllm-router
uv run rl @ examples/advanced/glm-5.3/swe.toml
# GLM-5 base plane — compose your train source onto it
uv run rl @ examples/advanced/glm-5.2/swe.toml @ my-train-source.toml
# with the llm-d router + Mooncake KV offload appended
uv run rl @ examples/advanced/glm-5.3/swe.toml @ examples/advanced/glm-5.3/swe-llmd.toml
```
The inference configs are standalone pre-flights: they serve the FP8 checkpoint through the same entrypoint the trainer uses (`/update_weights`, `/load_lora_adapter`, `/init_broadcaster` included — never call `vllm serve` directly), and are a fast way to check that this cluster can serve the model at all before committing it to a run:
```bash
uv run inference @ examples/advanced/glm-5.2/infer/pd.toml
uv run inference @ examples/advanced/glm-5.2/infer/pd-llmd.toml
uv run inference @ examples/advanced/glm-5.3/infer/pd.toml
uv run inference @ examples/advanced/glm-5.3/infer/pd-llmd.toml
```
## Monitor with the dashboard
@@ -97,6 +97,21 @@ Pass several output directories to track parallel experiments side by side (`uv
## Checkpoint and resume
`swe.toml` checkpoints every 100 steps (`[ckpt] interval = 100`). To resume, re-run the same command with `--resume` (latest checkpoint) or `--resume.step <N>`, a stable `--run.name`, and a `--max-steps` at least the target final step. Trainer checkpoints are DCP-sharded; export HF-format weights with `tools/convert_dcp_to_bf16.py`. See [Training](../../../docs/training.md) for the full resume and export reference.
Both RL configs ship without `[ckpt]` — add a `[ckpt]` overlay (e.g. `interval = 100`) for periodic checkpoints. To resume, re-run the same command with `--resume` (latest checkpoint) or `--resume.step <N>`, a stable `--run.name`, and a `--max-steps` at least the target final step. Trainer checkpoints are DCP-sharded; export HF-format weights with `tools/convert_dcp_to_bf16.py`. See [Training](../../../docs/training.md) for the full resume and export reference.
See [Scaling](../../../docs/scaling.md) for SLURM details and [Inference](../../../docs/inference.md) for the disaggregated-inference and router reference.
## SFT
The SFT configs live under [`sft/h200/`](sft/h200) — they are tuned for 8-GPU H200 nodes. Compose the base config with a data overlay:
```bash
uv run sft @ examples/advanced/glm-5.3/sft/h200/base.toml @ examples/advanced/glm-5.3/sft/h200/math-10k.toml
```
This will start a SFT run with the following configuration:
- The model is `zai-org/GLM-5.3-BF16`
- The data is `PrimeIntellect/INTELLECT-3-SFT-10K` (math split)
For a fake-data dry run, append [`fake.toml`](sft/h200/fake.toml) instead. You can use the same dashboard to monitor the SFT run.
# llm-d append for swe.toml: fronts the P/D-disaggregated inference plane with
# the llm-d router (Endpoint Picker + Envoy) and offloads KV to a Mooncake
# distributed CPU pool. Everything else is inherited from the base config:
#
# uv run rl @ examples/advanced/glm-5.3/swe.toml @ examples/advanced/glm-5.3/swe-llmd.toml
[run]
name="glm5-llmd"
[monitors.wandb]
project="glm5-llmd"
[slurm]
job_name="glm5-llmd"
# Overlays replace arrays of tables wholesale, so the train source is spelled
# out again just to swap the sandbox runtime label.
[[orchestrator.train.source]]
name="r2e"
env.taskset.id="r2e-gym"
env.agent.harness.id="rlm"
env.agent.runtime.labels=["glm5-llmd"]
[inference.router]
type="llm-d"
non_cached_tokens=128# if <128 tokens, skip prefill go to decode immediately
[inference.router.scorers]# need some prefix-cache routing, however due to shared mooncake pool do low prio
"prefix-cache-scorer"=3.0
[inference.router.prefill_scorer_overrides]# prefill creates queues quite heavily, queue scorer to 4.0, active request at 5.0 is needed due to burstiness of early pipeline RL fill
"queue-scorer"=4.0
"active-request-scorer"=5.0
[inference.router.decode_scorer_overrides]# decode doesn't really create queue, it fills in KV cache fast, give 4.0
"active-request-scorer"=5.0
"kv-cache-utilization-scorer"=4.0
"queue-scorer"=3.0
[inference.kv_cache_offload]
type="mooncake"
# Auto Detection is funky, do it yourself from nvidia-smi topo -m
# Base GLM-5.3 RL config: P/D-disaggregated FP8 inference behind the default
# vllm-router. Serves the same GLM-5.3-BF16 checkpoint the trainer broadcasts,
# quantized to per-block FP8 online on the vLLM side. Append swe-llmd.toml to
# front the same plane with the llm-d router + Mooncake KV offload:
#
# uv run rl @ examples/advanced/glm-5.3/swe.toml @ examples/advanced/glm-5.3/swe-llmd.toml
max_steps=10000000
seq_len=131072
output_dir="/shared/outputs"# FILL IN: point at your shared filesystem
clean=true
[run]
name="glm5-llmd"
name="glm5"
[log]
level="debug"
[monitors.wandb]
project="glm5-llmd"
project="glm5"
name="base"
[weight_broadcast]
type="nccl"
port=29502
timeout=12000
quantize_in_weight_transfer=true
[deployment]
type="multi_node"
@@ -35,6 +41,9 @@ num_decode_replicas = 1
# skip warmup for faster start in cost of some jit overhead early
# ucx needs to be set else random segfaults, vllm can't autoset before importing for some reason
[inference.deployment.prefill_env_vars]
# vLLM >= 0.29 auto-enables breakable CUDA graphs for GLM-5 (GlmMoeDsaForCausalLM); capturing
# the DeepEP high-throughput prefill dispatch then fails ("DeepEP error: timeout (dispatch CPU)").
"VLLM_USE_BREAKABLE_CUDAGRAPH"="0"
"VLLM_ENABLE_MOE_DP_CHUNK"="0"
"VLLM_DEEP_GEMM_WARMUP"="skip"
"UCX_RCACHE_MAX_UNRELEASED"="1024"
@@ -52,41 +61,30 @@ num_decode_replicas = 1
"max_num_seqs"=96
[inference.router]
type="llm-d"
non_cached_tokens=128# if <128 tokens, skip prefill go to decode immediately
[inference.router.scorers]# need some prefix-cache routing, however due to shared mooncake pool do low prio
"prefix-cache-scorer"=3.0
[inference.router.prefill_scorer_overrides]# prefill creates queues quite heavily, queue scorer to 4.0, active request at 5.0 is needed due to burstiness of early pipeline RL fill
"queue-scorer"=4.0
"active-request-scorer"=5.0
[inference.router.decode_scorer_overrides]# decode doesn't really create queue, it fills in KV cache fast, give 4.0
"active-request-scorer"=5.0
"kv-cache-utilization-scorer"=4.0
"queue-scorer"=3.0
type="vllm-router"
[inference.vllm]
model="zai-org/GLM-5.1-FP8"
# Serve the same GLM-5.3-BF16 checkpoint the trainer broadcasts; vLLM quantizes
# it to per-block FP8 online.
model="zai-org/GLM-5.3-BF16"
dtype="bfloat16"
quantization="fp8_per_block"
max_model_len=131072
tool_call_parser="glm47"
reasoning_parser="glm45"
gpu_memory_utilization=0.75
enable_expert_parallel=true
enable_eplb=false
enable_ep_weight_filter=true
safetensors_load_strategy="prefetch"
[slurm]
job_name="glm5-llmd"
job_name="glm5"
partition="all"# FILL IN: set to your cluster's partition
[trainer]
dist_timeout_seconds=1800
[trainer.model]
name="zai-org/GLM-5.1"
name="zai-org/GLM-5.3-BF16"
impl="custom"
attn="flash_attention_2"# ignored with GLM5
fused_lm_head_token_chunk_size=1024
@@ -114,18 +112,20 @@ weight_decay = 0.0
[orchestrator]
batch_size=256
group_size=16
max_off_policy_steps=8# 16/32 can be better, 8 is more CPU stable
[orchestrator.train]
group_size=16
[orchestrator.concurrency]
initial_inflight=256
max_inflight=512
[orchestrator.model]
name="zai-org/GLM-5.1-FP8"
name="zai-org/GLM-5.3-BF16"
[orchestrator.renderer]
name="glm-5.1"
name="glm-5.3"
clear_thinking=false
[orchestrator.train.sampling]
@@ -138,17 +138,9 @@ clear_thinking = false
name="r2e"
env.taskset.id="r2e-gym"
env.agent.harness.id="rlm"
env.agent.runtime.labels=["glm5-llmd"]
env.agent.runtime.labels=["glm5"]
[inference]
# <0.80 because glm5 layers are too large for 0.85
use_deep_gemm=true
enable_fp32_lm_head=true
[inference.kv_cache_offload]
type="mooncake"
# Auto Detection is funky, do it yourself from nvidia-smi topo -m
`tool.toml` is the odd one out: 400 steps, `group_size = 16`, checkpoints every 50 steps with `keep_last = 1`, and inference at `dp = 2` / `tp = 4`. `math.toml` and `swe.toml` run 512-task batches with checkpoints every 100 steps.
## Requirements
- A Slurm cluster with 8-GPU nodes and a shared filesystem. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path.
- **Sandboxes** (`swe.toml` only) — the SWE agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, log the `prime` CLI in (it ships with prime-rl's dependencies):
- **Sandboxes** (`swe.toml` only) — the SWE agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, install the `prime` CLI separately and log in:
```bash
uv run prime login # or: uv run prime config set-api-key <your-key>
uv tool install prime
prime login # or: prime config set-api-key <your-key>
```
To run on your own infrastructure instead, swap `env.agent.runtime` on the source for a runtime your environments support (e.g. a local Docker backend).
@@ -104,3 +106,20 @@ uv run python tools/convert_dcp_to_bf16.py /shared/outputs/qwen30b/qwen30b-math/
```
See [Training](../../../docs/training.md) for the full knobs and metrics reference, and [Scaling](../../../docs/scaling.md) for SLURM and multi-node details.
## SFT
The SFT configs live under [`sft/h200/`](sft/h200). They are tuned for two 8-GPU H200 nodes and train only (no inference nodes). Combine the base config with a data overlay:
```bash
uv run sft @ examples/advanced/qwen3-30b-a3b/sft/h200/base.toml @ examples/advanced/qwen3-30b-a3b/sft/h200/math-10k.toml \
--output-dir /shared/outputs/qwen30b \
--run.name qwen30b-sft-math
```
This starts an SFT run with the following setup:
- The model is `Qwen/Qwen3-30B-A3B-Instruct-2507`, trained with the custom MoE implementation, expert parallelism (`ep = 8`), full activation checkpointing with offloading, and AdamW.
- The data is `PrimeIntellect/INTELLECT-3-SFT-10K` (math split), at a 32k sequence length with a batch of 16 samples per step.
For a fake-data dry run, add [`fake.toml`](sft/h200/fake.toml) instead of the data overlay. `base.toml` sets `[slurm] partition = "all"` and `HF_HOME = "/home/huggingface"`. Change both to match your cluster. For longer contexts, raise `data.seq_len` and set `model.cp` to split each sequence across GPUs. You can monitor the SFT run with the same dashboard.
@@ -9,7 +9,7 @@ In this example, we demonstrate how to train `Qwen3-4B-Instruct-2507` to answer
- **LLM judges**: Uses an LLM judge to evaluate answer quality alongside tool execution metrics
- **Online difficulty buffer**: Uses difficulty-based sampling to ensure rollouts have strictly non-zero advantages
> This example runs on 8 GPUs (6 for inference, 2 for training).
> This example runs on 8 GPUs (6 for inference, 2 for training). To run on 2 GPUs (1 inference, 1 trainer), add `--deployment.num-train-gpus 1 --deployment.num-infer-gpus 1 --orchestrator.batch-size 128` to the `rl` command.
@@ -82,6 +82,8 @@ uv run rl @ examples/basic/wordle/rl.toml \
--monitors.wandb.name ...
```
This config runs on 8 GPUs (6 for inference, 2 for training). To run on 2 GPUs (1 inference, 1 trainer), add `--deployment.num-train-gpus 1 --deployment.num-infer-gpus 1 --orchestrator.batch-size 128`.
This will write a DCP checkpoint in `outputs/rl/checkpoints/step_100`.
We have uploaded the final model as [`PrimeIntellect/Qwen3-1.7B-Wordle-RL`](https://huggingface.co/PrimeIntellect/Qwen3-1.7B-Wordle-RL).
@@ -10,6 +9,9 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
project="reverse-text"
name="reverse-text"
[train]
group_size=16
[train.sampling]
max_completion_tokens=128
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.