Compare commits

..
360 Commits
Author SHA1 Message Date
Matej SirovatkaandGitHub b92c2128dd Feat: add weigh transfer fix (#2099)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Feat: add weigh transfer fix

* Fix style
2026-03-25 18:01:05 +01:00
rasdaniandGitHub c2b99e69ce refactor: use AutoModelForImageTextToText to configure VLMs (#2098)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-25 00:24:54 -07:00
ecd0809280 feat: disaggregated prefill-decode inference with multi-replica support (#2030)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: disaggregated prefill-decode inference with multi-replica support

Extracted PD disaggregation changes from PR #2010. Adds:
- Disaggregated deployment type with separate prefill/decode nodes
- vLLM kernel format weight transfer (avoids HF checkpoint round-trip)
- Pause/resume lifecycle for draining in-flight requests during weight updates
- Admin URL separation (bypass router for direct server access)
- Multi-replica inference support
- NIXL/UCX, DeepEP, and vllm-router install scripts

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

* refactor: remove vLLM kernel format weight transfer

This PR should focus on PD disaggregation only. The kernel format
transfer path (fused projections, stacked experts, FP8 quantization)
is a separate optimization that can be added back in a dedicated PR.

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

* style: fix ruff formatting

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

* fix: address PR review comments

- Raise error if tp != 1 in disaggregated mode instead of silently overriding
- Revert auto_setup_model to main's version (FP8 model name logic not needed for PD)
- Revert nccl.py broadcast to main's inline style (method extraction was for kernel format)
- Add try/finally around weight update to ensure engines are always resumed
- Fix sample config: num_infer_nodes=3 + num_infer_replicas=2 to pass validation

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

* feat: add disaggregated P/D support to inference SLURM template

Extends the existing inference.sbatch.j2 template with conditional
disaggregated mode support. When deployment type is "disaggregated",
the template splits nodes into prefill/decode groups with per-replica
vllm-router, NIXL KV transfer, and DeepEP expert parallelism.

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

* add inference disag slurm

* add extra deps

* add extra deps

* fix eps

* fadd stuff

* fadd stuff

* fadd stuff

* fix smth

* move deep-gemm from dep group to disagg extra for --all-extras

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

* feat: configurable deep-gemm via use_deep_gemm config field

Rebuild deep-gemm from vLLM 0.17 recommended commit (477618c).
Add use_deep_gemm bool to InferenceConfig that sets VLLM_USE_DEEP_GEMM=1
in the sbatch template. Only works with per-tensor FP8 models (e.g. GLM-5-FP8).

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

* wip

* add config

* add deps

* fix studfs

* fix studfs

* use vllm router from matej

* feat: add X-Session-ID header for prefix cache affinity in PD inference

Monkey-patch verifiers' OpenAI clients to inject X-Session-ID (derived
from example_id) on every inference request. The vllm-router uses this
header for sticky routing so that all requests for the same example hit
the same decode node, enabling prefix cache reuse.

Also updates hendrycks_math config for disaggregated PD with EP.

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

* Revert "feat: add X-Session-ID header for prefix cache affinity in PD inference"

This reverts commit 12deff893d0c5053273c25a537b6979be601eb6a.

* delete slurm

* feat: sticky routing, deep-gemm support, and P/D cleanup

- Add extra_headers_from_state to ClientConfig for per-request dynamic
  headers (X-Session-ID from example_id for sticky routing)
- Auto-configure session headers in RL runs
- Pass use_deep_gemm to disagg RL template (VLLM_USE_DEEP_GEMM=1)
- Add --intra-node-data-parallel-size 1 to P/D router args
- Fix uv sync: remove stale --group fp8-inference (deep-gemm now in disagg extra)
- Update verifiers to f6ff5274 (extra_headers_from_state support)

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

* chore: update verifiers to main (f5580acd)

Points to merged extra_headers_from_state support.

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

* chore: update disagg rl config for Qwen3-30B-A3B (1P+1D)

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

* docs: add disaggregated inference guide and GLM-5 config (#2077)

* chore: add reasoning_parser to GLM-5 inference config (#2081)

Enables vLLM to split reasoning_content from content natively,
so verifiers saves it as a separate field in trajectories.

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

* Enable none

* Feat: skip master weights gather

* updates deps

* remove configs

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: S1ro1 <matej.sirovatka@gmail.com>
Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
2026-03-24 23:21:22 -07:00
JannikStandGitHub 381733e0cf fix: terminate process on fatal orchestrator error (#2092)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: use sys.exit(1) in clean_exit to terminate process on fatal error

raise alone doesn't terminate the process in async context - the event
loop swallows the exception and the process hangs indefinitely, leaving
runs stuck in RUNNING state with leaked pods.

* fix: remove unused exception variable for ruff
2026-03-25 03:54:52 +01:00
rasdaniandGitHub 27c35b1ce1 fix: hybrid CP for Qwen3.5 MoE (DeltaNet + attention) (#2097)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-25 03:29:33 +01:00
halleriteandGitHub b7afd84024 perf: run VLM image preprocessing in thread to unblock event loop (#2065)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-24 19:14:13 -07:00
Matej SirovatkaandGitHub e7adec38f0 Revert exclude none (#2095)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Revert "Enable none in config (#2093)"

This reverts commit a25b3e7a18.

* Revert "Fix/none in list (#2094)"

This reverts commit 4f612601f6.

* fix conflict
2026-03-25 02:12:49 +01:00
Matej SirovatkaandGitHub 4f612601f6 Fix/none in list (#2094)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Enable none

* Fix: convert none in a list correctly too

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-03-25 01:55:36 +01:00
Matej SirovatkaandGitHub a25b3e7a18 Enable none in config (#2093)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-25 01:37:29 +01:00
JannikStandGitHub 692dfc8a4b fix mamba-ssm build by using CUDA torch in build env (#2091)
Release / Push CUDA image to Docker (push) Canceled after 0s
mamba-ssm needs nvcc and CUDA torch to compile. uv was resolving
CPU-only torch for the build environment, causing bare_metal_version
to be undefined. Adding match-runtime = true ensures the CUDA torch
from pytorch-cu128 index is used during the build.
2026-03-24 17:33:11 -07:00
2ddb1c8199 feat: add NemotronH models to tool call parser map (#2089)
Release / Push CUDA image to Docker (push) Canceled after 0s
Add nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16 and
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 with qwen3_coder parser.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:52:36 -07:00
53a8b45660 feat: hybrid CP for Qwen3.5 MoE (DeltaNet + attention) (#2080)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: hybrid CP for Qwen3.5 MoE (DeltaNet + standard attention)

Integrate fla (flash-linear-attention) library for native context parallelism
on GatedDeltaNet layers. Standard attention layers use ring attention for CP,
while DeltaNet layers use fla's state-passing CP which communicates only the
compact recurrent state (O(d²) per layer) instead of all-gathering full
sequences (O(N×d)).

- Add flash-linear-attention dependency (Triton kernels + CP support)
- Wire up fla's build_cp_context/cp_context in GatedDeltaNet forward
- Add setup_hybrid_cp to configure DeltaNet modules for CP
- Add CP gather/scatter autograd primitives as fallback in cp.py
- Fix VLM num_hidden_layers access for debug.num_layers config
- Add test configs for Qwen3.5-35B-A3B CP testing

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

* style: fix ruff formatting

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

* chore: remove config files from tracking

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

* fix: validate VLM bfloat16 dtypes from loaded config

Move the VLM bfloat16 validation from ModelConfig (which only had
the model name) to get_model() where we have the actual loaded HF
config and can reliably detect VLMs via is_vlm_config().

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:45:40 -07:00
c2dfc338c3 feat: add NemotronH (Nemotron-3-Super-120B-A12B) model support (#2046)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add NemotronH (Nemotron-3-Super-120B-A12B) model support

Implement hybrid Mamba-Transformer-MoE architecture with three distinct
layer types: Mamba-2 SSM (via HF NemotronHMamba2Mixer), LatentMoE with
non-gated experts and latent projections, and shared attention layers.

- Add NemotronHConfig with hybrid_override_pattern parsing
- Add NonGatedGroupedExperts, NemotronHRouter, LatentMoE to layers/moe.py
- Add bidirectional weight conversion (HF mixer.* <-> PrimeRL namespaces)
- Register model in AutoConfig and update FSDP/EP isinstance checks
- Add comprehensive tests (forward/backward, weight roundtrip, reverse conversion)

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

* fix: NemotronH weight conversion, MoE forward pass, and HF model compat

Weight conversion (converting_nemotron_h.py):
- Handle backbone.* -> model.* prefix rename (HF uses "backbone", PrimeRL uses "model")
- Stack individual expert weights into fused 3D tensors (HF stores per-expert, PrimeRL uses fused)
- Unstack fused tensors back to individual experts for HF export
- Drop mtp.* (multi-token prediction) keys during conversion
- Support both backbone.* and model.* prefixes in layer type inference

MoE forward pass (moe.py):
- Apply routing scores AFTER expert computation (was before), matching vLLM and HF reference
- Apply routed_scaling_factor separately after expert output, before fc2_latent_proj
- Remove routed_scaling_factor from router scores (applied in LatentMoE instead)

Model loading (model.py):
- Support HF models with "embeddings" attr (not just "embed_tokens") in FSDP setup
- Support HF models with "norm_f" attr (not just "norm") in FSDP setup
- Guard all .mlp accesses with getattr for HF model compat (NemotronHBlock has no .mlp)

Modeling (modeling_nemotron_h.py):
- Handle backbone.* prefix in is_hf_state_dict detection
- Handle both model.* and backbone.* in layer type inference
- Per-layer HF conversion for weight broadcast (model.* -> backbone.*)

Configs:
- Add nemotron_4node/ and nemotron_debug/ run configs

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

* fix: remove spurious RoPE from NemotronH attention layers

NemotronH gets position information from Mamba layers, not RoPE.
Both HF and vLLM implementations confirm NemotronH attention does not
apply rotary embeddings. The spurious RoPE was causing ~0.5 KL mismatch
between vLLM inference and PrimeRL training; after removal KL drops to
near zero.

- Make position_embeddings optional in FlashAttention/SDPAAttention
- Remove RotaryEmbedding from NemotronHModel
- Add KL mismatch test suite for NemotronH
- Mark test_nemotron_h_reverse as xfail (pre-existing HF fused tensor issue)

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

* fix: use mamba_ssm Triton SSD kernels for NemotronH to match vLLM precision

The HF torch_forward computes softplus in bf16 while vLLM uses fp32
Triton kernels, causing ~0.4 KL divergence in Mamba layers. This patch
monkey-patches NemotronHMamba2Mixer to use mamba_chunk_scan_combined
from mamba_ssm (Triton, fp32 softplus) with PyTorch nn.Conv1d fallback.

- Add mamba_ssm Triton SSD patch for NemotronHMamba2Mixer
- Add mamba-ssm as optional dependency in pyproject.toml
- Update installation skill with mamba-ssm instructions

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

* chore: update uv.lock for mamba-ssm and fix ruff formatting

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

* fix: move mamba-ssm to dependency-groups to fix CI CPU tests

mamba-ssm requires nvcc to build from source. When it was in
[project.optional-dependencies], `uv sync --all-extras` tried to build
it in CI where nvcc isn't available. Moving it to [dependency-groups]
means it's only installed explicitly via `uv sync --group mamba-ssm`.

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

* fix: detect attention layers in is_prime_state_dict for weight broadcast

The per-layer is_prime_state_dict check missed attention-only layers
(which have self_attn.* keys), causing the HF conversion to be skipped
during weight broadcast. vLLM then received PrimeRL keys (self_attn.*)
instead of HF keys (mixer.*), failing with a 500 error.

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

* fix: update uv.lock and ruff formatting for NemotronH

- Reformat modeling_nemotron_h.py to pass ruff check
- Update uv.lock after mamba-ssm dependency group addition
- Add pre_run_command to nemotron config for mamba-ssm install

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

* fix: guard mamba_ssm import for CI environments without it

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

* fix: include mamba-ssm in Docker build for NemotronH support

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

* fix: address review feedback for NemotronH

- Add non-layer weight handling to convert_layer_to_prime (backbone.* prefix)
- Make embed_module fallback consistent (safe getattr for both attrs)
- Remove unused routed_scaling_factor from NemotronHRouter
- Remove dead get_max_layer_num function from converting_nemotron_h

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 16:44:08 -07:00
f414d9ae49 fix: handle eval rollout failures without crashing the orchestrator (#2086)
Release / Push CUDA image to Docker (push) Canceled after 0s
Individual rollout group failures in generate() are now caught and
logged instead of propagating up and crashing the orchestrator.
Metrics are computed on the successful rollouts. If all rollouts
fail for an env, evaluate_env skips metrics with a warning.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 23:05:58 +01:00
Matej SirovatkaandGitHub 60f01a0468 Feat: skip optimizer load (#2087)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-24 15:05:44 -07:00
halleriteandGitHub d803065204 feat: add explicit vlm config flag for VLM detection (#2063)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-23 22:40:44 -07:00
rasdaniandGitHub 19511dc2b0 fix: don't constrain VLM dtype for SFT (#2079)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: don't constrain VLM dtype for SFT

* changelog
2026-03-24 01:38:44 +01:00
rasdaniandGitHub 7ef29a7660 feat: accept messages column for SFT (#2074)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: accept `messages` column for SFT

* return list instead of tuple

* elif prompt
2026-03-23 22:47:13 +01:00
rasdaniandGitHub 7e853195ea fix: scheduler test fixture drift after enable_policy_updates (#2078)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-23 22:46:38 +01:00
9c25ce2ca1 feat: GPT-OSS support with LoRA + DP fixes (#2073)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add GPT-OSS support with LoRA + DP fix

Add monkey patches to fix two vLLM 0.17.0 bugs that prevent serving
GPT-OSS MoE models with LoRA enabled under data parallelism:

1. Harmony stop token propagation: vLLM's ChatCompletionRequest doesn't
   merge harmony stop tokens (<|call|>, <|return|>) from
   default_sampling_params into per-request SamplingParams. The model
   ignores tool call boundaries. Fix: patch to_sampling_params() to
   merge default stop token IDs.

2. FusedMoE LoRA + DP: LoRA injection on MoE layers replaces the quant
   method with FusedMoEModularMethod, which inadvertently sets
   supports_internal_mk=True. This makes the MoE runner skip DP
   dispatch/combine, but the LoRA kernel uses NoDPEP and doesn't handle
   DP. Additionally, LoRA decorators capture full-batch tensors but fire
   per-chunk inside the kernel's chunk loop, causing shape mismatches at
   DP>=3. Fix: set moe_kernel=None to restore dispatch/combine, and make
   decorators chunk-aware by tracking offsets.

Also adds an example config for wiki-search with GPT-OSS-20B.

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

* fix: apply MoE LoRA+DP monkey patch in worker subprocesses

The monkey_patch_fused_moe_lora_dp() in server.py only runs in the main
API server process. vLLM DP workers are spawned as separate subprocesses
that import FusedMoEWithLoRA fresh, so the patched _inject_lora_into_fused_moe
never reaches them. This causes corrupted MoE output at DP>1 with --enable-lora.

Apply the patch in the worker extension module (filesystem.py) which gets
imported inside every worker subprocess.

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

* chore: remove redundant MoE LoRA+DP patch from server.py

This patch only ran in the main API server process, not the DP worker
subprocesses where FusedMoEWithLoRA is actually instantiated. The
effective call is in filesystem.py (worker extension).

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

* fix: move MoE LoRA+DP patch to worker __init__.py

Move from filesystem.py to __init__.py so it applies regardless of which
worker extension is loaded (filesystem or nccl).

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

* chore: remove GPT-OSS wiki-search config from PR

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

---------

Co-authored-by: dev <dev@prime-rl.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 14:40:25 -07:00
3dd48be5bf feat: integrate FP8 weight transfer format (#2038)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: integrate GLM5 FP8 kernel-format weight transfer

* refactor: clean fp8 transfer flow and model-name split

* refactor: unify quantized transfer config and enforce strict kernel updates

* fix: restore pre-existing nccl receiver log levels

* refactor: unify preprocess flow and validate kernel transfer method

* refactor: simplify transfer validation and flatten nccl preprocess flow

* refactor: use module-level preprocess functions for nccl broadcast

* refactor: split nccl worker loaders and postprocessors

* chore: remove fp8 weight transfer config tests per PR review

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

---------

Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:46:59 -07:00
40da51a235 SFT distillation: bug fixes, VLM support, and pretokenization optimization (#2053)
Release / Push CUDA image to Docker (push) Canceled after 0s
* SFT distillation with teacher endpoint

* streamline SFT distillation rollout/eval model split

* fix sft reconstruction and default loss scaling regressions

* simplify SFT distillation by removing eval inference split

* chore: apply ruff formatting

* docs: add changelog entries for RolloutModelConfig, SFTLossConfig, and CustomLossConfig

Co-authored-by: will brown <willccbb@users.noreply.github.com>

* refine external SFT rollout path and cleanup tests

* refactor shared SFT chat-template tokenization logic

* fix: remove dead store in _tokenize_step_from_messages

full_ids was tokenized via _render_messages then immediately overwritten
by build_incremental_token_mask, wasting a tokenization pass per step.

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

* fix: remove unused _should_add_generation_prompt from trajectories

Duplicate of should_add_generation_prompt in utils/chat_template.py,
never called anywhere.

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

* fix: pass top_k and min_p for both token and non-token client paths

Explicitly disable top-k and min-p filtering on all vLLM requests,
not just the token client path.

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

* chore: remove redundant test_rl_config_external_rollout_mode_rejects_inference

Redundant with the Pydantic model validator definition.

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

* fix: correct CHANGELOG field name to teacher_rollout_model

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

* fix: pass tool definitions through pretokenize pipeline

When external teacher rollouts have tool_defs, convert them to OAI
format and pass through to build_incremental_token_mask so that
tokenization includes tool definition tokens from the chat template.

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

* fix: enable collapse_consecutive_tool_messages in pretokenization

Matches the SFT data pipeline behavior. Without this, parallel tool
call responses cause an assertion failure in incremental tokenization
when the chat template re-renders consecutive tool messages.

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

* fix: handle dict tool_defs in _convert_tools_to_oai_format

Tool definitions arrive as plain dicts after ZMQ msgpack serialization
(verifiers' msgpack_encoder calls model_dump() on Tool pydantic objects).
Use duck-typed accessor to support both dict and object forms.

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

* feat: VLM processor support in SFT distillation pretokenization

For VLM models, the tokenizer alone produces only 1 <|image_pad|> token
per image, but the model expects the count to match actual image patches.
Thread the processor through pretokenize → render_messages →
build_incremental_token_mask so that processor.apply_chat_template
(which expands image placeholders correctly) is used when available.

Also move pretokenize before build_vlm_image_cache in the orchestrator,
since the cache build strips image data from messages.

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

* perf: replace incremental token mask with direct completion masking

In the SFT distillation path, completion is always a single assistant
message (enforced by verifiers' parse_response_message), so the
completion mask is trivially all-True. Replace N incremental
tokenizer/processor calls from build_incremental_token_mask with a
single render_messages call. For VLM models this avoids redundant
image preprocessing on every incremental prefix.

Added assertion to guard the single-assistant-role assumption.

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

* chore: remove duplicate SFT distillation configs

Keep examples/alphabet_sort/sft_distill_hard.toml as the canonical
example config.

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

* fix: always request logprobs in sampling args

logprobs=True was only set when use_token_client=True, but non-token-
client paths (e.g. external APIs) also need logprobs for RL training.
return_token_ids remains gated behind use_token_client since it is
vLLM-specific.

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

* chore: remove test_rl_config_external_rollout_mode_rejects_token_client

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

* fix: set checkpoint_ready in non-policy-update path

When enable_policy_updates is False (SFT distillation), generate_batch
skipped calling checkpoint_ready.set(). This worked by accident because
the event starts set and is only cleared inside maybe_update_policy
(which is never called in this path), but would deadlock if anything
else ever cleared the event.

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

* Address PR review feedback

- Revert loss_scale regression: use loss_mask-based scaling unconditionally
- Move setup_external_rollout_model to orchestrator/utils.py
- Clarify log message to say "SFT distillation mode"

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

* fix: truncate prompt_ids to common prefix to prevent corrupted token sequences

When tokenizing trajectory steps from messages, the prompt-only and
full (prompt+completion) tokenizations can diverge at a boundary
(non-prefix split). Previously, the full prompt_ids was returned even
when split_idx < len(prompt_ids), producing corrupted sequences where
prompt_ids + completion_ids != full_ids. This broke interleaving
(extension property checks fail on mismatched prefixes) and fed
invalid token sequences to the trainer.

Fix: use full_ids[:split_idx] as prompt_ids so the concatenation
always equals full_ids exactly.

Verified across GLM-4, Qwen3, Qwen2.5, Qwen2.5-VL tokenizers and
tested end-to-end SFT distillation on alphabet-sort, wiki-search,
tic-tac-toe, and color-codeword (VLM) environments.

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

* fix: restore non-prefix tokenization debug log after prompt_ids truncation

The previous commit truncating prompt_ids to full_ids[:split_idx] made
the debug log condition always false (split_idx < split_idx). Track the
original prompt length before overwrite so the log fires correctly.

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

---------

Co-authored-by: William Brown <williambrown97@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: will brown <willccbb@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:49:00 -07:00
rasdaniandGitHub bb4c23b122 breakdown difficulty pool metrics per env (#2070)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-21 23:55:10 +01:00
1bc1021a0f validate VLM dtype in configs (#2060)
Release / Push CUDA image to Docker (push) Canceled after 0s
* validate VLM dtype in configs

* ruff

* Add changelog entry for VLM bfloat16 validation requirement

Co-authored-by: rasdani <rasdani@users.noreply.github.com>

* Remove VLM bfloat16 dtype test

Co-authored-by: rasdani <rasdani@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: rasdani <rasdani@users.noreply.github.com>
2026-03-21 23:01:05 +01:00
Philipp NormannandGitHub 4875c101c2 Add SFT LoRA support (#1849)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add SFT LoRA support

* Fix ruff formatting and add missing comment

* Use MultiRunManager for SFT LoRA adapter export

* Rename SFT LoRA run adapter export helper
2026-03-20 20:18:15 -07:00
Shayon MukherjeeandGitHub fc6fd48fae Fix: typo in comment for sample_ratio (#2058)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-20 22:34:25 +01:00
DominikandGitHub d5c7240676 Feature: Add platform integration. (#1896)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-20 02:34:11 +01:00
3dcff28e02 fix: use mean().mean() for console metrics to match wandb (#2056)
Release / Push CUDA image to Docker (push) Canceled after 0s
Console reward was using results_df.reward.mean() (flat mean across all
rollouts) while wandb logged by_example.reward.mean().mean() (mean per
example, then across examples). These diverge when rollouts_per_example
varies across problems. Now both use the same aggregation.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 18:20:49 -07:00
JannikStandGitHub 58f4b37d5b Add router_url support for elastic inference pool (#2049)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add router_url support for elastic inference pool

When configured, inference requests route through a vllm-router
while admin operations (weight updates, LoRA loading) still go
directly to discovered pods via elastic DNS discovery.

* Gate router traffic on ready servers

Only expose the router client when there are actually ready backends,
preventing requests from being sent to a router with no healthy pods
during weight updates or scale-down.
2026-03-20 02:11:39 +01:00
47f6bb8307 fix: remove misleading orchestrator throughput metric (#2048)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: remove misleading orchestrator throughput metric

The orchestrator's perf/throughput (tokens/s) was computed as
num_tokens / generate_completions_time, but with in-flight rollouts
some tokens are generated during the previous training step. This makes
generate_completions_time shorter than the actual total inference time,
inflating the reported throughput. Per-rollout generation_ms metrics
remain available for accurate inference speed tracking.

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

* fix: remove throughput from orchestrator benchmark table

Same misleading metric — remove it from print_benchmark as well.

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 13:10:28 -07:00
1f6de8fff4 chore: bump verifiers to 1960e77 (#2051)
Release / Push CUDA image to Docker (push) Canceled after 0s
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 11:53:03 -07:00
c1bbbf9231 add Group Relative Reward Rescaling as length penalty (#2029)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add Group Relative Reward Rescaling as length penalty

* require online difficulty filtering

* add config validation

* fix mean

* refactor

* move `baseline`

* GR3 length penalty: Advantage config validator bug (#2039)

The validate_gr3_alpha validator in AdvantageConfig was incorrectly
accessing self.online_difficulty_filtering, which belongs to BufferConfig,
not AdvantageConfig. This caused an AttributeError whenever gr3_alpha was
set to a truthy value, making the GR3 feature unusable.

Fixed by moving the online_difficulty_filtering check to OrchestratorConfig
where both advantage and buffer configs are accessible.

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

* fix baseline

* fix dtype

* changelog

* rename to `length_shaping_alpha`

* deprecate `length_weighte_mean`

* add test

---------

Signed-off-by: rasdani <73563550+rasdani@users.noreply.github.com>
Co-authored-by: rasdani <3563550+rasdani@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-03-19 02:00:36 +01:00
halleriteandGitHub f399e2664c add weights-only checkpointing (#2033)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-18 15:10:37 -07:00
Mika SenghaasandGitHub 0f236d322c shared wandb mode (#2044)
Release / Push CUDA image to Docker (push) Canceled after 0s
* poc of shared run mode

* deprecate wandb.id

* style

* use step metric to align x-axis

* remove flush + fix signatures

* init monitor earlier

* retry shared run creation

* add note

* update changelog
2026-03-18 13:47:11 -07:00
Shayon MukherjeeandGitHub f7192e15f3 Add sample_ratio to LogExtrasConfig for gradual rollout data control (#2023)
Release / Push CUDA image to Docker (push) Canceled after 0s
Add a sample_ratio field (0.0–1.0) to LogExtrasConfig that controls
what fraction of rollouts are logged per step. When set, the effective
sample cap is computed from the actual rollout count at runtime:
int(len(rollouts) * sample_ratio).

  1.0  = all rollouts (full data)
  0.5  = half of rollouts
  0.0  = disable sample logging
  None (default) = current behavior (log all)

Usage: --prime-monitor.log-extras.sample-ratio 0.5
2026-03-18 13:49:55 -04:00
JannikStandGitHub bd110a10e9 fix: cleanup env subprocesses on orchestrator crash (#2028)
Release / Push CUDA image to Docker (push) Canceled after 0s
atexit handler ensures spawned env server processes are terminated when
the orchestrator crashes, preventing orphaned subprocesses that keep the
container alive and leave the run stuck in RUNNING.
2026-03-18 05:13:42 +01:00
d1c36af4b3 fix: handle DTensor weights in MultiLoRAGroupedExperts for EP (#2035)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: handle DTensor weights in MultiLoRAGroupedExperts for EP compatibility

When Expert Parallelism is enabled, distribute_module() converts all
parameters to DTensors sharded across the EP mesh. The base GroupedExperts
path handles this via the @expert_parallel decorator, but
MultiLoRAGroupedExperts.forward() bypassed the decorator entirely,
passing DTensors directly to torch._grouped_mm alongside regular tensors.

Mirror the @expert_parallel decorator logic: convert DTensors to local
shards, apply generate_permute_indices for token reordering and alignment
padding, and unpermute the output.

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

* fix: gather EP-sharded LoRA weights in state_dict and exclude base_layer from modules_to_save

Two fixes for EP + LoRA MoE weight broadcast:

1. state_dict_for_adapter: call full_tensor() on DTensor LoRA weights
   before per-expert indexing. With EP, these weights are sharded across
   ranks and direct indexing triggers a DTensor redistribute assertion.

2. save_lora_config: exclude "base_layer" params from modules_to_save
   detection. After EP/FSDP wrapping, base layer params can have
   requires_grad=True, causing them to be incorrectly added to
   modules_to_save which vLLM rejects.

Tested end-to-end: Qwen3-30B-A3B EP=4, LoRA rank 16, 30 steps at
batch sizes 128 and 256 on H200.

* fix: re-freeze base params after EP replaces them with DTensors

ExpertParallel() replaces expert params with DTensors that default to
requires_grad=True, overriding the freeze applied by LoRA setup.
Re-run freeze_all_except_lora_and_specified after apply_ep to restore
correct grad state.

This also reverts the save_lora_config workaround (base_layer filter)
since the root cause is now fixed.

* fix: use new_zeros instead of new_empty for unpermuted output buffer

new_empty leaves uninitialized memory in positions not covered by
permuted_indices, which could leak garbage values into the output.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:39:32 -07:00
rasdaniandGitHub eba667d9c0 bump verifiers (#2036)
Release / Push CUDA image to Docker (push) Canceled after 0s
* bump verifiers

bumps to verifiers `de2ed50`

https://github.com/PrimeIntellect-ai/verifiers/commit/de2ed50f015ed1af0990b218de1df0853d9b3973

Signed-off-by: rasdani <73563550+rasdani@users.noreply.github.com>

* update lock file

---------

Signed-off-by: rasdani <73563550+rasdani@users.noreply.github.com>
2026-03-17 16:22:18 -07:00
7e06730200 fix: use token-level loss normalization for all loss types (#2034)
Release / Push CUDA image to Docker (push) Canceled after 0s
Previously, custom losses were normalized by batch_size (number of
sequences) while the default loss was normalized by the number of
unmasked tokens. This made the effective learning rate depend on
sequence length for custom losses. Now all loss types consistently
normalize by the number of unmasked tokens.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 09:49:41 -07:00
6c55a9aab2 make the loss equal weight per unmaked token (#1961)
Release / Push CUDA image to Docker (push) Canceled after 0s
* make the loss equal weight per unmaked token

* minor fixes

* run ruff

* prevent nan-poisoning

* update

---------

Co-authored-by: hallerite <git@hallerite.com>
2026-03-16 12:41:06 -07:00
33d266b41f fix: patch sharded LoRA slice_lora_a for Qwen3.5 MoE (#2027)
Release / Push CUDA image to Docker (push) Canceled after 0s
MergedColumnParallelLinearWithShardedLoRA.slice_lora_a was hardcoded
for exactly 2 subloras, causing IndexError with Qwen3.5's 4-way
qkvz fusion when fully_sharded_loras=True.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 13:41:49 -07:00
8fa0dde0be feat: make max_retries configurable per training env (#2025)
Release / Push CUDA image to Docker (push) Canceled after 0s
Move max_retries from EvalEnvConfig to EnvConfig so it applies to both
training and eval environments. The scheduler now looks up max_retries
per task from the env config instead of hardcoding 0.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 01:57:33 -07:00
76946689cf add Qwen 3.5 MoE model support with EP and VLM weight broadcast (#2026)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add Qwen 3.5 MoE model support with EP and CP integration

Adds a custom Qwen 3.5 MoE (GatedDeltaNet + MoE) implementation with:
- HF <-> PrimeRL weight conversion (fused/unfused expert formats)
- Expert Parallelism support (MoE layers auto-detected by apply_ep)
- Context Parallelism support (ring attention patching for flash attention layers)
- Router replay via routed_experts argument
- Unit tests for forward pass, weight roundtrip, router replay, and CP patching

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

* remove vflm warning

* feat: add custom VLM support for Qwen 3.5 MoE

Extend Qwen3_5MoeForCausalLM to handle both text-only and VLM configs.
When the config has a vision_config, the model creates a composite body
(HF frozen vision encoder + custom PrimeRL text model). Weight conversion
auto-detects VLM keys and remaps accordingly.

- Unified model class (no separate VLM file) driven by config
- Config-based VLM detection fallback for local model paths
- VLM dispatch in get_model() via _CUSTOM_VLM_MAPPING
- mini_moe.py preset for qwen3_5_moe_vlm testing
- 6 new GPU tests covering forward/backward/weights/roundtrip/router/meta

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

* chore: add debug SFT config for real Qwen3.5-35B-A3B VLM

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

* fix: support VLM layer key format in weight broadcast

VLM models use `model.language_model.layers.*` instead of
`model.layers.*`, which crashed get_max_layer_num and caused
filter_state_dict_by_layers to silently drop layer weights.

Also fixes off-by-one in filter_state_dict_by_layers that
skipped layer 0.

* use registry-based approach

* run ruff

* chore: remove debug SFT configs for Qwen3.5 MoE

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

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: sami jaghouar <sami.jaghouar@gmail.com>
2026-03-13 00:51:53 -07:00
67de232773 fix: avoid duplicate policy updates during scheduler cancellation (#2004)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Fix duplicate policy updates during cancellation

* fix: cancel inflight scheduler policy update on stop

---------

Co-authored-by: Sebastian <sebastian@primeintellect.ai>
2026-03-12 10:47:04 -07:00
cab621fc5d fix: improve rollout error logging and normalize error/empty metrics (#2020)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: use repr for rollout error log to show full error chain

The rollout error warning was using str formatting which only showed
the short error_chain_str. Using repr shows the full error_chain_repr
with the actual error message, making debugging much easier.

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

* fix: print error_chain_repr instead of full error dict

Show only the error_chain_repr from the rollout error dict in the
warning log, which contains the actual useful error message rather
than the entire dict.

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

* simplify: index directly into error dict

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

* feat: make errored_rollouts and empty_rollouts metrics rates per step

Instead of logging raw counts, divide by total rollouts in the step
to get the fraction of errored/empty rollouts. This makes the metrics
comparable across steps with different numbers of rollouts.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 01:22:37 -07:00
275914349a make httpx connect timout configurable (#2017)
Release / Push CUDA image to Docker (push) Canceled after 0s
* make httpx connect timout configurable

* Set default connect_timeout to 30s and add CHANGELOG entry

Co-authored-by: rasdani <rasdani@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: rasdani <rasdani@users.noreply.github.com>
2026-03-12 00:29:07 +01:00
rasdaniandGitHub 9b2fb9afbe feat: save checkpoints and weights to separate path (#2018)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-11 15:50:27 -07:00
halleriteandGitHub be9f9f8d83 add monkeypatch for qwen3.5 lora (#2019)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-11 14:48:04 -07:00
51fcbae998 fix: re-schedule errored rollouts (#2016)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: re-schedule errored rollouts instead of filtering after group completion

Rollouts with a populated "error" field are now re-scheduled (like empty
trajectories) instead of being accepted into the group. Both conditions
are checked independently so a rollout that is both empty and errored
increments both counters. Adds scheduler/errored_rollouts metric.

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

* chore: remove now-dead error/mean metrics from orchestrator

Errored rollouts are filtered in the scheduler before reaching the
batch, so error is always None in results_df. Remove the error column
and the error/all/mean and error/{env}/mean metrics. Error tracking
is now handled by scheduler/errored_rollouts.

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

* feat: per-env metrics for empty and errored rollouts

Track empty_rollouts and errored_rollouts counts per task. Report both
global (scheduler/empty_rollouts/all, scheduler/errored_rollouts/all)
and per-env (scheduler/empty_rollouts/{task}, scheduler/errored_rollouts/{task})
metrics.

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

* chore: move empty/errored rollout metrics to their own section

Use empty_rollouts/ and errored_rollouts/ prefixes instead of nesting
under scheduler/.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 12:42:39 -07:00
faresobeidandGitHub 74a13f0ee2 add zero grad tracking (#1966)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add zero grad tracking

* address comments
2026-03-11 10:48:00 -07:00
051c8bac23 feat: allow num_infer_nodes=0 with fake data in multi-node SLURM RL (#2012)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: allow num_infer_nodes=0 with fake data in multi-node SLURM RL

Skip launching inference servers and orchestrator when num_infer_nodes=0,
running only the trainer with fake data. Useful for benchmarking multi-node
training without needing inference resources.

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

* feat: skip weight broadcast when using fake data

No inference server exists in fake data mode, so broadcasting weights
would either hang (NCCL) or write unnecessary files (filesystem).

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 10:43:37 -07:00
a7db21723e feat: per-env metrics logging (#1989)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: per-env metrics logging with consistent naming convention

Adopt {metric}/{scope}/{stat} naming where scope is "all" (global) or
an env name. All metrics that were previously global-only now get
per-env breakdowns when multiple envs are present.

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

* feat: always show per-env breakdown and drop reward std/median

Remove the nunique() > 1 gate so per-env metrics are always logged,
even with a single env. Remove std and median from reward stats.

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

* chore: metrics/{env}/{metric} format, remove error type breakdown

- Change verifier/filter metrics to metrics/{env}/{metric} (no global, no stat suffix)
- Remove per-error-type logging (error/{error_type})

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

* fix: remove redundant batch/{env}/{env} keys

Env ratios only make sense at the global level (batch/all/{env}).

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

* feat: separate solve/batch/off_policy metrics, flatten async_level

- Extract solve_none, solve_all, effective_batch_size as top-level
  metrics with /all and /{env} breakdowns
- Move off_policy_level to off_policy_level/all/{stat}
- Make async_level a flat key
- batch/ now only contains env ratios and inflight/cancelled counts

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

* feat: per-env off_policy_level tracking

Add task field to InflightRolloutInfo so off_policy_level can be
reported per env as off_policy_level/{env}/{stat}.

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

* chore: rename batch/ inflight/cancelled to progress/, simplify batch/{env}

- batch/inflight_rollouts, batch/inflight_samples, batch/cancelled_rollouts
  moved to progress/ prefix
- batch/all/{env} simplified to batch/{env}
- async_level moved to scheduler/async_level

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

* refactor: inline grouped_stats, separate global and per-env sections

Remove grouped_stats helper in favor of explicit inlined metrics.
Global metrics come first, per-env metrics in a dedicated section after.
All metrics consistently group by example_id before aggregating.

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

* fix: validate that env name is not "all" (reserved for global metrics)

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

* update scheduler config

* fix: use example_id grouping for solve stats instead of index arithmetic

The previous index-based approach (index // rollouts_per_example)
assumed rollouts were contiguous by example, which is not guaranteed
when the scheduler interleaves groups from different envs.

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

* fix: update scheduler test for new task field on InflightRolloutInfo

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

* docs: add changelog entry for metrics logging overhaul

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

* chore: validate unique env names, use notna(), simplify metrics_df access

- Add unique env name validation on OrchestratorConfig and EvalConfig
- Use notna() instead of ~isna() for error rate
- Use index-based loc instead of copying metrics_df with task/example_id

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

* refactor: extract compute_solve_rates, inline _off_policy_steps_by_task

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

* refactor: inline solve_stats, use compute_solve_rates directly

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

* also log per_env stop conditions

* minor

* style

* address bugbot

* min diff in changelog

* update changelog

* revert metrics_df

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 05:23:17 -07:00
00a4752a49 fix: re-schedule empty trajectories instead of filtering after group completion (#2014)
Release / Push CUDA image to Docker (push) Canceled after 0s
Empty trajectories were filtered after sampling from the buffer, which
could yield incomplete groups and break the advantage computation's
assumption that each group has exactly `rollouts_per_example` rollouts.

Now empty trajectories are detected per-rollout as they complete. When
one is found, `rollouts_to_schedule` is incremented so the group
naturally re-fills via `_fill_inflight_requests`, and the group is only
yielded once it has the full count of non-empty rollouts.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:34:19 -07:00
halleriteandGitHub fa95af173c Revert "chore: add Claude Code review GitHub Action (#2000)" (#2015)
Release / Push CUDA image to Docker (push) Canceled after 0s
This reverts commit bcb504bd4f.
2026-03-10 17:41:22 -07:00
rasdaniandGitHub 51bd1ad5d4 disinguish is_truncated and log stop_conditions (#2009)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-10 17:55:03 +01:00
samsjaandGitHub 93cd1fa37f feature: switch fused lm head to sequence chunking (#1987)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feature: switch fused lm head to sequence chunking

* fix: deprecate old fused lm head chunk config

* fix: update benchmark token chunk flag

* fix: stream vocab shards inside sequence chunked lm head

* fix: retune benchmark token chunk to 1024

* fix: treat benchmark memory as an upper bound

* fix: remove fused lm head chunk alias

* fix: remove token chunk size validation
2026-03-09 21:42:19 -07:00
00778b5a22 feat: disk-backed image offloading for VLM memory (#2006)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: disk-backed image offloading for VLM orchestrator memory

Replace base64 image data in rollout trajectories with file paths
immediately after receiving from ZMQ. This eliminates the triangle
duplication problem where 15-turn rollouts store 120 copies of
screenshot base64 strings in memory.

Images are written to {output_dir}/assets/images/{sha256}.png and
deduped by content hash. The VLM image cache reads from disk instead
of decoding from base64 strings.

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

* chore: add VLM memory benchmark for disk offloading

Benchmark generates synthetic rollouts with triangle-duplicated
screenshots, simulates ZMQ msgpack roundtrip, and measures RSS
with and without disk-backed image offloading.

Results with 32 rollouts, 15 turns, 512x384 screenshots (~770KB each):
- Without offload: +2.9 GB (91 MB/rollout)
- With offload: +7.8 MB (0.24 MB/rollout)
- 99.7% memory reduction

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

* fix: ruff lint fixes in vlm_memory_bench

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

* fix: ruff format

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

* chore: remove benchmarks folder

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

* Revert "chore: remove benchmarks folder"

This reverts commit 79918131a8c06be55b5a7450a24f2ca82e9aa206.

* revert: restore benchmarks folder, only remove vlm_memory_bench.py

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

* fix: handle file:// URLs in _extract_images_from_messages

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 20:13:59 -07:00
Philipp NormannandGitHub 447cafedea Add SFT validation eval with val_data (#1850)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-09 19:54:05 -07:00
halleriteandGitHub aa432f2c1f fix: patch HF tokenizer 'Already borrowed' crash under concurrent load (#1999)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-09 18:11:53 -07:00
7994d6c1aa fix: filter empty trajectory rollouts in scheduler (#2003)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: filter empty trajectory rollouts in scheduler

Empty trajectories consume batch slots without producing training signal.
Filter them after sampling so they don't count toward batch progress,
and track the count as a metric for observability.

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

* rename to empty_rollouts for consistency

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

* remove empty batch retry logic from orchestrator

The scheduler already filters empty trajectories, so the orchestrator
should not silently retry on empty batches — better to fail fast.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:30:47 -07:00
JannikStandGitHub 3639f0ab4f fix _tied_weights_keys for transformers v5 compat (#1998)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-09 16:07:05 -07:00
8eecadc943 fix: use pydantic-config dict coercion instead of local workaround (#1997)
Release / Push CUDA image to Docker (push) Canceled after 0s
Point pydantic-config to main which now includes proper string-to-type
coercion for dict fields in BaseConfig (samsja/pydantic_config#23).

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:54:46 -07:00
bcb504bd4f chore: add Claude Code review GitHub Action (#2000)
Release / Push CUDA image to Docker (push) Canceled after 0s
Adds automated PR review using anthropics/claude-code-action@v1.
Reviews run on PR open/sync/reopen and responds to @claude mentions.

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:07:17 -07:00
samsjaandGitHub 2041d93132 feat: fused linear cross-entropy loss for SFT (#1958)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-09 12:16:16 -07:00
46f26ce195 chore: move env packages to dedicated envs extras group (#1993)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: move env packages to dedicated `envs` extras group

Move math-env and reverse-text from main dependencies into a new
`envs` optional-dependencies group alongside all other environment
packages used in configs (aime2024, aime2025, alphabet-sort, code-env,
color-codeword, logic-env, math-python, math500, science-env,
wiki-search). All sourced from the primeintellect index.

Install with: uv sync --extra envs

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

* chore: remove primeintellect/ prefix from env IDs in configs

Envs are now installed directly via the envs extras group, so the
primeintellect/ prefix is no longer needed for runtime installation.

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

* chore: mark primeintellect index as explicit

Prevents uv from querying the primeintellect index for every package
during resolution, drastically speeding up uv sync/lock.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:00:38 -07:00
e113981a4e feat: add pre_run_command and common SLURM scheduling options (#1988)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add configurable pre_run_command for SLURM jobs

Allow running a cleanup command on compute nodes before starting
the job (e.g. `sudo pkill -f vllm`). Configured via `slurm.pre_run_command`.
For multi-node jobs, the command runs on all nodes via srun.

Replaces the hardcoded `pkill -9 -f vllm` in the inference template
with the configurable option.

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

* fix: tighten whitespace in template pre_run_command blocks

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

* fix: run pre_run_command on head node only, avoid shell quoting issues

Drop the srun bash -c wrapper from multi-node templates. The command
now runs directly on the head node (same as single-node), which avoids
single-quote injection when the user's command contains quotes.

Users who need all-nodes execution can wrap with srun themselves:
  pre_run_command = "srun bash -c \"pkill -f vllm || true\""

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

* chore: add CHANGELOG entry for slurm.pre_run_command

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

* feat: add nodelist, exclude, account, and time SLURM options

Add commonly needed SLURM scheduling fields to SlurmConfig:
- nodelist: target specific nodes
- exclude: exclude specific nodes
- account: charge to a SLURM account
- time: set maximum wall time

Also extract common slurm fields into SlurmConfig.template_vars
to avoid duplicating them across every template.render() call.

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

* fix: clean up Jinja2 whitespace for optional SBATCH directives

Use {%- if %} to strip leading newlines so no blank lines appear
when optional fields are unset.

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

* fix: run pre_run_command after env setup in single-node templates

Single-node templates ran pre_run_command before cd, .env sourcing,
and venv activation. Move it after setup to match multi-node and
inference templates. Update docs to clarify execution context.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:39:09 -07:00
JannikStandGitHub deecddc4af fix crash when pad_token_id is a list in model config (#1991)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-09 17:08:57 +01:00
Shayon MukherjeeandGitHub 26fd0e34be fix: route env install output through structured logger (#1985)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-08 09:15:02 -07:00
rasdaniandGitHub 710c9b32e9 fix: Patch get_encode_kwargs to prevent HF tokenizer left-truncation (#1986)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-08 04:26:16 -07:00
4d91edc9e6 add dp-rank-routing (#1940)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add dp-rank-routing

* docs: add changelog entry for client.dp_rank_count

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* fix elastic

* fix

* dp-rank-route

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>
2026-03-08 06:20:21 +00:00
2c5c69da8b chore: config warnings (#1984)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: remove orchestrator W&B resume ID warning

The warning about missing W&B run ID for orchestrator when resuming
training is not useful and creates noise.

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

* fix: remove trainer W&B resume ID warning

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

* fix: replace warnings.warn with get_logger().warning in configs

Use prime-rl's logger instead of Python's warnings module for
config validation warnings.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 18:28:14 -08:00
5f0dcc8a1b chore: upgrade vllm from 0.17.0rc0 to 0.17.0 stable (#1980)
Release / Push CUDA image to Docker (push) Canceled after 0s
Use the stable PyPI release instead of pre-built wheels from wheels.vllm.ai.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 18:27:51 -08:00
rasdaniandGitHub 8ea7bd4834 fix: wire verifiers max_seq_len correctly (#1983)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-08 00:19:09 +01:00
302ef6d084 fix: only pass --weight_broadcast.host to orchestrator when nccl broadcast is configured (#1979)
Release / Push CUDA image to Docker (push) Canceled after 0s
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 15:07:42 -08:00
JannikStandGitHub 89a5343780 fix arm64 flash-attn-cute: revert to 2b5db43 for sm100 pipeline fix (#1982)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix arm64 flash-attn-cute: use 2b5db43 rev with sm100 pipeline fix

* also update fix-flash-attn-cute.sh to 2b5db43
2026-03-07 23:23:26 +01:00
22f0ae7640 fix: reduce orchestrator memory usage for VLM rollouts (#1964)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: reduce orchestrator memory usage for VLM rollouts

The orchestrator's RSS grew unboundedly when processing VLM rollouts
with images (e.g. 1.2 GB → 25+ GB over 10 steps, spiking to 38 GB).
Three root causes:

1. Base64 image data in rollout prompts stayed alive through the entire
   step pipeline (preprocessing, training batch, wandb logging). Now
   stripped immediately after image extraction in _extract_images_from_examples.

2. Intermediate objects (PIL images, torch tensors, chunk results) in
   _preprocess_images_batched were held simultaneously. Now freed eagerly
   with del/clear() after each conversion step.

3. Python's GC and glibc malloc arenas retained freed memory across steps.
   Now explicitly gc.collect() + malloc_trim(0) at end of each step.

Result: baseline 3-5 GB (stable), spikes 5-9 GB (bounded).

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

* refactor: extract strip_base64_images into a standalone function

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

* fix: delete chunks before clearing images to actually free PIL objects

chunks holds shallow-copy references to the same PIL images, so
images.clear() alone doesn't free them during peak memory usage.

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

* Update src/prime_rl/orchestrator/trajectories.py

Signed-off-by: hallerite <git@hallerite.com>

---------

Signed-off-by: hallerite <git@hallerite.com>
Co-authored-by: root <root@vivid-capybara-of-dignity.datacrunch.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: hallerite <git@hallerite.com>
2026-03-06 18:06:09 -08:00
JannikStandGitHub f0746566e9 fix arm64 flash-attn: run uv pip from /tmp to avoid pyproject.toml build vars (#1975)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-07 02:10:43 +01:00
JannikStandGitHub 99c02bba6c fix arm64 flash-attn build: override FLASH_ATTENTION_SKIP_CUDA_BUILD (#1974)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix arm64 flash-attn build: override FLASH_ATTENTION_SKIP_CUDA_BUILD

* also set FLASH_ATTENTION_FORCE_BUILD to bypass cached wheel download
2026-03-07 00:12:09 +01:00
JannikStandGitHub ebb5a1cac2 add --no-cache to force flash-attn source build on arm64 (#1973)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-06 21:43:45 +01:00
JannikStandGitHub d19ce7919f force flash-attn source build on arm64 with --no-binary (#1972)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-06 21:02:18 +01:00
JannikStandGitHub e2175c11ae add aarch64 vllm wheel and restrict uv environments to linux x86_64/aarch64 (#1970)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-06 10:53:20 +01:00
JannikStandGitHub d4bfa08977 Add arm64 support to Dockerfile and deps (#1933)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add arm64 support to Dockerfile and deps

- Swap builder base to multi-arch nvidia/cuda:12.8.1 image
- Add platform_machine markers to x86_64-only wheel deps

* Fix tzdata interactive prompt in arm64 build

* Fix tzdata interactive prompt in Docker build

* add arm64 flash-attn source build and expose max_num_seqs on inference CLI

* only target sm_100 for arm64 flash-attn build

* remove max_num_seqs, belongs in a separate PR

* also build flash-attn-3 from source for arm64, supports sm_100

* use pip for flash-attn-3, uv cant resolve torch match-runtime from git

* use pip for flash-attn-3: uv rejects match-runtime without static metadata

* link uv issue in dockerfile comment

* use venv pip for flash-attn-3, pip not on PATH in builder

* use uv run pip for flash-attn-3

* install pip into venv before using it for flash-attn-3

* fix arm64 flash-attn build: export env vars, add ninja

* fix: install python ninja package, export all env vars properly

* remove flash-attn-3 from arm64 build, fa4 (flash-attn-cute) is used instead

* Fix missing cutlass.utils.ampere_helpers on arm64 (#1948)

* Fix missing cutlass.utils.ampere_helpers on arm64

flash-attn.cute imports cutlass.utils.ampere_helpers but
nvidia-cutlass-dsl 4.4.1 doesn't ship that module. Copy it
from flashinfer's vendored cutlass which has the file.

* Expand Dockerfile comment explaining cutlass ampere_helpers workaround

* Reinstall flash-attn-cute after flash-attn on arm64 to fix namespace conflict (#1949)

* Pin flash-attn-cute to locked commit, upstream renamed package to flash-attn-4 (#1950)

* Upgrade flash-attn-cute for cutlass-dsl 4.4.1 backward pass fix (#1952)

* Upgrade flash-attn-cute to 7ed0898 for cutlass-dsl 4.4.1 compatibility

* Pin fix-flash-attn-cute.sh to same commit as pyproject.toml

* Pin flash-attn-cute to 2b5db43 for cutlass-dsl 4.4.1 compat and sm100 backward fix

* refactor: extract arm64 post-install logic into script

* skip arm64 script entirely on x86, trim comments

* update uv.lock

* revert pydantic-config to branch=main

* pin flash-attn==2.8.3 in arm64 post-install

* pin flash-attn-cute to e2743ab5, regenerate uv.lock

* align flash-attn-cute rev in scripts with pyproject.toml (e2743ab5)
2026-03-06 09:56:16 +01:00
599cea81c1 fix vllm 17 nihglty (#1969)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix vllm 17 nihglty

* fix vllm 0.17 compat: conditionally pass log_error_stack

---------

Co-authored-by: Jannik Straube <info@jannik-straube.de>
2026-03-06 00:25:05 -08:00
c344a8a3c6 fix: modality-aware batch distribution to prevent FSDP deadlocks (#1959)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: modality-aware batch distribution to prevent FSDP deadlocks

When training multimodal models with FSDP, ranks must execute the same
operations at each step. If one rank processes a multimodal batch
(triggering the vision encoder all-gather) while another processes
text-only, training hangs. Fix by separating micro batches by modality,
padding each group independently, and distributing in strided order so
all ranks see the same modality at each step index.

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

* ruff format

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

---------

Co-authored-by: root <root@vivid-capybara-of-dignity.datacrunch.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 03:04:33 +01:00
892c895b83 fix: disable timeout on admin httpx clients (#1955)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: disable timeout on admin httpx clients

Admin operations (weight updates, LoRA loading, NCCL broadcast) can block
for an unbounded amount of time — especially under load where vLLM servers
are slow to enter NCCL receive mode. The previous 1200s read timeout was
causing orchestrator crashes on heavy prod runs.

Also adds retry logic to _update_weights for 5xx responses, matching the
existing behaviour of load_lora_adapter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* remove retry

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 10:57:46 -08:00
94984b9790 feat: add Qwen3.5 support (#1946)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add Qwen3.5 support

Bump vLLM to >=0.16.1.dev (nightly) which includes Qwen3.5 model support.
This requires torch 2.10 (resolved from the existing >=2.9.0 pin), an
updated flash-attn wheel built against torch 2.10, and version overrides
for nvidia-cutlass-dsl and quack-kernels.

Bump transformers pin to 5c1c72b which includes a rope validation fix
for Qwen3.5 (https://github.com/huggingface/transformers/pull/44272).

Add a trainer monkey-patch for a transformers bug where Qwen3.5 passes
3D MRoPE position_ids to decoder layers instead of 2D text_position_ids,
which breaks flash attention and causes NaN gradients. The upstream fix
is pending: https://github.com/huggingface/transformers/pull/44399

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

* apply patch for Qwen3.5 MoE model variants

* remove duplicated nvidia-cutlass-dsl override

* fix: patch Qwen3.5 MoE weight conversion mapping for broadcasting

* ruff

* change wheel

* fix vllm v0.16.1.dev (#1954)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: hallerite <git@hallerite.com>
Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
2026-03-05 11:34:43 +01:00
Christian RandGitHub 15fc324d1b perf: parallelize VLM image preprocessing across threads (#1951)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-04 22:57:53 -08:00
868ba03d9b fix: use qwen3_coder tool parser for Qwen3.5 models (#1953)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: use qwen3_coder tool parser for Qwen3.5 models

Qwen3.5 uses a different tool call format than Qwen3. Qwen3 uses
hermes-style JSON, but Qwen3.5 uses an XML-like format with
<function=name><parameter=arg> tags. Map all Qwen3.5 variants to
the qwen3_coder parser so tool calls are parsed correctly.

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

* fix for tool parser test

---------

Co-authored-by: root <root@vivid-capybara-of-dignity.datacrunch.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Johannes Hagemann <johannes@primeintellect.ai>
2026-03-04 21:36:31 -08:00
halleriteandGitHub aa33d910a4 update deep-gemm (#1944)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-04 12:57:07 -08:00
ac7ac62115 chore: update pydantic-config for JSON dict CLI support (#1943)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: update pydantic-config for JSON dict CLI support

Update pydantic-config to latest main which adds support for passing
dict[str, Any] fields as JSON via CLI:
  --inference.vllm-extra '{"custom_arg": "value"}'

Also switch source from pinned rev to branch = "main".

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

* chore: update pydantic-config lock to include JSON dict fix

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 12:33:16 -08:00
JannikStandGitHub 99058e9e37 bump nvidia-cutlass-dsl to 4.4.1 for flash-attn-cute ampere_helpers (#1945)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-04 05:54:10 +01:00
halleriteandGitHub fe32efbee1 perf: deduplicate VLM image bytes in orchestrator cache (#1935)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-03 13:49:21 -08:00
6a97762b5c fix: use space-separated list args for tyro CLI compatibility (#1942)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: use space-separated list args for tyro CLI compatibility

tyro parses list[str] fields as space-separated values, not
comma-separated. Update the multi-node SLURM template and integration
test to match. Also fix snake_case --weight_broadcast.host to
kebab-case --weight-broadcast.host.

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

* revert unnecessary kebab-case change for weight_broadcast.host

Both snake_case and kebab-case are accepted by tyro, so keep the
original snake_case to minimize diff.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 13:33:19 -08:00
8451067db7 fix env server task cancellation (#1939)
Release / Push CUDA image to Docker (push) Canceled after 0s
* bump vf (bb73f78, feature branch)

* fix: drop stale groups concurrently to avoid inflated cancellation count

The sequential drop_group loop allowed _fill_inflight_requests to add
new tasks to not-yet-dropped stale groups during yields, causing the
cancelled count to exceed max_inflight_rollouts. Using asyncio.gather
ensures all drops snapshot inflight_requests before any of them yield.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* bump vf (45fae8d, main)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 12:03:21 -08:00
ea161dd743 fix: validate prompt length in TITO endpoint before computing max_tokens (#1938)
Release / Push CUDA image to Docker (push) Canceled after 0s
In multi-turn TITO rollouts, prompt_token_ids are injected after
render_chat_request, bypassing vLLM's built-in context length
validation. When the prompt exceeds max_model_len, get_max_tokens
returns a negative value, causing a BadRequestError ("max_tokens must
be at least 1") that isn't recognized as an overlong prompt by the
verifiers client — aborting the rollout instead of truncating it.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 11:07:29 -08:00
Christian RandGitHub 9104df43c6 Serialize VLM pixel_values as raw bytes for 8-10x faster preprocessing (#1923)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-03 09:51:29 -08:00
Mika SenghaasandGitHub 02bdca2e41 change default rl algo to ipo (#1930)
Release / Push CUDA image to Docker (push) Canceled after 0s
* first impl for dppo+kl

* fix ratio_type ref

* sum the loss

* set kl_tau=1e-3 by default

* fix

* change to ipo + remove type ignore

* update changelog

* fix

* update names
2026-03-03 02:55:39 -08:00
bf71516c91 individual rollouts (#1865)
Release / Push CUDA image to Docker (push) Canceled after 0s
* individual-rollouts

* fixes

* fix group based scoring envs

* ruff

* ruff pls

* Fix inflight sample metric semantics

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* fixes

* Delete tests/unit/orchestrator/test_scheduler.py

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>

* fix: off-policy off-by-one - cancel when off_policy_steps >= max

Made-with: Cursor

* Fix off-policy increment race in scheduler

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* adress comments

* ruff

---------

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>
2026-03-03 02:54:37 -08:00
Ido HakimiandGitHub aacc466401 fix: remove trailing comma from vllm dependency in pyproject.toml (#1937)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-03 02:28:54 -08:00
68e443b833 inference entrypoint (#1898)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add SLURM scheduling support for standalone inference entrypoint

Move inference entrypoint to src/prime_rl/entrypoints/inference.py following
the SFT/RL patterns. Add opt-in [slurm] and [deployment] config sections to
InferenceConfig for submitting inference as SLURM jobs. Supports single-node
and multi-node (independent vLLM replicas per node, no cross-node parallelism).

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

* use single inference template

* add dry run and remove launcher fields

* correctly resolve union/annotated types

* log msg

* export urls

* switch to 0.0.0.0

* fix vllm

* move

* update changelog

* pass seed

* align with sft/rl entrypoint

* use config dir helper

* update docs and skill for inference SLURM entrypoint

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

* add back writing config

* add comment

* Revert "add comment"

This reverts commit 1481510decd244174049e1392ca51c1b7b29b294.

* Revert "add back writing config"

This reverts commit a67e8dfe3e57f5906fee0cb6f8fd299c148ecca5.

* remove non-user facing changelog items

* fix ruff

* fix infer entrypoint

* bump pydantic_config

* multi node is 2 nodes by default

* use rev

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:25:59 -08:00
6f6fa002a5 fix: replace removed teacher_gpu_ids with deployment.num_teacher_gpus in docs (#1929)
Release / Push CUDA image to Docker (push) Canceled after 0s
The on-policy distillation docs referenced teacher_gpu_ids which was
removed from RLConfig and replaced by the [deployment] section with
num_teacher_gpus. Users following the docs would get a pydantic
extra_forbidden error.

Closes #1924

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 14:52:37 -08:00
Ido HakimiandGitHub 732cbde83c fix: handle external CUDA_VISIBLE_DEVICES (#1920)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-02 09:16:46 -08:00
09a6875f11 migrate config system to pydantic_config (#1915)
Release / Push CUDA image to Docker (push) Canceled after 0s
* migrate config system from pydantic-settings to pydantic_config

Replace the custom pydantic-settings wrapper (BaseSettings, parse_argv,
toml_files inheritance) with the external pydantic_config library which
provides tyro-backed CLI parsing, @ syntax for TOML files, and deep merge
of configs + CLI overrides.

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

* update pydantic-config to fix-tyro branch and fix benchmark CLI args for tyro

- Switch dependency from refactor-tyro to fix-tyro branch (includes
  validators moved upstream)
- Simplify config.py by removing validators now in pydantic_config
- Fix benchmark script to use tyro subcommand syntax for optional
  nested configs (compile, ac, ac-offloading)

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

* update pydantic-config to include bare flag support for Optional configs

The benchmark script's --model.compile and --model.ac bare flags now
work without changes, thanks to upstream pydantic_config handling.

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

* update pydantic-config to main (includes AvoidSubcommands fix)

Fixes dict[str, Any] tyro parser errors and union subcommand issues.

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

* update pydantic-config to include sub-field override fix

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 08:37:24 -08:00
Christian RandGitHub f00925c006 fix: propagate use_cache=False to sub-configs for VLM models (#1922)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-03-01 16:56:52 -08:00
samsjaandGitHub 5a6ab4a968 add vllm 16 back (#1893)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-28 11:48:12 -08:00
DominikandGitHub 5ae5079478 validate mint.json pages exist before syncing docs (#1912)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-27 13:49:47 -08:00
753a728e8a disable fused lm head chunking by default (#1904)
Release / Push CUDA image to Docker (push) Canceled after 0s
* disable fused lm head chunking by default

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

* reduce benchmark_regression seq_len to 16384

65536 OOMs on A6000 without fused lm head chunking.

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

* pin fused lm head chunk size in benchmark regression test

The benchmark baselines were generated with chunking enabled, so
the regression test must explicitly enable it regardless of the
default.

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

* pin fused lm head chunk size in rl_multi_run CI config

This test uses seq_len=65536 which needs chunking to avoid OOM on
A6000 GPUs.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 22:09:32 -08:00
JannikStandGitHub df50bd2eb1 remove disown from orchestrator in multi-node sbatch template (#1907)
Release / Push CUDA image to Docker (push) Canceled after 0s
disown detaches the orchestrator from the shell job table, preventing
it from receiving SIGHUP on shell exit. This causes the orchestrator
and its env server subprocesses to survive as orphans after job
cancellation, leading to port conflicts on subsequent runs.
2026-02-26 20:29:43 -08:00
982a7756ec fix: resolve slurm project_dir to absolute path (#1908)
Release / Push CUDA image to Docker (push) Canceled after 0s
The default Path(".") was passed as-is to sbatch templates, producing
`export PROJECT_DIR=.` which breaks on compute nodes where the cwd
differs from the submission directory. Now resolved at config
construction time.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 19:06:39 -08:00
35671879fb support multi-node ep (#1894)
Release / Push CUDA image to Docker (push) Canceled after 0s
* support multi-node ep

* fix

* docs(changelog): add inference data parallel config entries

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

---------

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>
2026-02-27 02:43:43 +00:00
JannikStandGitHub 1ea7a8d3b5 fix: handle skipped eval intervals when ckpt_step jumps (#1903)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: handle skipped eval intervals when ckpt_step jumps + fix eval step reporting

When strict_async_level=False, ckpt_step can jump over eval interval
boundaries (e.g. 24->26 skipping 25), permanently missing scheduled evals.
Replace exact modulo check with range check that detects crossed intervals.

Also fix eval metrics being logged at progress.step instead of ckpt_step,
which caused eval results to appear at the wrong step in the metrics API.

* format ruff

* revert step=ckpt_step back to step=progress.step for eval logging

W&B requires monotonically increasing steps. Using ckpt_step (which lags
behind progress.step) causes W&B to silently drop eval metrics since
training already logged at a higher step. The ckpt_step is already
embedded in the metrics as progress/ckpt_step for platform-side lookup.

* fix stale comment about eval subprocess

* add unit tests for eval scheduling range check

* extract eval scheduling logic into compute_eval_ckpt_step function

Move range check logic from inline in orchestrator.py to a proper
function in eval_utils.py so tests import the real implementation.

* use plain functions instead of class in tests
2026-02-27 01:45:14 +01:00
halleriteandGitHub f655f71c33 simplify vlm path (#1877)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-27 01:06:26 +01:00
bc77fa0692 Feat: router replay (#1807)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Enable top_k indices from inference

* Feat; base64

* Feat: more work

* Feat: works now

* Feat: router replay done

* Fix: paths

* Fix: reshape vs view

* Final

* Fix: cp

* fix: config

* Add tests for router replay and fix routed_experts KeyError

- Add unit tests for `_align_routed_experts` (none, empty, no deficit,
  deficit padding, excess length)
- Add tests for `interleave_rollout` with routed experts (single-step
  alignment, multi-step extension, None passthrough)
- Add tests for `prepare_sample` with routed experts (passthrough,
  truncation, None)
- Add GPU test for Qwen3 MoE router replay (forward + backward with
  forced expert indices)
- Fix `tokens["routed_experts"]` -> `tokens.get("routed_experts")` in
  trajectories.py to avoid KeyError when field is absent
- Fix `_attn_only` tests for afmoe/glm4_moe/qwen3_moe broken by
  `routed_experts` kwarg passed to nn.Identity

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

* nit

* Fix

* Feat: address comments

* add to minimax and glm moe dsa

* add to minimax and glm moe dsa

* Fix: boundaries

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
2026-02-26 13:31:16 -08:00
Mika SenghaasandGitHub 7104dbdb5d hendrycks sanity ci (#1900)
Release / Push CUDA image to Docker (push) Canceled after 0s
* do not oversample hendrycks sanity (trainer bottlenecks)

* put hendrycks sanity into nightly config

* remove duplicate utils
2026-02-26 11:14:06 -08:00
Mika SenghaasandGitHub 3d9aa90a24 unify --dry-run flag across rl and sft entrypoint (#1897)
Release / Push CUDA image to Docker (push) Canceled after 0s
* unify dump_config and dry_run across local and slurm entrypoint

* also use in sft entrypoint

* update changelog

* fix exclude launcher fields

* address bugbot

* do not exclude deployment

* fix sft

* exclude clean output dir to not double clean

* fix rl
2026-02-26 11:11:23 -08:00
Mika SenghaasandGitHub 2da1e4ac5a stricly enforce async level + fix off policy off by one (#1901)
Release / Push CUDA image to Docker (push) Canceled after 0s
* stricly enforce async level

* update policy loop + cleanup

* always create policy loop task

* diff

* fix race

* cancel all

* fix

* safe cancel rollouts

* fix off by one err in off policy lag

* fill up in loop

* fix mutation

* cleaner

* update comments

* actually safe cancel

* address bugbot
2026-02-26 11:10:14 -08:00
halleriteandGitHub 7d8da4cbcc add deep_gemm as dependency for GLM5 (#1884)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-26 19:18:57 +01:00
Mika SenghaasandGitHub 7036a15119 update env var prefix (#1899)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-26 08:19:28 -08:00
leopold-tzafonandGitHub aef4a600f9 fix: vlm cache (#1887)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-26 15:00:40 +01:00
a3a307e70c fix: update benchmark baselines for fused_lm_head_chunk_size change (#1895)
Release / Push CUDA image to Docker (push) Canceled after 0s
Update benchmark baselines to reflect the memory increase from commit
83c21ddac which changed the default fused_lm_head_chunk_size from 2048
to 8192 for improved numerical stability.

Memory changes:
- 1-GPU: 22.69 GiB → 31.81 GiB
- 4-GPU: 14.13 GiB → 23.25 GiB

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-26 02:24:46 -08:00
Matej SirovatkaandGitHub 83c21ddac5 Feat: set default to 8192 (#1892)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-26 02:28:13 +01:00
5f2dc0fe42 chore: fix ruff formatting in orchestrator config (#1891)
Release / Push CUDA image to Docker (push) Canceled after 0s
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 13:58:03 -08:00
5b15e54e88 chore: move tool_call_parser resolution from config validation to server startup (#1882)
Release / Push CUDA image to Docker (push) Canceled after 0s
The auto-detection ran at config time via a model_validator, but the model
name may not be final yet (e.g. RLConfig propagates it later), requiring a
hacky reset+re-resolve in auto_setup_model(). Moving the lookup to
server() ensures we always resolve against the final model name.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 09:14:31 -08:00
samsjaandGitHub 4825d76e75 fix vllm v16 (#1883)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-25 02:39:14 -08:00
668579aaf0 add option for token-batch-size (#1855)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add option for token-batch-size

* changelog

* fix cursor bugbot

* changelog

* remove tests

* keep oversampling_factor

* restore oversampling_factor in wiki and math configs

Keep these RL config files aligned with main and retain the oversampling_factor naming convention instead of max_inflight_rollouts.

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

---------

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 05:42:42 +00:00
ce55c150e7 fix device mesh flattened dim deprecation warning (#1874)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Fix DeviceMesh flattened dim deprecation warning (PT 2.10+)

Store _flatten() return values in a _submeshes dict and access them
via get_mesh() instead of going through world_mesh.__getitem__, which
triggers "Slicing a flattened dim from root mesh will be deprecated
in PT 2.11" warnings and will break in PT 2.11.

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

* Fix get_mesh lazy init ordering

Ensure world_mesh (and _submeshes) are initialized before checking
the submeshes dict, so synthetic names like "hsdp" don't fall through
to the root mesh lookup.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 19:42:18 -08:00
75355f497b fix: wandb logging order (#1880)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: pass explicit step to wandb.log in orchestrator

Without an explicit step, wandb auto-increments its internal counter,
causing subsequent calls with explicit step values to trigger
"step N is less than current step N+1" warnings.

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

* fix: use explicit None check for step=0 in eval_utils

`step or ckpt_step` treats step=0 as falsy, silently substituting
ckpt_step. Use `step if step is not None else ckpt_step` instead.

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

* simplify: step is always an int, drop Optional and fallback

Both call sites always pass step=progress.step (int), so remove the
None type and the ckpt_step fallback that was broken for step=0.

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

* fix: commit immediately on wandb.log to avoid delayed dashboard data

With explicit step=, wandb accumulates without committing until it sees
a new step. Adding commit=True flushes data to the dashboard immediately.

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

* Revert "fix: commit immediately on wandb.log to avoid delayed dashboard data"

This reverts commit bf679db5f4069374a74d409c0064cd04d8091c6b.

* fix: add monitor.flush() for immediate wandb commits

commit=True can't be used on individual wandb.log calls when multiple
calls share the same step (it advances the counter, breaking subsequent
calls). Instead, accumulate with the default commit=False, then flush
once at the end of the step.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 15:45:51 -08:00
Mika SenghaasandGitHub 1c559feb25 fix using prime-rl logger (#1881)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-24 13:31:49 -08:00
cae5532f5d chore: consolidate config modules into prime_rl.configs (#1871)
Release / Push CUDA image to Docker (push) Canceled after 0s
* consolidate config modules into prime_rl.configs subpackage

Move all scattered config.py files (utils, trainer, rl, sft, orchestrator,
env_server, inference, transport, rl_config) into a single prime_rl.configs
subpackage for better discoverability and organization. Update all imports
across 59 files and refresh skill docs.

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

* merge shared, transport, and utility configs into configs/shared.py

Move SharedLog/Wandb/Checkpoint/Model/WeightBroadcast configs, deployment
configs, transport configs, and common utility configs (ModelConfig,
ClientConfig, LogConfig, WandbConfig, etc.) into a single configs/shared.py.
Remove configs/transport.py and configs/utils.py.

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

* rename SFTTrainerConfig -> SFTConfig, sft_trainer.py -> sft.py

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

* move shared configs into rl configs

* move trainer configs into shared.py

Merge configs/trainer.py into configs/shared.py since these configs
(model, optimizer, scheduler, checkpoint, LoRA, SLURM, etc.) are shared
across both SFT and RL trainers. Rename ModelConfig -> TrainerModelConfig
to avoid collision with the common ModelConfig.

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

* move some stuff

* update configs

* clean up config naming: move trainer configs, drop component prefixes

- Rename rl_trainer.py -> trainer.py, RLTrainerConfig -> TrainerConfig
- Move shared trainer building blocks (ModelConfig, optimizers, schedulers,
  checkpointing, LoRA, etc.) from shared.py into trainer.py
- Rename TrainerModelConfig -> ModelConfig, common ModelConfig -> BaseModelConfig
- Rename TrainerCheckpointConfig -> CheckpointConfig
- Drop Orchestrator/Inference prefixes from config classes
  (OrchestratorModelConfig -> ModelConfig, InferenceModelConfig -> ModelConfig, etc.)
  since the module name provides context; use aliases in rl.py for disambiguation
- Fix OrchestratorModelConfig inheriting from training ModelConfig instead of BaseModelConfig
- Fix broadcast module imports that had mismatched class names

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

* update changelog with config consolidation entry

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

* style

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:28:36 -08:00
8136f13c55 log reward statistics (#1866)
Release / Push CUDA image to Docker (push) Canceled after 0s
* log reward statistics

* ruff

---------

Co-authored-by: hallerite <git@hallerite.com>
2026-02-24 11:36:03 -08:00
cc59d7bedf cleaner naming for discriminated unions in config (#1879)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Drop Type suffix from config union TypeAliases

Rename all *ConfigType aliases to drop the redundant suffix:
- OptimizerConfigType → OptimizerConfig
- SchedulerConfigType → SchedulerConfig
- DeploymentConfigType → DeploymentConfig
- SFTDeploymentConfigType → SFTDeploymentConfig
- DataConfigType → DataConfig
- TransportConfigType → TransportConfig
- FilterConfigType → FilterConfig
- WeightBroadcastConfigType → WeightBroadcastConfig
- LossConfigType → LossConfig (class renamed to DefaultLossConfig)
- AdvantageConfigType → AdvantageConfig (class renamed to DefaultAdvantageConfig)

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

* Move Field(discriminator) into TypeAliases, simplify field sites

Embed Field(discriminator="type") in each union TypeAlias so field
declarations can use the alias directly without wrapping in
Annotated[..., Field(discriminator="type")].

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 11:28:16 -08:00
cfed378624 replace callable discriminator with field values (#1878)
Release / Push CUDA image to Docker (push) Canceled after 0s
LossConfigType and AdvantageConfigType used callable discriminators with
Tag annotations to provide a default fallback when the "type" key was
missing. This is unnecessary since _default_discriminator_types on
BaseSettings already injects the type tag from defaults. Switch to the
simpler Field(discriminator="type") pattern used by all other unions.

LossConfig and AdvantageConfig are changed from BaseConfig to BaseModel
because BaseConfig's field_validator("*", mode="before") conflicts with
pydantic's string-based discriminator. Neither model has Optional fields
that benefit from the empty_str_to_none validator.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 11:15:16 -08:00
f9b7856eec fix: per-component seq_len overrides shared seq_len (#1875)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: per-component seq_len overrides shared seq_len

Remove `nested_model_default_partial_update=True` from BaseSettings so that
`model_fields_set` correctly tracks which nested fields were explicitly set
in the config. This lets `auto_setup_seq_len` propagate the shared `seq_len`
only to components that didn't receive an explicit value.

- Bump pydantic-settings >=2.12.0
- Replace the `normalize_deployment` workaround with a generic
  `_default_discriminator_types` before-validator that injects the `type`
  tag from a field's default instance when missing
- Guard `auto_setup_seq_len` with `model_fields_set` checks

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

* add hendrycks sanity check exp (#1873)

* Flesh out hendrycks sanity example README

Add explanation of the sanity check methodology (perfectible dataset
filtering), setup instructions, and training commands for local/SLURM.

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

* update examples

* Add hendrycks sanity to training examples list in README

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

* update readme

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* add output_dir safety check to prevent accidental overwrites (#1872)

* Add output_dir safety check to prevent accidental overwrites

Training now raises FileExistsError when output_dir already contains
files from a previous run, unless explicitly resuming (ckpt.resume_step)
or opting in to clean (clean_output_dir=true). This encourages using
unique per-experiment output directories and prevents silent data loss.

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

* Move output_dir validation to entrypoints (before SLURM submission)

Validate in sft()/rl() dispatch functions instead of pydantic validators
or train() functions. This ensures the check runs before sbatch submit
while keeping config parsing side-effect-free.

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

* Remove old clean flag from RLConfig local path

The old `clean` field (default True) silently deleted logs, rollouts,
and broadcasts on every local RL run. This is now superseded by the
explicit `clean_output_dir` flag on the trainer configs.

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

* Move clean_output_dir to RLConfig and use shared ckpt for resume check

clean_output_dir belongs on the top-level RLConfig (next to output_dir),
not on the trainer sub-config. The resume check now uses config.ckpt
(the shared checkpoint config) instead of config.trainer.ckpt.

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

* update err message

* Fix stray paren in error message, ensure dirs exist after clean, add changelog

- Fix stray ) in FileExistsError message text
- Create output_dir after validate_output_dir in both entrypoints so it
  exists even after a clean
- Add log_dir.mkdir in RL local path (was previously done by maybe_clean)
- Add CHANGELOG entries for clean_output_dir and clean removal

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

* only raise if checkpoints exists

* Make RLConfig.output_dir non-optional and fix docs to match actual behavior

output_dir is always a Path after validation, so type it as Path with
default Path("outputs"). Fix docs/changelog that incorrectly said the
safety check triggers on "non-empty" dirs — it only triggers on dirs
containing checkpoints.

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

* Add changelog entry for output_dir type change and SLURM validation removal

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

* add env var to never clean output dir safeguard

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* add some more tests

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:29:23 -08:00
82652c7393 add output_dir safety check to prevent accidental overwrites (#1872)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add output_dir safety check to prevent accidental overwrites

Training now raises FileExistsError when output_dir already contains
files from a previous run, unless explicitly resuming (ckpt.resume_step)
or opting in to clean (clean_output_dir=true). This encourages using
unique per-experiment output directories and prevents silent data loss.

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

* Move output_dir validation to entrypoints (before SLURM submission)

Validate in sft()/rl() dispatch functions instead of pydantic validators
or train() functions. This ensures the check runs before sbatch submit
while keeping config parsing side-effect-free.

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

* Remove old clean flag from RLConfig local path

The old `clean` field (default True) silently deleted logs, rollouts,
and broadcasts on every local RL run. This is now superseded by the
explicit `clean_output_dir` flag on the trainer configs.

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

* Move clean_output_dir to RLConfig and use shared ckpt for resume check

clean_output_dir belongs on the top-level RLConfig (next to output_dir),
not on the trainer sub-config. The resume check now uses config.ckpt
(the shared checkpoint config) instead of config.trainer.ckpt.

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

* update err message

* Fix stray paren in error message, ensure dirs exist after clean, add changelog

- Fix stray ) in FileExistsError message text
- Create output_dir after validate_output_dir in both entrypoints so it
  exists even after a clean
- Add log_dir.mkdir in RL local path (was previously done by maybe_clean)
- Add CHANGELOG entries for clean_output_dir and clean removal

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

* only raise if checkpoints exists

* Make RLConfig.output_dir non-optional and fix docs to match actual behavior

output_dir is always a Path after validation, so type it as Path with
default Path("outputs"). Fix docs/changelog that incorrectly said the
safety check triggers on "non-empty" dirs — it only triggers on dirs
containing checkpoints.

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

* Add changelog entry for output_dir type change and SLURM validation removal

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

* add env var to never clean output dir safeguard

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:52:11 -08:00
4b0ecdb223 add hendrycks sanity check exp (#1873)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Flesh out hendrycks sanity example README

Add explanation of the sanity check methodology (perfectible dataset
filtering), setup instructions, and training commands for local/SLURM.

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

* update examples

* Add hendrycks sanity to training examples list in README

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

* update readme

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:13:47 -08:00
1826b18927 unify rl and sft slurm entrypoints to enable single-node slurm deployments (#1859)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fuse rl-slurm and rl

* also migrate sft slurm

* Move SLURM templates to templates/ and rename to multi_node_*

- rl_slurm.sh.j2 → templates/multi_node_rl.sh.j2
- sft_slurm.sh.j2 → templates/multi_node_sft.sh.j2
- Remove src/prime_rl/slurm/ directory entirely
- Update template path references in rl.py and sft/train.py

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

* update

* add single node template

* allow setting env vars everywhere

* fixes

* fix

* rename to .sbatch

* update scripts

* update configs

* adopt deployment and slurm config for sft

* rename slurm.template -> slurm.template_path

* style

* make inference optional again and some misc bug fixes

* update examples

* fix configs

* rewrite slurm docs for unified entrypoints and fix slurm_sft.toml

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

* fix config

* deprecate hf hub offline in sft slurm

* only HF_HUB_OFFLINE in multi_node

* tail with -F

* exclude deployment

* update changelog

* move templates

* update branch

* fix output dir

* do not allow None partition

* fix

* revert env_vars

* remove env_vars entries from changelog

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

* address bugbot

* extract sft entrypoint

* move entrypoints

* cleanup logic in sft local

* fix single node sft slurm

* fix

* fix: resolve SLURM template path relative to package for editable installs

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

* add changelog line

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-24 03:11:21 -08:00
db5092914d afmoe ring attention support. (#1848)
Release / Push CUDA image to Docker (push) Canceled after 0s
* initial test for ring attn

* tmp

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: S1ro1 <matej.sirovatka@gmail.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
2026-02-23 23:23:54 -08:00
faresobeidandGitHub 5bd9809399 fix effective_batch_size metric (#1862)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-24 04:04:26 +00:00
448f8c09ad ep inference support (#1860)
Release / Push CUDA image to Docker (push) Canceled after 0s
* ep inference support

* some fixes

* docs: add inference EP config changelog entry

Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>

* revert docs

* oops

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: faresobeid <faresobeid@users.noreply.github.com>
2026-02-24 01:59:57 +00:00
4076a0e457 Fix tool_call_parser not resolved when model name is propagated (#1854)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Move tool_call_parser log from validator to server startup

Validators shouldn't have logging side effects - they run during
config construction which causes spurious log messages on import.
Also use default_factory for ModelConfig to avoid eager instantiation.

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

* Fix tool_call_parser not resolved when model name is propagated

auto_setup_model() changes inference.model.name after the ModelConfig
validator has already run, leaving tool_call_parser stale from the
default model. Re-resolve after propagating the name, but only when
the current parser was auto-detected (preserves explicit overrides).

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:12:48 -08:00
Mika SenghaasandGitHub ad8d775fc3 bump vf 3f555af (#1858)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-23 09:04:33 -08:00
c2027a79d0 Feat: GLM5 (#1827)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add GLM-5 (glm_moe_dsa) custom model with MLA attention

Implement GLM-5 as a custom model following the 4-file convention:
- configuration, modeling, converting, and __init__
- MLA (Multi-head Latent Attention) with LoRA-compressed Q/KV
- Interleaved RoPE support via apply_rotary_pos_emb_interleave()
- Dense attention only (sparse Lightning Indexer is future work)
- Reuses existing MoE, MLP, RMSNorm, and RotaryEmbedding layers
- Weight conversion roundtrip (HF <-> PrimeRL) for MoE experts
- Indexer weights declared but unused for state dict compatibility
- mini_moe.py preset for test model creation
- Unit tests (attn-only, mlp-only, full model + roundtrip)

* feat: add sparse MLA attention with tilelang kernels for GLM-5

Add Dynamic Sparse Attention (DSA) to the glm_moe_dsa model using
vendored tilelang kernels for training fwd+bwd. Includes a bf16
PyTorch indexer (varlen-aware via cu_seqlens) and the absorption
trick to operate in compressed KV latent space (d_qk=576, d_v=512).

* Progress we run against vllm

* Feat: works but slow

* works now i think

* Cleanup

* deps

* Minor changes

* fix minimoe

* To be verified

* Feat: glm5

* Fix: scaling

* Fix more scaling

* FP8 quant

* Scale

* Cleanup: remove banner comments, verbose docstrings, dead code, and broken tests

- Remove license banner, section separators, and shape annotation comments
- Remove unused _weight_scale variable and commented-out code in fp8_indexer
- Trim verbose vendor attribution comments
- Consolidate duplicate warnings in GlmMoeDsaForCausalLM
- Remove broken test file (tests passed wrong kwargs to attention forward)
- Remove sloppy init comment in models/__init__.py

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

* final

* nit

* Fix GlmMoeDsaConfig pad_token_id forwarding

Co-authored-by: Matej Sirovatka <S1ro1@users.noreply.github.com>

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Matej Sirovatka <S1ro1@users.noreply.github.com>
2026-02-22 19:14:56 -08:00
will brownandGitHub 944163ac68 track seqs per rollout (#1852)
Release / Push CUDA image to Docker (push) Canceled after 0s
* track seqs per rollout

* rename
2026-02-22 17:37:49 -08:00
samsjaandGitHub 1e7561668d make tito default (#1851)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-22 15:54:02 -08:00
fd78f21f79 make tito client opt-in (#1847)
Release / Push CUDA image to Docker (push) Canceled after 0s
* make tito client opt-in

* Add CHANGELOG entry for orchestrator.use_token_client config field

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:15:30 -08:00
7eade4f7e1 Add SFT SLURM entrypoint (#1832)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add SFT SLURM entrypoint (`sft_slurm`)

Adds a `sft_slurm` CLI that mirrors `rl_slurm` but for SFT training.
The config extends `SFTTrainerConfig` directly (no `[trainer]` nesting)
with slurm-specific fields (num_nodes, gpus_per_node, etc.). Includes a
simplified Jinja2 SLURM template with no inference/orchestrator nodes.

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

* add sft example

* add SFT MoE SLURM example and slim down SFT docs

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

* add sft slur config to tests

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:31:36 -08:00
bf0f903b86 Feature/auto detect tool call parser (#1844)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat(inference): auto-detect tool_call_parser from model name

Previously tool_call_parser defaulted to "hermes" regardless of model,
causing silent failures when the wrong parser was used. Now the parser
is automatically inferred from the model name via a hardcoded mapping.
Users can still override explicitly.

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

* refactor: simplify MODEL_TOOL_CALL_PARSER to dict, address PR review

- Use get_logger instead of std logging
- Replace ordered list-of-tuples with a simple dict (no aliases/ordering concerns)
- Don't raise on unknown model, leave tool_call_parser as None
- Scope supported models to GLM, MiniMax, INTELLECT-3, Qwen3

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

* refactor: use exact model names in MODEL_TOOL_CALL_PARSER dict

Replace substring pattern matching with exact 1:1 model name lookup.
All supported models are listed explicitly by their HuggingFace ID.

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

* remove extra inference stuff

* feat: default enable_auto_tool_choice to True

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

* feat: auto-enable enable_auto_tool_choice when tool_call_parser is set

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

* refactor: remove hermes default, leave tool_call_parser as None for unknown models

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:57:15 -08:00
Mika SenghaasandGitHub 8ffa00c648 remove model map (#1842)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-20 15:58:47 -08:00
samsjaandGitHub bc740de6dc bump vf (#1843)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-20 14:39:05 -08:00
Mika SenghaasandGitHub c8fdcbb39c robustify env crash detection (#1841)
Release / Push CUDA image to Docker (push) Canceled after 0s
* bump vf

* do not run env server as daemon

* update commit to main

* kill env server process
2026-02-20 11:24:02 -08:00
f87be6ba76 fix Hermes tool parser "Already borrowed" crash under concurrent load (#1837)
Release / Push CUDA image to Docker (push) Canceled after 0s
vLLM's Hermes2ProToolParser.__init__ calls tokenizer.encode() and
tokenizer.decode() on every instantiation. Under concurrent request
load, multiple threads call these methods simultaneously on the same
shared HuggingFace tokenizer instance. The tokenizer's Rust backend
(via PyO3) uses RefCell-style borrow tracking, and concurrent mutable
borrows cause it to panic with `RuntimeError: Already borrowed`.

This was causing ~1% of /v1/chat/completions requests to fail with
500 Internal Server Error when tool calling (hermes parser) is enabled.

Fix: monkey-patch the parser __init__ to run the first tokenizer
encode/decode under a threading lock, cache the results, and reuse
them for all subsequent instantiations without touching the tokenizer.

Co-authored-by: root <root@industrious-conscious-koala.datacrunch.io>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-19 18:47:18 -08:00
192035e52c Add option to freeze MoE router during training (#1836)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add option to freeze MoE router during training

Adds `freeze_moe_router` config option to prevent routing collapse and
keep load balancing stable during RL and SFT fine-tuning. Supports both
custom MoE (router) and HuggingFace (gate) implementations.

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

* Remove freeze_moe_router unit tests

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:50:15 -08:00
halleriteandGitHub 30a14c1702 add mismatch_kl-entropy ratio (#1835)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-19 14:16:02 -08:00
halleriteandGitHub a646ad6050 use lower-variance estimator for pass@k (#1834)
Release / Push CUDA image to Docker (push) Canceled after 0s
* use unbiased estimator

* compute k's on the fly

* fix claude retardation
2026-02-19 14:15:28 -08:00
10135d4814 fix resume from latest step for single-run (#1805)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: add STABLE marker files to orchestrator checkpoints

Previously, orchestrator checkpoints did not create STABLE marker files,
causing the trainer's resume logic to fail when resuming with resume_step=-1.
The trainer would not find any STABLE files and incorrectly default to step 0,
even when orchestrator checkpoints existed at later steps.

This fix adds mark_stable() method to the orchestrator CheckpointManager
and calls it after successfully saving checkpoints, matching the behavior
of the trainer checkpoint manager.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: use mark_stable method in WeightCheckpointManager for consistency

Previously, WeightCheckpointManager directly touched the STABLE file
instead of using a dedicated method. This adds a mark_stable() method
to match the pattern used in CheckpointManager and OrchestratorCheckpointManager.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* make public methods

* indent

* consistency

* do not write stable from orch + search for any run ckpt dirs

* require stable for multi-tenant

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-19 13:57:35 -08:00
Mika SenghaasandGitHub 29cc7b24ef increase health check interval (#1833)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-19 04:29:43 -08:00
deb1aa92bc fix MiniMax M2 LoRA compatibility in vLLM inference (#1831)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix MiniMax M2 LoRA compatibility in vLLM inference

vLLM's MiniMax M2 model has two issues preventing MoE LoRA from working:

1. The MoE gate (router) uses float32 params and casts inputs to float32,
   but vLLM's LoRA Triton kernel only supports float16/bfloat16. Fixed by
   recreating the gate in model dtype and removing the float32 cast.

2. PrimeRL saves adapter keys as mlp.experts.{j}.gate_proj/down_proj/up_proj
   but vLLM expects block_sparse_moe.experts.{j}.w1/w2/w3. Fixed by adding
   hf_to_vllm_mapper on the model to remap adapter keys on load.

Also adds debug configs for MiniMax M2 and Qwen3 MoE LoRA RL training.

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

* remove debug LoRA config files

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

* improve comments explaining MiniMax M2 LoRA patches

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:18:33 -08:00
5c3008b3a5 Remove reload_weights_on_start dead code (#1829)
Release / Push CUDA image to Docker (push) Canceled after 0s
* dont reload weights by default

* Remove reload_weights_on_start config and dead code path

The reload_weights mechanism was a no-op in practice: vLLM servers
start with base weights already loaded, and LoRA runs already
skipped the reload. Remove the config field, server endpoint,
client function, and orchestrator branching.

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

* Remove helo/orchestrator.toml from branch

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

* Add changelog entry for reload_weights_on_start removal

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

---------

Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:35:18 -08:00
samsjaandGitHub 54b3e4cd24 remove hash from logs (#1830)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-18 17:20:58 -08:00
JannikStandGitHub bc55a1c85a pass json_logging to env servers (#1823)
Release / Push CUDA image to Docker (push) Canceled after 0s
* pass json_logging to env servers

- pass json_logging to ZMQEnvServer in standalone env-server entrypoint
- add json_logging param to spawn_env_server()
- pass config.log.json_logging in orchestrator spawn calls

* bump verifiers to 013d4da (json_logging support)

* remove duplicate
2026-02-18 16:18:23 +01:00
Mika SenghaasandGitHub 6f9c1362a1 env server recovery (#1816)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add exp

* bump vf

* setup timeouts and logging interception

* bump and use built-in wait for server health

* no prefix

* bump and show info logs

* add name and intercept without prefix

* slower health checks

* bump to lower health timeout

* back to 8k seq len

* bump

* update log interception and new config

* get free port pair

* bump to have prime-rl env server logs

* mini

* bump

* do not intercept on env server

* bump vf

* copy lock

* update lock

* remove configs
2026-02-18 07:08:51 -08:00
46d210bf6e add multimodal test to nightly CI (#1815)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix vlm in transformers 5

* improve

* fix bug

* rename

* fix: auto-install transformers v5 compat hook for vLLM workers

* refactor: use vLLM plugin system instead of .pth hook for transformers v5 compat (#1810)

Replace the runtime site-packages mutation (.pth file + generated module)
with a vllm.general_plugins entry-point. vLLM loads general plugins in
every process it spawns (workers, engine core, API servers), so the patch
survives multiprocessing spawn without writing to site-packages.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* minor fixes

* add nightly for multimodal

* improve exact config

---------

Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:58:05 -08:00
halleriteandGitHub 1e365924ac fix VLMs after transformers bump (#1806)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-17 23:19:56 +01:00
halleriteandGitHub decced2093 add gibberish & repetition filtering (#1746)
Release / Push CUDA image to Docker (push) Canceled after 0s
---------

Signed-off-by: hallerite <git@hallerite.com>
2026-02-17 22:46:10 +01:00
a77725e5c0 refactor(slurm): move NCCL and runtime configs from template to config (#1818)
Release / Push CUDA image to Docker (push) Canceled after 0s
* refactor(slurm): move NCCL and runtime configs from template to config

- Add port/timeout fields to SharedWeightBroadcastConfig
- Propagate port/timeout in auto_setup_weight_broadcast
- Add auto_setup_slurm_nccl validator that sets:
  - orchestrator.num_train_workers from SLURM topology
  - trainer.weight_broadcast.host to 0.0.0.0
  - trainer.weight_broadcast.inference_world_size from SLURM topology
- Add validate_inference_config to catch missing inference config early
- Remove hardcoded env vars and CLI args from SLURM template

Only --weight_broadcast.host $MASTER_ADDR and --client.base-url remain
as CLI args (runtime values from SLURM).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* feat(slurm): add rl_slurm entrypoint and update docs

- Add rl_slurm script entrypoint to pyproject.toml
- Update docs to use `uv run rl_slurm` instead of `uv run python -m prime_rl.slurm.rl`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 13:42:59 -08:00
3102ca47cb Add SLURM entrypoint with Jinja2 template (#1774)
Release / Push CUDA image to Docker (push) Canceled after 0s
* refactor config

* Add SLURM entrypoint with Jinja2 template and tmux launcher

Adds a new `rl_slurm` entrypoint that resolves the full RL config,
dumps sub-configs as TOML, renders a SLURM batch script from a Jinja2
template, and submits it via sbatch (with --dry-run option). Includes
a tmux launcher for monitoring trainer/orchestrator/inference logs and
documentation.

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

* fix ruff formatting

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

* fix(slurm): sync orchestrator output dir with cleanup

Co-authored-by: samsja <samsja@users.noreply.github.com>

* test(configs): include slurm config parser in config loading test

Co-authored-by: samsja <samsja@users.noreply.github.com>

* add auto dir

* fix(slurm): move auto_setup_output_dir to BaseRLConfig so SLURM entrypoint propagates output_dir

RLSLURMConfig extends BaseRLConfig, not RLConfig, so the validator that
propagates output_dir to trainer and orchestrator was never running.
This caused the Jinja template cleanup to target wrong paths and the
trainer to pick up stale rollouts.

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

* add args

* feat(slurm): make config more flexible and self-contained

- Replace base_dir/env_file/venv with single project_dir
- Add gpus_per_node (default 8) to remove hardcoded GPU counts
- Add nodes_per_fsdp_group to auto-compute dp_replicate
- Use -m module syntax for torchrun instead of file path
- Derive .env and .venv paths from project_dir

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

* fix many stuff

* add math

* addexamples

* add moe example

* docs(slurm): update to Hendrycks Math examples with MoE config

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

* fix: add required output_dir to slurm example configs

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-02-17 13:10:27 -08:00
7c40b334e6 fix: MoE weight conversion for vLLM compatibility (#1812)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: use per-expert format in MoE weight conversion for vLLM compatibility

convert_tt_layer_to_hf was producing transformers v5 fused format
(experts.gate_up_proj, experts.down_proj) but vLLM expects per-expert
format (experts.{j}.gate_proj.weight, etc). This caused KeyError during
weight updates in the inference server. Also adds MoE RL integration
tests for both hf and custom impl.

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

* fix: use underscores in MoE TOML config keys

Hyphens only work as CLI args, TOML config needs underscores.

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

* test: remove HF round-trip tests for MoE models

The MoE weight conversion now outputs per-expert format for vLLM
compatibility, which is incompatible with HF transformers 5.0+ fused
format. Remove the round-trip tests that loaded converted weights
back into HF models since vLLM is the target format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-02-17 12:28:55 -08:00
aaeb711501 Add MiniMax M2.1 MoE model support (#1773)
Release / Push CUDA image to Docker (push) Canceled after 0s
Implement full pipeline for MiniMax M2.1 (230B MoE, 10B activated/token):
modeling code, HF<->PrimeRL weight conversion, registration, and mini-model
verification.

Key additions:
- Per-layer QK norm support in shared attention (qk_norm_type="per_layer")
- MiniMax M2.1 model module with config, conversion, and modeling
- Mini model preset for testing at small scale
- Refactored mini_moe.py to support remote-code HF models

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 11:07:04 -08:00
minh hoangandGitHub 6c8faec459 helm:specify deployment component in container name (#1793)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-17 16:24:02 +01:00
Mika SenghaasandGitHub 95a53f39e7 implement optional cancellation of inflight rollouts before eval (#1802)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-16 12:30:12 -08:00
halleriteandGitHub 0756df77c1 fix missing param (#1808)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-16 10:20:14 -08:00
66b1f4b6b7 configure default logger instead of raise (#1804)
Release / Push CUDA image to Docker (push) Canceled after 0s
* configure default logger instead of raise

* fix: cleanup old logger resources when calling setup_logger

Calling setup_logger multiple times now properly cleans up the old
logger instance by calling logger.remove() before creating a new one.
This prevents resource leaks:
- Background threads from enqueue=True handlers are stopped
- JsonFileSink file handles are properly released

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: add cleanup to reset_logger to prevent resource leaks

Calling reset_logger now properly cleans up the logger instance by
calling logger.remove() before setting _LOGGER to None. This ensures
that any active handlers (file sinks, enqueued handlers, background
threads) are properly released, matching the cleanup pattern in
setup_logger.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 09:52:47 -08:00
bb5e48292d fix: upgrade flash-attn from 2.6.3 to 2.8.3 (#1803)
Release / Push CUDA image to Docker (push) Canceled after 0s
The downgrade from 2.8.3 to 2.6.3 happened during the vllm/transformers
bump (commit 8f2e6bbc) when PyTorch was upgraded from 2.9 to 2.10.

Flash-attn 2.6.3 does not support Blackwell GPUs (compute capability 12.0),
causing "FlashAttention only supports Ampere GPUs or newer" errors.

This upgrades back to 2.8.3 which may have better compatibility with newer
GPU architectures. The 2.8.3 wheel for torch 2.10 + cu128 is available in
the same v0.7.16 release.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 07:53:46 -08:00
187b7a438c fix env server deadlock (#1801)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix(deps): bump verifiers to e629347 (ZMQ env server deadlock fix)

The ZMQ env server used asyncio.wait_for around recv_multipart which
has a race condition in CPython's Task cancellation that silently
discards consumed messages. The verifiers fix replaces it with a
zmq.asyncio.Poller.

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

* use spawn method

* bump to commit on main

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 05:06:00 -08:00
faresobeidandGitHub 1b725b84b8 track prefill vs decode tokens (#1797)
Release / Push CUDA image to Docker (push) Canceled after 0s
* track prefill vs decode tokens

* fix ruff
2026-02-16 00:47:04 +00:00
c28eaf874b Alphabetical sort CI tests (#1784)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Align alphabet-sort nightly test with reverse-text checks

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Add alphabet-sort integration CI test and config

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Isolate alphabet-sort integration logs per run

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Reduce alphabet-sort CI runtime and raise timeout

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Seed resume output with alphabet-sort checkpoints

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Copy resume weights for alphabet-sort integration

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Simplify alphabet-sort integration test to single run

Co-authored-by: samsja <samsja@users.noreply.github.com>

* Remove unused alphabet-sort resume CI config

Co-authored-by: samsja <samsja@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
2026-02-15 15:33:58 -08:00
JannikStandGitHub 26db10418e WIP fix: call evaluate with explicit keyword arguments (#1792)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix: call evaluate with explicit keyword arguments

* chore: apply ruff format to vf utils

* fix: lazy client selection for elastic inference during evals

* refactor: make clients optional, remove redundant params from eval calls
2026-02-15 14:06:11 -08:00
c2a84f5604 fix(logging): route fatal errors through custom JSON logger instead of default loguru (#1789)
Release / Push CUDA image to Docker (push) Canceled after 0s
@logger.catch used loguru's default global logger, not the custom logger
created by setup_logger(). This meant fatal exceptions bypassed the JSON
formatter entirely. Move exception logging into clean_exit using get_logger(),
with a safe fallback to loguru's default if the logger isn't set up yet.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:41:59 -08:00
faresobeidandGitHub bdac9df86e replace round robin (#1791)
Release / Push CUDA image to Docker (push) Canceled after 0s
* replace round robin

* fix

* ruff
2026-02-15 15:16:25 +00:00
Mika SenghaasandGitHub 39ce147af0 bump vf v0.1.11.dev0 (#1780)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fix custom token endpoint

* bump vf

* fix import

* use tito client via client_config not interleaved_rollout kwarg

* cosmetic

* revert lock

* update lock

* bump bump bump

* bump more
2026-02-15 06:11:33 -08:00
Mika SenghaasandGitHub 5e9548d425 make eval retries configurable and default to no retries (#1775)
Release / Push CUDA image to Docker (push) Canceled after 0s
2026-02-14 18:21:13 -08:00
3d1056a607 ci: add devx tag workflow from latest release (#1786)
Release / Push CUDA image to Docker (push) Canceled after 0s
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
2026-02-14 17:15:42 -08:00
1a588975bf Devx version tag automation (#1783)
Release / Push CUDA image to Docker (push) Canceled after 0s
* ci: auto-create dev tags from latest release

Co-authored-by: samsja <samsja@users.noreply.github.com>

* ci: split dev tag workflow and handle missing releases

Co-authored-by: samsja <samsja@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
2026-02-14 16:56:44 -08:00
Mika SenghaasandGitHub 82417b0158 vllm validation patches (#1782) 2026-02-14 15:35:56 -08:00
Mika SenghaasandGitHub c0657c5d43 fix custom token endpoint (#1781) 2026-02-14 15:35:46 -08:00
Mika SenghaasandGitHub 4ae67c32cc clean deps (#1750)
* bump vf bc9fcd5

* clean pyproject

* add back reverse-text

* remove accelerate

* bring back liger

* revert lock file

* copy lock

* update lock

* revert lock

* update all
2026-02-14 15:35:35 -08:00
8f2e6bbccc bump vllm to 0.16 and transformer to 5 (#1731)
* add glm flash

* update vllm to nighjlty

* fix moe

* fix glm

* fix ruff

* fix: resolve unit test failures

- Add return_dict=False to apply_chat_template calls in SFT data processing
  (transformers now returns BatchEncoding by default instead of list[int])
- Handle missing pad_token_id in MoE model config for test_perf_counter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: update models for transformers 5.0.0 compatibility

- Remove deprecated rope_config_validation calls from configs
- Add pad_token_id attribute to MoE configs
- Add compute_default_rope_parameters to RotaryEmbedding classes
- Add attribute_map for num_local_experts in Glm4MoeConfig
- Override get_correct_experts_implementation in PreTrainedModelPrimeRL
- Update state dict conversion to handle new fused gate_up_proj format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: address Cursor bot review comments

- Fix temperature parameter type in Glm4MoeLiteForCausalLM (High):
  Changed from Optional[float] = 1.0 to Optional[torch.Tensor] = None
  to match other models and avoid crash with FusedOutputLinear

- Fix SDPA/flex_attn support flags (Medium):
  Set _supports_sdpa and _supports_flex_attn to False since the model
  only implements flash attention

- Update GLM4MoeLite conversion for transformers 5.0 fused format (High):
  Added support for new gate_up_proj fused format in convert_hf_layer_to_tt
  and convert_tt_layer_to_hf to match glm4_moe and qwen3_moe

- Fix return_dict keyword argument order in sft/data.py (Low):
  Use dict merge pattern to avoid duplicate keyword argument crash
  when chat_template_kwargs contains return_dict

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: update is_hf_state_dict to detect transformers 5.0 fused format

The is_hf_state_dict methods now check for both:
- Old per-expert format: mlp.experts.1.up_proj
- New fused format (transformers 5.0+): mlp.experts.gate_up_proj

Updated in: glm4_moe, glm4_moe_lite, qwen3_moe

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix smth

* fix glm

* remove glm flash

* fix: format serving_chat_with_tokens.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: update vllm 0.15 API compatibility

- Remove get_prompt_components import, use _extract_prompt_text instead
- Rename update_weights to update_weights_from_path to avoid conflict with vllm's built-in method

* feat: add revert_weight_conversion for transformers models

For non-PrimeRL transformers models (e.g., Glm4MoeLiteForCausalLM),
the internal fused format (experts.gate_up_proj) needs to be reverted
to the original HF hub format (experts.{j}.gate_proj.weight) for vLLM
compatibility.

Uses transformers' built-in revert_weight_conversion which:
- Unfuses MoE expert weights for models with conversion mappings
- No-ops for dense models (returns state_dict unchanged)

Applied to:
- ckpt.py: checkpoint saving
- nccl.py: NCCL weight broadcast
- filesystem.py: filesystem weight broadcast

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: CI vLLM CUDA bug and update baselines for transformers 5.0

- Add VLLM_WORKER_MULTIPROC_METHOD=spawn to fix CUDA driver init bug
- Update benchmark baselines for transformers 5.0 memory usage:
  - 1-GPU: 19.5 GiB -> 22.7 GiB
  - 4-GPU: 12.4 GiB -> 14.1 GiB

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* docs: add clarifying comments for vLLM 0.15 API changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Revert "docs: add clarifying comments for vLLM 0.15 API changes"

This reverts commit 84c62da44dba60dc5c712a21bdf903908b83de0b.

* bump t5 and vllm

* bump fa

* chore: sync uv.lock after rebase

* feat: update transformers to support GLM-5

Update transformers to main branch (commit 609e3d5) which includes
GlmMoeDsa (GLM-5) support. Add override-dependency to work around
vllm's transformers<5 constraint.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: restore weight tying after to_empty() for HF models

The to_empty() call breaks weight tying by allocating separate tensors
for lm_head.weight and embed_tokens.weight. This adds tie_weights() calls
after to_empty() to restore proper weight sharing.

Also reverts benchmark baselines to original values since the fix
eliminates the memory regression.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* chore: update baselines for transformers 5.0 memory usage

Transformers 5.0 uses ~16% more peak memory. The tie_weights() fix
doesn't help because FSDP already preserves weight tying through
to_empty(). Accept the new memory baseline.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* chore: upgrade to vLLM 0.16.0 official release

Use the official vLLM 0.16.0 release wheel from GitHub releases
instead of the nightly index. Key features:
- PyTorch 2.10 support
- Transformers v5 compatibility
- GLM-5 model support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: add attribute_map for MoE configs transformers 5.0 compatibility

Add attribute_map = {"num_local_experts": "num_experts"} to Qwen3MoeConfig
and AfmoeConfig to match the pattern used in Glm4MoeConfig for
transformers 5.0 compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 14:00:38 -08:00
Mika SenghaasandGitHub a3251c9e52 set recompile limits (#1778) 2026-02-13 12:32:34 -08:00
samsjaandGitHub a81f9bcfa1 fix uv warning (#1772) 2026-02-12 17:23:55 -08:00
258638503c Add --dump-config flag to rl command (#1771)
* Add `--dump-config` flag to rl command

Adds a `dump_config: Path | None` parameter to `RLConfig`. When set,
resolved subconfigs are written to the given directory and the process
exits without starting any services.

Also refactors config serialization into a shared `write_subconfigs`
function used by both the dump path and the normal run path.

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

* Add dump_config entry to CHANGELOG

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

* Add warning messages to --dump-config mode

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

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:23:44 -08:00
Ido HakimiandGitHub 491d891825 Fix torch distributed warning messge by adding device_id handling (#1756) 2026-02-12 16:07:31 -08:00
b55dcaa356 set default api key var to vllm (#1767)
* use VLLM_API_KEY by default

* add CHANGELOG entry for api_key_var default change

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: samsja <55492238+samsja@users.noreply.github.com>
2026-02-12 13:47:41 -08:00
Mika SenghaasandGitHub e327ca2600 log env name not env id (#1768) 2026-02-12 12:21:57 -08:00
Varun SinghandGitHub 05682882da add flash attn for afmoe (#1766)
* add flash attn for afmoe

* run ruff format
2026-02-12 11:36:44 -08:00
Varun SinghandGitHub 0db8d49f48 fix muon hparam passthrough (#1754)
* fix muon hparam passthrough

* ruff format
2026-02-12 11:36:08 -08:00
faresobeidandGitHub b84a07a251 fix off policy tracker bug (#1764) 2026-02-12 03:08:14 -08:00
f274fa312a fix weight checkpoint saving for tied-embedding models (#1765)
Co-authored-by: kalomaze <kalomaze@users.noreply.github.com>
2026-02-11 23:28:18 -08:00
samsjaandGitHub 67ab5d1da6 add mini moe (#1759) 2026-02-11 17:21:14 -08:00
JannikStandGitHub 8117c00ad6 Fix checkpoint step ordering bug (#1762)
Use bisect.insort to maintain sorted order when adding new checkpoint steps.
Previously, appending to the list could break sort order when saving a checkpoint
with a step number lower than existing ones, causing AssertionError in maybe_clean().
2026-02-11 17:24:17 +01:00
Jackmin801andGitHub 08f8c643cf Fix checkpoint cleanup crashing trainer on OSError (#1763)
* Fix checkpoint cleanup crashing trainer on OSError

When external processes (e.g. checkpoint uploader) hold open file handles
on checkpoint directories, shutil.rmtree can fail with "Directory not
empty". Skip the deletion and log a warning instead of crashing — the
next maybe_clean call will retry.

* Retain failed-to-delete steps in ckpt_steps for retry

Steps where rmtree fails were being removed from ckpt_steps, making
them orphaned and never retried. Track which deletions succeed and
only remove those from the list.

* Restore debug logging before checkpoint deletion

* Revert ckpt_steps tracking, just skip failed deletions

The steps_deleted tracking caused state divergence across ranks since
only master populates it. Keep the original ckpt_steps pruning logic
and accept potential disk leak over complexity.
2026-02-11 00:37:56 -08:00
Jackmin801andGitHub 869717456f Fix model weight loading: crash fix and memory optimization (#1760)
* Fix IndexError in load_state_dict sort for non-standard safetensor filenames

The sort assumed filenames follow the `model-NNNNN-of-NNNNN.safetensors`
convention, crashing on files like `model.safetensors`. The sort is
unnecessary since the function merges all shards into a flat dict where
key order doesn't matter.

* Only load full snapshot on master rank for format conversion

Previously all ranks loaded the full model weights into CPU memory just
to check key names for format detection. Now all ranks read only the
safetensor key names (no tensor data), and only master loads the full
state dict when conversion is actually needed.
2026-02-11 00:22:56 -08:00
294cd9f541 chore: bump wandb to 0.24.2 (#1758)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: samsja <samsja@users.noreply.github.com>
2026-02-10 19:56:53 -08:00
manveerandGitHub b05c0392e4 ENG-2586: Use presigned URLs when uploading samples (#1620)
* Use presigned URLs when uploading samples

* bugbot

* bugbot

* ruff format

* bugbot

* Simplify

* Update lock
2026-02-10 08:53:39 +01:00
crStivandGitHub 6fd4f698c2 docs: fix typos (#1751)
* Fix typo in precedence explanation in configs.md

Signed-off-by: crStiv <cryptostiv7@gmail.com>

* Fix typos and improve clarity in deployment.md

Signed-off-by: crStiv <cryptostiv7@gmail.com>

---------

Signed-off-by: crStiv <cryptostiv7@gmail.com>
2026-02-09 20:42:36 -08:00
DominikandGitHub 1ebb7dd439 Fix eval metrics type not json serializable. (#1752) 2026-02-09 20:04:56 -08:00
Jackmin801andGitHub 050490e0f6 Fix broadcast alpha rank (#1729)
* save lora config with orchestrator alpha and rank

* move alpha definition to orchestrator

* making rank default to trainers rank makes more sense
2026-02-09 16:14:14 -08:00
Mika SenghaasandGitHub a35a721817 bump vf (bc9fcd5) (#1749)
* bump vf bc9fcd5

* update lock

* retrigger ci
2026-02-09 09:54:39 -08:00
halleriteandGitHub 5cdada6457 add directory for skills & skill for starting prime-rl's vllm server (#1747)
* add skills dir & first skill for vllm

* remove unimplemented stuff

* make symlink relative

* make separate config skill

* update AGENTS.md & skills

* make more explicit
2026-02-08 21:13:07 -08:00
31b48b8b10 env worker integration (#1714)
* start env servers for env group

* bump

* working reverse-text

* correctly set log levels

* use client configs everywhere + make val work

* cycle through clients via inference pool

* update model name

* deprecate env worker

* implement evals

* deprecate evals+synthesize

* deprecate serialization

* use all clients for evals

* simplify config

* fix types and use inference pool for opd

* bring back logging intercept

* setup env client/server in prime-rl

* externalize running env server

* style

* bring back rate limiter on scheduler

* revert vf branch

* back to custom branch

* do not double asyncio

* bring back eval

* fix cpu tests

* bump vf

* add math group config

* remove stop server call

* add logs

* remove last mentions of vf.State

* deprecate some configs

* more

* remove eval + cpu integration tests

* remove evals + synthesize configs

* bump vf

* fix branch with vlm cache

* do not reference rollout status

* use correct model name

* stop teacher infer pool if setup

* update changelog

* deprecate server discovery (unused)

* fix env id stripping

* use updated model name for evals

* strip env version on env server

* remove server discovery tests

* bump vf

* do not fail if env server not yet up

* add elastic sanity check

* update docs

* use extra env kwargs consistently across orch and env server

* update math group config

* update cfg

* use dynamic model name in final evals

* add extra_env_kwargs to changelog

* resolve vf merge conflicts

* assert lora name not None

* fix unit tests

* fix types

* add hendrycks math sanity check

* bump vf

* do not double repeat eval inputs

* do not duplicate eval inputs

* lower avg@

* Initialize logger in env-server before install_env (#1743)

install_env() calls get_logger() which requires the logger to be set up first.
This was missing in env-server but present in orchestrator.

* disable vf logging on orch

* Fix elastic autoscaling: use base model for health checks (#1745)

The health check was using `model_name` which gets updated to the LoRA
adapter name after training starts. New inference servers only have the
base model, so they would fail health checks and never get added to the
pool.

Store the original model name as `base_model_name` and use it for health
checks, allowing new servers to be discovered and have the LoRA adapter
loaded on them.

---------

Co-authored-by: JannikSt <JannikSt@users.noreply.github.com>
Co-authored-by: William Brown <williambrown97@gmail.com>
2026-02-08 19:59:35 -08:00
Sebastian MüllerandGitHub 125012f8d7 Update prime-rl to newest verifiers main (#1744)
* Replace save_to_disk with save_outputs

* point verifiers to a fixed version

* bump verifiers pin to newest main

* update uv.lock
2026-02-08 17:42:35 -08:00
b0cabb979e add enable prefix caching arg passthrough to vllm (#1733)
* add enable prefix caching arg passthrough to vllm

* add comment

---------

Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
2026-02-08 10:15:35 +01:00
halleriteandGitHub 1f355411b5 move side-effects out of config (#1741)
* move side-effects out of config

* add back justification
2026-02-07 17:38:53 -08:00
halleriteandGitHub 922582d04f set VLLM_WORKER_MULTIPROC_METHOD=spawn by default (#1740)
* auto set necessary vllm vars for vlms

* make spawn general

* remove unnecessary vllm env var & improve docs
2026-02-07 16:16:37 -08:00
halleriteandGitHub 663e9d264a fix bug introduced in prev pr (#1739) 2026-02-07 14:10:41 -08:00
kalomazeandGitHub 7b95af5874 [QoL] Multiple small sanity checks (#1684)
* validate client port matches inference server

* error on existing GPU processes before training

* respect resume_step config in trainer

* format rl.py

* fix defenseslop

* move port validation from config to runtime
2026-02-06 23:00:46 -08:00
halleriteandGitHub 8dbd955a06 best-effort interleaving (#1674) 2026-02-06 21:09:19 -08:00
a78bbfa856 docs: add release notes guidelines to AGENTS.md (#1734)
* docs: add release notes guidelines to AGENTS.md

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

* docs: add style reference step to release guidelines

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:27:10 -08:00
f870f3cbd8 Feature: bring your own algorithms (#1715)
Release / Push CUDA image to Docker (push) Canceled after 0s
* update loss interface

* refactor: rename grpo_loss to prime_rl_loss and consolidate loss interface

- Rename grpo_loss to prime_rl_loss (uses LossConfig directly)
- Move LossInputs, LossOutputs, LossFn from loss_interface.py into loss.py
- Remove loss_interface.py

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

* feat: add bring-your-own-loss support for custom loss functions

- Add CustomLossConfig with path and kwargs fields
- Add LossConfigType union (LossConfig | CustomLossConfig)
- Update setup_loss_fn to handle custom loss imports
- Add _import_object helper for dynamic imports
- Add test for custom loss configuration
- Add docs/bring-your-own-loss.md documentation

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

* feat: add bring-your-own advantage function support

- Add AdvantageInputs/AdvantageOutputs dataclasses
- Add CustomAdvantageConfig with path and kwargs
- Add setup_advantage_fn for custom advantage imports
- Refactor compute_advantages to use the new interface
- Add tests for custom advantage configuration
- Rename docs to bring-your-own-algorithms.md with both loss and advantage sections

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

* refactor: rename path to byo_function in custom configs

More descriptive name that ties into the "bring your own" concept.

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

* refactor: address PR review feedback

- Extract import_object to shared utils (deduplicate from loss.py and advantage.py)
- Add pydantic discriminator types for LossConfigType and AdvantageConfigType
- Rename byo_function to import_path (standard Python terminology)
- Rename grpo_advantage to default_advantage
- Fix train.py AttributeError when using CustomLossConfig
- Fix docs: per-example terminology, loss/advantage descriptions, config examples

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

* docs: update prime_rl_loss description

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

* fix: handle custom loss metrics in training loop and restore extra=forbid on AdvantageConfig

- Guard mismatch_kl access in micro-step and step logging (custom loss may not emit it)
- Change AdvantageConfig base from BaseModel to BaseConfig to restore extra="forbid" validation

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

* refactor: rename prime_rl_loss to default_loss_fn

Consistent with default_advantage naming.

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

* refactor: simplify loss setup logging

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

* refactor: rename default_advantage to default_advantage_fn

Consistent with default_loss_fn naming.

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 12:51:59 -08:00
Matej SirovatkaandGitHub bd087277d5 Flash-attention-4 (#1726)
* Feat: initial

* Feat: fa4 cleanup

* Changelog

* Im done

* Fix

* Fix

* changelog

* Cleanup

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-02-06 11:25:35 -08:00
db92bb0fc6 fix swe update (#1730)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-02-06 10:32:23 -08:00
c87c19ba86 Add FA3 ring-attention kernel wrapper and benchmark coverage (#1727)
* Add FA3 ring-attention wrapper for CP and benchmark mode

* Remove benchmark script, pass attn_impl directly, add CP+FA3 impl validator

* Extract ring FA3 autograd into ring_attn.py, remove deep nesting from attn.py

* Update changelog for FA3 CP constraint

Co-authored-by: Matej Sirovatka <S1ro1@users.noreply.github.com>

* Fix: comments

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Matej Sirovatka <S1ro1@users.noreply.github.com>
2026-02-05 17:30:53 -08:00
JannikStandGitHub 8695aa10f8 Strip @version suffix from env IDs before loading as Python modules (#1724)
Platform sends versioned env IDs (e.g. d42me/meow@0.1.5) for installation.
The version must be stripped before passing to vf.load_environment() since
importlib.import_module() cannot handle @ in module names.
2026-02-05 20:58:58 +01:00
JannikStandGitHub 0041a93a45 Fix int64 JSON serialization in Chinese character metrics (#1725) 2026-02-05 10:27:59 +01:00
NPandGitHub d2ab3a43a9 handle empty completion_temperatures in prepare_sample (#1720) 2026-02-04 18:34:28 -08:00
2f7f07bf80 feat: Add AMD Instinct MI300X/MI325X peak FLOPS for MFU calculation (#1722)
Add peak BF16 FLOPS specifications for AMD Instinct accelerators:
- MI300X: 1307.4 TFLOPS
- MI325X: 1307.4 TFLOPS (same compute dies as MI300X, more HBM3e)

This enables accurate MFU reporting when training on AMD GPUs instead of
falling back to A100 baseline which produces misleading >100% MFU values.

Co-authored-by: Daniel Zautner <daniel.zautner@silo.ai>
2026-02-04 16:26:09 -08:00
faresobeidandGitHub 456e8cdc6e track chinese characters (#1700)
* track chinese characters

* ruff

* add extra check
2026-02-04 12:09:55 -08:00
9d40e5e6bf fix: use stable checkpoints for orchestrator resume (#1712)
* fix: use stable checkpoints for orchestrator resume

Only consider checkpoints with STABLE file when resuming, preventing
crash when orchestrator restarts before trainer finishes saving weights.

* fix: wait for checkpoint to become stable with timeout instead of skipping

* feat: make stability timeout configurable with 1000s default

* chore: log stability wait every 60s instead of 30s

* fix: add opt-in wait_for_stable_checkpoint config for orchestrator resume

* refactor: extract wait_for_stable_checkpoint helper, minimal orchestrator change

* fix: sort imports

* fix: import resolve_latest_ckpt_step from utils

* fix: formatting

* fix: add wait_for_weights_timeout option to wait for weight dir when resuming

* Update src/prime_rl/orchestrator/utils.py

Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Signed-off-by: JannikSt <JannikSt@users.noreply.github.com>

* cleanup contd.

* format

* readd docstring

* remove unused import

* adjust path for stable file

* ensure weight dirs exist

---------

Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2026-02-04 03:08:40 +01:00
JannikStandGitHub d74bf06d27 Add podManagementPolicy: Parallel to inference and trainer StatefulSets (#1718) 2026-02-04 01:52:58 +01:00
JannikStandGitHub 64c214bf9c Add health probes for inference and trainer (#1719)
* Add health probes for inference and trainer components

* Disable health probes by default
2026-02-04 01:51:52 +01:00
e41036a163 Add optimizer state CPU offload (#1694)
* [feature] add optimizer state CPU offload

Add CPUOffloadOptimizer that keeps optimizer states (exp_avg, exp_avg_sq)
on CPU, moving them to GPU only during optimizer.step(). Unlike FSDP's
CPUOffload, this keeps weights on GPU to avoid H2D all-gather overhead.

- Add optim_cpu_offload config option to ModelConfig
- Integrate into SFT trainer
- Works with DTensor/FSDP2 by operating on _local_tensor

Trade-off: saves ~2GB GPU memory for 0.6B model but ~10x slower due to
per-tensor transfer overhead. Best for memory-constrained scenarios.

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

* Refactor: move CPU offload logic into setup_optimizer and setup_scheduler

- setup_optimizer now handles wrapping with CPUOffloadOptimizer internally
- setup_scheduler now handles extracting base optimizer from CPUOffloadOptimizer
- Simplified SFT train.py to just pass cpu_offload flag

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

* Shorten docstring

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

* Add validation to prevent both cpu offload options enabled

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

* Move DTensor import to top of file

Co-authored-by: sami <sami@primeintellect.ai>

* docs: add changelog for optim_cpu_offload

Co-authored-by: sami <sami@primeintellect.ai>

* Fix CPU offload pinning race

Co-authored-by: sami <sami@primeintellect.ai>

* fix: avoid mutating DTensor state

Co-authored-by: sami <sami@primeintellect.ai>

* Fix checkpointing with CPUOffloadOptimizer

The checkpoint system uses PyTorch's get_state_dict/set_state_dict which
expect actual Optimizer objects. CPUOffloadOptimizer is a wrapper, so we
need to extract the base optimizer for checkpointing and re-initialize
the wrapper state after loading.

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

* Add docstring clarifying _move_states behavior

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

* fix devise

* fix: pass optim_cpu_offload to RL optimizer setup

- Add cpu_offload parameter to setup_optimizer call in RL training
- Add validation to prevent optim_cpu_offload with max_concurrent_runs > 1

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

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-02-03 15:29:37 -08:00
samsjaandGitHub a2ce702a7d update agents md (#1710) 2026-02-03 15:28:56 -08:00
63863647e4 fix rac e condition (#1717)
Co-authored-by: Mika Senghaas <mail@mikasenghaas.de>
2026-02-03 15:28:22 -08:00
a0d889cb72 Add a rate limit on worker job submission (#1711)
* feat: Add task rate limiting for environment workers

* fix: Update maximum sandbox tasks to disable rate limiting

* update lock

* refactor: Remove tasks_per_minute references from tests

* feat: Add optional rate limiting for sandbox tasks per worker

* feat: Add optional rate limiting for task executions

* feat: Add optional rate limiting for tasks per minute

* test: Add tasks_per_minute to env_worker tests

---------

Co-authored-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
2026-02-03 14:13:44 -08:00
Mika SenghaasandGitHub 65ba487034 bump vf (dfc473c) (#1708)
* bump vf

* use ckpt consistently

* fix imports

* make env worker run

* fix utils used in eval and synthesize endpoint

* restore old semaphore behavior

* remove unnessary semaphore setup

* set max_concurrent_groups

* fix to make concurrency global

* fix key error

* access oai_tools safely

* use vf retries

* use new types

* consistent tool handling

* misc
2026-02-03 02:50:02 -08:00
halleriteandGitHub 4fb4639616 add multi-turn support for multi-modal RL (#1703) 2026-02-02 20:06:41 -08:00
JannikStandGitHub 3194b161a6 Add JSON structured logging for log aggregation (#1681)
* Add JSON structured logging option for log aggregation

* Add CHANGELOG entry and fix default value pattern

* Pass JSON logging config to env workers

* Wire JSON logging to all entrypoints (eval, synthesize, sft)

* Pass JSON logging to eval subprocesses

* Rename json to json_logging to avoid Pydantic shadowing warning

* Use flat JSON format for log aggregation instead of loguru serialize

* Fix exception handling in JSON logger sinks

* Remove [verifiers] prefix from intercepted logs

* Fix outdated docstring for intercept_verifiers_logging

* Refactor JSON logging: dedupe, non-blocking sinks, fix CHANGELOG

* Remove unused close method from _JsonFileSink

* Include worker tag in JSON log output

* Create parent directories for JSON file sink

* Restore [verifiers] prefix for intercepted logs

* Rename json parameter to json_logging in setup_logger for consistency

* Replace tqdm with ProgressTracker for JSON logging compatibility

When JSON logging is enabled, progress bars are replaced with periodic
log messages (every 10%) to avoid garbled output. When disabled, tqdm
works as before.

* Fix file handle leak and emit structured progress events

- Add atexit cleanup for _JsonFileSink file handle
- Progress events now emit structured JSON with type/current/total/percent fields
- Remove unused is_json_logging function
- Add proper type hints for postfix dict

* Add step context to progress events and fix 0% jump

- Add optional step parameter to ProgressTracker
- Include step in JSON output and tqdm desc
- Don't emit 0% on init (only on actual progress)

* Keep tqdm output unchanged, only add step to JSON mode

* Remove enqueue=True from non-JSON handlers to fix tqdm

enqueue=True causes loguru to use background thread which
interferes with tqdm's terminal output. Only needed for JSON mode.

* Remove unreachable else branch in _emit_progress

* Fix typo in get_logger docstring

* Add lock to prevent interleaved JSON output

Both _json_sink (loguru background thread) and _emit_progress write
to stdout - without synchronization they can corrupt JSON lines.

* Route progress through loguru for single output path

Instead of writing directly to stdout (which needed a lock),
progress events now go through loguru with _progress marker.
_build_log_entry detects and formats them specially.

* Add level field to progress events for consistency
2026-02-03 00:21:52 +01:00
Matej SirovatkaandGitHub e71145acc5 Revert "Single cat dataset (#1706)" (#1709)
This reverts commit 309970c3ec.
2026-02-02 18:11:56 +01:00
Matej SirovatkaandGitHub 309970c3ec Single cat dataset (#1706)
* Feat: basic data pipeline

* Feat: single cat dataset
2026-02-01 14:27:19 +01:00
a3ba95b292 fix: eval watcher only picks up checkpoints in increasing order (#1702)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 23:17:39 -08:00
Jackmin801andGitHub f14c8d6c2d user inference pool client instead of starting one for validation (#1704) 2026-01-31 20:39:05 -08:00
Jackmin801andGitHub b798a90d6a [ci] benchmark test (#1696)
* weee test

* add it to gha

* 4gpu test

* add row for 4 x a6000 to benchamrks

* change the baseline a bit

* im not sure if we actually regressed :(

* up tolerance because massed compute suk
2026-01-31 20:13:51 -08:00
JannikStandGitHub e5566f9819 Add HF Hub timeout defaults to Dockerfile (#1699)
Defaults are 10s which causes issues on slow networks or large model downloads.
2026-01-31 16:23:32 -08:00
samsjaandGitHub e794fbe524 fix nccl update (#1693) 2026-01-30 16:06:52 -08:00
halleriteandGitHub 36959cbbac add multimodal training (experimental) (#1680) 2026-01-30 15:23:43 -08:00
a57550349c Lieger kernel model deprecation (#1691)
* Deprecate liger kernel model impl

Co-authored-by: sami <sami@primeintellect.ai>

* Remove liger_kernel impl option

Co-authored-by: sami <sami@primeintellect.ai>

* Restore historical changelog note

Co-authored-by: sami <sami@primeintellect.ai>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-30 14:46:46 -08:00
Jackmin801andGitHub 53ddafcbee remove cc check for grouped mm (#1692) 2026-01-30 14:46:29 -08:00
Jackmin801andGitHub 370221cb4e [fix] dont create config dir on trainer during config validation (#1690)
* dont ever create config dir

* add parsing error back

* remove test for error file on missing config
2026-01-30 12:56:06 -08:00
samsjaandGitHub 3ac5c20543 make nccl broadcast compatbile with dp (#1686) 2026-01-30 11:07:47 -08:00
Jackmin801andGitHub 25f604ed01 [ci] make multi run test do 2 gpu trainer and 2 inference servers (#1682)
* make multi run rl test run on 4xa6000

* make multi run test do 2:2
2026-01-29 15:16:42 -08:00
samsjaandGitHub 9ebcb8ef9c update agents (#1679) 2026-01-29 14:46:08 -08:00
manveerandGitHub 96ccece00f Fix bug where hosted RL rollouts were missing final msg (#1683) 2026-01-28 20:58:08 -08:00
kalomazeandGitHub af6709b20c [fix] add Gemma3 support (#1648)
* [fix] add Gemma3 support: final_logit_softcapping and meta device buffer handling

* [fix] handle softcap=0 as disabled

* [fix] use comment not docstring
2026-01-28 15:55:30 -08:00
Jackmin801andGitHub 137e36add5 [fix] zombie guard on checkpoint (#1670)
* zombie guard on checkpoint

* make the cleanup code safer

* make resume from latest stable so we dont try to resume from orchestrator only ckts

* simpler logic

* the old checkpoint step discovery is needed by single packer

* we need to relook for stable step in load_run otherwise packer might ahveincremented the step and we are introuble

* dont set step after ckpt load because we might reset packer progress
2026-01-28 15:41:08 -08:00
samsjaandGitHub 98c05cf656 only master clean weight (#1678) 2026-01-28 13:03:25 -08:00
a622429bfe Wandb async RL inflight (#1677)
* Add inflight rollout metric to scheduler

Co-authored-by: sami <sami@primeintellect.ai>

* Add inflight sample count metric

Co-authored-by: sami <sami@primeintellect.ai>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-28 10:37:31 -08:00
halleriteandGitHub 4fc312b0b0 add Temperature Scheduler (#1624) 2026-01-27 15:28:06 -08:00
samsjaandGitHub 22674559d4 cancel all rollout eval (#1671) 2026-01-27 11:28:06 -08:00
JannikStandGitHub 667fb388fa bump prime to 0.5.24 (#1673)
* bump prime to >=0.5.24

* update uv.lock for prime 0.5.24
2026-01-26 23:41:41 -08:00
halleriteandGitHub bc5c3cfdb2 bump transformers (#1672) 2026-01-26 22:49:18 -08:00
JannikStandGitHub 9d1581479c Revert "bump prime minimum version to 0.5.23 (#1664)" (#1669)
This reverts commit d6552d6d15.
2026-01-26 17:06:53 -08:00
samsjaandGitHub d83dce6994 fix: support NCCL mode when resuming from checkpoint (#1665)
Add `check_exists` parameter to `get_weight_dir()` to handle NCCL weight
broadcast mode where weights are transmitted via NCCL rather than stored
on disk.
2026-01-26 13:10:09 -08:00
7cc9cd903b update angnts.md (#1658)
* update angnts.md

* Update AGENTS.md

Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>

* Update AGENTS.md

Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>

* Update AGENTS.md

Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
2026-01-26 11:52:58 -08:00
JannikStandGitHub d6552d6d15 bump prime minimum version to 0.5.23 (#1664)
* bump prime minimum version to 0.5.23

* update uv.lock for prime 0.5.23
2026-01-26 20:35:46 +01:00
Jackmin801andGitHub 756b78e7a4 skip openai integ tests if key not set (#1662) 2026-01-26 02:35:39 -08:00
kalomazeandGitHub 4acd5f08bb fix weight update when enforce_eager=True (#1644) 2026-01-25 14:03:48 -08:00
minh hoangandGitHub 2b3cc8574a tidy: prometheus_client dependency is always available via vLLM (#1656)
* remove metrics optional dep group

* uv sync

* update metrics server and tests to remove usage of PROMETHEUS_AVAILABLE
2026-01-25 13:58:07 -08:00
42e09073f6 Add missing [ckpt] section to reverse_text rl.toml (#1653)
* Add missing [ckpt] section to reverse_text rl.toml

The README.md documents that `outputs/weights/step_20` will be created
after RL training, but the rl.toml was missing the [ckpt] section.
Without this section, no weight checkpoints are saved because
`setup_ckpt_managers()` returns (None, None) when ckpt_config is None.

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

* Add missing [ckpt] section to other example configs

Also adds [ckpt] section to:
- examples/wiki_search/rl.toml
- examples/reverse_text/sft/train.toml
- examples/reverse_text/rl/train.toml

These training configs were missing checkpoint configuration,
which would result in no weights being saved after training.

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 12:14:28 -08:00
WindandGitHub 31cdc0bce5 Update train.py (#1647)
Signed-off-by: Wind <116412564+windlgrass@users.noreply.github.com>
2026-01-23 21:14:16 -08:00
bd78508566 Pin Ruff in pre-commit + add Ruff format to CI (#1633)
* bump ruff version & move to ruff-check

* add ruff format to CI

* run ruff format

* fix ruff

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-23 20:59:43 -08:00
halleriteandGitHub e67022bb3b fix kl mismatch by resetting prefix cache (#1650) 2026-01-24 03:49:43 +01:00
rasdaniandGitHub a588963740 add option to skip has model check (#1543)
* add option to skip has model check

* changelog

* pre-commit

* resolve to non-breaking kwarg `skip_model_check`
2026-01-23 15:10:14 -08:00
Matej SirovatkaandGitHub e3146ba9f2 3-stage logic for chunked lm head loss (#1649)
* 3-stage logic for chunked lm head loss

* Better description

* Fixes

* idk

* Final I hope

* switch to auto/disable

* changelog
2026-01-23 22:22:39 +01:00
halleriteandGitHub 40d8103c38 add mismatch-KL stability checks for nightly math runs (#1640) 2026-01-23 12:03:53 -08:00
82a8241f0c fix cpu offloading (#1636)
* fix cpu offloading

* fix offlaod for moe

Fix buffer init in random init path

Co-authored-by: sami <sami@primeintellect.ai>

Fix buffer device move when meta load unavailable

Co-authored-by: sami <sami@primeintellect.ai>

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-23 11:18:54 -08:00
Jackmin801andGitHub 53a5ab868b [fix] use discovery in eval (#1642)
* use discovery in eval

* make eval use lora name unless none of the servers have it

* address comments to encapsulate and not be too defensive

* type hinting

* pass model name directly instead of doing model config

* better logging

* we dont need complicated discovery because only ckpt 0 is base in lora

* wait indefinitely similar to the env workers

* move the wait into discovery
2026-01-23 08:10:49 +01:00
halleriteandGitHub 526af9c367 fix wording in warning (#1643) 2026-01-22 23:34:02 +01:00
halleriteandGitHub 258e0dfc79 align token chat preprocessing with vllm 0.14 (#1637) 2026-01-22 02:48:00 -08:00
d0f2eb43dc Weights reload configuration (#1635)
* Make reload weights optional on start

Co-authored-by: sami <sami@primeintellect.ai>

* Default reload weights to true

Co-authored-by: sami <sami@primeintellect.ai>

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-21 20:28:57 -08:00
JannikStandGitHub beb8ef3c66 Add INFO log when orchestrator resumes after checkpoint wait (#1638) 2026-01-22 04:22:43 +01:00
JannikStandGitHub e1663ba065 Add elastic inference pool with DNS-based service discovery (#1617)
* Add elastic inference pool with DNS-based service discovery

- Add ElasticInferencePool for tracking pod readiness and adapter sync
- Main process discovers pods via K8s headless service DNS
- Only exposes pods with correct LoRA adapter as "ready" to workers
- Workers receive ready URLs via callback to prevent model-not-found errors
- Fully backwards compatible with static base_url configuration

* Fix tests: use asyncio.run() pattern instead of pytest-asyncio

* Fix: pass ready URLs to workers in elastic mode

* Generalize elastic inference pool to support any DNS-based discovery

- Rename headless_service to hostname (works with any DNS with multiple A records)
- Rename pod terminology to server throughout (not K8s-specific)
- Update docstrings to mention Kubernetes as one option among many

* Add changelog entry for elastic inference pool

* Fix min_pods -> min_servers parameter name

* Validate elastic inference requires LoRA training

* Add health and base model check before marking server as discovered

* Remove servers that fail health checks during sync

* Change elastic pool logs from info to debug

* fix: queue rollout requests when no inference servers available

- Clear clients when URLs become empty (instead of keeping stale clients)
- Queue incoming requests while waiting for servers to become ready
- Process queued requests once servers are available again
- Add NoServersAvailableError safety check in process_request

* fix: avoid false adapter match on default step=0

Only match by step when step > 0 to prevent false matches when
both loaded and desired adapters have default step=0 but different paths.

* test: fix elastic tests for health check changes

- Mock _check_server_health in _add_server and sync tests
- Add test for step=0 not causing false adapter matches
- Add test for health check failure in _add_server
- Add tests for _check_server_health method

* feat: support elastic inference for non-LoRA training

Elastic pool now works for base model inference too. Servers are
ready once they pass health check and have the base model loaded.

* fix: address cursor bot concerns

- Compare URLs as sets to avoid spurious callbacks from order changes
- Close old inference clients before creating new ones to prevent connection leaks

* refactor: use Literal type for server status

* docs: simplify elastic pool descriptions

* test: convert to pytest function style

* fix: address copilot review feedback

- Move time import to module level
- Use empty list instead of fallback to base_url in elastic mode
- Add comments to except:pass blocks

* docs: clarify sync_interval unit is seconds

* refactor: rename sync_interval to sync_interval_s for clarity

* rename update_weights to sync_adapter in elastic pool

* rename sync_adapter back to update_weights, remove test_elastic.py

* refactor: workers do own DNS discovery, remove callback pattern

- Workers discover servers via DNS and check /v1/models directly
- Majority vote: use all healthy servers if no adapter, only adapter servers otherwise
- Remove callback/URL push machinery from scheduler and elastic pool
- Simplify elastic.py to only handle admin operations (adapter sync)

* fix: pass model_name per-request for LoRA compatibility

* Simplify orchestrator: remove worker_client_config branching

* Restore comments in extract_result

* Encapsulate elastic mode behind InferencePool abstraction

* Move discovery functions to elastic.py to reduce duplication

* Restore comments in env_worker.py

* Fix type annotations - remove unnecessary string quotes

* Fix code review issues: rename sync_weights to public, add debug logging

* Add unit tests for elastic inference pool

* refactor: consolidate elastic config handling in WorkerServerDiscovery

- Remove redundant elastic params from env_worker (hostname, port, sync_interval)
- Extract elastic config from ClientConfig inside workers
- Add WorkerServerDiscovery class to encapsulate worker-side discovery
- Simplify worker loop logic, remove duplicate get_clients calls
- Convert tests to function-based format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* refactor: move client discovery logic to WorkerServerDiscovery class

* restore inline comment

* remove redundant update_model_name - model name is fixed at init

* restore update_model_name method

* move update_model_name to original location

* fix test: patch setup_clients function instead of non-existent method

* fix: dedupe servers, guard elastic requires LoRA, don't close clients mid-request

* fix: workers start with base model name, switch to LoRA after loading

* add logging for model switch and tests for update_model_name

* fix test: mock queue put to avoid multiprocessing timing issues

* make inference_pool required parameter in Scheduler

* cache inference clients in ElasticInferencePool to avoid recreating on each access

* update worker discovery model name when request model changes (LoRA switch)

* fix: multi-adapter detection, refactor InferencePool to Protocol

- fix _get_loaded_adapter to filter by adapter name when multiple adapters loaded
- unify LoadedAdapter and DesiredAdapterState into AdapterState
- refactor InferencePool to Protocol with StaticInferencePool and ElasticInferencePool implementations
- remove unused admin_clients param from Scheduler
- fix discover_ready_servers to only return servers with requested model (no fallback)
- add tests for multi-adapter case

* refactor: clean up elastic discovery with shared utility functions

- Add ServerDiscovery class for env workers (DNS discovery + client management)
- ElasticInferencePool uses same discovery functions
- Shared logic via utility functions: discover_server_ips, discover_ready_servers
- Remove mode flags and unnecessary abstractions

* remove early elastic+lora validation from orchestrator (handled in ElasticInferencePool.update_weights)

* add debug logging for adapter mismatch + parallelize sync_weights

* add more debug logging for adapter matching

* close inference clients on ElasticInferencePool shutdown
2026-01-22 02:26:01 +01:00
Jackmin801andGitHub 0ca5739f75 Allow trainer to evict runs that write bad batches (#1634)
* add run eviction logic

* add some tests

* add run eviction to docs

* update rename in index

* make packer evict runs it doesnt like

* add check for teacher logprobs

* dont error on idx not found in case we double evict

* remove stale test

* this log is quite spammy

* rename config folder to control
2026-01-21 16:10:10 -08:00
9613f61b9b Disable final checkpoint saving when max_concurrent_runs > 1 (#1632)
* Disable final checkpoint saving when max_concurrent_runs > 1

When max_concurrent_runs > 1, checkpoints are managed by the
MultiCheckpointManager at the whims of the orchestrator, making
the final checkpoint save in the trainer redundant and meaningless.

* Update src/prime_rl/trainer/rl/train.py

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* Update src/prime_rl/trainer/rl/train.py

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-21 11:57:24 -08:00
manveerandGitHub 646e9928a4 Ensure eval results upload before existing subproc (#1631) 2026-01-20 21:32:41 -08:00
Jackmin801andGitHub 11c84c2853 [fix] make search for line more robust (#1630)
* make search for line more robust

* need the fix in above line as well
2026-01-20 19:47:58 -08:00
kalomazeandGitHub 63988a79ec Assert when only trainer or orchestrator wandb is configured (#1629)
* [Validate] Assert when only trainer or orchestrator wandb is configured

* Mention [wandb] as alternative in assert messages
2026-01-20 17:35:34 -08:00
d7742b9569 Add AGENTS.md and CLAUDE.md (#1627)
* Add AGENTS.md and CLAUDE.md for AI coding agents

- AGENTS.md as source of truth for all AI agents
- CLAUDE.md imports AGENTS.md for Claude Code compatibility

* Update AGENTS.md

---------

Signed-off-by: JannikSt <JannikSt@users.noreply.github.com>
Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2026-01-21 02:02:09 +01:00
Jackmin801andGitHub 66bfa0f473 up vllm version to 0.14 (#1625) 2026-01-20 16:37:03 -08:00
c3de771b0d [Refactor] rename Runs -> RunsManager and cleanup hooks (#1619)
* better runs docs

* some renamin

* missed tests

* missed comments

* meraid docs render in gh according to CC [skip ci]

* better diagram [skip ci]

* Update docs/runs.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* docs update

* rename to MultiRunManager

* guard the discovery apis rom being used by non master ranks

* variable renaming

* sync runs to synchronize state

* dont register master only hooks on non master

* encapsulate lora hook registration into run manager setup

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-20 12:54:48 -08:00
50600eaa79 remove extra logging (#1621)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-20 10:21:52 -08:00
JannikStandGitHub c69c615cfb Add retry with exponential backoff for empty training batches (#1622)
* Add exponential backoff retry for empty training batches

When inference becomes temporarily unavailable, all rollouts may fail
resulting in an empty batch. Instead of crashing, retry the step with
exponential backoff (30s, 60s, 120s, 240s, 300s cap) up to 5 times.

* Cancel validation task before retry to avoid accumulation

* Fix off-by-one: use >= for retry count check
2026-01-20 18:55:32 +01:00
halleriteandGitHub 41d141934a bump wandb (#1623) 2026-01-20 09:44:42 -08:00
JannikStandGitHub a9b5aa5cdf Fix trainer crash when all rollouts in a batch fail (#1596)
* Fix trainer crash when all rollouts in a batch fail

When all rollouts fail (e.g., conversations exceed context limit), the tensor is empty and compute_stats() crashes on .min()/.max() calls. Skip stats computation for empty tensors.

* Emit NaN for empty tensor stats instead of skipping
2026-01-20 03:10:32 +01:00
JannikStandGitHub 571d48135c Auto-restart env workers on unexpected death (#1609)
* Auto-restart env workers on unexpected death

- Add restart() method to EnvWorker
- Modify collect_responses() to auto-restart with warning log
- Scheduler catches WorkerDiedError and continues instead of crashing
- Add unit tests for restart functionality

* Fix: join dead process to prevent zombies

* Add max restart limit (5) to prevent infinite restart loops

* Make max_worker_restarts configurable via orchestrator config

* Rename to max_env_worker_restarts for clarity

* Support -1 for unlimited restarts

* Fix AI review feedback on worker restart behavior

- Reset restart count after 10 successful responses (prevents
  isolated failures over time from accumulating)
- Store fatal error on worker so orchestrator can detect and crash
  when max restarts exceeded
- Fix misleading log message that claimed auto-restart unconditionally
- Add _check_for_fatal_worker_errors() to crash orchestrator properly

* Remove elastic utility file

* Remove k8s references from config and scheduler

* Make restart method private

* Fix test mock to use _restart
2026-01-20 02:58:09 +01:00
Jackmin801andGitHub 41a66e2b26 fix comma in benchmark json (#1618) 2026-01-19 16:45:48 -08:00
Jackmin801andGitHub 8718eb143d [CI] Add CP and EP to benchmarks (#1614)
* add ep

* add cp

* add ep and cp to the table

* rename json in benchmark ci

* add some cp and ep tests
2026-01-19 15:18:34 -08:00
Jackmin801andGitHub 2486860eba [feat] Multi run ckpt (#1593)
* support index in register post creation callback

register scheduler at index 0

plumbing

first draft

fixes

* just copy for now

* fix issue where only master tracks saved ckpt steps

* only master should do the broadcast copy

* add deletion hooks

* delete stale managers on deletion

* support the -1 convention

* make orchestrator broadcast support reading from ckpy dir

* only delete manager if it exists

* fix: add creation hook so we check existing ckpts before orchestrator
creates them

* missing arg [skip ci]

* dcp is not my friend

* add ckpt config to test

* more efficient trainer

* include some stop resume in the tests

* fix tests

* add some useful debug logs

* fix: type in orch check

* fix: dont load progress in create run hook

* broadcast progress so all ranks know when to ckpt

* better debug log for ckpting

* fix: we must wait for trainer checkpoint before we can delete run

* ci uses single gpu trainer

* Revert "ci uses single gpu trainer"

This reverts commit 7b0382b947aa0cb2af64645c17d849708adef467.

* refactor wait and kill for tests

* tests passing but kinda messy

* remove old log

* cleanup test

* cosmetic changes to multi run test

* fix: missed orch proc setting

* put start print in a better location

* exclude the resumes from reward go up check

* use stable file to mark trainer is done with checkpointing

* the barrier needs t be outside the try catch

* add timeout to wait for file

* mark stable after last barrier

* error in wait for log if timeout

* fix fixture signature

* append to tracked steps after barrier

* fix bad while else

* fix: move barrier and mark stable into the loop

* the orchestrator finish wait was apparently necessary for beta orch to exit correctly

* better error message for not finding weight dir

* cleaner manager creation in multi ckpt

* try catch the weight copy

* fix: manager access in clean

* move wait file print to less spammy place

* no max steps in trainer toml should make it infinite

* add comment about wide try except
2026-01-19 14:42:40 -08:00
Jackmin801andGitHub 08afcd20c1 [fix] use step change instead of batch size to demarcate when to update (#1613)
* use step change instead of batch size to demarcate when to update

* address copilot comments
2026-01-18 13:40:13 -08:00
Jackmin801andGitHub 213553403c Fix timeout overcounting (#1612)
* smaller timeout [skip ci]

* fix timeout overcounting into next step
2026-01-18 10:53:11 -08:00
Jackmin801andGitHub 147e443101 Revert "fix logging (#1605)" (#1611)
This reverts commit 0e53e7f19b.
2026-01-16 16:49:35 -08:00
manveerandGitHub 30873eb28b Improve log message on orchestrator for hosted rl (#1608) 2026-01-16 14:35:33 -08:00
0e53e7f19b fix logging (#1605)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-16 13:01:07 -08:00
Jackmin801andGitHub b214a4536c adjust multi run test args to be less flaky (#1606) 2026-01-16 12:31:42 -08:00
Jackmin801GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>github-actions[bot] <github-actions[bot]@users.noreply.github.com>
d8f290ef03 [CI] nightly perf (#1566)
* support exporting json in bench mode

* script to run one benchmark

* auto set batch size

* aggregation script

* draft nightly

* add benchmarks folder to image

* support passing docker image

* use image and from micro batches

* some reordering and passing more args

* try this

* use runner name in step name

* bash the entrypoint and working dir

* rename artifact

* dont support sft lora for now

* remove concurrency gorup

* print last 100 lines in success so we can see the table in the ci run output

* add comment

* make containers use host HF home to speedup multiple tests on the same runner

* set max loras

* use hosts root cache

* add runner to artifact name

* make baselines dir

* dont use this random dudes step wth claude

* do /data

* don do labels

* try to just use a named volume

* try directly having root level dir

* try clearing lock and changing permissions

* just start container as root

* god i cant rmb the name of my own args

* better device name surfacing

* pin a digest because tag might drift

* should probably make it easier to test changes to agg result but yolo i trust the ai overlords

* get the image digest on a self hosted runner so we have image cache

* go out of our way to surface OOM

* allow setting diff display threshold

* baseline should be set after running not before

* put docker image in the markdown

* displaying per microbatch step time probably makes more sense

* set better name for benchmark json files

* dont use batch size in config key

* move constants to the top

* rename and cleanup

* wishlist matrix

* missing commas lol

* fix typo

* use the 1xa6000 as the digest runner

* rename workflow

* set longer timeout for 235b

* try shell arithmetic

* we need to multiply the num tokens by dp size

* add time taken

* better sorting key

* change hardware col order

* just print every line in the success case, we arent poor

* lines

* wishlist benchmarks

* prune some more errors

* remove some dead ones

* rl bench validator

* add timeou to run single benchmark

* only copy the scripts

* sort matrix a bit better

* more pruning and tuning

* Update benchmark results 2026-01-16 (#13)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* make regression flag more unique

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-16 11:44:18 -08:00
Matej SirovatkaandGitHub 43cacaa289 Ep (#1595)
* Feat: some ep

* Fix: some minor

* Fixes

* Feat: final?

* Fix: remove debugpy-run

* Fix: reshard_after_forward=False

* Fix: optimizer

* Fix: pass parallel_dims instead of device_mesh

* Fix: multi-opimzer

* changelog

* Fix: reference comments
2026-01-16 11:43:04 -08:00
DominikandGitHub a1271501b8 Fix: Add k8s doc to docs folders and update mint config (#1597)
* Add k8s docs to docs content and update mint config.

* Revert change.

* Revert deployment.
2026-01-16 10:57:54 +01:00
JannikStandGitHub bdfbfae982 Add health endpoint for worker nodes in multi-node training (#1601)
* Add health endpoint for worker nodes in multi-node training

- Add HealthServer base class with /health endpoint only
- MetricsServer now extends HealthServer
- Worker nodes start HealthServer, master gets full MetricsServer
- Add tests for HealthServer

* Fix port conflict: only start server on local_rank 0 per node

* Fix ruff formatting

* Format test file

* Fix ruff lint errors

* remove transient error testfile
2026-01-16 06:56:40 +01:00
Jackmin801andGitHub 7a50d2680e check for current step based on progress to know what is valid for this step (#1604) 2026-01-15 20:47:43 -08:00
32adbba802 Sami/fix logging env (#1602)
Release / Push CUDA image to Docker (push) Canceled after 0s
* make per worker env false by defaulot

* udpate changelogkl

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-15 16:01:04 -08:00
JannikStandGitHub c330a6d4eb Add InfiniBand libraries for NCCL multi-node support (#1600)
* Add InfiniBand libraries for NCCL multi-node support

* Fix: remove comment breaking Dockerfile line continuation
2026-01-15 14:28:05 -08:00
11d87ee888 Incomplete evaluation results (#1589)
* Eval: record no-response rollouts instead of cancelling

Co-authored-by: sami <sami@primeintellect.ai>

* Eval: report no_response percentage metric

Co-authored-by: sami <sami@primeintellect.ai>

* Fix eval: don't clobber successful rollouts on save failure

Co-authored-by: sami <sami@primeintellect.ai>

* Annotate save failures without discarding state

Co-authored-by: sami <sami@primeintellect.ai>

* Revert "Annotate save failures without discarding state"

This reverts commit 85a0e3c441eb0b053964b0feb0eaab2863699e3b.

* Update src/prime_rl/eval/utils.py

Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>

* Eval: ignore failed rollouts in avg reward; simplify saving

Co-authored-by: sami <sami@primeintellect.ai>

* Simplify rollout_status parsing (assume dict)

Co-authored-by: sami <sami@primeintellect.ai>

* Update src/prime_rl/eval/utils.py

Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
Co-authored-by: rasdani <73563550+rasdani@users.noreply.github.com>
2026-01-15 13:05:27 -08:00
0e5940f82b refactor logging on environment in orch (#1594)
* remove logging

* add per env logging

* log to one file when having multiple worker

* intercept verifier log

* intercept verifier log

* intercept verifier log

* Add worker tag to env worker logger for identification

Co-authored-by: sami <sami@primeintellect.ai>

* Update changelog for logging config changes

Co-authored-by: sami <sami@primeintellect.ai>

* Rename env worker log config flag

Co-authored-by: sami <sami@primeintellect.ai>

---------

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-15 13:04:27 -08:00
969df59e54 fix eval order (#1598)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-15 11:22:54 -08:00
ff620131e4 remove logging (#1592)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-15 10:11:27 -08:00
Jackmin801andGitHub c95bd79d43 Make packer pack smaller granularity and round-robin (#1542)
* generated packer tests

* simplify packer tests

* packer doc

* support buffers and smaller orchestrator granularity

* fix duplicates in filesystem reader

* make small batch granularity toggleable to not break single run behavior

* add comment about temperature

* fix reset staleness

* fix: cc is way too defensive and didnt understand what we meant with needing full batches in small_batch_granularity=False case

* missing samples increment

* guard infinite loop in select samples

* remove the tests because the previous logic didnt make sense so theyre probably super stale and confusing

* fix: check every run in full batch case

* do popleft

* add create run data hook

* just prealloc state cuz life is easier

* set small granularity packing on the multi run test

* remove debug prints

* have very descriptive name for pack flag

* the doc isnt particularly helpful

* cover overfull case

* split out single run packer

* remove packer arg

* missing step arg

* pop out the oversized batch

* take out tokens collected if skip

* transport config

* move packing reset hook to deletion
2026-01-14 19:43:36 -08:00
baf62617aa Step check runtime context (#1587)
* refactor(eval): move checkpoint step validation to runtime

Keep the same stable-checkpoint step validation logic, but run it at eval startup instead of during config parsing.

Co-authored-by: sami <sami@primeintellect.ai>

* chore(eval): remove runtime step validation comment

Co-authored-by: sami <sami@primeintellect.ai>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-14 19:02:42 -08:00
bceb0ccebf Logging tmux script panes (#1590)
* docs: simplify tmux logging section

Co-authored-by: sami <sami@primeintellect.ai>

* docs: trim tmux logging usage snippet

Co-authored-by: sami <sami@primeintellect.ai>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-14 18:24:09 -08:00
rasdaniandGitHub 6d3af788ac fix skipped eval env log (#1591)
* fix: return values

* changelog
2026-01-15 01:06:47 +01:00
manveerandGitHub a03d81f14f Fix bug causing evals to not get uploaded for hosted RL (#1582)
* Fix bug causing evals to not get uploaded for hosted RL

* Simplify approach

* Add detailed comment
2026-01-14 15:46:39 -08:00
4ff009d2ec update docs for logging (#1588)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-14 14:07:12 -08:00
0403f1271a bump verifier main (#1572)
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-14 13:54:23 -08:00
rasdaniandGitHub 33101f260c skip failed eval envs with warning (#1586) 2026-01-14 13:54:01 -08:00
eb8a154f11 Eval script checkpoint failures (#1585)
* fix: keep eval running on checkpoint failures

Adds `continue_on_ckpt_error` so a single bad checkpoint won't abort multi-checkpoint evals. In watcher mode, existing stable checkpoints are skipped (per docs) and failed new checkpoints remain pending for retry.

Co-authored-by: sami <sami@primeintellect.ai>

* chore: sort imports in eval checkpoint test

Co-authored-by: sami <sami@primeintellect.ai>

* chore: satisfy ruff import ordering in eval test

Co-authored-by: sami <sami@primeintellect.ai>

* chore: apply ruff import ordering fix

Co-authored-by: sami <sami@primeintellect.ai>

* fix: avoid global sys.modules stubs in eval test

Use anyio marker and local monkeypatching so this test doesn't break collection for other unit tests.

Co-authored-by: sami <sami@primeintellect.ai>

* refactor: always continue on checkpoint eval failures

Remove the config/test and make checkpoint eval best-effort by default: per-checkpoint exceptions are logged and evaluation continues. Watcher mode keeps failed checkpoints pending for retry.

Co-authored-by: sami <sami@primeintellect.ai>

* fix: keep watcher evaluating existing checkpoints

Restore prior watcher behavior: evaluate all stable checkpoints first, then watch for new ones. Checkpoint failures are logged and skipped without aborting the whole eval process.

Co-authored-by: sami <sami@primeintellect.ai>

* refactor: inline checkpoint try/except in eval

Co-authored-by: sami <sami@primeintellect.ai>

* Revert "refactor: inline checkpoint try/except in eval"

This reverts commit 4b6483786bd39889676c2226693229ae59a4e63a.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-14 13:09:14 -08:00
rasdaniandGitHub 518fa49811 fix: wait for checkpoint completion in eval watcher (#1584) 2026-01-14 15:58:03 +01:00
85a9dc0e71 add watcher (#1581)
* wip add watcher

* docs: add changelog entry for eval.watcher

Document the new eval.watcher config flag per config-change review rules.

Co-authored-by: sami <sami@primeintellect.ai>

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-13 18:20:49 -08:00
Jackmin801andGitHub dddc0ddfb7 add fa3 to deps (#1580)
* add fa3 to deps

* pin prebuilt wheel instead
2026-01-13 15:52:23 -08:00
faresobeidandGitHub 05456490a4 fix opd (#1577)
* fix opd

* oops
2026-01-13 20:02:29 +00:00
3436f42a4a add env worker logging (#1561)
* add env worker logging

* reset logger before env logger

* redirect verifiers logger to file

* Add CHANGELOG entry for orchestrator.env.log configuration

Documents the new EnvLogConfig class and log field added to EnvConfig,
which provides logging configuration for environment workers.

* Fix worker crash when logging disabled

When logging is disabled (default), reset_logger() sets _LOGGER to None
but setup_logger() was not called. This caused EventLoopLagMonitor to
crash with RuntimeError when calling get_logger().

Fix: Always set up a logger in worker processes. When logging is disabled,
use CRITICAL level which produces no output (critical logging is disabled
in setup_logger).

* fix

* Add formatter to verifiers logger FileHandler

The FileHandler added for the verifiers logger was missing a Formatter,
causing log messages to be written as raw text without timestamps, log
levels, or logger names. This makes the verifiers logs difficult to
correlate or debug effectively.

Added a Formatter with timestamp (HH:MM:SS) and log level formatting,
matching the format used by the prime-rl logger for consistency.

* Add missing reset_logger() in else branch

On Linux with fork start method, worker subprocesses inherit _LOGGER
from parent. Both branches need reset_logger() before setup_logger()
to avoid RuntimeError("Logger already set").

* Revert "Fix worker crash when logging disabled"

This reverts commit f37ab4be3ce4fe85e15391ecdc3164bfe5b59ee5.

* refactor

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-13 11:29:44 -08:00
aab07534ea Trainer nccl broadcast log (#1575)
* Clarify NCCL weight broadcast logging for non-layer weights

Co-authored-by: sami <sami@primeintellect.ai>

* Refine debug logging for NCCL weight broadcast.

Co-authored-by: sami <sami@primeintellect.ai>

* Remove per-layer NCCL broadcast logging.

Keep only the aggregate broadcast count message to reduce trainer log noise.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2026-01-12 17:29:33 -08:00
samsjaandGitHub 5197c4027e Update README.md (#1573)
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
2026-01-12 14:55:15 -08:00
rasdaniandGitHub 7fbf4a02cb Re-raise vf.SandboxError in eval to trigger rollout rescheduling (#1553)
* Re-raise `vf.SandboxError` in eval to trigger rollout rescheduling

* catch `vf.InfraError` instead
2026-01-12 23:18:43 +01:00
ddb9571ef4 Update LoRA layer default alpha from 16.0 to 32.0 (#1571)
Ensures consistency with the config default changed in #1567. The
MultiLoRALinear and MultiLoRAGroupedExperts classes had stale defaults
that should match the orchestrator and trainer configs.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-12 09:21:21 -08:00
c2f90c8a28 change LoRA alpha default to 32 (#1567)
* change LoRA alpha default to 32

* bugbot fixes

* LR fix

* use alpha=64 in alphabet_sort config

* adjust LR for CI configs

* Apply suggestion from @Jackmin801

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

* lr moved to optim

* check step 9 now that lr is lower

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Jackmin801 <ongjackm@gmail.com>
2026-01-12 09:12:37 -08:00
Sebastian MüllerandGitHub 1455a8afbc Unique rollout request ids to avoid collisions (#1568)
* Fix rollout request matching by using unique request IDs

* Fix worker pending task tracking after request_id change

* simplify request_id access

* Revert "simplify request_id access"

This reverts commit eb456b87275120b2ba1ad5e000cee74f386d288f.

* Fix pending task typing
2026-01-12 05:51:52 -08:00
88da7cb296 fix: detect dead worker process in collect_responses (#1546)
* fix: detect dead worker process in collect_responses

Previously if a worker subprocess crashed, collect_responses() would loop forever waiting for responses. Now it checks process.is_alive() and raises RuntimeError with exit code.

* fix: remove unused import

* fix: rewrite tests as sync to avoid pytest-asyncio dependency

* Add _stopping flag to skip dead worker error during shutdown

* Reset _stopping flag in start() to fix restart detection

* Remove unused tests for EnvWorker subprocess management

Co-authored-by: jannik <jannik@primeintellect.ai>

* Fix race condition and pending futures on worker death

* Prevent scheduler from routing to dead workers

* Drain response queue before checking dead worker

* Add WorkerDiedError to propagate through scheduler for K8s restart

* Fix exit code race condition in rl.py main loop

* Check subprocess return codes directly after loop
2026-01-12 12:58:52 +01:00
Jackmin801andGitHub d70a00f6e8 [fix] orchestrator shouldnt have null batch (#1563)
* orchestrator shouldnt have null batch

* change to zero check so partial is stil allowed
2026-01-09 19:01:39 -08:00
1fa70e83dd feat: set default fused_lm_head_chunk_size to 2048 for RL training (#1544)
* feat: set default fused_lm_head_chunk_size to 2048 for RL training

Auto-configures model.fused_lm_head_chunk_size to 2048 for RL training
when not explicitly set. SFT training continues to use None (no chunking)
as it doesn't support chunked loss yet.

* docs: update fused_lm_head_chunk_size description and changelog

Update the field description to mention RL training auto-sets to 2048.
Add changelog entry for the default behavior change.

* Fix: RL training auto-sets fused_lm_head_chunk_size except for liger_kernel

Co-authored-by: ongjackm <ongjackm@gmail.com>

* Refactor check_number_in_range to improve step searching

Co-authored-by: ongjackm <ongjackm@gmail.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-09 12:55:43 -08:00
JannikStandGitHub 355e742a69 Add optional Prometheus metrics server for trainer (#1547)
* Add optional Prometheus metrics server for trainer observability

- Exposes /metrics endpoint with training metrics (step, loss, throughput, grad_norm, etc.)
- Disabled by default, enable via `metrics_server.port` config
- Uses isolated CollectorRegistry per instance
- prometheus_client is optional dependency (uv sync --extra metrics)

* Update lockfile for prometheus_client optional dep

* Add changelog entry for metrics_server

* Convert tests to function style

* Clean up Prometheus metrics naming and add mismatch_kl

- Remove rft_ prefix from all metrics (trainer_* instead of rft_trainer_*)
- Add trainer_mismatch_kl metric for tracking KL divergence

* Add per-run/LoRA metrics to Prometheus server

Aggregate metrics:
- trainer_runs_discovered: run folders found
- trainer_runs_active: runs with assigned slots
- trainer_runs_ready: runs ready for gradient updates
- trainer_runs_max: maximum run capacity

Per-run metrics (with labels):
- trainer_run_step{run="run_001"}: training step
- trainer_run_tokens{run="run_001"}: total tokens processed
- trainer_run_learning_rate{run="run_001"}: current LR
- trainer_run_ready{run="run_001"}: ready status (1/0)

* Add /health endpoint for K8s liveness probes

- Add HealthCheckConfig with max_step_age_seconds and startup_grace_seconds
- Add /health endpoint to MetricsServer for trainer liveness checks
- Fix socket leak in stop() by calling server_close() and joining thread

* Use heartbeat instead of step-age for health checks

- Rename max_step_age_seconds to timeout_seconds
- Add heartbeat() method called every loop iteration
- Detects hung main thread even when waiting for runs

* Add optional on_wait callback to sync_wait_for_path

* Revert unused on_wait callback

* Simplify /health to always return 200
2026-01-09 19:59:29 +01:00
Jackmin801andGitHub 16e747c25e set multinear linear cumsum dtype to int32 (#1557) 2026-01-07 21:34:24 -08:00
Jackmin801andGitHub e75677fcbd [Feat] multi run optim args (#1555)
* orchestrator config is ok and component integrations look satisfactory

* rename lora_name to lora.name in orchestrator

* fix in rl.py

* multilora independent scaling factors

* train.py changes

* changes to runs

* update tomls for lora.name

* set the default lora rank to trainers

* set lora scaling dtype to bf16

* missed lora_name -> lora.name

* allow run to reset the lora globals

* damn these configs got hands

* i feel like i might have made my life hard for no reason. ah well, im lazy to think of somethin better rn

* set higher default lr on orch side

* fix configs for non-master ranks
2026-01-07 18:50:40 -08:00
a24ec986b3 Remove PR template (#1550)
With agents now drafting PRs and auto-generating descriptions, the
template with placeholder text is no longer needed.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-07 01:39:50 -08:00
kalomazeandGitHub ede6b62e69 feat: Add reward field to TrainingSample (#1551)
Store raw reward alongside advantage in rollouts for inspection.
Backward compatible with existing rollout files.
2026-01-06 21:07:12 -08:00
d564195cac [feat] Enable loss chunking for non-custom HuggingFace models (#1545)
* [feat] Enable loss chunking for non-custom HuggingFace models

Add support for chunked loss computation (via FusedOutputLinear) for any
HuggingFace CausalLM model, not just custom PrimeRL implementations.

Changes:
- Add wrap_lm_head_for_hf_model() function in model.py that:
  - Wraps the lm_head with FusedOutputLinear or VanillaOutputLinear
  - Overrides the model's forward method to accept labels and temperature
  - Returns PrimeLmOutput with logprobs/entropy for chunked mode
- Update setup_model() to call wrap_lm_head_for_hf_model for non-PrimeRL models
- Remove config validator restriction that limited fused_lm_head_chunk_size
  to custom/auto implementations
- Add tests for HF model wrapping with both vanilla and fused modes

* change PrimeLmOutput to TypedDict so that it is pytree node by default

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

* change all references to output for dict

* guard against unconventional model being used

* dont be so defensive in tests with model output

* guard against lm heads with bias

* move lm head injection logic into lm_head.py and unify injection path for custom and hf impl

* update inject in tests

* fix forward signature for custom impls

* cover input embeds case

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-01-06 18:56:06 -08:00
rasdaniandGitHub be0e3d1313 fix: resolve all checkpoints for proper cleanup on resume and cancelled rollout metric (#1537)
* fix: resolve all checkpoints for proper cleanup on resume

* delete dead code

* fix `resume_step`

* log cancelled rollouts to wandb
2026-01-06 02:21:55 +01:00
f870bc91df [feat] moe lora (#1526)
* plumbing to get it to be loaded

* first draft without tenant splitting

* correct fqns

* cleanup multilora moe impl

* fix: param counting

* fix excessive vram usage due to views

* fix perf lora adapter param counting

* make packer only pack global mbs rows with similar run_idx

* add comment because this packing is kinda weird

* fix: set offset correctly for multiloramoe

* idk if th vibe coding has more typos or me

* support lora dropout

* add experts to default lora targets

* remove outdated tests

* feat: Add LoRA dropout to MultiLoRAGroupedExperts

Co-authored-by: ongjackm <ongjackm@gmail.com>

* cursor nits

* forgot the changelog lol

* Update CHANGELOG with recent changes and fixes

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>

---------

Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Johannes Hagemann <johannes@primeintellect.ai>
2026-01-05 13:21:43 -08:00
Matej SirovatkaandGitHub 5ad6f62fc2 Fused LM Head implementation (#1525)
* Something

* poc

* Fix: proper logits in sft

* Feat: clean up the surface

* Fix: remove unused arg

* Fix: CP-safe label shift + unify custom forwards

* feat: cleanup

* Feat: more cleanup

* Feat: even more cleanup

* fix

* Feat: final

* cursor unscrew

* fix tests

* more fixes

* Shift labels instead of inputs

* Feat: fix logit shifting

* Fix: sft crash

* Tiny fix

* Shift entropy as well

* Some minor cleanup

* Add to afmoe

* Fix afmoe tests

* Final hopefully

* FINAL

---------

Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com>
2026-01-05 12:31:50 -08:00
2cc5c550b7 fix: enable grouped_mm on Blackwell cards (#1536)
* fix: enable grouped_mm on blackwell

* fix: disable grouped_mm in unit tests for MoE models other than AFMoE

* use_grouped_mm should default to True

---------

Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com>
2026-01-04 18:45:22 -08:00
Johannes HagemannandGitHub 840cd87495 fix: add step param to Monitor.log() interface (#1538) 2026-01-03 07:47:39 +01:00
fba2185ed0 refactor online eval (#1518)
* refactor online eval

* fix eval

* fix eval

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-02 12:17:10 +01:00
samsjaandGitHub 3fea505e9d Update README.md (#1533)
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
2026-01-02 12:06:15 +01:00
4706ea0c27 Sami/fix nccl handshake (#1531)
* Revert "Revert "Inference readiness handshake (#1506)" (#1528)"

This reverts commit d85027f7f1.

* fix nccl ready

---------

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-02 11:16:13 +01:00
AutumnAureliumandGitHub f731eb9d07 feat: Add AFMoE support (#1515)
* basic slow afmoe setup

* add flex attention

* avoid compilation error on flex-attn

* super rough fix for swa and sequence packing

* massively simplify impl

* remove a bunch of dead/unused code and clean up

* un-correct unrelated bug for later fix

* remove debug config file accidentally left in

* remove redundant extra imports

* simplify attention impl

* revert comment

* remove flex_attn for now

* fix ruff lints

* do not put attn in separate file

* satisfy ruff
2026-01-02 10:21:55 +01:00
8b2ef0daa6 fix wandb (#1529)
Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-02 10:11:25 +01:00
b750db03c8 Revert "take out step in wandb monitor (#1516)" (#1530)
This reverts commit 895e7d6901.

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-01 10:19:21 +01:00
d621e8889d Add retry logic to load_lora_adapter for NFS delays (#1520)
* Add retry logic to load_lora_adapter for NFS delays

Uses tenacity with exponential backoff (1-30s) for up to 10 attempts.
Retries on 404 (adapter not found) and 500 (server error) which can
occur due to NFS propagation delays between trainer broadcast and
inference server load.

* Add unit tests for load_lora_adapter retry logic

* Fix tests: use asyncio.run instead of pytest.mark.asyncio

* Refactor tests to pytest function style (no classes)

* Fix: Adjust reward check thresholds and step in lora integration test

Co-authored-by: ongjackm <ongjackm@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: ongjackm <ongjackm@gmail.com>
2026-01-01 01:09:32 -08:00
d85027f7f1 Revert "Inference readiness handshake (#1506)" (#1528)
This reverts commit 76cc87ec59.

Co-authored-by: sami jaghouar <sami@primeintellect.ai>
2026-01-01 09:10:32 +01:00
e3dbf2ad86 feat: Add keep_interval to checkpointing config (#1521)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2025-12-31 16:00:46 +01:00
0bfb317c02 docs: add changelog entry for ckpt.keep_last and ckpt.keep_interval (#1522)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-12-31 15:51:17 +01:00
faresobeidandGitHub 1a5841b060 On policy distillation (#1458)
* on-policy-distill

* some more fixes

* some more fixes

* simplify loss

* fixes

* fix tests

* fix tests again

* fix changelog

* refactor

* use score rollouts

* fix ruff pls

* fix ruff and simplify temp

* fix ruff plssss

* Revert "fix ruff plssss"

This reverts commit ebe4fb1cfa33ab28643741cd4f904bf577728e9c.

* pls

* fixes

* fix kl loss

* fix tests

* fix

* fix

* remove reference model

* fix tests

* add logging and comments

* change logic

* setup teacher inference automatically

* fix

* cleanups and fixes

* fix

* fix changelog

* make so we can use an existing teacher inference server

* make teacher logprobs None when no teacher

* fixes

* fix

* fix

* fix

* add docs

---------

Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com>
2025-12-31 16:23:14 +02:00
Jackmin801andGitHub 895e7d6901 take out step in wandb monitor (#1516) 2025-12-31 10:22:18 +01:00
76cc87ec59 Inference readiness handshake (#1506)
* feat: Add NCCL broadcast support for weight updates

This commit introduces NCCL broadcast as a new method for updating weights. It includes modifications to the orchestrator, scheduler, and NCCL broadcast implementation to handle the synchronization required for NCCL communication. The `update_weights` utility function is updated to create a `NCCL_READY` marker file when NCCL broadcast is enabled, signaling to the trainer that inference workers are ready to receive weights.

Co-authored-by: sami <sami@primeintellect.ai>

* Refactor: Remove unused is_nccl_broadcast flag

Co-authored-by: sami <sami@primeintellect.ai>

* Remove NCCL ready marker cleanup from broadcast

Co-authored-by: sami <sami@primeintellect.ai>

* feat: Add timeout to sync_wait_for_path and wait_for_path

Co-authored-by: sami <sami@primeintellect.ai>

* Checkpoint before follow-up message

Co-authored-by: sami <sami@primeintellect.ai>

* remove to

* remove upus ty

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sami <sami@primeintellect.ai>
2025-12-31 09:46:27 +01:00
406 changed files with 38734 additions and 9465 deletions
+1
View File
@@ -0,0 +1 @@
../skills
-10
View File
@@ -1,10 +0,0 @@
<!-- Provide a brief description of the changes in this PR -->
I was too lazy to explain my changes, decreasing my chances of this ever getting merged.
---
<!-- Link the GitHub and Linear issue (if external, delete the Linear issue link) -->
**GitHub Issue**: [Issue ID]
**Linear Issue**: Resolves [Issue ID]
+252
View File
@@ -0,0 +1,252 @@
name: Trainer Benchmarks
on:
workflow_dispatch:
inputs:
set_baselines:
description: "Save results as new baselines"
required: false
default: false
type: boolean
image:
description: "Docker image to use for benchmarks"
required: true
type: string
jobs:
build-matrix:
name: Build benchmark matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build.outputs.matrix }}
steps:
- name: Build matrix
id: build
run: |
matrix='{"include":[
{"model":"Qwen/Qwen3-0.6B","runner":"1xa6000","num_gpus":1,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xa6000","num_gpus":1,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_3","ac":"Offload","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xa6000","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xa6000","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Offload","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xa6000","num_gpus":1,"type":"sft","lora_rank":null,"seq_len":8192,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"sft","lora_rank":null,"seq_len":8192,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-0.6B","runner":"1xh100","num_gpus":1,"type":"sft","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"1xa6000","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Offload","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"1xh100","num_gpus":1,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Offload","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"sft","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"sft","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"sft","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-4B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"sft","lora_rank":null,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":null,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh100","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":2,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":4,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":8,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xh200","num_gpus":8,"type":"sft","lora_rank":null,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"Qwen/Qwen3-30B-A3B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"sft","lora_rank":null,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":30},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Offload","cp":1,"ep":1,"timeout_minutes":60},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_3","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":60},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":60},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_2","ac":"Offload","cp":1,"ep":1,"timeout_minutes":60},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xh200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_3","ac":"Offload","cp":1,"ep":1,"timeout_minutes":60},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_2","ac":"Offload","cp":1,"ep":1,"timeout_minutes":60},
{"model":"PrimeIntellect/INTELLECT-3","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":65536,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":60},
{"model":"Qwen/Qwen3-235B-A22B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":1,"timeout_minutes":120},
{"model":"Qwen/Qwen3-235B-A22B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Offload","cp":1,"ep":1,"timeout_minutes":120},
{"model":"Qwen/Qwen3-235B-A22B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":2,"ep":1,"timeout_minutes":120},
{"model":"Qwen/Qwen3-235B-A22B-Instruct-2507","runner":"8xb200","num_gpus":8,"type":"rl","lora_rank":16,"seq_len":16384,"attention":"flash_attention_2","ac":"Recompute","cp":1,"ep":2,"timeout_minutes":120}
]}'
echo "matrix=$(echo "$matrix" | jq -c .)" >> "$GITHUB_OUTPUT"
get-image-digest:
name: Get image digest
runs-on: 1xa6000
outputs:
image_with_digest: ${{ steps.digest.outputs.image_with_digest }}
steps:
- name: Get image digest
id: digest
run: |
docker pull "${{ inputs.image }}"
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "${{ inputs.image }}")
echo "image_with_digest=${DIGEST}" >> "$GITHUB_OUTPUT"
run-benchmark:
name: "${{ matrix.model }} (${{ matrix.type }}${{ matrix.lora_rank && format(' r={0}', matrix.lora_rank) || '' }}) on ${{ matrix.runner }}"
needs: [build-matrix, get-image-digest]
runs-on: ${{ matrix.runner }}
container:
image: ${{ needs.get-image-digest.outputs.image_with_digest }}
options: --gpus all --shm-size=16g --user root --entrypoint bash -v huggingface_cache:/huggingface_cache
env:
HF_HOME: /huggingface_cache
PYTORCH_CUDA_ALLOC_CONF: expandable_segments:True
PRIME_DIST__TIMEOUT__SECONDS: 3600
defaults:
run:
working-directory: /app
timeout-minutes: ${{ matrix.timeout_minutes }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
steps:
- name: Clean HF cache locks and fix permissions
run: |
# Remove stale lock files from interrupted downloads
find /huggingface_cache -name "*.lock" -type f -delete 2>/dev/null || true
# Ensure cache directory exists and is writable
mkdir -p /huggingface_cache/hub
chmod -R u+rw /huggingface_cache 2>/dev/null || true
- name: Run benchmark
run: |
python benchmarks/scripts/run_single_benchmark.py \
--type "${{ matrix.type }}" \
--num-gpus "${{ matrix.num_gpus }}" \
--model-name "${{ matrix.model }}" \
${{ matrix.lora_rank && format('--lora-rank {0}', matrix.lora_rank) || '' }} \
--seq-len "${{ matrix.seq_len }}" \
--ac "${{ matrix.ac }}" \
--attention "${{ matrix.attention }}" \
--cp "${{ matrix.cp }}" \
--ep "${{ matrix.ep }}" \
--output "/tmp/benchmark_result.json" \
--docker-image "${{ needs.get-image-digest.outputs.image_with_digest }}" \
--timeout $(( (${{ matrix.timeout_minutes }} - 5) * 60 ))
- name: Set artifact name
id: artifact
run: echo "name=benchmark-${{ matrix.runner }}-$(echo '${{ matrix.model }}' | sed 's/\//--/')-${{ matrix.type }}-${{ matrix.lora_rank || 'full' }}-${{ matrix.num_gpus }}gpu-${{ matrix.ac }}-${{ matrix.attention }}-${{ matrix.seq_len }}-cp${{ matrix.cp }}-ep${{ matrix.ep }}" >> "$GITHUB_OUTPUT"
- name: Upload benchmark result
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ steps.artifact.outputs.name }}
path: /tmp/benchmark_result.json
retention-days: 30
aggregate-and-report:
name: Aggregate results and create PR
needs: run-benchmark
runs-on: ubuntu-latest
if: always()
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository # We can't use the image because then no git
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync
- name: Download all benchmark artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/benchmark_artifacts
pattern: benchmark-*
- name: Aggregate results
id: aggregate
run: |
mkdir -p benchmarks/baselines
uv run python benchmarks/scripts/aggregate_results.py \
--artifacts-dir "/tmp/benchmark_artifacts" \
--baselines-dir "benchmarks/baselines" \
--output-markdown "benchmarks/results/BENCHMARKS.md" \
--regression-threshold 0.05
if [ -f /tmp/prime-rl-benchmark-aggregate-has-regressions ]; then
echo "has_regressions=true" >> "$GITHUB_OUTPUT"
else
echo "has_regressions=false" >> "$GITHUB_OUTPUT"
fi
- name: Set baselines from artifacts
if: ${{ github.event.inputs.set_baselines == 'true' }}
run: |
rm -f benchmarks/baselines/*.json
for dir in /tmp/benchmark_artifacts/*/; do
name=$(basename "$dir")
cp "$dir/benchmark_result.json" "benchmarks/baselines/${name}.json"
done
- name: Set benchmark metadata (date + unique branch)
run: |
BENCHMARK_DATE="$(date +%Y-%m-%d)"
echo "BENCHMARK_DATE=${BENCHMARK_DATE}" >> "$GITHUB_ENV"
echo "BENCHMARK_BRANCH=benchmark-results-${BENCHMARK_DATE}-${{ github.run_id }}" >> "$GITHUB_ENV"
- name: Create PR branch and commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BENCHMARK_BRANCH"
git add benchmarks/results/BENCHMARKS.md
${{ github.event.inputs.set_baselines == 'true' && 'git add benchmarks/baselines/' || 'true' }}
git commit -m "Update benchmark results $(date +%Y-%m-%d)" || echo "No changes to commit"
git push origin "$BENCHMARK_BRANCH" --force
- name: Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ steps.aggregate.outputs.has_regressions }}" = "true" ]; then
WARNING="> :warning: **Performance regressions detected!** Please review the results carefully."
else
WARNING="> :white_check_mark: No regressions detected."
fi
PR_BODY_FILE="/tmp/benchmark_pr_body.md"
cat > "${PR_BODY_FILE}" <<EOF
## Nightly Benchmark Results
**Run ID:** ${{ github.run_id }}
**Date:** ${BENCHMARK_DATE}
**Regression Detected:** ${{ steps.aggregate.outputs.has_regressions }}
${WARNING}
---
## Results (\`benchmarks/results/BENCHMARKS.md\`)
EOF
cat benchmarks/results/BENCHMARKS.md >> "${PR_BODY_FILE}"
cat >> "${PR_BODY_FILE}" <<'EOF'
---
*This PR was automatically generated by the nightly benchmark workflow.*
EOF
gh pr create \
--base main \
--head "$BENCHMARK_BRANCH" \
--title "[Benchmarks] Nightly performance results - ${BENCHMARK_DATE}" \
--body-file "${PR_BODY_FILE}" \
|| echo "PR already exists"
-32
View File
@@ -38,35 +38,3 @@ jobs:
run: PYTEST_OUTPUT_DIR=/tmp/outputs uv run pytest tests/unit -m "not gpu"
- name: Cleanup output_dir
run: rm -rf /tmp/outputs
integration-tests:
name: Integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync --all-extras --locked
- name: Run tests
env:
USERNAME_CI: CI_RUNNER
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
# Set WANDB_MODE to online only if WANDB_API_KEY is available, otherwise set to offline
# This is to allow running tests on forks without WANDB_API_KEY
WANDB_MODE: ${{ secrets.WANDB_API_KEY && 'online' || 'offline' }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PRIME_API_KEY: ${{ secrets.PRIME_API_KEY }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
PYTEST_OUTPUT_DIR: /tmp/outputs
run: PYTEST_OUTPUT_DIR=/tmp/outputs uv run pytest tests/integration -m "not gpu"
- name: Cleanup output_dir
run: rm -rf /tmp/outputs
+94
View File
@@ -0,0 +1,94 @@
name: DevX Tag
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
create-dev-tag:
name: Create .dev tag
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Create next .dev tag from latest release
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const sha = context.sha;
let latestTag;
try {
const latestRelease = await github.rest.repos.getLatestRelease({ owner, repo });
latestTag = latestRelease.data.tag_name;
} catch (error) {
if (error.status === 404) {
core.notice("No releases found. Skipping .dev tag creation.");
return;
}
throw error;
}
const semverMatch = /^(v?)(\d+)\.(\d+)(?:\.(\d+))?$/.exec(latestTag);
if (!semverMatch) {
core.setFailed(`Latest release tag '${latestTag}' is not semver-like.`);
return;
}
const [, versionPrefix, majorRaw, minorRaw, patchRaw] = semverMatch;
const major = Number.parseInt(majorRaw, 10);
const minor = Number.parseInt(minorRaw, 10);
const patch = Number.parseInt(patchRaw ?? "0", 10) + 1;
const baseTag = `${versionPrefix}${major}.${minor}.${patch}`;
const prefix = `${baseTag}.dev`;
const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const pattern = new RegExp(`^refs/tags/${escapeRegex(baseTag)}\\.dev(\\d+)$`);
for (let attempt = 0; attempt < 5; attempt += 1) {
const refs = await github.paginate(github.rest.git.listMatchingRefs, {
owner,
repo,
ref: `tags/${prefix}`,
});
let maxVersion = 0;
for (const ref of refs) {
const match = pattern.exec(ref.ref);
if (match) {
const version = Number.parseInt(match[1], 10);
if (version > maxVersion) {
maxVersion = version;
}
}
}
const tag = `${prefix}${maxVersion + 1}`;
try {
await github.rest.git.createRef({
owner,
repo,
ref: `refs/tags/${tag}`,
sha,
});
core.notice(`Created tag ${tag} at ${sha}`);
return;
} catch (error) {
if (error.status === 422) {
core.warning(`Tag ${tag} already exists, retrying...`);
continue;
}
throw error;
}
}
core.setFailed("Could not create a unique .dev tag after retries.");
+14 -2
View File
@@ -53,7 +53,7 @@ jobs:
integration-tests:
name: Integration tests (${{ matrix.test }})
runs-on: vm
runs-on: ${{ matrix.runner }}
container:
image: pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
options: --gpus all
@@ -64,11 +64,20 @@ jobs:
matrix:
include:
- test: base
pytest_args: "tests/integration -m gpu --ignore=tests/integration/test_rl_lora.py --ignore=tests/integration/test_rl_multi_run_lora.py"
runner: vm
pytest_args: "tests/integration -m gpu --ignore=tests/integration/test_rl_lora.py --ignore=tests/integration/test_rl_multi_run_lora.py --ignore=tests/integration/test_benchmark_regression.py --ignore=tests/integration/test_alphabet_sort.py"
- test: rl_lora
runner: vm
pytest_args: "tests/integration/test_rl_lora.py -m gpu"
- test: alphabet_sort
runner: vm
pytest_args: "tests/integration/test_alphabet_sort.py -m gpu"
- test: rl_multi_run
runner: 4xa6000
pytest_args: "tests/integration/test_rl_multi_run_lora.py -m gpu"
- test: benchmark_regression
runner: 4xa6000
pytest_args: "tests/integration/test_benchmark_regression.py -m gpu"
steps:
- name: Install Git
run: |
@@ -96,7 +105,10 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PRIME_API_KEY: ${{ secrets.PRIME_API_KEY }}
PRIME_BASE_URL: ${{ secrets.PRIME_BASE_URL }}
PRIME_TEAM_ID: ${{ secrets.PRIME_TEAM_ID }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
PYTEST_OUTPUT_DIR: /tmp/outputs
VLLM_WORKER_MULTIPROC_METHOD: spawn
run: uv run pytest ${{ matrix.pytest_args }}
+8
View File
@@ -20,3 +20,11 @@ jobs:
submodules: true
- name: Run ruff
uses: astral-sh/ruff-action@v3
with:
version: "0.13.0"
args: "check --config=pyproject.toml"
- name: Run ruff format (check)
uses: astral-sh/ruff-action@v3
with:
version: "0.13.0"
args: "format --check --config=pyproject.toml"
+33
View File
@@ -12,6 +12,39 @@ jobs:
trigger-docs-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate mint.json pages exist
run: |
missing=()
pages=$(python3 -c "
import json, sys
data = json.load(open('docs/mint.json'))
pages = []
def collect(obj):
if isinstance(obj, list):
for item in obj: collect(item)
elif isinstance(obj, dict):
if 'pages' in obj: collect(obj['pages'])
if 'groups' in obj: collect(obj['groups'])
elif isinstance(obj, str):
pages.append(obj)
collect(data.get('navigation', []))
print('\n'.join(pages))
")
while IFS= read -r page; do
[ -z "$page" ] && continue
if [ ! -f "docs/${page}.md" ] && [ ! -f "docs/${page}.mdx" ]; then
missing+=("${page}")
fi
done <<< "$pages"
if [ ${#missing[@]} -gt 0 ]; then
echo "ERROR: The following pages listed in mint.json do not exist in docs/:"
printf ' - %s\n' "${missing[@]}"
exit 1
fi
echo "All mint.json pages verified."
- name: Trigger public-docs workflow
uses: peter-evans/repository-dispatch@v3
with:
+4
View File
@@ -5,6 +5,10 @@ configs/endpoints.py
# Artifacts
**/slurm
!src/prime_rl/slurm
!examples/slurm
!scripts/slurm_tmux.sh
!docs/slurm.md
**/torchrun
**/weights
**/checkpoints
+2 -2
View File
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.3
rev: v0.13.0
hooks:
# Run the linter.
- id: ruff
- id: ruff-check
args: [ --fix, --config=pyproject.toml ]
# Run the formatter.
- id: ruff-format
+72
View File
@@ -0,0 +1,72 @@
# AGENTS.md
## Code Guidelines
- Avoid try/except blocks unless it's really necessary. It's fine that a program fails if something goes wrong as this helps us to catch non-obvious bugs and unforeseen side-effects earlier. You can add try catch on code that explicitly aims to be fault tolerant like adding retry mechanisms or explicit and intentional robustness.
- Do not add unnecessary comments. Especially do not try to explain code change that reflect your work process, do not refer to old code. "The code used to do that but now we are doing this" is not a pattern we want. Instead prefer to use targeted comments sparingly to explain ambiguous code.
## Zen of Python
remember the zen of python when writing code.
```
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
```
## Running code
- All code should be runnable with `uv run` or `uv run <command>`.
- All dependencies should already be installed and pin in the lock file. If not, add it to pyproject.toml and run `uv sync --all-extras` to install it.
## CLI Usage
- Config files use `@` syntax: `uv run sft @ path/to/config.toml`
- For multi-GPU with torchrun: `uv run torchrun --nproc-per-node 2 src/prime_rl/trainer/sft/train.py @ path/to/config.toml`
- See the `toml-config` skill in `skills/` for full details on TOML structure, CLI overrides, and available commands.
## 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). When you make changes to the codebase, check if any skills need to be updated to stay accurate.
You are responsible for maintaining the skills folder. When a workflow fails and you fix it – whether with help from the user or through trial and error – you must update the skills to make implicit knowledge explicit. You are also responsible for keeping the skills up to date whenever you or anyone else modifies the code.
## Testing
Write tests as plain functions with pytest fixtures. Don't use class-based tests.
## Git
Branch prefixes: `feature/`, `fix/`, `chore/`
## Releases
When preparing release notes:
1. **Style reference**: check the previous release (`gh release list --limit 1` then `gh release view <tag>`) to match the tone and formatting.
2. **Gather changes**: use `git log <last-tag>..origin/main --oneline --no-merges` to list all commits since the last release.
2. **Check for new commits**: always `git fetch origin main` and re-check right before publishing, since PRs may have been merged while drafting.
3. **Structure**: organize notes into numbered highlight sections (`# 1.`, `# 2.`, ...), then `# Breaking Changes`, `# Bug Fixes`, and `# Misc`.
4. **Highlights**: group related PRs under a single highlight. Use `##` subsections when a highlight contains multiple items (e.g. Performance & Parallelism). Keep the top highlights for the most impactful user-facing features.
5. **Config examples**: when referencing TOML config, verify the exact field names against the actual code or docs — don't guess.
6. **Links**: use clickable links for docs (`[docs/foo.md](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/docs/foo.md)`) and PR references (`[#1234](https://github.com/PrimeIntellect-ai/prime-rl/pull/1234)`).
7. **Contributors**: list all contributors ranked by number of commits, using their GitHub `@username`. Get usernames via the GitHub API, not git author names (which can be inconsistent).
8. **Draft first**: always create releases as `--draft` first, iterate on content, then publish.
+98
View File
@@ -2,20 +2,118 @@
Documenting changes which affect configuration usage patterns (added/moved/removed/renamed fields, notable logic changes).
- **`[model.vlm]` (NEW — replaces auto-detection)**: VLM mode is now opt-in via a `[model.vlm]` sub-config with required `vision_encoder_attr` and `language_model_attr` fields. There is no auto-detection — if you train a VLM, you must add `[model.vlm]`. Existing multimodal configs need the new section. See `docs/multimodal.md` for the table of known model attrs. (2026-03-24)
- **`model.optimization_dtype` / `model.reduce_dtype` (VLM models, RL only)**: VLM dtype validation now only applies to RL training (`TrainerConfig`), not SFT. VLM models used with `sft` no longer require `optimization_dtype='bfloat16'` / `reduce_dtype='bfloat16'`. RL training still enforces both to match vLLM inference. (2026-03-24)
- **`model.optimization_dtype` / `model.reduce_dtype` (VLM models)**: Added validation that VLM models must use `optimization_dtype='bfloat16'` and `reduce_dtype='bfloat16'` to match vLLM inference. Previously valid configs with `float32` (the default) are now rejected for VLM model names. Set both fields to `"bfloat16"` when training VLMs. (2026-03-21)
- **`orchestrator.advantage.length_weighted_mean`**: Removed. The default advantage now always uses the plain per-problem mean baseline unless `orchestrator.advantage.length_shaping_alpha` is set. Existing configs must delete this field. (2026-03-19)
- **`orchestrator.advantage.length_shaping_alpha`**: Added Group Relative Reward Rescaling coefficient to the default advantage config. When set, applies length-based GR3 shaping during advantage computation and requires `orchestrator.buffer.online_difficulty_filtering = true` (default: `None`) (2026-03-18)
- **`prime_monitor.log_extras.sample_ratio`**: Added ratio-based rollout sampling (0.0–1.0, default: None). When set, caps the number of rollouts logged per step to `len(rollouts) * sample_ratio`. `None` preserves current behavior (log all rollouts). Interacts with existing `interval` gate which still runs first. (2026-03-12)
- **`client.connect_timeout`**: Added configurable TCP connect timeout for inference API requests (default: 30.0s). Previously hardcoded to 5.0s. Helps with vLLM or cluster flakiness (2026-03-11)
- **`model.fused_lm_head_token_chunk_size`**: Added as the fused LM-head chunking field for the token-chunked implementation. Unlike the removed `model.fused_lm_head_chunk_size`, this chunks over flattened sequence tokens rather than vocabulary rows. `model.fused_lm_head_chunk_size` is no longer accepted; switch configs to `model.fused_lm_head_token_chunk_size` explicitly. (2026-03-09)
- **`slurm.pre_run_command`**: Added optional shell command to run on the head node before starting the job. Useful for cleanup routines (e.g. killing stale processes, removing lock files). For all-nodes execution, wrap with `srun` in the command string (default: None) (2026-03-08)
- **`slurm.nodelist`**, **`slurm.exclude`**, **`slurm.account`**, **`slurm.time`**: Added common SLURM scheduling options (all default: None) (2026-03-08)
- **`orchestrator.verification.enabled`**: Added top-level rollout verification switch. `orchestrator.buffer.skip_verification` has been removed; use `verification.enabled = false` instead. When disabled, rewards are always 0 and reward-dependent buffer features (`online_difficulty_filtering`, `easy_threshold`, `hard_threshold`) must be unset (2026-03-03)
- **`client.dp_rank_count`**: Added configuration for data-parallel inference routing. When > 1, each `client.base_url` is expanded into `dp_rank_count` logical clients and pinned via `X-data-parallel-rank` to keep multi-turn rollouts on a consistent DP rank (default: 1) (2026-03-03)
- **`model.lora`**: Moved from `model.experimental.lora` to `model.lora` (no longer experimental) (#1440, 2025-12-16)
- Auto-set `api_server_count=1` on inference when LoRA is enabled, because vLLM doesn't support hotloading for multiple API servers (#1422, 2025-12-17)
- **`inference.model.rope_scaling`**: Added RoPE scaling configuration passthrough to vLLM (#1447 2025-12-17)
- **`orchestrator.env_mix`**: Deprecated in favor of `orchestrator.buffer.env_ratios` (#1450, 2025-12-18)
- **`orchestrator.buffer.hash_keys`**: Added hash keys configuration for buffer checkpointing (#1450, 2025-12-18)
- **`orchestrator.buffer.env_ratios`**: Added environment ratio configuration for buffer sampling (#1450, 2025-12-18)
- **`orchestrator.buffer.skip_verification`**: Added configuration to skip verification of rollouts using the environment's rubric. If True, rewards are always set to 0. Cannot be used with `online_difficulty_filtering=True` or when `easy_threshold`/`hard_threshold` are set (default: False)
- **`orchestrator.ckpt.buffer_path`**: Deprecated (#1450, 2025-12-18)
- **`orchestrator.buffer.easy_fraction`** and **`orchestrator.buffer.hard_fraction`**: Easy and hard fraction now defines the fraction of easy and hard problems to convert to normal when resuming, whereas previously it was the ratio of easy/ hard samples to sample per step (#1450, 2025-12-18)
- **`orchestrator.teacher_model`**: Added teacher model configuration for computing teacher logprobs (e.g. for distillation). Supports `TeacherModelConfig` (custom model) or `None` (disabled). Renamed from `reference_model` (2025-12-20)
- **`seq_len`**: Added root-level `seq_len` config that sets both `trainer.model.seq_len` and `orchestrator.seq_len`. Added validation that `trainer.model.seq_len >= orchestrator.seq_len` (2025-12-18)
- **`trainer.loss.sequence_mask_ratio_low`** and **`trainer.loss.sequence_mask_ratio_high`**: Renamed to `trainer.loss.sequence_mask_low` and `trainer.loss.sequence_mask_high` (2025-12-19)
- **`trainer.loss.token_mask_high`** and **`trainer.loss.token_mask_low`**: Added token-level importance ratio masking thresholds (2025-12-19)
- **`trainer.loss.sequence_clip_high`**: Added sequence-level importance ratio clipping threshold (2025-12-19)
- **`trainer.loss.geo_mask_high`** and **`trainer.loss.geo_mask_low`**: Added geometric importance ratio masking thresholds (2025-12-19)
- **`trainer.loss.adv_tau`**: Added tau parameter for advantages (default: 1.0)
- **`trainer.loss.teacher_tau`**: Added tau parameter for teacher logprobs (default: 0.0). Renamed from `ref_tau`
- **`teacher_gpu_ids`**: Added GPU IDs for teacher inference server. When set, automatically starts a teacher inference server and configures `orchestrator.teacher_model`
- **`teacher_inference`**: Added optional teacher inference config. Defaults to copying from `inference` config with port 8001
- **`{orchestrator,trainer}.transport.zmq`**: Added ZMQ transport for training batches and micro batches (#1446, 2025-12-22)
- **`model.impl`**: Changed default from `hf` to `auto`. With `auto`, the implementation automatically selects `custom` if supported for the model, otherwise falls back to `hf` (#1488, 2025-12-27)
- **`orchestrator.eval.skip_eval_on_resume`**: Added flag (default `True`) to skip the first potentially redundant online eval immediately after resuming from a checkpoint (#1491, 2025-12-27)
- **`trainer.weight_broadcast.adapter_only`**: Removed. Adapter-only behavior is now automatically derived from the presence of LoRA configuration (2025-12-27)
- **`ckpt.keep`**: Renamed to `ckpt.keep_last`. Added `ckpt.keep_interval` to keep checkpoints at every N steps permanently (2025-12-31)
- **`MultiLoRAMoE`**: QwenMoE now supports training expert loras and this is enabled by default in the `target_modules`. (2026-01-01)
- **`model.fused_lm_head_chunk_size`**: Added chunk size configuration for fused LM head to enable memory-efficient chunked logprob computation. When set, splits vocabulary into chunks to avoid materializing full [N, V] logit tensor (default: None) (#1525, 2026-01-03)
- **`model.fused_lm_head_chunk_size`**: RL training now auto-sets this to 2048 if not specified (except when `impl='liger_kernel'`). SFT training continues to use None (2026-01-05)
- **`trainer.metrics_server`**: Added optional Prometheus metrics server for trainer observability. Exposes `/metrics` endpoint with step, loss, throughput, grad_norm, etc. Disabled by default (default: None) (#1547, 2026-01-06)
- **`model.lora.alpha`**: Changed default from 16.0 to 32.0 (2026-01-10)
- **`orchestrator.env.log`**: Added logging configuration for environment workers. If set, enables logging with `level` (str, default: "warn") and `vf_level` (str, default: "warn") fields. If None (default), logging is disabled (#1561, 2026-01-13)
- **`eval.watcher`**: Added flag (default `False`) to watch `weights_dir` for newly-created stable checkpoints and evaluate them as they appear (2026-01-14)
- **`orchestrator.log.env_worker_logs`**: Added flag (default `False`) to write env worker logs to `logs/env_workers/{env_name}.log` (2026-01-15)
- **`orchestrator.env.log`**: Removed. Use `orchestrator.log` for env worker logging instead (2026-01-15)
- **`orchestrator.eval.retry.reraise`**: Changed default from `True` to `False`. When `False`, raises `tenacity.RetryError` after retries are exhausted instead of the original exception, allowing failed eval environments to be skipped with a warning (#1586, 2026-01-14)
- **`model.ep`**: Expert parallelism now supported (with auto/custom impl only), changed from the old behaviour when `ep>1` was a no-op to a proper parallelization of the MoE layers. (#1595, 2026-01-15)
- **`orchestrator.reload_weights_on_start`**: Removed. The reload was a no-op in practice since vLLM servers already start with base weights, and LoRA runs skipped it. (#1829, 2026-02-19)
- **`orchestrator.client.elastic`**: Added elastic inference pool with DNS-based service discovery. Supports dynamic server scaling via any DNS hostname with multiple A records (Kubernetes headless services, Consul, Route53, etc.). Automatically syncs LoRA adapters on new servers and only exposes ready servers to workers (#1617, 2026-01-19)
- **`model.fused_lm_head_chunk_size`**: Replaced chunk size `int | None` setting with `int | Literal["auto", "disabled"]` setting. `auto` auto-sets to 2048 if possible. `disabled` explicitly disables chunked loss (use vanilla LM head). Default behaviour is to use `auto` for RL training and `disabled` for SFT training. (not changed from previous version) (#1649, 2026-01-23)
- **`client.skip_model_check`**: Added configuration to skip checking if the model is available in the inference pool. Useful for external APIs or API keys that don't support the /models endpoint (default: False) (#1543, 2026-01-06)
- **`orchestrator.sampling.temp_scheduler`**: Added optional temperature schedule configuration with linear and cosine schedules. Set either `sampling.temperature` (constant) or `sampling.temp_scheduler` (schedule), not both. Default remains 1.0 if neither is set. (2026-01-27)
- **`orchestrator.trajectory_strategy`**: Deprecated. Interleaving now automatically handles extension breaks by starting a new sample when the prefix doesn't match, achieving best-of-both behavior. The setting is ignored and interleaved mode is always used. (2026-01-30)
- **`model.impl`**: Removed `liger_kernel` model implementation from supported options. The Liger kernel dependency remains for SFT loss. (2026-01-30)
- **`log.json_logging`**: Added JSON structured logging option for log aggregation systems (Loki, Grafana, etc.). Outputs flat newline-delimited JSON with `timestamp`, `level`, `message`, `module`, `function`, `line` fields. Available on root `log`, `trainer.log`, and `orchestrator.log` (default: False) (2026-01-28)
- **`model.optim_cpu_offload`**: Added flag to offload optimizer states to CPU without moving parameters (default: False) (2026-01-31)
- **`orchestrator.tasks_per_minute`**: Added optional rate limiting for sandbox tasks per environment worker. Uses token bucket algorithm. If None (default), no rate limiting is applied (2026-02-02)
- **`model.cp`**: When `cp>1` with `attn="flash_attention_3"`, require `model.impl="custom"` (FA3 ring-attention kernel only in custom path) (2026-02-06)
- **`model.attn`**: Added `fa4` as an attention implementation option. Flash attention 4 is only supported with the custom implementation (#1726, 2026-02-06)
- **`inference.model.enable_prefix_caching`**: Added flag to enable prefix caching in vLLM. Passed to vLLM as `--enable-prefix-caching` (default: None) (2026-02-08)
- **`orchestrator.env.address`**: Added address field on `EnvConfig`. If set, connect to an environment server at this address; if None, spawn a server in a subprocess (2026-02-06)
- **`orchestrator.env.extra_env_kwargs`**: Added on `EnvConfig`. Extra kwargs passed to the env (e.g. seq_len, interleaved_rollouts, score_rollouts). Auto-populated by the orchestrator for training envs; generally not recommended for user override. Main use case is to match these kwargs when running an env in an isolated environment server (default: {}) (2026-02-06)
- **`OrchestratorConfig`**: Removed `workers_per_env`, `max_env_worker_restarts`, and `mask_env_responses` (2026-02-06)
- **`EvalSaveDiskConfig`**, **`EvalSaveConfig`**, **`RetryConfig`**, **`OnlineEvalConfig`**: Removed (2026-02-06)
- **`TemperatureScheduleConfig`**: Renamed to `TemperatureSchedulerConfig` (2026-02-06)
- **`optim.mu`**: Added Muon momentum (`mu`) config field (default: 0.95). Previously hardcoded to Muon class default. Also fixed `optim.betas1`/`optim.betas2` not being passed through to the Muon optimizer (2026-02-09)
- **`dump_config`**: Added `--dump-config <path>` flag to the `rl` command. When set, writes the resolved subconfigs (trainer, orchestrator, inference, teacher_inference) to the given directory and exits without starting any processes (2026-02-12)
- **`client.api_key_var`**: Changed default from "OPENAI_API_KEY" to "VLLM_API_KEY" (2026-02-12)
- **`orchestrator.filters`**: Added orchestrator-side rollout filters for detecting degenerate generations. Supports `[[filters]] type = "gibberish"` (rare tokens at high entropy) and `[[filters]] type = "repetition"` (high-confidence token streaks). Detected rollouts get reward zeroed and completion mask cleared (2026-02-13)
- **`inference.model.tool_call_parser`**: Changed default from `"hermes"` to auto-detection from model name. Uses `MODEL_TOOL_CALL_PARSER` dict to infer the correct vLLM tool call parser (e.g. Qwen3→`hermes`, GLM-4.5→`glm45`, GLM-4.7→`glm47`, MiniMax-M2→`minimax_m2`, INTELLECT-3→`hermes`). Unknown models default to `None`. Explicit values still take priority. (#1795, 2026-02-16)
- **`orchestrator.eval.cancel_inflight_rollouts_on_eval`**: Added flag to optionally cancel in-flight training rollouts before starting online evals. When enabled, avoids congestion by preventing training and eval rollouts from running simultaneously, but slows training as the rollout pipeline must refill after each eval (default: False) (2026-02-16)
- **`orchestrator.use_token_client`**: Added flag to use the token-in-token-out (TITO) client for training across all environments. When enabled, uses `openai_chat_completions_token` client type instead of `openai_chat_completions`. Only use when environments have linear history and the chat template has the extension property (default: False) (2026-02-21)
- **`model.cp` + AFMoE**: Context parallelism now works with AFMoE models via unified `substitute_ring_attn` which patches `_compute_attention` on both `FlashAttention` and `AfmoeFlashAttention` to use ring attention. Sliding window layers automatically get per-layer `window_size`; full attention layers default to `(-1, -1)`. Also plumbed `window_size` through the FA3 ring attention wrapper (`ring_fa3_varlen_func`). (2026-02-21)
- **`orchestrator.token_batch_size`** and **`orchestrator.max_inflight_rollouts`**: Added token-based batching via `token_batch_size` and explicit in-flight rollout control via `max_inflight_rollouts` (2026-02-23)
- **`orchestrator.batch_size`**: Now optional and mutually exclusive with `token_batch_size`. If neither is set, defaults to rollout mode with `batch_size=128` (2026-02-23)
- **`inference.enable_expert_parallel`**, **`inference.all2all_backend`**, and **`inference.enable_eplb`**: Added expert-parallel inference controls passed to vLLM as `--enable-expert-parallel`, `--all2all-backend`, and `--enable-eplb` (defaults: `False`, `"allgather_reducescatter"`, `False`) (2026-02-23)
- **`rl_slurm` / `sft_slurm` entrypoints**: Removed. SLURM submission is now handled by the unified `rl` and `sft` entrypoints. Add a `[slurm]` section to your config to submit via SLURM instead of running locally (2026-02-23)
- **`inference_gpu_ids` / `trainer_gpu_ids` / `teacher_gpu_ids`**: Removed from `RLConfig`. Replaced by `[deployment]` section with `type = "single_node"` (fields: `num_train_gpus`, `num_infer_gpus`, `num_teacher_gpus`) or `type = "multi_node"` (fields: `num_train_nodes`, `num_infer_nodes`, `num_teacher_nodes`, `nodes_per_fsdp_group`). Default is `single_node` with 1 train GPU and 1 infer GPU (2026-02-23)
- **`RLSLURMConfig`**: Removed. Fields `job_name`, `num_train_nodes`, `num_infer_nodes`, `gpus_per_node`, `nodes_per_fsdp_group`, `project_dir`, `slurm_template`, `dry_run` are now under `[slurm]` and `[deployment]` in the unified `RLConfig` (2026-02-23)
- **`SFTSLURMConfig`**: Removed. Fields `job_name`, `num_nodes`, `gpus_per_node`, `nodes_per_fsdp_group`, `project_dir`, `slurm_template`, `dry_run` are now under `[slurm]` and `[deployment]` in `SFTConfig` (2026-02-23)
- **`[deployment]` (RL)**: Added deployment configuration. `type = "single_node"` auto-derives contiguous GPU assignments from `num_infer_gpus`, `num_train_gpus`, `num_teacher_gpus`. `type = "multi_node"` requires `[slurm]` and uses `num_train_nodes`, `num_infer_nodes` (2026-02-23)
- **`[deployment]` (SFT)**: Added deployment configuration. `type = "single_node"` with `num_gpus` (default: 1). `type = "multi_node"` with `num_nodes`, `nodes_per_fsdp_group`, `hf_hub_offline` (2026-02-23)
- **`[slurm]` (RL)**: Added SLURM configuration with `job_name`, `project_dir`, `template_path`, `partition`, `dry_run`. When present, `uv run rl` generates and submits an sbatch script instead of running locally. Template is auto-selected based on deployment type (2026-02-23)
- **`[slurm]` (SFT)**: Added SLURM configuration with `job_name`, `project_dir`, `template_path`, `partition`, `dry_run`. When present, `uv run sft` generates and submits an sbatch script instead of running locally (2026-02-23)
- **`hf_hub_offline` (RL/SFT SLURM)**: Removed. `HF_HUB_OFFLINE=1` is now hardcoded in the multi-node SLURM templates (2026-02-23)
- **SLURM templates**: Moved from `src/prime_rl/slurm/` to `src/prime_rl/templates/` and renamed to `single_node_rl.sbatch.j2`, `multi_node_rl.sbatch.j2`, `single_node_sft.sbatch.j2`, `multi_node_sft.sbatch.j2` (2026-02-23)
- **Entrypoints**: Moved `rl` and `sft` entrypoints from `prime_rl.rl` / `prime_rl.sft` to `prime_rl.entrypoints.rl` / `prime_rl.entrypoints.sft`. No change to CLI usage (`uv run rl`, `uv run sft`) (2026-02-24)
- **`output_dir` (RL)**: Changed from `Path | None` (default `None`) to `Path` (default `Path("outputs")`). The SLURM-specific validation that rejected the default has been removed — `output_dir` now works the same for local and SLURM runs (2026-02-24)
- **`clean_output_dir`**: Added to `RLConfig` and `SFTConfig` (default: `False`). Training now raises `FileExistsError` when `output_dir` contains checkpoints from a previous run and not resuming. Set `clean_output_dir=true` to delete and start fresh, or set `ckpt.resume_step` to resume (2026-02-24)
- **`clean`**: Removed from `RLConfig`. The old `clean` flag (default: `True`) silently deleted logs, rollouts, and broadcasts on every local RL run. Superseded by the explicit `clean_output_dir` flag (2026-02-24)
- **Config consolidation**: All config modules moved into `prime_rl.configs` subpackage. `utils/config.py` + `transport/config.py` → `configs/shared.py`; `trainer/config.py` + `trainer/rl/config.py` → `configs/trainer.py`; `trainer/sft/config.py` → `configs/sft.py`; `orchestrator/config.py` → `configs/orchestrator.py`; `inference/config.py` → `configs/inference.py`; `rl_config.py` → `configs/rl.py`. Class renames: `SFTTrainerConfig` → `SFTConfig`, `RLTrainerConfig` → `TrainerConfig`. Component prefixes dropped from orchestrator and inference config classes (e.g. `OrchestratorCheckpointConfig` → `CheckpointConfig`). TypeAlias renames: dropped `Type` suffix (e.g. `LossConfigType` → `LossConfig`, `TransportConfigType` → `TransportConfig`), renamed `LossConfig` class → `DefaultLossConfig`. No TOML key changes. (2026-02-24)
- **`trainer.enable_router_replay`**: Added flag to enable router replay. If True, will return routed experts in the batch. This is only supported if `enable_return_routed_experts=True` in the inference config or pass `--enable-return-routed-experts` to vLLM server. This is only supported for custom models. (2026-02-22)
- **`inference.enable_return_routed_experts`**: Added flag to enable return routed experts. Passed to vLLM as `--enable-return-routed-experts` (2026-02-22)
- **`orchestrator.oversampling_factor`**: Added rollout-only over-sampling config that resolves `max_inflight_rollouts = int(batch_size * oversampling_factor)` when `max_inflight_rollouts` is unset. Cannot be used with `token_batch_size` or together with explicit `max_inflight_rollouts` (2026-02-25)
- **`sft.val`**: Added optional periodic SFT validation with `val/loss` and `val/num_tokens` logging. Configure via `sft.val.data` (validation dataset) and `sft.val.interval` (every N steps, default 50). Runs the full validation dataset each pass. (2026-02-26)
- **`model.fused_lm_head_chunk_size`**: Changed default value from 2048 to 8192 for RL training (2026-02-26)
- **`inference.data_parallel_size_local`** and **`inference.data_parallel_rpc_port`**: Added data-parallel node-local controls for vLLM, passed as `--data-parallel-size-local` and `--data-parallel-rpc-port` (defaults: `None`, `13345`) (2026-02-26)
- **`dump_config`**: Removed from `RLConfig`. Replaced by `dry_run` (see below) (2026-02-26)
- **`slurm.dry_run`**: Removed from `SlurmConfig`. Replaced by top-level `dry_run` (see below) (2026-02-26)
- **`dry_run`**: Added to `RLConfig` and `SFTConfig` (default: `False`). When set, validates the config, writes resolved subconfigs to `output_dir/configs/`, and exits without starting any processes. Works the same for both local and SLURM runs (2026-02-26)
- **Config output location**: Resolved subconfigs are now always written to `output_dir/configs/` instead of `.pydantic_config/<uuid>/`. This applies to both local and SLURM entrypoints, and for both single-node and multi-node deployments (2026-02-26)
- **SFT config filename**: The resolved SFT trainer config is now written as `sft.toml` instead of `trainer.toml` (2026-02-26)
- **Inference entrypoint**: Moved from `prime_rl.inference.server` to `prime_rl.entrypoints.inference`. No change to CLI usage (`uv run inference`) (2026-02-26)
- **`[slurm]` (inference)**: Added SLURM configuration to `InferenceConfig`. When present, `uv run inference` generates and submits an sbatch script instead of running locally. Each SLURM node runs an independent vLLM replica (no cross-node parallelism) (2026-02-26)
- **`[deployment]` (inference)**: Added deployment configuration. `type = "single_node"` (default) with `gpus_per_node`. `type = "multi_node"` with `num_nodes` and `gpus_per_node` — requires `[slurm]` (2026-02-26)
- **`inference.output_dir`**: Added directory for SLURM logs and generated scripts (default: `"outputs"`) (2026-02-26)
- **`inference.dry_run`**: Added flag (default: `False`). When set, validates config, writes resolved config to `output_dir/configs/`, and exits without starting inference or submitting SLURM jobs (2026-02-26)
- **`orchestrator.teacher_rollout_model`**: Added optional external rollout model configuration. When set, rollouts are generated from this endpoint/model instead of the student inference server. Accepts a `TeacherRolloutModelConfig` with `client` and `model` sub-fields, or `None` (default: `None`) (2026-02-26)
- **`trainer.loss.type = "sft"`**: Added SFT loss variant. Set `trainer.loss.type = "sft"` to use masked negative log-likelihood loss instead of the default RL loss (2026-02-26)
- **`trainer.loss.type = "custom"`**: Added custom loss variant. Set `trainer.loss.type = "custom"` with `import_path` (e.g. `"my_module.my_loss"`) and optional `kwargs` to use an external loss function (2026-02-26)
- **`trainer.loss` (default loss)**: Made IPO (DPPO-Binary TV variant ([arxiv](https://arxiv.org/pdf/2602.04879)) + Kimi-K2.5 KL ([Kimi-K2.5](https://arxiv.org/pdf/2602.02276))) the default loss. Removed `ratio_type`, `token_mask_low`, `token_mask_high`, `sequence_clip_high`, `geo_mask_low`, `geo_mask_high`, `sequence_mask_low`, `sequence_mask_high`. Added `ipo_mask_low` (default: 0.2) and `ipo_mask_high` (default: 0.2) for token-level probability-difference masking. Changed `kl_tau` default from `0.0` to `1e-3`. (2026-03-02)
- **Metrics logging overhaul**: All orchestrator metrics now follow a `{metric}/{scope}/{stat}` naming convention where scope is `all` (global) or an env name. Per-env breakdowns are always logged (previously only when >1 env). Key renames: `reward/mean` → `reward/all/mean`, `batch/solve_none` → `solve_none/all`, `val_reward/` → `val/reward/`, `metrics/{name}` → `metrics/{env}/{name}`, `stop_condition/{sc}` → `stop_condition/all/{sc}`, `error/mean` → `error/all/mean`. New per-env metrics: `solve_none/{env}`, `solve_all/{env}`, `effective_batch_size/{env}`, `stop_condition/{env}/generation_truncated`, `stop_condition/{env}/{sc}`, `error/{env}/mean`, plus per-env breakdowns for `seq_len`, `prefill_len`, `decode_len`, `is_truncated`, `samples_per_rollout`, `num_turns`, `generation_ms`, `scoring_ms`. Removed: `reward/std`, `reward/median`, per-error-type breakdown (`error/{error_type}`). Env name `"all"` is reserved and rejected at config validation. Env name validation now strips `@version` suffixes to match runtime behavior (e.g. `math@1.0` and `math@2.0` correctly detected as duplicates). Solve stats now use `example_id` grouping instead of index arithmetic (pre-existing bug fix). (2026-03-08)
- **`wandb.shared`** (experimental): Added shared W&B mode that logs trainer and orchestrator metrics to a single W&B run instead of two separate runs. Uses `wandb.Settings(mode="shared")` (requires wandb SDK >= 0.19.9). Enabled by default on the RL entrypoint. Disable with `--wandb.shared False`. Run ID is communicated via `WANDB_SHARED_RUN_ID` env var; process role via `WANDB_SHARED_LABEL`. Non-primary processes retry `wandb.init` up to 30 times waiting for the primary to create the run. Works with multi-node SLURM. (2026-03-18)
- **`wandb.id`**: Removed from `WandbConfig`. Run IDs are now managed internally via env vars for shared mode. (2026-03-18)
- **`trainer.ckpt.skip_optimizer`**: Added flag to skip loading optimizer states when resuming training. When set, only the model weights are loaded from the checkpoint. (2026-03-24)
+1
View File
@@ -0,0 +1 @@
@AGENTS.md
+26 -4
View File
@@ -1,7 +1,7 @@
#inspired from https://github.com/astral-sh/uv-docker-example/blob/main/multistage.Dockerfile
# Build stage
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel AS builder
# Build stage - multi-arch base (supports amd64 + arm64)
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 AS builder
LABEL maintainer="prime intellect"
LABEL repository="prime-rl"
@@ -12,12 +12,22 @@ RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=$PATH:/usr/local/cuda/bin
# Install packages
# Install packages (including Python 3.12 and ninja for fast CUDA kernel compilation)
ARG DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \
build-essential \
curl \
sudo \
git \
ninja-build \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends python3.12 python3.12-dev python3.12-venv \
&& ln -sf /usr/bin/python3.12 /usr/bin/python3 \
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
&& apt-get clean autoclean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Download the latest installer
@@ -40,9 +50,15 @@ COPY README.md /app/README.md
COPY src/ /app/src/
COPY configs /app/configs
COPY examples /app/examples
COPY benchmarks/scripts /app/benchmarks/scripts
RUN --mount=type=cache,target=/app/.cache/uv \
uv sync --all-extras --locked --no-dev
uv sync --all-extras --group mamba-ssm --locked --no-dev
# arm64: build flash-attn from source, fix namespace conflicts, apply workarounds
ARG TARGETARCH
COPY scripts/docker-arm64-post-install.sh /app/scripts/docker-arm64-post-install.sh
RUN if [ "$TARGETARCH" = "arm64" ]; then /app/scripts/docker-arm64-post-install.sh; fi
FROM python:3.12-slim
@@ -62,6 +78,8 @@ RUN apt-get update && apt-get install -y \
net-tools \
curl \
vim \
libibverbs1 \
ibverbs-providers \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -94,6 +112,10 @@ RUN rm /app/.venv/bin/python3.12 && ln -s /usr/local/bin/python /app/.venv/bin/p
# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"
# HuggingFace Hub timeouts (defaults are 10s which causes issues on slow networks)
ENV HF_HUB_ETAG_TIMEOUT=500
ENV HF_HUB_DOWNLOAD_TIMEOUT=300
# Use entrypoint for setup (ulimit, etc) but default to sleep infinity for K8s
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["sleep", "infinity"]
+3 -2
View File
@@ -34,7 +34,7 @@ PRIME-RL is a framework for large-scale asynchronous reinforcement learning. It
1. Integrates natively with [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) environments via the [Environments Hub](https://app.primeintellect.ai/dashboard/environments?ex_sort=most_stars)
2. Supports end-to-end post-training, including SFT and RL training and evals
3. Multi-node deployment with [FSDP2](https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html) training and [vLLM](https://github.com/vllm-project/vllm) inference backend
4. Designed for asynchronous training in decentralized settings
4. Designed for asynchronous agentic RL training at scale
5. Hackable, modular and extensible by nature
## Setup
@@ -164,8 +164,9 @@ We provide end-to-end training examples in the [`examples`](examples) directory
2. [**Wordle**](examples/wordle/README.md): Train `Qwen3-1.7B` to play Wordle. A fun example of multi-turn SFT and RL training. Can be trained on a 2-4 H100 GPUs in a few hours. Ideal for exploring the multi-turn training capabilities of the framework.
3. [**Alphabet Sort**](examples/alphabet_sort/README.md): Train `Qwen3-4B-Instruct-2507` to sort names alphabetically. Demonstrates multi-turn RL training via LoRA without SFT warmup. Can be trained on a single H100 GPU in just over an hour. Ideal for exploring LoRA-based training.
4. [**Wiki Search**](examples/wiki_search/README.md): Train `Qwen3-4B-Instruct-2507` to answer trivia questions by searching through a Wikipedia. Demonstrates multi-turn with web search tool use.
5. [**Hendrycks Sanity**](examples/hendrycks_sanity/README.md): Run a sanity check experiment on `DeepSeek-R1-Distill-Qwen-1.5B` using a filtered subset of MATH where the model already partially solves 20-80% of problems. Useful for algorithm ablations.
4. *More to come...*
*More to come...*
## Docs
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA RTX A6000",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:07:14.032743+00:00",
"success": true,
"error_reason": null,
"time_taken": 110.89856401001452
},
"metrics": {
"mfu": {
"mean": 6.25326518008405,
"std": 1.1088767048821218,
"min": 5.042813758258495,
"max": 7.220033506991957
},
"throughput": {
"mean": 2414.13793444897,
"std": 428.09336255378895,
"min": 1946.8305980283696,
"max": 2787.3688825375607
},
"step_time": {
"mean": 9.231287551335603,
"std": 0.08240427237252125,
"min": 9.138645098020788,
"max": 9.296410266979365
},
"peak_memory": {
"gib": 5.087890625,
"pct": 10.733540123945605
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA RTX A6000",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:09:42.402759+00:00",
"success": true,
"error_reason": null,
"time_taken": 323.0761482360249
},
"metrics": {
"mfu": {
"mean": 15.980779848317193,
"std": 0.016794587683451167,
"min": 15.96452617710017,
"max": 15.9980675684045
},
"throughput": {
"mean": 1994.95423828766,
"std": 2.096545612755065,
"min": 1992.9252177648882,
"max": 1997.1123438861257
},
"step_time": {
"mean": 65.7679032223338,
"std": 0.13193422188415097,
"min": 65.63013747497462,
"max": 65.89310738901258
},
"peak_memory": {
"gib": 11.453125,
"pct": 24.161796271330914
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA RTX A6000",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:20:58.816045+00:00",
"success": true,
"error_reason": null,
"time_taken": 69.12897840799997
},
"metrics": {
"mfu": {
"mean": 10.888337274160449,
"std": 0.1146035522747722,
"min": 10.756101312551046,
"max": 10.958838408729708
},
"throughput": {
"mean": 3687.3357954776216,
"std": 38.810496952046634,
"min": 3642.5540824929494,
"max": 3711.211007144323
},
"step_time": {
"mean": 7.457733287660328,
"std": 0.06480044847570422,
"min": 7.398152031993959,
"max": 7.526724088995252
},
"peak_memory": {
"gib": 12.469401041666666,
"pct": 26.30575738885863
}
}
}
@@ -0,0 +1,48 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"ep": 1,
"cp": 1,
"docker_image": null,
"device_name": "NVIDIA RTX A6000",
"commit_sha": "83c21ddac",
"timestamp": "2026-02-26T02:07:06+00:00",
"success": true,
"error_reason": null,
"time_taken": 276.12556480802596
},
"metrics": {
"mfu": {
"mean": 16.41977165630161,
"std": 0.010586646038388221,
"min": 16.407648988464405,
"max": 16.42719598975201
},
"throughput": {
"mean": 1960.9836648020673,
"std": 1.2643440104327244,
"min": 1959.5358764831926,
"max": 1961.8703395331793
},
"step_time": {
"mean": 65.87,
"std": 0.13,
"min": 65.74,
"max": 66.0
},
"peak_memory": {
"gib": 31.806640625,
"pct": 67.03
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 8192,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA RTX A6000",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:15:16.344492+00:00",
"success": true,
"error_reason": null,
"time_taken": 37.26451032201294
},
"metrics": {
"mfu": {
"mean": 13.534357307187642,
"std": 0.11591312542586621,
"min": 13.432546913664385,
"max": 13.660507673056479
},
"throughput": {
"mean": 6603.696328150197,
"std": 56.55644101790505,
"min": 6554.020905326831,
"max": 6665.2477331393675
},
"step_time": {
"mean": 2.458166876322745,
"std": 0.01111478049147262,
"min": 2.4491563979827333,
"max": 2.4705870889883954
},
"peak_memory": {
"gib": 31.21484375,
"pct": 65.85160777769623
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA RTX A6000",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:03:16.754400+00:00",
"success": true,
"error_reason": null,
"time_taken": 189.08276393299457
},
"metrics": {
"mfu": {
"mean": 13.593108190460633,
"std": 0.6113375543806666,
"min": 12.9129464707711,
"max": 14.096800271491071
},
"throughput": {
"mean": 1232.6245823189486,
"std": 55.4361583139007,
"min": 1170.947440940054,
"max": 1278.299436980461
},
"step_time": {
"mean": 24.43446325266268,
"std": 0.05958367621622373,
"min": 24.387022126989905,
"max": 24.501337252993835
},
"peak_memory": {
"gib": 23.302734375,
"pct": 49.160025803760085
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:45:06.153019+00:00",
"success": true,
"error_reason": null,
"time_taken": 101.25457232699955
},
"metrics": {
"mfu": {
"mean": 24.720617400371953,
"std": 0.0059618599726984295,
"min": 24.716927952372927,
"max": 24.727495488498064
},
"throughput": {
"mean": 9782.187433962441,
"std": 2.359165661739719,
"min": 9780.727483700286,
"max": 9784.909159967388
},
"step_time": {
"mean": 13.400609701333451,
"std": 0.011325855757257303,
"min": 13.389435630000662,
"max": 13.412081471999954
},
"peak_memory": {
"gib": 7.91796875,
"pct": 10.000107919270219
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:47:00.758560+00:00",
"success": true,
"error_reason": null,
"time_taken": 54.114448966000054
},
"metrics": {
"mfu": {
"mean": 10.902290160145071,
"std": 0.011717783508844587,
"min": 10.889823370330753,
"max": 10.91307776345264
},
"throughput": {
"mean": 13341.807441650146,
"std": 14.33977714053646,
"min": 13326.551059121803,
"max": 13355.008899689909
},
"step_time": {
"mean": 2.4532590479999876,
"std": 0.004686582604909462,
"min": 2.449214012000084,
"max": 2.4583948149993375
},
"peak_memory": {
"gib": 5.146484375,
"pct": 6.499823474907999
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:29:24.218730+00:00",
"success": true,
"error_reason": null,
"time_taken": 97.12500511000053
},
"metrics": {
"mfu": {
"mean": 25.186637106124792,
"std": 0.01564156074320041,
"min": 25.176655080716063,
"max": 25.20466375456501
},
"throughput": {
"mean": 9966.595939452507,
"std": 6.189516890762853,
"min": 9962.645955439677,
"max": 9973.729258616522
},
"step_time": {
"mean": 13.155961893666548,
"std": 0.013725280074692658,
"min": 13.141330864999873,
"max": 13.168553112999689
},
"peak_memory": {
"gib": 11.453125,
"pct": 14.464882298618786
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:35:09.475885+00:00",
"success": true,
"error_reason": null,
"time_taken": 72.44658932200036
},
"metrics": {
"mfu": {
"mean": 26.354162261984143,
"std": 0.2016890980989746,
"min": 26.126549197344954,
"max": 26.510662024401086
},
"throughput": {
"mean": 9976.949543004863,
"std": 76.35385769823057,
"min": 9890.78159584497,
"max": 10036.195980725191
},
"step_time": {
"mean": 12.462525163000464,
"std": 0.012756092294355367,
"min": 12.452715442000226,
"max": 12.476945533000617
},
"peak_memory": {
"gib": 16.083984375,
"pct": 20.31349006294777
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:31:15.062827+00:00",
"success": true,
"error_reason": null,
"time_taken": 28.47874303699973
},
"metrics": {
"mfu": {
"mean": 11.081739629278019,
"std": 0.19889239779611573,
"min": 10.855698631694322,
"max": 11.229935211006715
},
"throughput": {
"mean": 11895.994753646642,
"std": 213.50645294640813,
"min": 11653.344897999395,
"max": 12055.079330773913
},
"step_time": {
"mean": 1.9923289040001084,
"std": 0.00613332391088384,
"min": 1.9878587729999708,
"max": 1.9993211860000883
},
"peak_memory": {
"gib": 12.527994791666666,
"pct": 15.822403937717219
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:27:13.470591+00:00",
"success": true,
"error_reason": null,
"time_taken": 85.34243606500058
},
"metrics": {
"mfu": {
"mean": 26.804595710779356,
"std": 0.06729310221031364,
"min": 26.729508818984065,
"max": 26.85945477435236
},
"throughput": {
"mean": 10147.471062392868,
"std": 25.47528844477991,
"min": 10119.045262956117,
"max": 10168.239171194939
},
"step_time": {
"mean": 12.175553453000248,
"std": 0.01538792877423435,
"min": 12.158267948000685,
"max": 12.187759467999967
},
"peak_memory": {
"gib": 19.560546875,
"pct": 24.704262657003266
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:32:30.606234+00:00",
"success": true,
"error_reason": null,
"time_taken": 23.356497423999826
},
"metrics": {
"mfu": {
"mean": 23.741677026845252,
"std": 0.04651049464446475,
"min": 23.70207542828724,
"max": 23.792894559815245
},
"throughput": {
"mean": 25486.148818001486,
"std": 49.92795524795279,
"min": 25443.637405132922,
"max": 25541.12967153968
},
"step_time": {
"mean": 1.2819336799996865,
"std": 0.0006079202348362681,
"min": 1.2813300379993962,
"max": 1.2825457899998582
},
"peak_memory": {
"gib": 52.83984375,
"pct": 66.7348099772907
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:28:52.686902+00:00",
"success": false,
"error_reason": "[rank0]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 37.09 GiB. GPU 0 has a total capacity of 79.18 GiB of which 34.48 GiB is free. Including non-PyTorch memory, this process has 44.69 GiB memory in use. Of the allocated memory 43.38 GiB is allocated by PyTorch, and 103.94 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)",
"time_taken": 17.978304365999975
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 8192,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:31:56.529860+00:00",
"success": true,
"error_reason": null,
"time_taken": 20.62643332300013
},
"metrics": {
"mfu": {
"mean": 16.81390538290134,
"std": 0.05651510665525934,
"min": 16.751081970567313,
"max": 16.860609944501103
},
"throughput": {
"mean": 26005.173345163068,
"std": 87.40891016818526,
"min": 25908.007714057374,
"max": 26077.408806987827
},
"step_time": {
"mean": 0.6225078416667505,
"std": 0.007687299084230651,
"min": 0.617841731000226,
"max": 0.6313804020001044
},
"peak_memory": {
"gib": 31.7421875,
"pct": 40.089233819432565
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Offload",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:33:07.297136+00:00",
"success": true,
"error_reason": null,
"time_taken": 108.76686536699981
},
"metrics": {
"mfu": {
"mean": 20.708341728583434,
"std": 0.004926960367148572,
"min": 20.702702202532606,
"max": 20.711810912813448
},
"throughput": {
"mean": 5952.495445170788,
"std": 1.4162268291871345,
"min": 5950.874395374987,
"max": 5953.492642512722
},
"step_time": {
"mean": 5.503622571999888,
"std": 0.0020800783397258095,
"min": 5.501920187999531,
"max": 5.505941123000412
},
"peak_memory": {
"gib": 20.568359375,
"pct": 25.977093364044073
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:41:29.404702+00:00",
"success": true,
"error_reason": null,
"time_taken": 203.20685914300066
},
"metrics": {
"mfu": {
"mean": 36.28241994221462,
"std": 0.022193678051459942,
"min": 36.26066970131873,
"max": 36.3050319536981
},
"throughput": {
"mean": 4042.514189268571,
"std": 2.4727749300619926,
"min": 4040.0908212136933,
"max": 4045.0335740674755
},
"step_time": {
"mean": 32.442406444666936,
"std": 0.03856478525322434,
"min": 32.40275257099984,
"max": 32.47978104200047
},
"peak_memory": {
"gib": 31.056640625,
"pct": 39.22341293150364
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:36:35.591532+00:00",
"success": true,
"error_reason": null,
"time_taken": 80.70320002000062
},
"metrics": {
"mfu": {
"mean": 21.67106712168685,
"std": 0.0011546935789889254,
"min": 21.66976201051341,
"max": 21.671955962863645
},
"throughput": {
"mean": 6229.22540223386,
"std": 0.3319101239291823,
"min": 6228.850255425044,
"max": 6229.480894591757
},
"step_time": {
"mean": 5.260317135999685,
"std": 0.0009800976196505141,
"min": 5.25973307699951,
"max": 5.261448657999608
},
"peak_memory": {
"gib": 23.302734375,
"pct": 29.430510011054018
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 1,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:38:09.656407+00:00",
"success": true,
"error_reason": null,
"time_taken": 186.07668963200013
},
"metrics": {
"mfu": {
"mean": 37.373497733547545,
"std": 0.030793764694046207,
"min": 37.350622380323436,
"max": 37.40851070666222
},
"throughput": {
"mean": 4164.079880313542,
"std": 3.430979270813021,
"min": 4161.531154508035,
"max": 4167.980955292829
},
"step_time": {
"mean": 31.492112124332987,
"std": 0.048781656532353834,
"min": 31.43624878099945,
"max": 31.526298007999685
},
"peak_memory": {
"gib": 41.994140625,
"pct": 53.037079519543404
}
}
}
@@ -0,0 +1,48 @@
{
"config": {
"type": "rl",
"num_gpus": 4,
"model_name": "Qwen/Qwen3-0.6B",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"ep": 1,
"cp": 1,
"docker_image": null,
"device_name": "NVIDIA RTX A6000",
"commit_sha": "83c21ddac",
"timestamp": "2026-02-26T02:07:06+00:00",
"success": true,
"error_reason": null,
"time_taken": 291.91085167229176
},
"metrics": {
"mfu": {
"mean": 15.634260517326164,
"std": 0.009817863071768202,
"min": 15.622927380137481,
"max": 15.640172924064188
},
"throughput": {
"mean": 7468.685954343421,
"std": 4.690118598479809,
"min": 7463.271969943842,
"max": 7471.510386564679
},
"step_time": {
"mean": 68.34095695288852,
"std": 0.16054587555887065,
"min": 68.16114284005016,
"max": 68.46991707291454
},
"peak_memory": {
"gib": 23.25390625,
"pct": 49.05701678145735
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:26:32.539787+00:00",
"success": true,
"error_reason": null,
"time_taken": 1020.7996206080006
},
"metrics": {
"mfu": {
"mean": 5.687602748221284,
"std": 0.018745865227927518,
"min": 5.676304894379825,
"max": 5.709241557476678
},
"throughput": {
"mean": 5036.226163028962,
"std": 16.598982223051312,
"min": 5026.222203606826,
"max": 5055.386772890979
},
"step_time": {
"mean": 207.41716993466676,
"std": 2.02401520618876,
"min": 205.080392803,
"max": 208.62080098299975
},
"peak_memory": {
"gib": 131.494140625,
"pct": 73.72330763876674
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:12:47.559188+00:00",
"success": true,
"error_reason": null,
"time_taken": 809.163406182
},
"metrics": {
"mfu": {
"mean": 2.490786315088448,
"std": 0.033110540270011306,
"min": 2.4542463835991133,
"max": 2.5187996340566254
},
"throughput": {
"mean": 4775.430825821454,
"std": 63.48079468206003,
"min": 4705.375071078247,
"max": 4829.139032793618
},
"step_time": {
"mean": 54.28342847499971,
"std": 1.2435951181078917,
"min": 53.43692385699978,
"max": 55.71122110999977
},
"peak_memory": {
"gib": 90.44466145833333,
"pct": 50.70856822428712
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:15:30.364274+00:00",
"success": true,
"error_reason": null,
"time_taken": 984.287366173
},
"metrics": {
"mfu": {
"mean": 5.827906818358083,
"std": 0.022833943391300654,
"min": 5.807295619326128,
"max": 5.8524522502693515
},
"throughput": {
"mean": 5160.461813808787,
"std": 20.21887044561124,
"min": 5142.211126408267,
"max": 5182.196163383928
},
"step_time": {
"mean": 202.34163654333315,
"std": 1.810525756526242,
"min": 200.36271737700008,
"max": 203.91497343799983
},
"peak_memory": {
"gib": 153.607421875,
"pct": 86.12130673399314
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-235B-A22B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Offload",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 6900,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:59:19.508644+00:00",
"success": true,
"error_reason": null,
"time_taken": 549.3317680299988
},
"metrics": {
"mfu": {
"mean": 4.168587169086432,
"std": 0.01943333057040498,
"min": 4.148011530875203,
"max": 4.186629771954931
},
"throughput": {
"mean": 4127.532530653436,
"std": 19.241939979838868,
"min": 4107.159533133892,
"max": 4145.397439615796
},
"step_time": {
"mean": 63.236984533667055,
"std": 0.5393767880164467,
"min": 62.76671389400144,
"max": 63.82576015599989
},
"peak_memory": {
"gib": 150.33528645833334,
"pct": 84.28675619955848
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-235B-A22B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 6900,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:55:26.218741+00:00",
"success": false,
"error_reason": "[rank4]: torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 8.00 GiB. GPU 4 has a total capacity of 178.36 GiB of which 7.20 GiB is free. Including non-PyTorch memory, this process has 171.05 GiB memory in use. Of the allocated memory 168.36 GiB is allocated by PyTorch, and 418.92 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)",
"time_taken": 1187.6552004240002
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-235B-A22B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 6900,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:37:50.660932+00:00",
"success": true,
"error_reason": null,
"time_taken": 537.6964168579998
},
"metrics": {
"mfu": {
"mean": 4.1765827538888205,
"std": 0.051049197538156864,
"min": 4.120994785084703,
"max": 4.221362139742245
},
"throughput": {
"mean": 4135.449370348717,
"std": 50.54643574807943,
"min": 4080.408863758512,
"max": 4179.787743115238
},
"step_time": {
"mean": 62.716718792332664,
"std": 1.346972230949721,
"min": 61.699117662999925,
"max": 64.24419503999889
},
"peak_memory": {
"gib": 161.52018229166666,
"pct": 90.55766311989025
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-235B-A22B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 6900,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-16T00:08:44.717309+00:00",
"success": false,
"error_reason": "Non-zero exit code: 1",
"time_taken": 3980.190812207
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:32:10.654918+00:00",
"success": true,
"error_reason": null,
"time_taken": 244.50675971500004
},
"metrics": {
"mfu": {
"mean": 1.8819492849425725,
"std": 0.018657004256960857,
"min": 1.8647429725679725,
"max": 1.9017792358057817
},
"throughput": {
"mean": 9266.367565195435,
"std": 91.86361210349598,
"min": 9181.646889574527,
"max": 9364.006547801635
},
"step_time": {
"mean": 28.328965114333794,
"std": 0.6755728629253066,
"min": 27.88586488400142,
"max": 29.106523622000168
},
"peak_memory": {
"gib": 32.041666666666664,
"pct": 17.96443277014256
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:51:34.679404+00:00",
"success": true,
"error_reason": null,
"time_taken": 449.1452536000015
},
"metrics": {
"mfu": {
"mean": 6.946321930899347,
"std": 0.04943793567535021,
"min": 6.907147510672552,
"max": 7.001869300686485
},
"throughput": {
"mean": 13225.618902255133,
"std": 94.1285622896153,
"min": 13151.031810296197,
"max": 13331.379670491255
},
"step_time": {
"mean": 79.47065850533363,
"std": 1.170419801192356,
"min": 78.65436104000037,
"max": 80.81161287000032
},
"peak_memory": {
"gib": 64.82161458333333,
"pct": 36.34278919847233
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:36:31.593391+00:00",
"success": false,
"error_reason": "Non-zero exit code: 1",
"time_taken": 63.58203920199958
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:43:48.864376+00:00",
"success": false,
"error_reason": "Non-zero exit code: 1",
"time_taken": 210.35651835000044
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:54:09.465200+00:00",
"success": false,
"error_reason": "Non-zero exit code: 1",
"time_taken": 60.86861479300023
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:10:45.595226+00:00",
"success": true,
"error_reason": null,
"time_taken": 106.1217524460003
},
"metrics": {
"mfu": {
"mean": 8.808826116109998,
"std": 0.004229053216833396,
"min": 8.80401218210114,
"max": 8.811943308874014
},
"throughput": {
"mean": 46083.769889207404,
"std": 22.1244820507199,
"min": 46058.58557699578,
"max": 46100.0776233077
},
"step_time": {
"mean": 5.686930948999968,
"std": 0.005284924202613482,
"min": 5.680966203000025,
"max": 5.691029913999955
},
"peak_memory": {
"gib": 10.216796875,
"pct": 5.728134010521928
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:47:04.725977+00:00",
"success": true,
"error_reason": null,
"time_taken": 254.2014976369992
},
"metrics": {
"mfu": {
"mean": 12.348302496931252,
"std": 0.006805052347726637,
"min": 12.34074166489301,
"max": 12.353936045871244
},
"throughput": {
"mean": 25040.256927943043,
"std": 13.799488572419822,
"min": 25024.924846721864,
"max": 25051.680806885804
},
"step_time": {
"mean": 41.85612941899914,
"std": 0.03884213222620387,
"min": 41.831036413999755,
"max": 41.90087012999902
},
"peak_memory": {
"gib": 28.810546875,
"pct": 16.152877994496077
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:52:34.912968+00:00",
"success": true,
"error_reason": null,
"time_taken": 77.61734246100059
},
"metrics": {
"mfu": {
"mean": 6.465139069561914,
"std": 0.04130725425852038,
"min": 6.418776595758626,
"max": 6.498024945638078
},
"throughput": {
"mean": 27541.81564064197,
"std": 175.970968167648,
"min": 27344.3091844938,
"max": 27681.911116752446
},
"step_time": {
"mean": 4.634802302666685,
"std": 0.08513574433508829,
"min": 4.565404164000029,
"max": 4.72980078099954
},
"peak_memory": {
"gib": 17.037109375,
"pct": 9.552000186156143
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:09:40.928786+00:00",
"success": false,
"error_reason": "Non-zero exit code: 1",
"time_taken": 45.902424454000084
},
"metrics": {
"mfu": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"throughput": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"step_time": {
"mean": 0,
"std": 0,
"min": 0,
"max": 0
},
"peak_memory": {
"gib": 0,
"pct": 0
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:51:22.159961+00:00",
"success": true,
"error_reason": null,
"time_taken": 55.56085521700061
},
"metrics": {
"mfu": {
"mean": 16.045704463732047,
"std": 0.3669414038018912,
"min": 15.635441903073977,
"max": 16.34253889185774
},
"throughput": {
"mean": 68355.50317006244,
"std": 1563.188724278261,
"min": 66607.76415187177,
"max": 69620.03267318218
},
"step_time": {
"mean": 3.743108587333154,
"std": 0.11113779012396933,
"min": 3.6789139749998867,
"max": 3.8714394489998085
},
"peak_memory": {
"gib": 54.59375,
"pct": 30.60844998319804
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA B200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:47:34.969809+00:00",
"success": true,
"error_reason": null,
"time_taken": 210.73784957300086
},
"metrics": {
"mfu": {
"mean": 14.166913779062327,
"std": 0.03189668324825658,
"min": 14.133844861170086,
"max": 14.19749221907924
},
"throughput": {
"mean": 26394.914306925668,
"std": 59.42792016262459,
"min": 26333.30235194374,
"max": 26451.886158132867
},
"step_time": {
"mean": 39.612902531999985,
"std": 0.12892289776828222,
"min": 39.48159200600003,
"max": 39.739297179999994
},
"peak_memory": {
"gib": 171.52994791666666,
"pct": 96.16972330033852
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:29:07.316579+00:00",
"success": true,
"error_reason": null,
"time_taken": 140.79688516900023
},
"metrics": {
"mfu": {
"mean": 15.293682809246896,
"std": 0.0014841779556249671,
"min": 15.292477098886133,
"max": 15.29534040662252
},
"throughput": {
"mean": 33099.95928339881,
"std": 3.2121909754006244,
"min": 33097.34977695445,
"max": 33103.54680422854
},
"step_time": {
"mean": 7.918505162999888,
"std": 0.0025994999660927214,
"min": 7.915530807999858,
"max": 7.920342067999627
},
"peak_memory": {
"gib": 31.6484375,
"pct": 39.970830962963646
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:17:11.459622+00:00",
"success": true,
"error_reason": null,
"time_taken": 624.2448271570001
},
"metrics": {
"mfu": {
"mean": 27.942932963415544,
"std": 0.014498147027639258,
"min": 27.930455687231994,
"max": 27.958837751284484
},
"throughput": {
"mean": 23385.51075359203,
"std": 12.133535648026946,
"min": 23375.068489827237,
"max": 23398.821510491805
},
"step_time": {
"mean": 44.85819833366653,
"std": 0.03992741859460502,
"min": 44.812667397999576,
"max": 44.887240678000126
},
"peak_memory": {
"gib": 63.6796875,
"pct": 80.42514025650868
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:31:45.516492+00:00",
"success": true,
"error_reason": null,
"time_taken": 253.7607040289995
},
"metrics": {
"mfu": {
"mean": 2.9033962435015255,
"std": 0.06185211772693289,
"min": 2.8333683904138596,
"max": 2.9505657988343432
},
"throughput": {
"mean": 6113.178662139965,
"std": 130.23129279813597,
"min": 5965.733139259937,
"max": 6212.4954260190325
},
"step_time": {
"mean": 8.173900715999784,
"std": 0.030643063802763774,
"min": 8.154543812000156,
"max": 8.20923029000005
},
"peak_memory": {
"gib": 74.587890625,
"pct": 94.20180595190192
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:07:58.431560+00:00",
"success": true,
"error_reason": null,
"time_taken": 118.56876047700007
},
"metrics": {
"mfu": {
"mean": 21.186359822422222,
"std": 0.0008420584654773224,
"min": 21.185637325200606,
"max": 21.187284596349986
},
"throughput": {
"mean": 48719.19229289033,
"std": 1.9363594617136561,
"min": 48717.53087104316,
"max": 48721.31886107815
},
"step_time": {
"mean": 5.380075431333201,
"std": 0.0007378815620199924,
"min": 5.379241290999744,
"max": 5.3806429229998685
},
"peak_memory": {
"gib": 10.255859375,
"pct": 12.95277915246372
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:13:31.235946+00:00",
"success": true,
"error_reason": null,
"time_taken": 202.00237810199997
},
"metrics": {
"mfu": {
"mean": 36.80129006524934,
"std": 0.038682209837297775,
"min": 36.760663305779815,
"max": 36.83767867963716
},
"throughput": {
"mean": 32802.60523065393,
"std": 34.479151586600146,
"min": 32766.39281662397,
"max": 32835.03999993886
},
"step_time": {
"mean": 32.001040753666835,
"std": 0.07306682405527636,
"min": 31.934163717000047,
"max": 32.07902539700035
},
"peak_memory": {
"gib": 28.849609375,
"pct": 36.43601235213133
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:36:16.464322+00:00",
"success": true,
"error_reason": null,
"time_taken": 73.39023454399921
},
"metrics": {
"mfu": {
"mean": 13.898604576898995,
"std": 0.09860944703652262,
"min": 13.786370142108543,
"max": 13.971346979414989
},
"throughput": {
"mean": 26025.535138303083,
"std": 184.64901383576387,
"min": 25815.37294466665,
"max": 26161.747370419624
},
"step_time": {
"mean": 4.687673982000281,
"std": 0.09089959338883277,
"min": 4.6215637490004156,
"max": 4.7913323130005665
},
"peak_memory": {
"gib": 17.095703125,
"pct": 21.591254222341448
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:10:14.248139+00:00",
"success": true,
"error_reason": null,
"time_taken": 179.18628272199976
},
"metrics": {
"mfu": {
"mean": 35.369152588637945,
"std": 0.05330515137907955,
"min": 35.316299078746994,
"max": 35.422898183835194
},
"throughput": {
"mean": 28965.660342784828,
"std": 43.65439362726316,
"min": 28922.37582213965,
"max": 29009.675439032973
},
"step_time": {
"mean": 30.286332981666572,
"std": 0.06468944241064038,
"min": 30.22071294999978,
"max": 30.350049833999947
},
"peak_memory": {
"gib": 36.104817708333336,
"pct": 45.59907785553104
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H100 80GB HBM3",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:27:53.996296+00:00",
"success": true,
"error_reason": null,
"time_taken": 56.04371451099996
},
"metrics": {
"mfu": {
"mean": 26.55059850068127,
"std": 0.9214643188212911,
"min": 25.52123970895786,
"max": 27.298541372653315
},
"throughput": {
"mean": 49716.756124637475,
"std": 1725.46832852818,
"min": 47789.25230540903,
"max": 51117.300574136076
},
"step_time": {
"mean": 5.014559059999859,
"std": 0.12068159290123663,
"min": 4.944470342999921,
"max": 5.153909341999679
},
"peak_memory": {
"gib": 54.6328125,
"pct": 68.99926460725865
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:40:32.097857+00:00",
"success": true,
"error_reason": null,
"time_taken": 850.1089639260008
},
"metrics": {
"mfu": {
"mean": 16.183996593923855,
"std": 0.0037561429610161526,
"min": 16.181544055966448,
"max": 16.18832083048134
},
"throughput": {
"mean": 6299.056753540347,
"std": 1.4619477672614645,
"min": 6298.102188597488,
"max": 6300.73981194519
},
"step_time": {
"mean": 166.49029159400015,
"std": 0.06453865622834476,
"min": 166.42061012799968,
"max": 166.54801481200047
},
"peak_memory": {
"gib": 130.34765625,
"pct": 93.23810509247556
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Offload",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:27:51.581711+00:00",
"success": true,
"error_reason": null,
"time_taken": 218.2948968770006
},
"metrics": {
"mfu": {
"mean": 19.1682663627078,
"std": 0.005302549001711897,
"min": 19.16325925051159,
"max": 19.173821745555
},
"throughput": {
"mean": 16153.725429668006,
"std": 4.46863159297824,
"min": 16149.50577234049,
"max": 16158.407132617673
},
"step_time": {
"mean": 16.231846535000233,
"std": 0.008343797303602548,
"min": 16.22289656399971,
"max": 16.239410609000515
},
"peak_memory": {
"gib": 84.234375,
"pct": 60.253124103633404
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Offload",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:56:15.445296+00:00",
"success": true,
"error_reason": null,
"time_taken": 610.8198953759993
},
"metrics": {
"mfu": {
"mean": 25.072133344311208,
"std": 0.006226456419567391,
"min": 25.0676110733694,
"max": 25.079234992016517
},
"throughput": {
"mean": 9758.45428238915,
"std": 2.4234312045658766,
"min": 9756.694146000587,
"max": 9761.21835130623
},
"step_time": {
"mean": 107.47203745833303,
"std": 0.043855674302782005,
"min": 107.42230272799952,
"max": 107.50516088899985
},
"peak_memory": {
"gib": 128.84375,
"pct": 92.16235603015416
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "PrimeIntellect/INTELLECT-3",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 3300,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:20:31.633435+00:00",
"success": true,
"error_reason": null,
"time_taken": 1182.043570376
},
"metrics": {
"mfu": {
"mean": 19.80122443240109,
"std": 0.009098784296829253,
"min": 19.79363619148072,
"max": 19.811311550992613
},
"throughput": {
"mean": 16687.13991133496,
"std": 7.667843324668441,
"min": 16680.745052352813,
"max": 16695.64065631736
},
"step_time": {
"mean": 15.714851607333307,
"std": 0.012174909467773673,
"min": 15.700846749000448,
"max": 15.722915346000264
},
"peak_memory": {
"gib": 89.72265625,
"pct": 64.17890964275439
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:21:23.241794+00:00",
"success": true,
"error_reason": null,
"time_taken": 140.92812991700066
},
"metrics": {
"mfu": {
"mean": 16.987738215725667,
"std": 0.003842547228315253,
"min": 16.9834062123014,
"max": 16.990735168068667
},
"throughput": {
"mean": 36766.385851652594,
"std": 8.316385162955287,
"min": 36757.01014151481,
"max": 36772.87212456442
},
"step_time": {
"mean": 7.128945582333472,
"std": 0.00330733605842928,
"min": 7.1251666289999775,
"max": 7.131312663000244
},
"peak_memory": {
"gib": 31.6484375,
"pct": 22.638230916696244
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:07:39.365493+00:00",
"success": true,
"error_reason": null,
"time_taken": 537.1643096139996
},
"metrics": {
"mfu": {
"mean": 29.16920060446058,
"std": 0.022125997715458492,
"min": 29.15022260355039,
"max": 29.19350299028142
},
"throughput": {
"mean": 24411.777221181026,
"std": 18.517303039959025,
"min": 24395.894484571094,
"max": 24432.115948890652
},
"step_time": {
"mean": 42.98113733000006,
"std": 0.05581546205591432,
"min": 42.91741776500021,
"max": 43.021377362000294
},
"peak_memory": {
"gib": 63.6796875,
"pct": 45.550288867437935
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:06:44.350139+00:00",
"success": true,
"error_reason": null,
"time_taken": 249.35987513700002
},
"metrics": {
"mfu": {
"mean": 2.8224020757175636,
"std": 0.003054514902315025,
"min": 2.819748382689604,
"max": 2.8257410097727513
},
"throughput": {
"mean": 5942.643269541411,
"std": 6.431363051397209,
"min": 5937.055847696838,
"max": 5949.6734847475345
},
"step_time": {
"mean": 7.401247934666874,
"std": 0.02254675077815527,
"min": 7.380187235000449,
"max": 7.425033139000334
},
"peak_memory": {
"gib": 74.587890625,
"pct": 53.352962261028935
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:14:27.917821+00:00",
"success": true,
"error_reason": null,
"time_taken": 397.24606492099974
},
"metrics": {
"mfu": {
"mean": 15.397168832361032,
"std": 0.06657191378906012,
"min": 15.321655222551161,
"max": 15.447379181165193
},
"throughput": {
"mean": 12748.349255622132,
"std": 55.11935452798206,
"min": 12685.82647095371,
"max": 12789.921772606987
},
"step_time": {
"mean": 42.89128534700012,
"std": 0.5558737978726181,
"min": 42.567282986000464,
"max": 43.533143310000014
},
"peak_memory": {
"gib": 105.353515625,
"pct": 75.35971450737547
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:25:54.085658+00:00",
"success": true,
"error_reason": null,
"time_taken": 98.99489516799986
},
"metrics": {
"mfu": {
"mean": 16.63549253820368,
"std": 0.819573259617385,
"min": 15.705104680132697,
"max": 17.25063363475304
},
"throughput": {
"mean": 35026.47571662118,
"std": 1725.63347974548,
"min": 33067.51912769404,
"max": 36321.671793990135
},
"step_time": {
"mean": 7.173170910666461,
"std": 0.6337301307519424,
"min": 6.712108918000013,
"max": 7.895820040999752
},
"peak_memory": {
"gib": 106.423828125,
"pct": 76.12531254133928
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:24:02.574320+00:00",
"success": true,
"error_reason": null,
"time_taken": 93.59855710200009
},
"metrics": {
"mfu": {
"mean": 22.77780543062047,
"std": 0.0042322790783645555,
"min": 22.774391607679817,
"max": 22.782540798115665
},
"throughput": {
"mean": 52378.80844495008,
"std": 9.732357044068635,
"min": 52370.95817252511,
"max": 52389.69768130354
},
"step_time": {
"mean": 5.005079579333445,
"std": 0.0016031840898894046,
"min": 5.003228462999687,
"max": 5.006020153000463
},
"peak_memory": {
"gib": 10.255859375,
"pct": 7.336049774350283
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": 16,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:16:54.365807+00:00",
"success": true,
"error_reason": null,
"time_taken": 199.22786494399998
},
"metrics": {
"mfu": {
"mean": 37.50498548642796,
"std": 0.08614247168198098,
"min": 37.43500175224926,
"max": 37.601192001603245
},
"throughput": {
"mean": 33429.839848315816,
"std": 76.78256624065938,
"min": 33367.46027410088,
"max": 33515.59293828403
},
"step_time": {
"mean": 31.42467853866674,
"std": 0.12039063430338016,
"min": 31.285738278999816,
"max": 31.498099366000133
},
"peak_memory": {
"gib": 28.849609375,
"pct": 20.636219999414973
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:05:47.581338+00:00",
"success": true,
"error_reason": null,
"time_taken": 94.38669985200022
},
"metrics": {
"mfu": {
"mean": 14.6522948792678,
"std": 0.09331446034479328,
"min": 14.548699267346166,
"max": 14.72975492212209
},
"throughput": {
"mean": 27436.841815830994,
"std": 174.73399960250234,
"min": 27242.856065439788,
"max": 27581.887964598303
},
"step_time": {
"mean": 4.415443519999826,
"std": 0.08516777230844812,
"min": 4.348332472000038,
"max": 4.51125360099968
},
"peak_memory": {
"gib": 17.095703125,
"pct": 12.228612392856222
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "rl",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 65536,
"ac": "Recompute",
"attention": "flash_attention_3",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T23:11:11.497803+00:00",
"success": true,
"error_reason": null,
"time_taken": 178.26785598200058
},
"metrics": {
"mfu": {
"mean": 36.07478778767836,
"std": 0.045382177103142095,
"min": 36.02410276426409,
"max": 36.11165476465475
},
"throughput": {
"mean": 29543.54214105793,
"std": 37.16585304924738,
"min": 29502.033508104272,
"max": 29573.734448614276
},
"step_time": {
"mean": 29.889196768666807,
"std": 0.03833519915834691,
"min": 29.858544257000176,
"max": 29.932179942999937
},
"peak_memory": {
"gib": 36.104817708333336,
"pct": 25.825894263704924
}
}
}
@@ -0,0 +1,46 @@
{
"config": {
"type": "sft",
"num_gpus": 8,
"model_name": "Qwen/Qwen3-4B-Instruct-2507",
"lora_rank": null,
"seq_len": 16384,
"ac": "Recompute",
"attention": "flash_attention_2",
"output": "/tmp/benchmark_result.json",
"dry_run": false,
"timeout": 1500,
"micro_batches": 2,
"docker_image": "primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6",
"device_name": "NVIDIA H200",
"commit_sha": "unknown",
"timestamp": "2026-01-15T22:55:02.193975+00:00",
"success": true,
"error_reason": null,
"time_taken": 55.37509840599978
},
"metrics": {
"mfu": {
"mean": 28.37954151134585,
"std": 0.9404399349147221,
"min": 27.327257024240104,
"max": 29.13795577178809
},
"throughput": {
"mean": 53141.50429461707,
"std": 1761.000713141191,
"min": 51171.07145417345,
"max": 54561.65671893574
},
"step_time": {
"mean": 4.706847163666983,
"std": 0.10895631514583606,
"min": 4.640467990000616,
"max": 4.832593936000194
},
"peak_memory": {
"gib": 54.6328125,
"pct": 39.079029573057724
}
}
}
+89
View File
@@ -0,0 +1,89 @@
# Performance Benchmarks
Automated benchmark results for prime-rl using `--bench` flag.
**Last Updated:** 2026-02-01 00:43 UTC
**Commit:** `unknown`
**Docker Image:** `primeintellect/prime-rl-jackmin@sha256:5a146f7dfdcdf6b0e90fd3f1ed0874d22a3a0641378dc8dad46ce213d02fa2e6`
> :warning: indicates regression > 5% from baseline
> diffs shown when abs(change) >= 1.0% (except regressions, which always show diffs)
> :clock10: The Step Time shown is the time taken per micro batch. This differs from what gets displayed in the bench table which is the total step time.
## INTELLECT-3
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 19.8% | 16.69k | 7.85s | 89.7 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA3 | 1 | 1 | 8xH200 | 19.2% | 16.15k | 8.11s | 84.2 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 2.5% | 4.78k | 27.45s | 90.4 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1 | 1 | 8xH200 | 25.1% | 9.76k | 53.73s | 128.8 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA2 | 1 | 1 | 8xH200 | 16.2% | 6.30k | 83.23s | 130.3 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 5.8% | 5.16k | 101.60s | 153.6 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA2 | 1 | 1 | 8xB200 | 5.7% | 5.04k | 104.10s | 131.5 GiB |
## Qwen3-0.6B
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 11.1% | 11.90k | 1.38s | 12.5 GiB |
| RL Full | 16384 | Recompute | FA2 | 1 | 1 | 1xA6000 | 10.9% | 3.69k | 4.44s | 12.5 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 26.8% | 10.15k | 6.46s | 19.6 GiB |
| RL Full | 65536 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 26.4% | 9.98k | 6.57s | 16.1 GiB |
| RL Full | 65536 | Recompute | FA2 | 1 | 1 | 4xA6000 | 16.2% | 7.72k | 33.94s | 12.4 GiB |
| RL Full | 65536 | Recompute | FA2 | 1 | 1 | 1xA6000 | 17.1% | 2.04k | 32.12s | 19.5 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 10.9% | 13.34k | 1.23s | 5.1 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 1xA6000 | 6.3% | 2.41k | 6.79s | 5.1 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 25.2% | 9.97k | 6.58s | 11.5 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 24.7% | 9.78k | 6.70s | 7.9 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 1xA6000 | 16.0% | 1.99k | 32.85s | 11.5 GiB |
| SFT Full | 8192 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 16.8% | 26.01k | 0.32s | 31.7 GiB |
| SFT Full | 8192 | Recompute | FA2 | 1 | 1 | 1xA6000 | 13.5% | 6.60k | 1.24s | 31.2 GiB |
| SFT Full | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 23.7% | 25.49k | 0.64s | 52.8 GiB |
## Qwen3-235B-A22B-Instruct-2507
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 4.2% | 4.14k | 31.69s | 161.5 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA2 | 1 | 1 | 8xB200 | 4.2% | 4.13k | 31.76s | 150.3 GiB |
## Qwen3-30B-A3B-Instruct-2507
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 2.9% | 6.11k | 21.44s | 74.6 GiB |
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 2.8% | 5.94k | 22.06s | 74.6 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 15.4% | 12.75k | 41.13s | 105.4 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 17.0% | 36.77k | 3.56s | 31.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 15.3% | 33.10k | 3.96s | 31.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 1.9% | 9.27k | 14.14s | 32.0 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 29.2% | 24.41k | 21.48s | 63.7 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 27.9% | 23.39k | 22.42s | 63.7 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 6.9% | 13.23k | 39.64s | 64.8 GiB |
| SFT Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 16.6% | 35.03k | 3.74s | 106.4 GiB |
## Qwen3-4B-Instruct-2507
| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |
|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|
| RL Full | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 6.5% | 27.54k | 4.76s | 17.0 GiB |
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 14.7% | 27.44k | 4.78s | 17.1 GiB |
| RL Full | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 13.9% | 26.03k | 5.04s | 17.1 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 36.1% | 29.54k | 17.75s | 36.1 GiB |
| RL Full | 65536 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 35.4% | 28.97k | 18.10s | 36.1 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH200 | 22.8% | 52.38k | 2.50s | 10.3 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 21.2% | 48.72k | 2.69s | 10.3 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 8.8% | 46.08k | 2.84s | 10.2 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 21.7% | 6.23k | 2.63s | 23.3 GiB |
| RL LoRA(r=16) | 16384 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 20.7% | 5.95k | 2.75s | 20.6 GiB |
| RL LoRA(r=16) | 16384 | Recompute | FA2 | 1 | 1 | 1xA6000 | 13.6% | 1.23k | 13.29s | 23.3 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH200 | 37.5% | 33.43k | 15.68s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 8xH100 HBM3 | 36.8% | 32.80k | 15.98s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 12.3% | 25.04k | 20.94s | 28.8 GiB |
| RL LoRA(r=16) | 65536 | Recompute | FA3 | 1 | 1 | 1xH100 HBM3 | 37.4% | 4.16k | 15.74s | 42.0 GiB |
| RL LoRA(r=16) | 65536 | Offload | FA3 | 1 | 1 | 1xH100 HBM3 | 36.3% | 4.04k | 16.21s | 31.1 GiB |
| SFT Full | 16384 | Recompute | FA2 | 1 | 1 | 8xB200 | 16.0% | 68.36k | 1.92s | 54.6 GiB |
| SFT Full | 16384 | Recompute | FA2 | 1 | 1 | 8xH200 | 28.4% | 53.14k | 2.47s | 54.6 GiB |
| SFT Full | 16384 | Recompute | FA2 | 1 | 1 | 8xH100 HBM3 | 26.6% | 49.72k | 2.64s | 54.6 GiB |
| SFT Full | 65536 | Recompute | FA2 | 1 | 1 | 8xB200 | 14.2% | 26.39k | 19.86s | 171.5 GiB |
+233
View File
@@ -0,0 +1,233 @@
#!/usr/bin/env python3
"""Aggregate benchmark results from multiple JSON files into markdown report."""
from __future__ import annotations
import json
import sys
from datetime import datetime, timezone
from pathlib import Path
from typing import Annotated
from pydantic import Field
from prime_rl.utils.config import BaseConfig, cli
SHORTENED_ATTN_MAPPING = {
"flash_attention_2": "FA2",
"flash_attention_3": "FA3",
"flash_attention_4": "FA4",
}
# These words are stripped from the device name to get the short name
DEVICE_NAME_STRIP_WORDS = ["NVIDIA", "RTX", "80GB", "40GB"]
class AggregateConfig(BaseConfig):
"""Configuration for aggregating benchmark results."""
artifacts_dir: Annotated[Path, Field(description="Directory containing benchmark JSON artifacts")]
baselines_dir: Annotated[Path, Field(description="Directory containing baseline JSON artifacts")]
output_markdown: Annotated[Path, Field(description="Output markdown file path")]
regression_threshold: Annotated[float, Field(description="Regression threshold (default: 0.05 = 5%)")] = 0.05
diff_display_threshold: Annotated[float, Field(description="Diff display threshold (default: 0.01 = 1%)")] = 0.01
def get_hardware(config: dict) -> str:
num_gpus = config.get("num_gpus", 1)
device_name = config.get("device_name", "Unknown")
short_name = " ".join(word for word in device_name.split() if word not in DEVICE_NAME_STRIP_WORDS)
return f"{num_gpus}x{short_name}"
def get_training_type(config: dict) -> str:
train_type = config.get("type", "unknown").upper()
lora_rank = config.get("lora_rank")
if lora_rank is not None:
return f"{train_type} LoRA(r={lora_rank})"
return f"{train_type} Full"
def get_config_key(config: dict) -> str:
"""Get a unique key for a benchmark configuration."""
return "|".join(
[
config.get("model_name", "unknown"),
get_hardware(config),
config.get("type", "rl"),
str(config.get("lora_rank") or "none"),
str(config.get("seq_len", 0)),
config.get("ac", "None"),
config.get("attention", "unknown"),
str(config.get("ep", 1)),
str(config.get("cp", 1)),
]
)
def load_json_dir(directory: Path) -> list[dict]:
"""Load all JSON files from a directory."""
results = []
if not directory.exists():
return results
for f in directory.rglob("*.json"):
try:
results.append(json.loads(f.read_text()))
except Exception as e:
print(f"Warning: Failed to load {f}: {e}", file=sys.stderr)
return results
def format_metric(
value: float,
baseline: float | None,
threshold: float,
diff_display_threshold: float,
fmt: str,
higher_is_better: bool = True,
) -> tuple[str, bool]:
formatted = fmt.format(value)
if baseline is None or baseline == 0:
return formatted, False
pct_change = (value - baseline) / baseline * 100
is_regression = (value < baseline * (1 - threshold)) if higher_is_better else (value > baseline * (1 + threshold))
if is_regression:
return f"**{formatted}** :warning: ({pct_change:+.1f}%)", True
elif abs(pct_change) >= diff_display_threshold * 100:
return f"{formatted} ({pct_change:+.1f}%)", False
return formatted, False
def sorting_key(x: dict) -> tuple:
return (
get_training_type(x["config"]),
x["config"]["seq_len"],
-x["metrics"]["throughput"]["mean"],
get_hardware(x["config"]),
x["config"]["ac"],
x["config"]["attention"],
)
def generate_markdown(
results: list[dict],
baselines: dict[str, dict],
threshold: float,
diff_display_threshold: float,
) -> tuple[str, bool]:
has_regressions = False
by_model: dict[str, list[dict]] = {}
for r in results:
if r["config"]["success"]:
model = r["config"]["model_name"]
by_model.setdefault(model, []).append(r)
commit = results[0]["config"].get("commit_sha", "unknown") if results else "unknown"
docker_image = results[0]["config"].get("docker_image", "unknown") if results else "unknown"
lines = [
"# Performance Benchmarks",
"",
"Automated benchmark results for prime-rl using `--bench` flag.",
"",
f"**Last Updated:** {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M UTC')} ",
f"**Commit:** `{commit}` ",
f"**Docker Image:** `{docker_image}`",
"",
f"> :warning: indicates regression > {threshold * 100:.0f}% from baseline",
f"> diffs shown when abs(change) >= {diff_display_threshold * 100:.1f}% (except regressions, which always show diffs)",
"",
"> :clock10: The Step Time shown is the time taken per micro batch. This differs from what gets displayed in the bench table which is the total step time."
"",
]
for model, model_results in sorted(by_model.items()):
lines.append(f"## {model.split('/')[-1]}")
lines.append("")
lines.append("| Type | SeqLen | AC | Attn | EP | CP | Hardware | MFU | TPS | Step Time | Peak Mem |")
lines.append("|------|--------|----|----|----|----|----------|-----|-----|-----------|----------|")
for r in sorted(model_results, key=sorting_key):
cfg, m = r["config"], r["metrics"]
bl = baselines.get(get_config_key(cfg), {})
mfu_str, mfu_reg = format_metric(
m["mfu"]["mean"], bl.get("mfu"), threshold, diff_display_threshold, "{:.1f}%", True
)
tps_str, tps_reg = format_metric(
m["throughput"]["mean"] / 1000,
bl.get("throughput", 0) / 1000 if bl.get("throughput") else None,
threshold,
diff_display_threshold,
"{:.2f}k",
True,
)
step_str, step_reg = format_metric(
cfg["seq_len"] * cfg["num_gpus"] / m["throughput"]["mean"],
None,
threshold,
diff_display_threshold,
"{:.2f}s",
False,
)
has_regressions = has_regressions or mfu_reg or tps_reg or step_reg
attn = SHORTENED_ATTN_MAPPING.get(cfg["attention"], cfg["attention"])
lines.append(
f"| {get_training_type(cfg)} | {cfg['seq_len']} | {cfg.get('ac', 'None')} | {attn} | {cfg.get('ep', 1)} | {cfg.get('cp', 1)} | {get_hardware(cfg)} | "
f"{mfu_str} | {tps_str} | {step_str} | {m['peak_memory']['gib']:.1f} GiB |"
)
lines.append("")
failed = [r for r in results if not r["config"]["success"]]
if failed:
lines.append("## Failed Benchmarks")
lines.append("")
for r in failed:
cfg = r["config"]
error = (cfg.get("error_reason") or "Unknown error")[:200]
lines.append(f"- **{cfg['model_name']}** ({get_training_type(cfg)}) on {get_hardware(cfg)}: {error}")
lines.append("")
return "\n".join(lines), has_regressions
def main():
config = cli(AggregateConfig)
results = load_json_dir(config.artifacts_dir)
print(f"Loaded {len(results)} benchmark results", file=sys.stderr)
baseline_results = load_json_dir(config.baselines_dir)
baselines = {}
for r in baseline_results:
if r["config"]["success"]:
m = r["metrics"]
baselines[get_config_key(r["config"])] = {
"mfu": m["mfu"]["mean"],
"throughput": m["throughput"]["mean"],
"step_time": m["step_time"]["mean"],
}
print(f"Loaded {len(baselines)} baseline entries", file=sys.stderr)
markdown, has_regressions = generate_markdown(
results, baselines, config.regression_threshold, config.diff_display_threshold
)
config.output_markdown.parent.mkdir(parents=True, exist_ok=True)
config.output_markdown.write_text(markdown)
print(f"Wrote markdown report to {config.output_markdown}", file=sys.stderr)
successful = sum(1 for r in results if r["config"]["success"])
print(f"\nSummary: {successful} successful, {len(results) - successful} failed benchmarks", file=sys.stderr)
if has_regressions:
Path("/tmp/prime-rl-benchmark-aggregate-has-regressions").touch()
print("WARNING: Performance regressions detected!", file=sys.stderr)
if __name__ == "__main__":
main()
+256
View File
@@ -0,0 +1,256 @@
#!/usr/bin/env python3
"""
Run a single benchmark configuration and output JSON results.
This script wraps the prime-rl training with --bench.output-json to get
metrics directly without parsing console output.
"""
from __future__ import annotations
import json
import subprocess
import sys
import time
from datetime import datetime, timezone
from pathlib import Path
from typing import Annotated, Literal
import torch
from pydantic import Field
from prime_rl.utils.config import BaseConfig, cli
MAX_LORAS = 4
def get_commit_sha() -> str:
"""Get current git commit SHA."""
try:
result = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, check=True)
return result.stdout.strip()[:8]
except Exception:
return "unknown"
def extract_oom_error_reason(output: str) -> str | None:
"""
Extract a human-readable error reason from process output.
Currently we only special-case CUDA OOM to make failures easier to triage in CI.
"""
needle = "torch.OutOfMemoryError: CUDA out of memory."
for line in output.splitlines():
if needle in line:
return line.strip()
return None
class BenchmarkConfig(BaseConfig):
"""Configuration for running a single benchmark."""
type: Annotated[
Literal["sft", "rl"],
Field(description="Training type"),
] = "rl"
num_gpus: Annotated[int, Field(ge=1, description="Number of GPUs")] = 2
model_name: Annotated[str, Field(description="Model name (e.g., Qwen/Qwen3-0.6B)")] = "Qwen/Qwen3-0.6B"
lora_rank: Annotated[int | None, Field(description="LoRA rank (None for full fine-tuning)")] = None
seq_len: Annotated[int, Field(ge=1, description="Sequence length")] = 512
ac: Annotated[Literal["Recompute", "Offload", "None"], Field(description="Activation checkpointing type")] = (
"Recompute"
)
attention: Annotated[
Literal["sdpa", "flash_attention_2", "flash_attention_3", "flash_attention_4"],
Field(description="Attention implementation"),
] = "flash_attention_2"
output: Annotated[Path, Field(description="Output JSON file path")] = Path("benchmark_result.json")
dry_run: Annotated[bool, Field(description="Print command without executing")] = False
timeout: Annotated[int, Field(description="Timeout in seconds")] = 3600
micro_batches: Annotated[int, Field(ge=1, description="Number of micro batches")] = 2
ep: Annotated[int, Field(ge=1, description="Expert parallelism size (1 = no EP)")] = 1
cp: Annotated[int, Field(ge=1, description="Context parallelism size (1 = no CP)")] = 1
fused_lm_head_token_chunk_size: Annotated[
int | None,
Field(description="Fused LM head token chunk size (None uses trainer default)"),
] = None
docker_image: Annotated[str | None, Field(description="Docker image used for the benchmark")] = None
# Metadata set by the script
device_name: Annotated[str, Field(description="Device name. This is set automatically by the script.")] = (
torch.cuda.get_device_name()
)
commit_sha: Annotated[str, Field(description="Commit SHA. This is set automatically by the script.")] = (
get_commit_sha()
)
timestamp: Annotated[str, Field(description="Timestamp. This is set automatically by the script.")] = datetime.now(
timezone.utc
).isoformat()
success: Annotated[bool, Field(description="Success. This is set automatically by the script.")] = True
error_reason: Annotated[str | None, Field(description="Error reason. This is set automatically by the script.")] = (
None
)
time_taken: Annotated[
float | None, Field(description="Time taken in seconds. This is set automatically by the script.")
] = None
def build_command(config: BenchmarkConfig) -> list[str]:
"""Build the benchmark command from config."""
# Determine training script
if config.type == "rl":
script = "src/prime_rl/trainer/rl/train.py"
elif config.type == "sft":
script = "src/prime_rl/trainer/sft/train.py"
else:
raise ValueError(f"Invalid training type: {config.type}")
cmd = [
"uv",
"run",
"torchrun",
f"--nproc-per-node={config.num_gpus}",
script,
"--model.name",
config.model_name,
"--model.seq-len",
str(config.seq_len),
"--model.attn",
config.attention,
"--bench.output-json",
str(config.output),
"--model.compile",
"--dist-timeout-seconds",
str(config.timeout),
]
# Add activation checkpointing if enabled
if config.ac == "Recompute":
cmd.append("--model.ac")
elif config.ac == "Offload":
cmd.append("--model.ac-offloading")
# Add LoRA configuration if applicable
if config.lora_rank is not None:
cmd.extend(["--model.lora.rank", str(config.lora_rank)])
cmd.extend(["--max-concurrent-runs", str(MAX_LORAS)])
# Add expert parallelism if enabled
if config.ep > 1:
cmd.extend(["--model.ep", str(config.ep)])
# Add context parallelism if enabled
if config.cp > 1:
cmd.extend(["--model.cp", str(config.cp)])
# Fused LM head chunk size
if config.fused_lm_head_token_chunk_size is not None:
cmd.extend(["--model.fused-lm-head-token-chunk-size", str(config.fused_lm_head_token_chunk_size)])
# Data configuration differs between RL and SFT
if config.type.startswith("rl"):
cmd.extend(["--data.fake.batch-size", str(config.micro_batches * config.num_gpus)])
else:
cmd.extend(
[
"--data.type",
"fake",
"--data.batch-size",
str(config.micro_batches * config.num_gpus),
"--data.seq-len",
str(config.seq_len),
]
)
return cmd
def dummy_metrics() -> dict:
return {
"mfu": {"mean": 0, "std": 0, "min": 0, "max": 0},
"throughput": {"mean": 0, "std": 0, "min": 0, "max": 0},
"step_time": {"mean": 0, "std": 0, "min": 0, "max": 0},
"peak_memory": {"gib": 0, "pct": 0},
}
def run_benchmark(config: BenchmarkConfig) -> None:
"""Run a single benchmark and write results to output path."""
cmd = build_command(config)
print(f"Running: {' '.join(cmd)}")
if config.dry_run:
return
start_time = time.perf_counter()
try:
config.output.parent.mkdir(parents=True, exist_ok=True)
result = subprocess.run(
cmd,
capture_output=True,
text=True,
timeout=config.timeout,
)
output = result.stdout + result.stderr
if result.returncode != 0:
config.success = False
config.error_reason = extract_oom_error_reason(output) or f"Non-zero exit code: {result.returncode}"
print(f"Process exited with code {result.returncode}: {output}")
if not config.output.exists():
config.success = False
config.error_reason = config.error_reason or extract_oom_error_reason(output) or "No JSON output written"
print(f"Process exited with code {result.returncode}: {output}")
print("Benchmark completed but no JSON output was written")
else:
with open(config.output) as f:
metrics = json.load(f)
lines = output.splitlines()
print("\n".join(lines))
except subprocess.TimeoutExpired:
config.success = False
config.error_reason = "Timeout"
print(f"Benchmark timed out after {config.timeout} seconds")
except Exception as e:
config.success = False
config.error_reason = str(e)
print(f"Error: {e}")
finally:
config.time_taken = time.perf_counter() - start_time
if not config.success:
metrics = dummy_metrics()
# Write final result with config and metadata
final_result = {
"config": config.model_dump(mode="json"),
"metrics": metrics,
}
with open(config.output, "w") as f:
json.dump(final_result, f, indent=2)
print(f"Results written to {config.output}", file=sys.stderr)
def main():
config = cli(BenchmarkConfig)
run_benchmark(config)
if __name__ == "__main__":
main()
+4 -3
View File
@@ -1,9 +1,10 @@
inference_gpu_ids = [0,1,2,3,4,5]
trainer_gpu_ids = [6,7]
max_steps = 500
seq_len = 8192
[deployment]
num_train_gpus = 2
num_infer_gpus = 6
[model]
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B"
+4 -3
View File
@@ -1,9 +1,10 @@
inference_gpu_ids = [0,1,2,3,4,5]
trainer_gpu_ids = [6,7]
max_steps = 1000
seq_len = 16384
[deployment]
num_train_gpus = 2
num_infer_gpus = 6
[model]
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B"
+1 -1
View File
@@ -17,7 +17,7 @@ rollouts_per_example = 16
max_tokens = 512
[[orchestrator.env]]
id = "primeintellect/alphabet-sort"
id = "alphabet-sort"
name = "alphabet-sort"
args = { min_turns = 2, max_turns = 2 }
@@ -0,0 +1,24 @@
max_steps = 10
seq_len = 2048
[ckpt]
[model]
name = "PrimeIntellect/Qwen3-0.6B"
[trainer.optim]
lr = 1e-5
[orchestrator]
batch_size = 128
rollouts_per_example = 8
[orchestrator.sampling]
max_tokens = 384
[[orchestrator.env]]
id = "alphabet-sort"
name = "alphabet-sort"
args = { min_turns = 2, max_turns = 2, min_names_per_turn = 1, max_names_per_turn = 3, similarity_power = 4, power_per_turn = false }
[inference]
@@ -0,0 +1,29 @@
max_steps = 10
seq_len = 2048
[deployment]
type = "single_node"
num_infer_gpus = 1
num_train_gpus = 1
[ckpt]
[model]
name = "Qwen/Qwen3-0.6B"
[trainer.optim]
lr = 1e-5
[orchestrator]
batch_size = 128
rollouts_per_example = 8
[orchestrator.sampling]
max_tokens = 1024
[[orchestrator.env]]
id = "primeintellect/alphabet-sort"
name = "alphabet-sort"
args = { min_turns = 2, max_turns = 2, min_names_per_turn = 1, max_names_per_turn = 3, similarity_power = 4, power_per_turn = false }
[inference]
@@ -1,15 +0,0 @@
num_examples = 5
rollouts_per_example = 3
[sampling]
max_tokens = 16
[[env]]
id = "primeintellect/math-env"
name = "gsm8k"
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
[[env]]
id = "primeintellect/math-env"
name = "hendrycks"
args = { dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default" }
@@ -1,9 +0,0 @@
num_examples = 5
rollouts_per_example = 3
[sampling]
max_tokens = 16
[[env]]
id = "primeintellect/math-env"
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
-3
View File
@@ -1,6 +1,3 @@
inference_gpu_ids = [0]
trainer_gpu_ids = [1]
max_steps = 25
seq_len = 2048
-3
View File
@@ -1,6 +1,3 @@
inference_gpu_ids = [0]
trainer_gpu_ids = [1]
max_steps = 20
seq_len = 2048
+6 -6
View File
@@ -1,6 +1,3 @@
inference_gpu_ids = [0]
trainer_gpu_ids = [1]
max_steps = 25
seq_len = 2048
@@ -11,7 +8,7 @@ resume_step = 20
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
[trainer.optim]
lr = 1e-4
lr = 5e-5
[trainer.model.lora]
rank = 8
@@ -22,7 +19,9 @@ save_adapter_separately = true
[orchestrator]
batch_size = 128
rollouts_per_example = 16
lora_name = "r8-1e-4"
[orchestrator.model.lora]
name = "r8-1e-4"
[orchestrator.sampling]
max_tokens = 128
@@ -31,4 +30,5 @@ max_tokens = 128
id = "reverse-text"
[inference]
enable_lora = true
enable_lora = true
gpu_memory_utilization = 0.7
+6 -6
View File
@@ -1,6 +1,3 @@
inference_gpu_ids = [0]
trainer_gpu_ids = [1]
max_steps = 20
seq_len = 2048
@@ -10,7 +7,7 @@ seq_len = 2048
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
[trainer.optim]
lr = 1e-4
lr = 5e-5
[trainer.model.lora]
rank = 8
@@ -21,7 +18,9 @@ save_adapter_separately = true
[orchestrator]
batch_size = 128
rollouts_per_example = 16
lora_name = "r8-1e-4"
[orchestrator.model.lora]
name = "r8-1e-4"
[orchestrator.sampling]
max_tokens = 128
@@ -30,4 +29,5 @@ max_tokens = 128
id = "reverse-text"
[inference]
enable_lora = true
enable_lora = true
gpu_memory_utilization = 0.7
+26
View File
@@ -0,0 +1,26 @@
max_steps = 20
seq_len = 2048
[ckpt]
[model]
name = "samsja/mini-glm-moe"
[trainer.optim]
lr = 3e-6
[orchestrator]
batch_size = 128
rollouts_per_example = 16
[orchestrator.sampling]
max_tokens = 128
[[orchestrator.env]]
id = "reverse-text"
[inference]
gpu_memory_utilization = 0.7
[inference.model]
max_model_len = 2048
@@ -1,5 +1,5 @@
# Orchestrator config for multi-run RL integration test
# lora_name and output_dir are set via CLI
# model.lora.name and output_dir are set via CLI
batch_size = 128
rollouts_per_example = 16
seq_len = 2048
@@ -8,9 +8,15 @@ max_steps = 20
[model]
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
[optim]
lr = 3e-5
[sampling]
max_tokens = 128
[[env]]
id = "reverse-text"
[ckpt]
interval = 10
resume_step = -1
@@ -1,17 +1,17 @@
# Trainer config for multi-run RL integration test
max_steps = 1000
max_concurrent_runs = 2
max_async_level = 5
[model]
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
seq_len = 65536
fused_lm_head_token_chunk_size = 8192
[model.lora]
rank = 8
[optim]
lr = 1e-4
[weight_broadcast]
adapter_only = true
[model.ac]
freq = 1
[model.compile]
fullgraph = false
@@ -0,0 +1,30 @@
max_steps = 20
[ckpt]
resume_step = 10
[ckpt.weights]
save_adapter_separately = true
[model]
name = "PrimeIntellect/Qwen3-0.6B"
[model.lora]
rank = 8
target_modules = [
"q_proj",
"k_proj",
"v_proj",
"o_proj",
"gate_proj",
"up_proj",
"down_proj",
]
[data]
name = "PrimeIntellect/Reverse-Text-SFT"
batch_size = 4
seq_len = 1024
[optim]
lr = 1.5e-5
@@ -0,0 +1,29 @@
max_steps = 10
[ckpt]
[ckpt.weights]
save_adapter_separately = true
[model]
name = "PrimeIntellect/Qwen3-0.6B"
[model.lora]
rank = 8
target_modules = [
"q_proj",
"k_proj",
"v_proj",
"o_proj",
"gate_proj",
"up_proj",
"down_proj",
]
[data]
name = "PrimeIntellect/Reverse-Text-SFT"
batch_size = 4
seq_len = 1024
[optim]
lr = 1.5e-5
@@ -1,15 +0,0 @@
num_examples = 5
rollouts_per_example = 3
[sampling]
max_tokens = 16
[[env]]
id = "primeintellect/math-env"
name = "gsm8k"
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
[[env]]
id = "primeintellect/math-env"
name = "hendrycks"
args = { dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default" }
@@ -1,8 +0,0 @@
num_examples = 5
rollouts_per_example = 3
[sampling]
max_tokens = 16
[[env]]
id = "primeintellect/wiki-search"
@@ -1,9 +0,0 @@
num_examples = 5
rollouts_per_example = 3
[sampling]
max_tokens = 16
[[env]]
id = "primeintellect/math-env"
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
+5 -4
View File
@@ -3,12 +3,13 @@
# - 300 instead of 500 steps
# - No checkpointing
# - No evals
inference_gpu_ids = [0,1,2,3]
trainer_gpu_ids = [4,5,6,7]
max_steps = 300
seq_len = 8192
[deployment]
num_train_gpus = 4
num_infer_gpus = 4
[model]
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B"
@@ -21,7 +22,7 @@ temperature = 0.6
max_tokens = 8192
[[orchestrator.env]]
id = "primeintellect/math-env"
id = "math-env"
name = "acereason-math"
args = { dataset_name = "nvidia/AceReason-Math", dataset_subset = "default", question_key = "problem", math_verify_max_workers = 128, math_verify_timeout = 60 }
-46
View File
@@ -1,46 +0,0 @@
inference_gpu_ids = [0,1,2,3]
trainer_gpu_ids = [4,5,6,7]
max_steps = 300
seq_len = 2048
[model]
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
[orchestrator]
batch_size = 1024
rollouts_per_example = 16
[orchestrator.sampling]
max_tokens = 2048
[[orchestrator.env]]
id = "primeintellect/math-env"
name = "hendrycks-math"
args = { dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", math_verify_max_workers = 128, math_verify_timeout = 60 }
[orchestrator.buffer]
easy_fraction = 0.0
hard_fraction = 0.0
easy_threshold = 1.0
hard_threshold = 0.0
[orchestrator.val]
interval = 5
num_examples = 128
[orchestrator.eval]
interval = 10
[orchestrator.eval.sampling]
max_tokens = 2048
[[orchestrator.eval.env]]
id = "primeintellect/math500"
name = "math500"
num_examples = 30
rollouts_per_example = 4
[trainer] # Default trainer config
[inference]
@@ -0,0 +1,40 @@
# Based on configs/multimodal/rl_color_codeword.toml but tuned for CI
max_steps = 25
seq_len = 4096
[deployment]
num_train_gpus = 4
num_infer_gpus = 4
[model]
name = "Qwen/Qwen3-VL-4B-Instruct"
[model.vlm]
vision_encoder_attr = "model.visual"
language_model_attr = "model.language_model"
[orchestrator]
batch_size = 256
rollouts_per_example = 16
[orchestrator.sampling]
max_tokens = 64
[[orchestrator.env]]
id = "color-codeword"
args = { images_per_turn = 1, max_turns = 3, num_examples = 1000, seed = 42 }
[orchestrator.val]
interval = 5
num_examples = 100
[trainer]
[trainer.model]
optimization_dtype = "bfloat16"
reduce_dtype = "bfloat16"
[trainer.optim]
lr = 3e-6
[inference]

Some files were not shown because too many files have changed in this diff Show More