Compare commits

...
Author SHA1 Message Date
Matej SirovatkaandGitHub c4a78d1134 fix: specialize FP8 indexer quantization constants (#3594)
Compiled GLM-5.3 training fails on its first forward pass because `eps`,
`fp8_min`, and `fp8_max` reach the FP8 indexer quantization kernel as
runtime FP64 scalars. Their arithmetic promotes the quantization result
to FP64, and Triton rejects the resulting conversion with `Unsupported
conversion from f64 to f8E4M3FN with rounding mode rtne`.

Mark these three fixed scalar arguments as `tl.constexpr` so Triton
specializes them at compile time.

Validation: reproduced the failure on an 8-node H200 BF16 trainer with
`torch.compile`, activation checkpointing/offloading, full CPU offload,
and SignSGD. With this patch, the first forward/backward pass and
optimizer update completed, and the trainer began broadcasting policy
v1. The 20-step verification run is still in progress. `git diff
--check` passes.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Single-line Triton signature change with no API or logic changes; only
affects compile-time specialization of fixed FP8 bounds.
> 
> **Overview**
> Fixes **compiled training crashes** on the first forward pass when the
FP8 indexer quantizes activations under `torch.compile`.
> 
> The Triton kernel `_per_token_group_quant_fp8` now treats **`eps`,
`fp8_min`, and `fp8_max` as `tl.constexpr`** instead of runtime
arguments. Previously those scalars promoted quant math to FP64, and
Triton failed converting the result to FP8 (`f64` → `f8E4M3FN`).
Specializing them at compile time keeps the quant path in types Triton
can lower correctly; callers still pass the same module-level `FP8_EPS`
/ `FP8_MIN` / `FP8_MAX` constants.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
02f155d8ffb8776346c320be42a6be1f1f5299e9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-09-18 13:12:13 +02:00
cacae615e6 chore(examples): rename GLM example folder to glm-5.3 (#3593)
The advanced GLM presets now train GLM-5.3, but the directory was still
named glm-5.2. Rename it and update every inbound link and the
"GLM-5/GLM-5.2" prose in the READMEs and docs.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation and example path updates only; no training, inference,
or runtime code changes.
> 
> **Overview**
> Renames the advanced GLM example from **`glm-5.2`** to **`glm-5.3`**
and updates every inbound link and launch snippet so docs match the
presets that target GLM-5.3.
> 
> **README**, **docs** (`advanced.md`, `configuration.md`,
`scaling.md`), and **examples/README** now point at
`examples/advanced/glm-5.3/` and describe **`GLM-5`/`GLM-5.3`** instead
of 5.2. The **glm-5.3** walkthrough updates `uv run rl` / `uv run
inference` paths; **`infer/pd-llmd.toml`** only fixes its launch comment
to the new path (config content such as `GLM-5.2-FP8` model IDs is
unchanged).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fb2d99039d8719ff2bcdf2ac1e2c7baaa6f49946. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Johannes Hagemann <johannes@Johanness-MacBook-Pro.local>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 00:22:35 -07:00
samsjaandGitHub a9005aba8e fix(examples): express GLM-5.2 SWE shared model as a [model] table (#3591)
## Summary
PR #3588 centralized the model id for
`examples/advanced/glm-5.2/swe.toml` as a top-level
string (`model = "zai-org/GLM-5.3-BF16"`), but `RLConfig.model` is a
`SharedModelConfig`
table, so no config class could parse the file and CPU tests on `main`
failed
(`test_load_configs[examples/advanced/glm-5.2/swe.toml]`).

- Express the shared model as a `[model]` table with `name =
"zai-org/GLM-5.3-BF16"`, which
propagates to `trainer.model.name`, `orchestrator.model.name`, and
`inference.vllm.model`
  (same intent as #3588).
- Update the `[inference.vllm]` comment: it now serves the shared BF16
checkpoint with online
  per-block FP8 quantization, not a separate block-FP8 release.

Fixes the CPU Tests failure on `main` introduced by #3588.
2026-09-17 23:55:47 -07:00
samsjaandGitHub 788b9fdd1a Update swe.toml (#3588)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Example config-only change with no application code; verify the stack
resolves the correct vLLM checkpoint now that `[inference.vllm]` no
longer sets a separate `zai-org/GLM-5.3` id.
> 
> **Overview**
> **Centralizes the Hugging Face model id** for the GLM-5.2 SWE advanced
example by adding a top-level `model = "zai-org/GLM-5.3-BF16"` and
dropping duplicate `name` / `model` entries under `[trainer.model]`,
`[inference.vllm]`, and `[orchestrator.model]`.
> 
> Inference still uses the same vLLM settings (BF16 dtype,
`fp8_per_block` quantization, GLM tool parser); only the redundant
per-section model strings are removed so one field drives training and
orchestration.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4520df470f2417d4333f48fb80f40a2ed820574e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Signed-off-by: samsja <55492238+samsja@users.noreply.github.com>
2026-09-17 22:38:22 -07:00
samsjaandGitHub abcf7c0acc docs(examples): update GLM SWE presets to 5.3 (#3587)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Documentation and example TOML checkpoint IDs only; no runtime or auth
logic changes.
> 
> **Overview**
> Updates the **GLM-5.2** advanced SWE example presets and README so
runs target **GLM-5.3**: trainers load **`zai-org/GLM-5.3-BF16`**, while
disaggregated vLLM inference serves the **`zai-org/GLM-5.3`** block-FP8
checkpoint (with short comments explaining the train/serve split).
> 
> **`swe.toml`** and **`swe-llmd.toml`** swap prior **`GLM-5` /
`GLM-5.1`** Hugging Face IDs on **`[inference.vllm]`**,
**`[trainer.model]`**, and **`[orchestrator.model]`**. The base
**`swe.toml`** plane also gains **`[orchestrator.renderer] name =
"glm-5.1"`** so it matches the llm-d stack’s rendering setup. Docs and
launch comments now describe **GLM-5.3** full-stack RL instead of 5.1;
inference-only table rows for **`infer/pd*.toml`** are unchanged in this
diff.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e02482573c596a0c7b575a710e8cf09e38ef4757. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-09-17 21:45:53 -07:00
samsjaandGitHub 26c967c6e3 Default IPO to eps 0.3 without KL (#3586)
## Summary

- make IPO use `eps = 0.3` by default
- disable the IPO KL regularizer by default with `kl_tau = 0.0`
- update the algorithm documentation to match

Explicit `[trainer.loss]` values continue to override these defaults.

## Test plan

- instantiated `IPOLossConfig` and the default `TrainerConfig.loss`,
confirming `eps == 0.3` and `kl_tau == 0.0`
- `ruff check packages/prime-rl-configs/src/prime_rl/configs/trainer.py`
2026-09-17 20:59:24 -07:00
Mika SenghaasandGitHub 7760531310 feat: update Prime sandbox SDK (#3585)
## Summary

- Replace the full Prime CLI dependency with `prime-sandboxes` 0.3.0.
- Preserve API key and team discovery from `prime login` through the
sandbox SDK config reader.
- Advance the verifiers submodule to merged
[PrimeIntellect-ai/verifiers#2626](https://github.com/PrimeIntellect-ai/verifiers/pull/2626).
- Document the Prime CLI as a separate tool for login and sandbox
cleanup commands.

## Breaking

- Remove the Prime runtime `vm` and `guaranteed` fields. Delete these
fields from configs. Prime now always creates a VM sandbox.
- Stop publishing ports from Prime service runtimes. Colocate the
service and consumer, or use Docker or Modal for the service runtime.
- Stop installing the `prime` CLI with prime-rl. Run `uv tool install
prime` when the CLI is needed.

## Verification

- `uv lock --check`
- `uv sync --all-packages`
- `uv run ruff check src/prime_rl/orchestrator/clients.py
src/prime_rl/monitors/prime.py`
- `uv run pytest tests/unit/orchestrator/test_clients.py
tests/unit/test_configs.py -q` (199 passed)
- Confirmed `prime_sandboxes.Config` detects the existing CLI login and
team with `PRIME_API_KEY` and `PRIME_TEAM_ID` unset and the `prime`
distribution absent.
- `env -u PRIME_API_KEY -u PRIME_TEAM_ID uv run eval gsm8k -n 1 -r 1 -c
1 --run.name cli-login-smoke --output-dir /tmp/prl-cli-login-smoke`
(reward 1.0, no errors)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes how Prime credentials are loaded and sandbox SDK version;
misconfiguration could break Prime Inference headers or sandbox rollouts
until users install the CLI and log in separately.
> 
> **Overview**
> Swaps the **`prime`** PyPI dependency for **`prime-sandboxes>=0.3.0`**
and points API key / team resolution at `prime_sandboxes.Config` instead
of `prime_cli.core.config` in the orchestrator client helpers and Prime
monitors.
> 
> Advanced example READMEs now tell users to install the **`prime`** CLI
separately (`uv tool install prime` + `prime login`) rather than
assuming it ships with prime-rl. The lockfile drops the full **`prime`**
package and its transitive UI stack while bumping **`prime-sandboxes`**
to 0.3.0 (and related Prime packages where resolved).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9c37d34fc380e4c0a8d79159e8323c31fe605ff2. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-09-17 20:04:56 -07:00
Matej SirovatkaandGitHub ce65f38fc0 Replace trainer-side FP8 transfer with online inference quantization (#3581)
NCCL weight updates now always send HF checkpoint-format weights and use
vLLM's layerwise reload, letting inference apply its configured
quantization. Remove the trainer-side FP8 transfer switch from config
schemas, propagation, admin requests, and worker RPCs, along with its
unused kernel conversion and loading helpers and tests. No references to
the removed setting remain in tracked project files.

Update both GLM SWE configs to use their BF16 checkpoints, `dtype =
"bfloat16"`, and `quantization = "fp8_per_block"`; align the
orchestrator model names with those checkpoints. EPLB remains rejected
for RL weight updates because the remaining reload path has not been
validated with it.

Validation:
- 131 config and admin/Dynamo RPC unit tests passed, plus both changed
GLM config-loading tests (133 total).
- Full RL config smoke checks cover model-name alignment, NCCL settings
propagation, and EPLB rejection for both examples.
- Ruff lint/format, Python compilation, TOML parsing, and diff
whitespace checks passed.
- The broader config-file sweep was blocked by missing optional taskset
plugins. GPU weight reload was not exercised.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the critical trainer→inference weight update path and removes
a large alternate loading implementation; misalignment between trainer
weights and vLLM quantization could cause silent drift until GPU reload
is exercised.
> 
> **Overview**
> **Removes trainer-side FP8 kernel-format NCCL weight transfer** in
favor of always broadcasting HuggingFace checkpoint-format tensors and
reloading them in vLLM with layerwise processing, so inference applies
its own quantization settings.
> 
> The `weight_broadcast.quantize_in_weight_transfer` flag is deleted
from shared/trainer/orchestrator schemas, RL propagation,
`/init_broadcaster` RPCs, Dynamo admin, and the NCCL broadcaster/worker
path. Related trainer conversion (`convert_layer_to_vllm_kernel`,
GLM-MoE-DSA kernel export, `quantize_to_vllm_kernel_format`) and
inference helpers (`load_weights_kernel`, EPLB expert remapping) are
removed along with their unit tests.
> 
> **Example GLM SWE configs** switch from `*-FP8` checkpoints to BF16
base weights with `dtype = "bfloat16"` and `quantization =
"fp8_per_block"` on the vLLM side; orchestrator model names match.
> 
> **EPLB** is no longer tied to quantized NCCL transfer—`enable_eplb`
now fails validation for any RL run with weight updates, since the
checkpoint reload path is not validated with EPLB.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
33bf980a95d5ee259f0f8d7b52a7e29b7d8e4a63. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-09-17 16:43:34 -07:00
35 changed files with 93 additions and 643 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ prime-rl is a framework for large-scale reinforcement learning. It is designed t
5. Multi-node deployment with Slurm and Kubernetes support.
6. Multimodal support for VLMs such as Qwen3-VL.
7. Hackable, modular, and extensible by design.
8. One-line SLURM deployment for frontier models — e.g. [`GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload](examples/advanced/glm-5.2/).
8. One-line SLURM deployment for frontier models — e.g. [`GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload](examples/advanced/glm-5.3/).
## Models support
@@ -204,7 +204,7 @@ These guides are designed to be run from a Slurm cluster but can also be adapted
1. [**Qwen3-30B-A3B**](examples/advanced/qwen3-30b-a3b/): Train `Qwen3-30B-A3B` on math, SWE, and agentic tool use.
2. [**GLM-4.5-Air**](examples/advanced/glm-4.5-air/): Train `GLM-4.5-Air` on search, SWE, and terminal tasks.
3. [**GLM-5**](examples/advanced/glm-5.2/): Large-scale `GLM-5`/`GLM-5.2` training with P/D disaggregation, the `llm-d` router, and FP8.
3. [**GLM-5**](examples/advanced/glm-5.3/): Large-scale `GLM-5`/`GLM-5.3` training with P/D disaggregation, the `llm-d` router, and FP8.
## Docs
+1 -1
+1 -1
View File
@@ -188,7 +188,7 @@ For large MoE serving, splitting prefill and decode onto separate vLLM groups ca
| Agentic (SWE, Lean) | 3:1 | Long growing contexts → prefill-heavy |
| Non-agentic (math, chat) | 1:2 | Short prompts, long generations → decode-heavy |
Example config: [`examples/advanced/glm-5.2/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-5.2/swe.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast, paired with an inference config from [`examples/advanced/glm-5.2/infer/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2/infer).
Example config: [`examples/advanced/glm-5.3/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-5.3/swe.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast, paired with an inference config from [`examples/advanced/glm-5.3/infer/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.3/infer).
Monitor live queue depths to detect imbalance:
+2 -2
View File
@@ -209,9 +209,9 @@ The knobs under `[trainer.loss]` are:
| Knob | Default | What it does |
|---|---|---|
| `eps` | 0.1 | Maximum absolute probability change before a token is masked. |
| `eps` | 0.3 | Maximum absolute probability change before a token is masked. |
| `adv_tau` | 1.0 | Temperature on the advantage term. Set to 0 to drop the policy-gradient term, leaving only the KL regularizer. |
| `kl_tau` | 1e-3 | Temperature on the KL regularizer. Set to 0 to disable. |
| `kl_tau` | 0.0 | Temperature on the KL regularizer. Set to 0 to disable. |
Omit `[trainer.loss]` to use these defaults. Set `type = "ipo"` when you specify the section. The `ce` and `ref_kl` components are fixed and unaffected by `[trainer.loss]`.
+1 -1
View File
@@ -229,7 +229,7 @@ The shipped end-to-end examples in [`examples/`](https://github.com/PrimeIntelle
- [**Nemotron-3-Super**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/configs/advanced/nemotron-3-super) — `Nemotron-3-Super-120B` hybrid-Mamba MoE on SWE at 131k context.
- [**MiniMax-M2.5 SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/configs/advanced/minimax-m2.5) — `MiniMax-M2.5` on agentic SWE.
- [**INTELLECT-3.1**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/intellect-3.1) — reproduces our INTELLECT-3.1 training run.
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2) — large-scale `GLM-5`/`GLM-5.2` inference with P/D disaggregation and FP8.
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.3) — large-scale `GLM-5`/`GLM-5.3` inference with P/D disaggregation and FP8.
### Worked Example: Compose, Override, Dry-Run
+1 -1
View File
@@ -233,7 +233,7 @@ gpus_per_node = 8
Full multi-node configs ship under [`examples/advanced/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced):
- [`nemotron-3-super/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/configs/advanced/nemotron-3-super/swe.toml) — 4 trainer + 1 inference node RL on a 120B hybrid-Mamba MoE with NCCL weight broadcast.
- [`glm-5.2/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2) — large-scale and P/D-disaggregated inference across the GLM-5 family.
- [`glm-5.3/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.3) — large-scale and P/D-disaggregated inference across the GLM-5 family.
- [`glm-4.5-air/swe-2-node.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-4.5-air/swe-2-node.toml) — train a 100B+ MoE on only two nodes: a single-node sign-SGD trainer (full optimizer offload) paired with one inference replica at batch size 64. An overlay on the shared `swe-budget.toml` base — launch with `uv run rl @ swe-budget.toml @ swe-2-node.toml`.
For inference-only multi-node, set `[deployment] type = "multi_node"` on an inference TOML — each node runs an independent vLLM replica (TP and DP must fit within one node), fronted by a single global router on node 0. Point clients at the router URL the launcher prints.
+1 -1
View File
@@ -10,7 +10,7 @@ Larger runs on frontier models, one folder per model, each with a launch README
- [`qwen3-30b-a3b/`](advanced/qwen3-30b-a3b/README.md) — `Qwen3-30B-A3B` RL on math (`i3_math`), SWE (`r2e-gym`), and agentic tool use (general-agent on Modal). 2 train + 2 infer nodes; the SWE config runs at 131k context with `ep = 8` + `cp = 2`.
- [`glm-4.5-air/`](advanced/glm-4.5-air/README.md) — `GLM-4.5-Air` (100B MoE) RL across search, SWE, and terminal domains at 131k context, with agents in sandboxes. 2 train + 4 infer nodes (SWE: 1 + 3).
- [`glm-5.2/`](advanced/glm-5.2/README.md) — the GLM-5 family at scale: 16 trainer nodes, P/D-disaggregated FP8 inference, and an llm-d router + Mooncake KV-offload variant. Also ships standalone `infer/` pre-flights.
- [`glm-5.3/`](advanced/glm-5.3/README.md) — the GLM-5 family at scale: 16 trainer nodes, P/D-disaggregated FP8 inference, and an llm-d router + Mooncake KV-offload variant. Also ships standalone `infer/` pre-flights.
- `intellect-3.1/` — reproduce the `INTELLECT-3.1` run: 4 train + 12 infer nodes on SWE.
All advanced configs submit through SLURM (the `rl` entrypoint writes the sbatch job when the config has a `[slurm]` table) and are monitored with `uv run dashboard`. See the per-model README for the full walkthrough.
+3 -2
View File
@@ -15,10 +15,11 @@ Inference serves the bf16 checkpoint as-is (no quantization), with `tensor_paral
## Requirements
- A Slurm cluster with 8-GPU nodes and a shared filesystem. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path.
- **Sandboxes.** Rollout and eval agents run in sandboxes. These configs are wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default — if you use those, log the `prime` CLI in (it ships with prime-rl's dependencies), and each config's `slurm.pre_run_command` will clean up the run's orphaned sandboxes by label before launching:
- **Sandboxes.** Rollout and eval agents run in sandboxes. These configs are wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. Install the `prime` CLI separately and log in. Each config's `slurm.pre_run_command` then cleans up the run's orphaned sandboxes by label before launch:
```bash
uv run prime login # or: uv run prime config set-api-key <your-key>
uv tool install prime
prime login # or: prime config set-api-key <your-key>
```
To run on your own infrastructure instead, swap `env.agent.runtime` on each source for a runtime your environments support (e.g. a local Docker backend) and drop the `slurm.pre_run_command` cleanup line.
@@ -1,11 +1,11 @@
# GLM-5 family at scale
Large-scale RL and serving for the GLM-5 family — `zai-org/GLM-5`, `GLM-5.1`, and `GLM-5.2-FP8` — at 131k context: 16 trainer nodes on the custom MoE implementation (expert parallelism; the llm-d variant adds context parallelism) and P/D-disaggregated FP8 inference. The `-llmd` variants front the inference plane with the [**llm-d**](https://llm-d.ai) router (Endpoint Picker + Envoy): its `active-request-scorer` load-balances in flight — instead of reacting to delayed metrics like the default `vllm-router` — which, combined with prefix-cache affinity for grouped rollouts, keeps prefill and decode ranks evenly loaded under RL's bursty request pattern. They also offload KV to a Mooncake distributed CPU pool (1TB per node by default).
Large-scale RL and serving for the GLM-5 family — including `zai-org/GLM-5.3-BF16` for training and its `GLM-5.3` block-FP8 serving release — at 131k context: 16 trainer nodes on the custom MoE implementation (expert parallelism; the llm-d variant adds context parallelism) and P/D-disaggregated FP8 inference. The `-llmd` variants front the inference plane with the [**llm-d**](https://llm-d.ai) router (Endpoint Picker + Envoy): its `active-request-scorer` load-balances in flight — instead of reacting to delayed metrics like the default `vllm-router` — which, combined with prefix-cache affinity for grouped rollouts, keeps prefill and decode ranks evenly loaded under RL's bursty request pattern. They also offload KV to a Mooncake distributed CPU pool (1TB per node by default).
| Config | What it runs | Topology |
|---|---|---|
| [`swe.toml`](swe.toml) | GLM-5 RL plane: 16 train nodes, eval on `swebench-verified` every 20 steps, default vLLM router over 2 P/D replicas (4 prefill + 4 decode nodes each). Declares **no train source** — compose yours on top with an `[[orchestrator.train.source]]` overlay. | 16 train + 16 infer nodes |
| [`swe-llmd.toml`](swe-llmd.toml) | Full-stack GLM-5.1 RL: trains on `r2e-gym` (`rlm` harness), FP8-quantized trainer (`deepgemm_fp8` MoE compute), llm-d router + Mooncake KV offload. | 16 train + 16 infer nodes |
| [`swe-llmd.toml`](swe-llmd.toml) | Full-stack GLM-5.3 RL: trains on `r2e-gym` (`rlm` harness), FP8-quantized trainer (`deepgemm_fp8` MoE compute), llm-d router + Mooncake KV offload. | 16 train + 16 infer nodes |
| [`infer/pd.toml`](infer/pd.toml) | Inference-only pre-flight: P/D-disaggregated `GLM-5-FP8`. | 6 infer nodes |
| [`infer/pd-llmd.toml`](infer/pd-llmd.toml) | Inference-only pre-flight: `GLM-5.2-FP8` with llm-d + Mooncake. | 16 infer nodes |
@@ -13,10 +13,11 @@ Large-scale RL and serving for the GLM-5 family — `zai-org/GLM-5`, `GLM-5.1`,
- A Slurm cluster with 8-GPU nodes, a shared filesystem, and at least **32 nodes** (16 trainer + 16 inference) for the RL configs. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path. If you have fewer nodes, drop `seq_len`, lower `num_train_nodes`, and reduce `cp` (llm-d variant) accordingly.
- InfiniBand/RDMA NICs for the Mooncake KV pool (llm-d variants).
- **Sandboxes.** Rollout and eval agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, log the `prime` CLI in — it ships with prime-rl's dependencies:
- **Sandboxes.** Rollout and eval agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, install the `prime` CLI separately and log in:
```bash
uv run prime login # or: uv run prime config set-api-key <your-key>
uv tool install prime
prime login # or: prime config set-api-key <your-key>
```
To run on your own infrastructure instead, swap `env.agent.runtime` on each source for a runtime your environments support (e.g. a local Docker backend).
@@ -57,18 +58,18 @@ uv sync --all-extras --all-packages
The `rl` entrypoint submits an sbatch job whenever the config has a `[slurm]` table — there is no separate launcher. From the shared checkout:
```bash
# GLM-5.1 RL with llm-d + Mooncake (recommended)
uv run rl @ examples/advanced/glm-5.2/swe-llmd.toml
# GLM-5.3 RL with llm-d + Mooncake (recommended)
uv run rl @ examples/advanced/glm-5.3/swe-llmd.toml
# GLM-5 base plane — compose your train source onto it
uv run rl @ examples/advanced/glm-5.2/swe.toml @ my-train-source.toml
uv run rl @ examples/advanced/glm-5.3/swe.toml @ my-train-source.toml
```
The inference configs are standalone pre-flights: they serve the FP8 checkpoint through the same entrypoint the trainer uses (`/update_weights`, `/load_lora_adapter`, `/init_broadcaster` included — never call `vllm serve` directly), and are a fast way to check that this cluster can serve the model at all before committing it to a run:
```bash
uv run inference @ examples/advanced/glm-5.2/infer/pd.toml
uv run inference @ examples/advanced/glm-5.2/infer/pd-llmd.toml
uv run inference @ examples/advanced/glm-5.3/infer/pd.toml
uv run inference @ examples/advanced/glm-5.3/infer/pd-llmd.toml
```
## Monitor with the dashboard
@@ -2,7 +2,7 @@
# Step 3 / goal target. Topology mirrors the proven original glm5.1_llmd_inference
# (job 348 succeeded): 8 prefill nodes (4 replicas x 2) + 8 decode nodes (1 replica).
#
# Launch: uv run inference @ examples/advanced/glm-5.2/infer/pd-llmd.toml
# Launch: uv run inference @ examples/advanced/glm-5.3/infer/pd-llmd.toml
output_dir = "/shared/outputs/glm5.2-16node-llmd"
@@ -17,7 +17,6 @@ name = "base"
type = "nccl"
port = 29502
timeout = 12000
quantize_in_weight_transfer = true
[deployment]
type = "multi_node"
@@ -69,7 +68,10 @@ non_cached_tokens = 128 # if <128 tokens, skip prefill go to decode immediately
"queue-scorer" = 3.0
[inference.vllm]
model = "zai-org/GLM-5.1-FP8"
# The trainer uses GLM-5.3-BF16; serve the official block-FP8 release.
model = "zai-org/GLM-5.3"
dtype = "bfloat16"
quantization = "fp8_per_block"
max_model_len = 131072
tool_call_parser = "glm47"
reasoning_parser = "glm45"
@@ -86,7 +88,7 @@ partition = "all" # FILL IN: set to your cluster's partition
dist_timeout_seconds = 1800
[trainer.model]
name = "zai-org/GLM-5.1"
name = "zai-org/GLM-5.3-BF16"
impl = "custom"
attn = "flash_attention_2" # ignored with GLM5
fused_lm_head_token_chunk_size = 1024
@@ -122,7 +124,7 @@ initial_inflight = 256
max_inflight = 512
[orchestrator.model]
name = "zai-org/GLM-5.1-FP8"
name = "zai-org/GLM-5.3"
[orchestrator.renderer]
name = "glm-5.1"
@@ -1,5 +1,8 @@
seq_len = 131072
[model]
name = "zai-org/GLM-5.3-BF16"
[log]
level = "debug"
@@ -10,7 +13,6 @@ project = "glm5-pd-disag"
type = "nccl"
port = 29502
timeout = 12000
quantize_in_weight_transfer = true
[deployment]
type = "multi_node"
@@ -24,7 +26,9 @@ prefill_nodes_per_replica = 4
decode_nodes_per_replica = 4
[inference.vllm]
model = "zai-org/GLM-5-FP8"
# Serve the shared BF16 checkpoint above with online per-block FP8 quantization.
dtype = "bfloat16"
quantization = "fp8_per_block"
tool_call_parser = "glm47"
gpu_memory_utilization = 0.80
enable_expert_parallel = true
@@ -39,7 +43,6 @@ interval = 100
dist_timeout_seconds = 7200
[trainer.model]
name = "zai-org/GLM-5"
impl = "custom"
attn = "flash_attention_2" # dsa is skipping flash attn anyway
fused_lm_head_token_chunk_size = 2048
@@ -70,8 +73,8 @@ max_off_policy_steps = 16
initial_inflight = 4096
max_inflight = 8192
[orchestrator.model]
name = "zai-org/GLM-5-FP8"
[orchestrator.renderer]
name = "glm-5.1"
[orchestrator.eval]
interval = 20
+3 -2
View File
@@ -13,10 +13,11 @@ RL on the 30B-A3B MoE across three domains: math, SWE, and agentic tool use. The
## Requirements
- A Slurm cluster with 8-GPU nodes and a shared filesystem. This guide assumes the shared filesystem is mounted at `/shared` — adjust to your own path.
- **Sandboxes** (`swe.toml` only) — the SWE agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, log the `prime` CLI in (it ships with prime-rl's dependencies):
- **Sandboxes** (`swe.toml` only) — the SWE agents run in sandboxes, wired for [Prime Intellect Sandboxes](https://docs.primeintellect.ai/sandboxes/overview) by default. If you use those, install the `prime` CLI separately and log in:
```bash
uv run prime login # or: uv run prime config set-api-key <your-key>
uv tool install prime
prime login # or: prime config set-api-key <your-key>
```
To run on your own infrastructure instead, swap `env.agent.runtime` on the source for a runtime your environments support (e.g. a local Docker backend).
@@ -459,9 +459,6 @@ class NCCLWeightBroadcastConfig(InMemoryWeightBroadcastConfig):
port: int = 29501
"""Port for the NCCL broadcast rendezvous."""
quantize_in_weight_transfer: bool = False
"""Use kernel-format FP8 quantized NCCL transfer for weight updates."""
class NIXLWeightBroadcastConfig(InMemoryWeightBroadcastConfig):
type: Literal["nixl"] = "nixl"
@@ -145,9 +145,6 @@ class SharedNCCLWeightBroadcastConfig(SharedInMemoryWeightBroadcastConfig):
port: int = 29501
"""Port for NCCL weight broadcast."""
quantize_in_weight_transfer: bool = False
"""Use kernel-format FP8 quantized NCCL transfer for weight updates. When disabled, uses default HF checkpoint-format transfer."""
class SharedNIXLWeightBroadcastConfig(SharedInMemoryWeightBroadcastConfig):
type: Literal["nixl"] = "nixl"
@@ -368,22 +365,6 @@ class RLConfig(BaseConfig):
)
return self
@model_validator(mode="after")
def validate_quantize_in_weight_transfer(self):
if not isinstance(self.weight_broadcast, SharedNCCLWeightBroadcastConfig):
return self
if not self.weight_broadcast.quantize_in_weight_transfer:
return self
if self.inference is None:
raise ValueError("weight_broadcast.quantize_in_weight_transfer requires an inference config.")
if self.trainer.model.impl != "custom":
raise ValueError("weight_broadcast.quantize_in_weight_transfer requires trainer.model.impl = 'custom'.")
return self
### Auto-setup shared configs (before sub-config construction)
@model_validator(mode="before")
@@ -487,9 +468,7 @@ class RLConfig(BaseConfig):
inference_world_size=inference_world_size,
)
if self.weight_broadcast.type == "nccl":
transport_config = dict(
quantize_in_weight_transfer=self.weight_broadcast.quantize_in_weight_transfer,
)
transport_config = {}
trainer_config_type = TrainerNCCLWeightBroadcastConfig
orchestrator_config_type = OrchestratorNCCLWeightBroadcastConfig
else:
@@ -538,18 +517,9 @@ class RLConfig(BaseConfig):
return self
@model_validator(mode="after")
def validate_eplb_requires_quantized_weight_transfer(self):
if self.inference is None or not self.inference.vllm.enable_eplb:
return self
# TODO(matej): check if weight reloading works itself before supporting EPLB without quantized transfer.
trainer_weight_broadcast = self.trainer.weight_broadcast
if trainer_weight_broadcast.type != "nccl" or not trainer_weight_broadcast.quantize_in_weight_transfer:
raise ValueError(
"inference.vllm.enable_eplb requires weight_broadcast.type = 'nccl' and "
"weight_broadcast.quantize_in_weight_transfer = true."
)
def validate_eplb(self):
if self.inference is not None and self.inference.vllm.enable_eplb:
raise ValueError("inference.vllm.enable_eplb is not supported with RL weight updates.")
return self
@model_validator(mode="after")
@@ -568,13 +568,13 @@ class CheckpointConfig(BaseConfig):
class IPOLossConfig(BaseConfig):
type: Literal["ipo"] = "ipo"
eps: float = Field(0.1, ge=0)
eps: float = Field(0.3, ge=0)
"""Maximum absolute probability change before a token is masked."""
adv_tau: float = Field(1.0, ge=0)
"""Temperature for the advantage term."""
kl_tau: float = Field(1e-3, ge=0)
kl_tau: float = Field(0.0, ge=0)
"""Temperature for the KL term."""
@@ -645,9 +645,6 @@ class NCCLWeightBroadcastConfig(InMemoryWeightBroadcastConfig):
port: int = 29501
"""Port for the NCCL broadcast rendezvous."""
quantize_in_weight_transfer: bool = False
"""Use kernel-format FP8 quantized NCCL transfer for weight updates. When disabled, uses default HF checkpoint-format transfer."""
class NIXLWeightBroadcastConfig(InMemoryWeightBroadcastConfig):
type: Literal["nixl"] = "nixl"
+1 -1
View File
@@ -16,7 +16,7 @@ dependencies = [
"transformers==5.6.2",
"wandb>=0.26.1",
"wandb-workspaces>=0.4.3",
"prime>=0.6.19",
"prime-sandboxes>=0.3.0",
"prime-runs[train]>=0.1.3",
"pyzmq>=27.1.0",
"aiolimiter>=1.2.1",
-2
View File
@@ -391,7 +391,6 @@ class DynamoAdminPlane(AdminPlane):
port: int,
timeout: int,
inference_world_size: int,
quantize_in_weight_transfer: bool = False,
) -> None:
async with self._mutation_lock:
self._require_uninitialized_nccl()
@@ -411,7 +410,6 @@ class DynamoAdminPlane(AdminPlane):
0,
1,
timeout,
quantize_in_weight_transfer,
"default",
],
)
+1 -2
View File
@@ -138,11 +138,10 @@ async def init_broadcaster(request: Request):
timeout = data.get("timeout")
rank_offset = data.get("rank_offset")
inference_world_size = data.get("inference_world_size")
quantize_in_weight_transfer = data.get("quantize_in_weight_transfer", False)
session_id = data.get("session_id", "default")
await engine_client(request).collective_rpc(
"init_broadcaster",
args=(host, port, rank_offset, inference_world_size, timeout, quantize_in_weight_transfer, session_id),
args=(host, port, rank_offset, inference_world_size, timeout, session_id),
)
return {"status": "ok"}
+1 -12
View File
@@ -7,11 +7,7 @@ from vllm.distributed.device_communicators.pynccl import PyNcclCommunicator
from vllm.distributed.utils import StatelessProcessGroup
from vllm.logger import init_logger
from prime_rl.inference.vllm.worker.weight_transfer import (
load_weights_checkpoint_layerwise,
load_weights_kernel,
update_mla_absorbed_weights,
)
from prime_rl.inference.vllm.worker.weight_transfer import load_weights_checkpoint_layerwise
from prime_rl.utils.nccl import disable_nccl_p2p_if_unavailable
# This is to get type hints for the Worker class but not actually extend it at runtime as this is required by vLLM worker extension
@@ -99,7 +95,6 @@ class NCCLWeightUpdateWorker(Worker):
rank_offset: int,
inference_world_size: int,
timeout: int,
quantize_in_weight_transfer: bool = False,
session_id: str = "default",
) -> None:
"""Initialize the NCCL broadcast receiver.
@@ -109,7 +104,6 @@ class NCCLWeightUpdateWorker(Worker):
inference_world_size: Total number of inference GPUs across all servers.
"""
del session_id
self.quantize_in_weight_transfer = quantize_in_weight_transfer
# Use the worker's device index directly as the local rank.
# The previous dp_group-based computation broke in vLLM v1 multiprocess
# DP mode where each worker is a separate process with a singleton
@@ -145,11 +139,6 @@ class NCCLWeightUpdateWorker(Worker):
assert isinstance(model, Module)
state_iter = self.nccl_broadcast_receiver.receive_state_dict()
if self.quantize_in_weight_transfer:
load_weights_kernel(model, state_iter)
update_mla_absorbed_weights(model)
return
load_weights_checkpoint_layerwise(
model,
state_iter,
+1 -2
View File
@@ -98,10 +98,9 @@ class NIXLWeightUpdateWorker(Worker):
rank_offset: int,
inference_world_size: int,
timeout: int,
quantize_in_weight_transfer: bool = False,
session_id: str = "default",
) -> None:
del inference_world_size, quantize_in_weight_transfer
del inference_world_size
global_rank = rank_offset + self.device.index
server_url = f"{host}:{port}"
set_ucx_env_defaults(self.device.index)
@@ -1,11 +1,10 @@
from typing import Generator, Iterable
from typing import Iterable
import torch
from torch.nn import Module
from vllm.config import set_current_vllm_config
from vllm.logger import init_logger
from vllm.model_executor.model_loader.reload import finalize_layerwise_reload, initialize_layerwise_reload
from vllm.model_executor.model_loader.weight_utils import remap_moe_expert_weights
logger = init_logger("vllm.inference.vllm.worker_weight_transfer")
@@ -24,116 +23,6 @@ def load_weights_checkpoint_layerwise(
finalize_layerwise_reload(model, model_config)
def _invert_logical_to_physical_map(logical_to_physical_map: torch.Tensor, num_physical_experts: int) -> torch.Tensor:
"""Build a physical expert -> logical expert map from vLLM EPLB state."""
physical_to_logical = torch.full(
(num_physical_experts,),
-1,
dtype=torch.long,
device=logical_to_physical_map.device,
)
logical_indices = torch.arange(
logical_to_physical_map.shape[0],
dtype=torch.long,
device=logical_to_physical_map.device,
)[:, None].expand_as(logical_to_physical_map)
physical_indices = logical_to_physical_map.to(torch.long)
invalid = (physical_indices < -1) | (physical_indices >= num_physical_experts)
if invalid.any():
invalid_indices = physical_indices[invalid].unique().tolist()
raise ValueError(f"EPLB maps to invalid physical experts: {invalid_indices}")
valid = physical_indices >= 0
physical_to_logical[physical_indices[valid]] = logical_indices[valid]
return physical_to_logical
def _build_expert_source_indices(routed_experts, router) -> torch.Tensor | None:
if routed_experts._expert_map is None:
return None
physical_indices = torch.where(routed_experts._expert_map >= 0)[0]
local_indices = routed_experts._expert_map[physical_indices]
physical_indices = physical_indices[local_indices.argsort()]
eplb_layer_state = getattr(router, "eplb_state", None)
logical_to_physical_map = getattr(eplb_layer_state, "logical_to_physical_map", None)
if logical_to_physical_map is None:
return physical_indices
physical_to_logical = _invert_logical_to_physical_map(logical_to_physical_map, routed_experts.global_num_experts)
logical_indices = physical_to_logical[physical_indices.to(physical_to_logical.device)]
if (logical_indices < 0).any():
missing = physical_indices[(logical_indices < 0).to(physical_indices.device)].tolist()
raise ValueError(f"EPLB has no logical mapping for local physical experts: {missing}")
return logical_indices.to(physical_indices.device)
def build_expert_map(model: Module) -> dict[str, torch.Tensor]:
"""Map MoE module names to source expert indices local to this worker.
vLLM 0.24 turned ``FusedMoE`` into a factory returning a ``MoERunner`` and
split the state that used to live on the ``FusedMoE`` module: the expert map
(``_expert_map`` / ``global_num_experts``) now lives on
``MoERunner.routed_experts`` (a ``RoutedExperts``), and the EPLB state on
``MoERunner.router``. Keying by the ``MoERunner`` name prefix-matches the
nested ``routed_experts.*`` weight params after ``load_weights_kernel``
remaps incoming flat names via ``remap_moe_expert_weights``.
"""
from vllm.model_executor.layers.fused_moe import MoERunner
source_indices_by_module: dict[str, torch.Tensor] = {}
for module_name, module in model.named_modules():
if not isinstance(module, MoERunner):
continue
source_indices = _build_expert_source_indices(module.routed_experts, module.router)
if source_indices is None:
continue
source_indices_by_module[module_name] = source_indices
return source_indices_by_module
@torch.no_grad()
def load_weights_kernel(model: Module, state_iter: Generator[tuple[str, torch.Tensor], None, None]) -> None:
"""Load vLLM kernel-format tensors using in-place copy_ updates."""
params = dict(model.named_parameters())
expert_source_indices = build_expert_map(model)
loaded = 0
skipped: list[str] = []
shape_mismatches: list[str] = []
# The trainer emits pre-0.24 flat kernel names (``...experts.w13_weight``); since
# vLLM 0.24 the expert params are nested (``...experts.routed_experts.w13_weight``).
# ``remap_moe_expert_weights`` is upstream's compat shim for exactly this transition.
for name, tensor in remap_moe_expert_weights(state_iter, params):
if name not in params:
skipped.append(name)
continue
param = params[name]
if param.shape != tensor.shape:
for module_name, source_indices in expert_source_indices.items():
if not name.startswith(f"{module_name}."):
continue
tensor = tensor[source_indices.to(tensor.device)]
break
if param.shape != tensor.shape:
shape_mismatches.append(f"{name}: param={list(param.shape)} != received={list(tensor.shape)}")
continue
param.copy_(tensor)
loaded += 1
if shape_mismatches:
raise ValueError(f"Kernel weight transfer had {len(shape_mismatches)} shape mismatches: {shape_mismatches}")
if skipped:
raise ValueError(f"Kernel weight transfer skipped {len(skipped)} weights not found in model: {skipped}")
logger.debug(f"Kernel weight transfer copied {loaded} weights in-place")
@torch.no_grad()
def update_mla_absorbed_weights(model: Module) -> None:
"""Recompute MLA absorbed KV weights after in-place kv_b_proj updates."""
+1 -1
View File
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Any
import orjson
import prime_runs as pr
from prime_cli.core.config import Config as PrimeConfig
from prime_sandboxes import Config as PrimeConfig
from prime_rl.configs.monitors import PrimeEvalMonitorConfig, PrimeTrainMonitorConfig
from prime_rl.monitors.base import Kind, Monitor, Subset
+2 -5
View File
@@ -24,7 +24,7 @@ def resolve_api_key(api_key_var: str) -> str:
CLI config (``prime login``), like the verifiers client does. ``"EMPTY"`` when unset."""
api_key = os.environ.get(api_key_var)
if not api_key and api_key_var == "PRIME_API_KEY":
from prime_cli.core.config import Config as PrimeConfig
from prime_sandboxes import Config as PrimeConfig
api_key = PrimeConfig().api_key
return api_key or "EMPTY"
@@ -39,7 +39,7 @@ def resolve_headers(client_config: ClientConfig) -> dict[str, str]:
}
headers = {**client_config.headers, **env_headers}
if client_config.base_url.startswith(PRIME_INFERENCE_URL) and "X-Prime-Team-ID" not in headers:
from prime_cli.core.config import Config as PrimeConfig
from prime_sandboxes import Config as PrimeConfig
if team_id := os.environ.get("PRIME_TEAM_ID") or PrimeConfig().team_id:
headers["X-Prime-Team-ID"] = team_id
@@ -169,7 +169,6 @@ class AdminPlane:
port: int,
timeout: int,
inference_world_size: int,
quantize_in_weight_transfer: bool = False,
) -> None:
gpus_per_server = inference_world_size // len(self.clients)
get_logger().info(
@@ -187,7 +186,6 @@ class AdminPlane:
"rank_offset": rank_offset,
"inference_world_size": inference_world_size,
"timeout": timeout,
"quantize_in_weight_transfer": quantize_in_weight_transfer,
},
)
response.raise_for_status()
@@ -513,7 +511,6 @@ async def init_nixl_broadcast(
"rank_offset": rank_offset,
"inference_world_size": inference_world_size,
"timeout": timeout,
"quantize_in_weight_transfer": False,
"session_id": session_id,
},
)
-17
View File
@@ -143,23 +143,6 @@ class PreTrainedModelPrimeRL(PreTrainedModel):
"""
return state_dict
@classmethod
def convert_layer_to_vllm_kernel(
cls,
state_dict: dict[str, Tensor],
layer_idx: int,
quantize_fp8: bool = False,
) -> dict[str, Tensor]:
"""
Convert a single layer's state dict from PrimeRL format to vLLM kernel format.
Args:
state_dict: Layer weights in PrimeRL format.
layer_idx: Layer index to convert.
quantize_fp8: Whether to emit FP8 (e4m3) kernel weights with per-block scales.
"""
raise NotImplementedError(f"convert_layer_to_vllm_kernel is not implemented for {cls.__name__}")
def init_buffers_post_meta(self) -> None:
"""
Initialize buffers that are not in the state dict after loading with meta device.
-25
View File
@@ -37,28 +37,3 @@ def quantize_to_fp8_blockwise(weight: Tensor, block_size: int = 128) -> tuple[Te
quantized = blocks_fp8.permute(0, 2, 1, 3).reshape(padded_rows, padded_cols)[:rows, :cols].contiguous()
return quantized, scales.float().contiguous()
def quantize_to_vllm_kernel_format(weight: Tensor, block_size: int = 128) -> tuple[Tensor, Tensor]:
"""Quantize a weight into the FP8 layout used by vLLM kernels.
Hopper kernels consume the regular blockwise scale grid. On SM100, vLLM's
DeepGEMM kernels instead use UE8M0 scales in an architecture-specific packed
layout. Reuse vLLM's own post-processing so tensors sent over the kernel
weight-transfer path have the same representation as the loaded parameters.
"""
quantized, scales = quantize_to_fp8_blockwise(weight, block_size)
if not weight.is_cuda or torch.cuda.get_device_capability(weight.device) != (10, 0):
return quantized, scales
from vllm.model_executor.layers.quantization.utils.fp8_utils import (
deepgemm_post_process_fp8_weight_block,
)
return deepgemm_post_process_fp8_weight_block(
wq=quantized,
ws=scales,
quant_block_shape=(block_size, block_size),
use_e8m0=True,
)
@@ -6,11 +6,7 @@ parameters retain their names in both formats.
from __future__ import annotations
import torch
from torch import Tensor
from prime_rl.trainer.models.conversion_ops import ConvOp
from prime_rl.trainer.models.fp8 import quantize_to_vllm_kernel_format
from prime_rl.trainer.models.glm4_moe.converting_glm4_moe import glm_moe_layer_ops
@@ -19,123 +15,3 @@ def conversion_chain(config) -> list[ConvOp]:
for layer_idx in range(config.num_hidden_layers):
ops.extend(glm_moe_layer_ops(layer_idx))
return ops
def convert_tt_layer_to_vllm_kernel(
state_dict: dict[str, Tensor],
layer_idx: int,
quantize_fp8: bool = False,
) -> dict[str, Tensor]:
"""Convert a single GLM layer from PrimeRL format to vLLM kernel format."""
out: dict[str, Tensor] = {}
prefix = f"model.layers.{layer_idx}"
def add(name: str, tensor: Tensor) -> None:
out[name] = tensor
def add_maybe_fp8(name: str, tensor: Tensor) -> None:
if quantize_fp8 and tensor.ndim == 2:
fp8_weight, scale = quantize_to_vllm_kernel_format(tensor)
out[name] = fp8_weight
scale_name = name.removesuffix(".weight") + ".weight_scale_inv"
out[scale_name] = scale
return
out[name] = tensor
for name in [f"{prefix}.input_layernorm.weight", f"{prefix}.post_attention_layernorm.weight"]:
if name in state_dict:
add(name, state_dict[name])
q_a_key = f"{prefix}.self_attn.q_a_proj.weight"
kv_a_key = f"{prefix}.self_attn.kv_a_proj_with_mqa.weight"
if q_a_key in state_dict and kv_a_key in state_dict:
add_maybe_fp8(
f"{prefix}.self_attn.fused_qkv_a_proj.weight", torch.cat([state_dict[q_a_key], state_dict[kv_a_key]], dim=0)
)
for suffix in ["q_a_layernorm.weight", "kv_a_layernorm.weight"]:
key = f"{prefix}.self_attn.{suffix}"
if key in state_dict:
add(key, state_dict[key])
for suffix in ["q_b_proj.weight", "kv_b_proj.weight", "o_proj.weight"]:
key = f"{prefix}.self_attn.{suffix}"
if key in state_dict:
add_maybe_fp8(key, state_dict[key])
indexer_wq_b_key = f"{prefix}.self_attn.indexer.wq_b.weight"
if indexer_wq_b_key in state_dict:
add_maybe_fp8(indexer_wq_b_key, state_dict[indexer_wq_b_key])
indexer_wk_key = f"{prefix}.self_attn.indexer.wk.weight"
indexer_weights_proj_key = f"{prefix}.self_attn.indexer.weights_proj.weight"
if indexer_wk_key in state_dict and indexer_weights_proj_key in state_dict:
add(
f"{prefix}.self_attn.indexer.wk_weights_proj.weight",
torch.cat([state_dict[indexer_wk_key], state_dict[indexer_weights_proj_key]], dim=0),
)
for suffix in ["indexer.k_norm.weight", "indexer.k_norm.bias"]:
key = f"{prefix}.self_attn.{suffix}"
if key in state_dict:
add(key, state_dict[key])
gate_key = f"{prefix}.mlp.gate_proj.weight"
up_key = f"{prefix}.mlp.up_proj.weight"
down_key = f"{prefix}.mlp.down_proj.weight"
if gate_key in state_dict and up_key in state_dict:
add_maybe_fp8(f"{prefix}.mlp.gate_up_proj.weight", torch.cat([state_dict[gate_key], state_dict[up_key]], dim=0))
if down_key in state_dict:
add_maybe_fp8(f"{prefix}.mlp.down_proj.weight", state_dict[down_key])
router_key = f"{prefix}.mlp.router.gate.weight"
if router_key in state_dict:
add(f"{prefix}.mlp.gate.weight", state_dict[router_key])
selection_bias_key = f"{prefix}.mlp.router.selection_bias"
if selection_bias_key in state_dict:
add(f"{prefix}.mlp.gate.e_score_correction_bias", state_dict[selection_bias_key])
w1_key = f"{prefix}.mlp.experts.gate_proj"
w2_key = f"{prefix}.mlp.experts.down_proj"
w3_key = f"{prefix}.mlp.experts.up_proj"
if w1_key in state_dict and w2_key in state_dict and w3_key in state_dict:
w1 = state_dict[w1_key]
w2 = state_dict[w2_key]
w3 = state_dict[w3_key]
w13 = torch.cat([w1, w3], dim=1)
if quantize_fp8:
w13_fp8: list[Tensor] = []
w13_scales: list[Tensor] = []
w2_fp8: list[Tensor] = []
w2_scales: list[Tensor] = []
for expert_idx in range(w1.shape[0]):
expert_w13_fp8, expert_w13_scales = quantize_to_vllm_kernel_format(w13[expert_idx])
expert_w2_fp8, expert_w2_scales = quantize_to_vllm_kernel_format(w2[expert_idx])
w13_fp8.append(expert_w13_fp8)
w13_scales.append(expert_w13_scales)
w2_fp8.append(expert_w2_fp8)
w2_scales.append(expert_w2_scales)
out[f"{prefix}.mlp.experts.w13_weight"] = torch.stack(w13_fp8)
out[f"{prefix}.mlp.experts.w13_weight_scale_inv"] = torch.stack(w13_scales)
out[f"{prefix}.mlp.experts.w2_weight"] = torch.stack(w2_fp8)
out[f"{prefix}.mlp.experts.w2_weight_scale_inv"] = torch.stack(w2_scales)
else:
out[f"{prefix}.mlp.experts.w13_weight"] = w13
out[f"{prefix}.mlp.experts.w2_weight"] = w2
sw1_key = f"{prefix}.mlp.shared_expert.gate_proj.weight"
sw2_key = f"{prefix}.mlp.shared_expert.down_proj.weight"
sw3_key = f"{prefix}.mlp.shared_expert.up_proj.weight"
if sw1_key in state_dict and sw2_key in state_dict and sw3_key in state_dict:
sw1 = state_dict[sw1_key]
sw2 = state_dict[sw2_key]
sw3 = state_dict[sw3_key]
if sw1.ndim == 3:
sw1 = sw1.squeeze(0)
sw2 = sw2.squeeze(0)
sw3 = sw3.squeeze(0)
add_maybe_fp8(f"{prefix}.mlp.shared_experts.gate_up_proj.weight", torch.cat([sw1, sw3], dim=0))
add_maybe_fp8(f"{prefix}.mlp.shared_experts.down_proj.weight", sw2)
return out
@@ -14,10 +14,7 @@ from transformers.utils.deprecation import deprecate_kwarg
from prime_rl.trainer.models.base import PreTrainedModelPrimeRL
from prime_rl.trainer.models.glm_moe_dsa.configuration_glm_moe_dsa import GlmMoeDsaConfig, _index_cache_skip_topk
from prime_rl.trainer.models.glm_moe_dsa.converting_glm_moe_dsa import (
conversion_chain,
convert_tt_layer_to_vllm_kernel,
)
from prime_rl.trainer.models.glm_moe_dsa.converting_glm_moe_dsa import conversion_chain
from prime_rl.trainer.models.glm_moe_dsa.sparse_mla_attention import GlmMoeDsaAttention, SparseMlaAttentionArgs
from prime_rl.trainer.models.layers.lm_head import PrimeLmOutput
from prime_rl.trainer.models.layers.mlp import FeedForward
@@ -153,12 +150,6 @@ class GlmMoeDsaPreTrainedModel(PreTrainedModelPrimeRL):
def conversion_chain(cls, config):
return conversion_chain(config)
@classmethod
def convert_layer_to_vllm_kernel(
cls, state_dict: dict[str, Tensor], layer_idx: int, quantize_fp8: bool = False
) -> dict[str, Tensor]:
return convert_tt_layer_to_vllm_kernel(state_dict, layer_idx, quantize_fp8=quantize_fp8)
@auto_docstring
class GlmMoeDsaModel(GlmMoeDsaPreTrainedModel):
@@ -22,9 +22,9 @@ def _per_token_group_quant_fp8(
group_size,
y_num_columns,
y_row_stride,
eps,
fp8_min,
fp8_max,
eps: tl.constexpr,
fp8_min: tl.constexpr,
fp8_max: tl.constexpr,
use_ue8m0: tl.constexpr,
BLOCK: tl.constexpr,
):
+2 -22
View File
@@ -114,16 +114,6 @@ def preprocess_layer_checkpoint(
return revert_weight_conversion(model, layer_state_dict)
def preprocess_layer_quantized(
model: nn.Module,
layer_state_dict: dict[str, Tensor],
layer_idx: int,
) -> dict[str, Tensor]:
if layer_idx < 0:
return layer_state_dict
return model.convert_layer_to_vllm_kernel(layer_state_dict, layer_idx, quantize_fp8=True)
class NCCLBroadcaster:
def __init__(
self,
@@ -133,12 +123,10 @@ class NCCLBroadcaster:
world_size: int,
device: int | str | torch.device,
timeout: int,
quantize_in_weight_transfer: bool = False,
):
self.logger = get_logger()
self.world = get_world()
self.dtype = torch.bfloat16
self.quantize_in_weight_transfer = quantize_in_weight_transfer
if self.world.is_master:
disable_nccl_p2p_if_unavailable()
@@ -163,16 +151,10 @@ class NCCLBroadcaster:
broadcast_integer(num_state_dict_to_send, self.communicator)
self.logger.debug(f"Broadcasting {num_state_dict_to_send} layer state dicts")
preprocess_fn: Callable[[nn.Module, dict[str, Tensor], int], dict[str, Tensor]]
if self.quantize_in_weight_transfer:
preprocess_fn = preprocess_layer_quantized
else:
preprocess_fn = preprocess_layer_checkpoint
keep_in_fp32 = getattr(model, "keep_in_fp32_for_weight_transfer", None)
for layer_id, layer_state_dict in filter_state_dict_by_layers(state_dict, num_layers, layer_prefix):
layer_state_dict = resolve_dtensors(layer_state_dict, keep_in_fp32, self.dtype)
layer_state_dict = preprocess_fn(model, layer_state_dict, layer_id)
layer_state_dict = preprocess_layer_checkpoint(model, layer_state_dict, layer_id)
if self.world.is_master:
broadcast_state_dict(layer_state_dict, self.communicator)
@@ -194,14 +176,13 @@ class NCCLWeightSender(WeightSender):
config.inference_world_size + 1,
device,
config.timeout,
quantize_in_weight_transfer=config.quantize_in_weight_transfer,
)
@torch.no_grad()
def _broadcast(self, model: nn.Module, step: int, step_dir: Path) -> None:
# The master enters only after the receiver acknowledged the handshake,
# but all ranks must be held back until then: the broadcast preparation
# (DTensor resolution, quantization) enqueues collectives on non-master
# (DTensor resolution, checkpoint conversion) enqueues collectives on non-master
# ranks, and if those start before the receiver has paused inference,
# the collectives sit unmatched until NCCL's watchdog kills the process.
if self.world.world_size > 1:
@@ -221,7 +202,6 @@ class NCCLWeightReceiver(WeightReceiver):
port=self.config.port,
timeout=self.config.timeout,
inference_world_size=self.config.inference_world_size,
quantize_in_weight_transfer=self.config.quantize_in_weight_transfer,
)
async def receive(self, step: int) -> None:
+1 -1
View File
@@ -213,7 +213,7 @@ def test_dynamo_nccl_lifecycle_initializes_and_updates_weights(tmp_path):
asyncio.run(admin.initialize_nccl(host="trainer", port=29501, timeout=10, inference_world_size=1))
asyncio.run(admin.update_weights(tmp_path / "step_1", transport="nccl", step=1))
assert collective_rpc.await_args_list[0].kwargs["args"] == ["trainer", 29501, 0, 1, 10, False, "default"]
assert collective_rpc.await_args_list[0].kwargs["args"] == ["trainer", 29501, 0, 1, 10, "default"]
assert collective_rpc.await_args_list[1].kwargs["args"] == [(tmp_path / "step_1").as_posix()]
assert [call.args[1] for call in post.await_args_list] == ["/pause", "/resume"]
assert admin._nccl_initialization_state == "ready"
-1
View File
@@ -81,7 +81,6 @@ def test_admin_plane_initializes_nccl():
"rank_offset": 0,
"inference_world_size": 1,
"timeout": 1200,
"quantize_in_weight_transfer": False,
},
)
asyncio.run(admin_plane.aclose())
@@ -1,68 +0,0 @@
import torch
from prime_rl.trainer.models.glm_moe_dsa.converting_glm_moe_dsa import convert_tt_layer_to_vllm_kernel
def _build_prime_layer_state(layer_idx: int = 0) -> dict[str, torch.Tensor]:
prefix = f"model.layers.{layer_idx}"
return {
f"{prefix}.self_attn.q_a_proj.weight": torch.randn(4, 6),
f"{prefix}.self_attn.kv_a_proj_with_mqa.weight": torch.randn(3, 6),
f"{prefix}.self_attn.q_b_proj.weight": torch.randn(5, 6),
f"{prefix}.self_attn.kv_b_proj.weight": torch.randn(7, 6),
f"{prefix}.self_attn.o_proj.weight": torch.randn(6, 5),
f"{prefix}.self_attn.indexer.wq_b.weight": torch.randn(4, 6),
f"{prefix}.self_attn.indexer.wk.weight": torch.randn(4, 6),
f"{prefix}.self_attn.indexer.k_norm.weight": torch.randn(6),
f"{prefix}.self_attn.indexer.k_norm.bias": torch.randn(6),
f"{prefix}.self_attn.indexer.weights_proj.weight": torch.randn(2, 6),
f"{prefix}.mlp.gate_proj.weight": torch.randn(8, 6),
f"{prefix}.mlp.up_proj.weight": torch.randn(8, 6),
f"{prefix}.mlp.down_proj.weight": torch.randn(6, 8),
f"{prefix}.mlp.router.gate.weight": torch.randn(4, 6),
f"{prefix}.mlp.router.selection_bias": torch.randn(4),
f"{prefix}.mlp.experts.gate_proj": torch.randn(2, 3, 6),
f"{prefix}.mlp.experts.up_proj": torch.randn(2, 3, 6),
f"{prefix}.mlp.experts.down_proj": torch.randn(2, 6, 3),
f"{prefix}.mlp.shared_expert.gate_proj.weight": torch.randn(3, 6),
f"{prefix}.mlp.shared_expert.up_proj.weight": torch.randn(3, 6),
f"{prefix}.mlp.shared_expert.down_proj.weight": torch.randn(6, 3),
}
def test_convert_tt_layer_to_vllm_kernel_no_fp8():
state = _build_prime_layer_state()
out = convert_tt_layer_to_vllm_kernel(state, layer_idx=0, quantize_fp8=False)
assert "model.layers.0.self_attn.fused_qkv_a_proj.weight" in out
assert out["model.layers.0.self_attn.fused_qkv_a_proj.weight"].shape == (7, 6)
assert "model.layers.0.self_attn.indexer.wk_weights_proj.weight" in out
assert out["model.layers.0.self_attn.indexer.wk_weights_proj.weight"].shape == (6, 6)
assert "model.layers.0.self_attn.indexer.wk.weight" not in out
assert "model.layers.0.self_attn.indexer.weights_proj.weight" not in out
assert "model.layers.0.mlp.gate_up_proj.weight" in out
assert out["model.layers.0.mlp.gate_up_proj.weight"].shape == (16, 6)
assert "model.layers.0.mlp.experts.w13_weight" in out
assert out["model.layers.0.mlp.experts.w13_weight"].shape == (2, 6, 6)
assert "model.layers.0.mlp.experts.w2_weight" in out
assert out["model.layers.0.mlp.experts.w2_weight"].shape == (2, 6, 3)
assert "model.layers.0.mlp.gate.weight" in out
assert "model.layers.0.mlp.gate.e_score_correction_bias" in out
def test_convert_tt_layer_to_vllm_kernel_with_fp8():
state = _build_prime_layer_state()
out = convert_tt_layer_to_vllm_kernel(state, layer_idx=0, quantize_fp8=True)
assert out["model.layers.0.self_attn.fused_qkv_a_proj.weight"].dtype == torch.float8_e4m3fn
assert out["model.layers.0.self_attn.fused_qkv_a_proj.weight_scale_inv"].dtype == torch.float32
assert out["model.layers.0.self_attn.indexer.wk_weights_proj.weight"].dtype == torch.float32
assert "model.layers.0.self_attn.indexer.wk.weight_scale_inv" not in out
assert out["model.layers.0.mlp.experts.w13_weight"].dtype == torch.float8_e4m3fn
assert out["model.layers.0.mlp.experts.w13_weight_scale_inv"].dtype == torch.float32
assert out["model.layers.0.mlp.experts.w2_weight"].dtype == torch.float8_e4m3fn
assert out["model.layers.0.mlp.experts.w2_weight_scale_inv"].dtype == torch.float32
Generated
+32 -161
View File
@@ -17,27 +17,27 @@ exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for
exclude-newer-span = "P7D"
[options.exclude-newer-package]
vllm = false
verifiers = false
harbor = "2026-08-11T00:00:00Z"
prime-traces = false
prime-pydantic-config = false
vllm-router = false
dion = false
prime-runs = false
flash-attn-3 = false
prime-tunnel = false
fastokens = false
deep-gemm = false
prime-evals = false
torchao = false
tokenspeed-mla = false
nixl-cu13 = false
deep-ep = false
prime-sandboxes = false
renderers = false
prime-kernels = false
deep-gemm = false
dion = false
fastokens = false
flash-attn-3 = false
harbor = "2026-08-11T00:00:00Z"
nixl-cu13 = false
prime = false
prime-evals = false
prime-kernels = false
prime-pydantic-config = false
prime-runs = false
prime-sandboxes = false
prime-traces = false
prime-tunnel = false
renderers = false
tokenspeed-mla = false
torchao = false
verifiers = false
vllm = false
vllm-router = false
[manifest]
members = [
@@ -2069,12 +2069,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", hash = "sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", size = 62794, upload-time = "2025-01-02T07:20:43.624Z" },
]
[[package]]
name = "gitignore-parser"
version = "0.1.13"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/e5/51/e391a1a4238f18d0abb47be479b07af265ad4519022cf51b7da47ef82487/gitignore_parser-0.1.13.tar.gz", hash = "sha256:c7e10c8190accb8ae57fb3711889e73a9c0dbc04d4222b91ace8a4bf64d2f746", size = 5603, upload-time = "2025-08-25T06:33:22.704Z" }
[[package]]
name = "gitpython"
version = "3.1.50"
@@ -3142,18 +3136,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/e9/61/f75cd1fa54d8434276126034aed54dd120747de9a8fa013cdd79545ccbeb/latex2sympy2_extended-1.11.0-py3-none-any.whl", hash = "sha256:aebb77d52ce269e25028e4bea89ddb14d242ba36bcf7b636496fb5fd9728d234", size = 209050, upload-time = "2026-01-10T01:43:19.458Z" },
]
[[package]]
name = "linkify-it-py"
version = "2.1.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "uc-micro-py" },
]
sdist = { url = "https://files.pythonhosted.org/packages/2e/c9/06ea13676ef354f0af6169587ae292d3e2406e212876a413bf9eece4eb23/linkify_it_py-2.1.0.tar.gz", hash = "sha256:43360231720999c10e9328dc3691160e27a718e280673d444c38d7d3aaa3b98b", size = 29158, upload-time = "2026-03-01T07:48:47.683Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/b4/de/88b3be5c31b22333b3ca2f6ff1de4e863d8fe45aaea7485f591970ec1d3e/linkify_it_py-2.1.0-py3-none-any.whl", hash = "sha256:0d252c1594ecba2ecedc444053db5d3a9b7ec1b0dd929c8f1d74dce89f86c05e", size = 19878, upload-time = "2026-03-01T07:48:46.098Z" },
]
[[package]]
name = "litellm"
version = "1.95.0"
@@ -3349,11 +3331,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" },
]
[package.optional-dependencies]
linkify = [
{ name = "linkify-it-py" },
]
[[package]]
name = "markupsafe"
version = "3.0.3"
@@ -3502,18 +3479,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/f5/4c/c78d78c3d52b0ac594ad7cc8ef5972adfe070e3597a8a4c6ce0cd39196ea/mcp_types-2.0.0-py3-none-any.whl", hash = "sha256:6b2de797ca2797f568b79529e1b25948e34de511bcc0bd82fef1039a6d1b8eb0", size = 69649, upload-time = "2026-07-28T13:45:30.713Z" },
]
[[package]]
name = "mdit-py-plugins"
version = "0.6.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "markdown-it-py" },
]
sdist = { url = "https://files.pythonhosted.org/packages/59/fc/f8d0863f8862f25602c0404d75568e89fb6b4109804645e5cdfb1be5cf56/mdit_py_plugins-0.6.1.tar.gz", hash = "sha256:a2bca0f039f39dbd35fb74ae1b5f998608c437463371f0ff7f49a19a17a114d0", size = 56114, upload-time = "2026-05-13T09:03:38.91Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a5/69/6da5581c6a7fede7dc261bf4e67d6adca4196f176b43288b55b3db395b6e/mdit_py_plugins-0.6.1-py3-none-any.whl", hash = "sha256:214c82fb2ac524472ab6a5bcab1de80f73b50443e187f401bfd77efbc7c6481d", size = 66663, upload-time = "2026-05-13T09:03:37.76Z" },
]
[[package]]
name = "mdurl"
version = "0.1.2"
@@ -4886,47 +4851,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/e6/88/bdb244e40284ded3632a9f88c23bc80230bd7b2ae4a8b7f2cc91adead7a8/preshed-3.0.13-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2e77bed56aded7cbe5d28d6bd2178bc5b13eda0e0e464dab205fb578fa915000", size = 1919236, upload-time = "2026-03-23T08:56:42.616Z" },
]
[[package]]
name = "prime"
version = "0.6.19"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "build" },
{ name = "cryptography" },
{ name = "gitignore-parser" },
{ name = "httpx" },
{ name = "prime-evals" },
{ name = "prime-sandboxes" },
{ name = "prime-tunnel" },
{ name = "pydantic" },
{ name = "pyyaml" },
{ name = "rich" },
{ name = "textual" },
{ name = "textual-plot" },
{ name = "toml" },
{ name = "tomli" },
{ name = "typer" },
{ name = "verifiers" },
]
sdist = { url = "https://files.pythonhosted.org/packages/54/01/d355265be49ec5bd5ce602791e572e266c315ba9087c1a9e77911781a99d/prime-0.6.19.tar.gz", hash = "sha256:cbf33d5050e3795373842b9b89be0ee2b11a9ae9bbdcda080272eb0d982276c2", size = 711104, upload-time = "2026-07-17T17:41:09.283Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/5e/ad/67705b41b441513cc09de0a6134b8584d436efba8bc8b4ddeb4a3bbca768/prime-0.6.19-py3-none-any.whl", hash = "sha256:c2a4ee9252cd1a54fa6bcec2958a09ad4374077c68d461071d1ca699a9f4dda2", size = 473362, upload-time = "2026-07-17T17:41:07.35Z" },
]
[[package]]
name = "prime-evals"
version = "0.2.3"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "httpx" },
{ name = "pydantic" },
{ name = "tenacity" },
]
sdist = { url = "https://files.pythonhosted.org/packages/1b/e6/8c84619b09ecfb9484ba9b14bf57de3e9417a08e0b3695bd054b181efca8/prime_evals-0.2.3.tar.gz", hash = "sha256:4b22f9057a8765c85f2e91c795d78e48015ae6d30439f24aea9e8396b2c3f016", size = 14417, upload-time = "2026-06-05T00:39:56.145Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e9/f8/41c4a4bc7a03ece28b1c4f39d45a5c362ebaa0895a161db83c591f10e6b6/prime_evals-0.2.3-py3-none-any.whl", hash = "sha256:e5217f36d360baedf2c10dd49abe7be504932bf8249a35c9f7abad12d0c0299a", size = 13575, upload-time = "2026-06-05T00:39:54.901Z" },
]
[[package]]
name = "prime-kernels"
version = "0.1.0+cu130torch2.13.0"
@@ -5006,10 +4930,10 @@ dependencies = [
{ name = "openai" },
{ name = "orjson" },
{ name = "pandas" },
{ name = "prime" },
{ name = "prime-pydantic-config" },
{ name = "prime-rl-configs" },
{ name = "prime-runs", extra = ["train"] },
{ name = "prime-sandboxes" },
{ name = "prometheus-client" },
{ name = "psutil" },
{ name = "pyarrow" },
@@ -5165,7 +5089,6 @@ requires-dist = [
{ name = "orjson", specifier = ">=3.10" },
{ name = "orjson", specifier = ">=3.11.0" },
{ name = "pandas", specifier = ">=2.0" },
{ name = "prime", specifier = ">=0.6.19" },
{ name = "prime-kernels", marker = "platform_machine == 'aarch64' and sys_platform == 'linux' and extra == 'kernels'", url = "https://github.com/PrimeIntellect-ai/prime-kernels/releases/download/v0.1.1/prime_kernels-0.1.0+cu130torch2.13.0-cp312-cp312-linux_aarch64.whl" },
{ name = "prime-kernels", marker = "platform_machine != 'aarch64' and platform_machine != 'x86_64' and sys_platform == 'linux' and extra == 'kernels'" },
{ name = "prime-kernels", marker = "platform_machine == 'x86_64' and sys_platform == 'linux' and extra == 'kernels'", url = "https://github.com/PrimeIntellect-ai/prime-kernels/releases/download/v0.1.1/prime_kernels-0.1.0+cu130torch2.13.0-cp312-cp312-linux_x86_64.whl" },
@@ -5178,6 +5101,7 @@ requires-dist = [
{ name = "prime-rl", extras = ["quack"], marker = "extra == 'all'" },
{ name = "prime-rl-configs", editable = "packages/prime-rl-configs" },
{ name = "prime-runs", extras = ["train"], specifier = ">=0.1.3" },
{ name = "prime-sandboxes", specifier = ">=0.3.0" },
{ name = "prometheus-client", specifier = ">=0.20.0" },
{ name = "psutil", specifier = ">=7.0.0" },
{ name = "pyarrow", specifier = ">=21.0.0" },
@@ -5269,7 +5193,7 @@ train = [
[[package]]
name = "prime-sandboxes"
version = "0.2.39"
version = "0.3.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "aiofiles" },
@@ -5281,36 +5205,36 @@ dependencies = [
{ name = "pyqwest" },
{ name = "tenacity" },
]
sdist = { url = "https://files.pythonhosted.org/packages/59/8c/0bf89180addb74f75e41fbf6fa06c5401ea802b69ec0b565330562270be2/prime_sandboxes-0.2.39.tar.gz", hash = "sha256:7ff6c23aa2c96985a9129d977d532c0ae2fb6afb6d394dac746393ce0c53b597", size = 103161, upload-time = "2026-08-19T23:09:27.921Z" }
sdist = { url = "https://files.pythonhosted.org/packages/b6/46/2d118d8bbb901b729f3bc0678725eb28088d757a872db04cffa1492d0208/prime_sandboxes-0.3.0.tar.gz", hash = "sha256:c99075ed82a9bbfe5a453cee84b9f09565a7f6b07fd5ace072401cce59a1fe08", size = 132759, upload-time = "2026-09-18T01:32:31.263Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/db/a5/8a2a1aefecfc58ca926d6b21e8302a127884bf2a45952ed390b5f702eeda/prime_sandboxes-0.2.39-py3-none-any.whl", hash = "sha256:3ea355158473c1697f9ef6ec2a07f3189e9a2555c80d1c88e1f7e22979772e0a", size = 58161, upload-time = "2026-08-19T23:09:26.69Z" },
{ url = "https://files.pythonhosted.org/packages/5f/04/c77c7f260babf93978f912b85511e76f63a3cfa5bb11a8c34108177d5825/prime_sandboxes-0.3.0-py3-none-any.whl", hash = "sha256:19078ff508fa72de8f565422918faf367e2831ed8a2f26a5a6a98110e4062941", size = 71441, upload-time = "2026-09-18T01:32:30.062Z" },
]
[[package]]
name = "prime-traces"
version = "0.0.3"
version = "0.0.4"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "httpx" },
{ name = "pydantic" },
]
sdist = { url = "https://files.pythonhosted.org/packages/8c/77/13fa99c0fb71909f2f35d048d9724efb9ae432484e47f12386b1542815e8/prime_traces-0.0.3.tar.gz", hash = "sha256:4071833db77a606ccbb718e5c73f2dfaf63982fe801aa096daed0bc605da554f", size = 50874, upload-time = "2026-08-27T19:46:44.672Z" }
sdist = { url = "https://files.pythonhosted.org/packages/5f/5d/d3646fb34d4f3cf4caf2064eb3830c4da5c18a3ecd3292ce9e85eb04398f/prime_traces-0.0.4.tar.gz", hash = "sha256:713b59984292304bd4e99a55998b7d69373f22b5205a7e097ef0d0d8e531561c", size = 50935, upload-time = "2026-09-04T16:51:10.488Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ce/9a/5a917de29a3a839c0ba36d445e3af562f744d9716b509571be643a01476c/prime_traces-0.0.3-py3-none-any.whl", hash = "sha256:0838f60651f1ed38371e383bd88b954e461d20ac424874e694bc83358934f5f3", size = 38345, upload-time = "2026-08-27T19:46:43.396Z" },
{ url = "https://files.pythonhosted.org/packages/b6/55/de30cc732631522f5f12cb590b63b80cb1c6ca004ad81762d94ee7dda256/prime_traces-0.0.4-py3-none-any.whl", hash = "sha256:68f2b527d266f9c3d02f6c86a1713309a58a61b81e1be6be43948e1dd2456d8f", size = 38409, upload-time = "2026-09-04T16:51:09.201Z" },
]
[[package]]
name = "prime-tunnel"
version = "0.1.10"
version = "0.1.11"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "httpx" },
{ name = "pydantic" },
{ name = "tenacity" },
]
sdist = { url = "https://files.pythonhosted.org/packages/bf/26/7324b5b9ec117c21fc9320214bf04ecbe9144ee87ef48c7d6d6c3e3d3f7f/prime_tunnel-0.1.10.tar.gz", hash = "sha256:8bf575af659bcc107a98b0b5ec1ba3e958ea72ead535ced03c443134a1ad07ea", size = 15305, upload-time = "2026-06-17T00:01:02.392Z" }
sdist = { url = "https://files.pythonhosted.org/packages/de/c7/55c21d8e1abfb66d3a0dc0e25b89abb506b0a49605fb4b0040590af82136/prime_tunnel-0.1.11.tar.gz", hash = "sha256:cd93e78824ef824b45e636f5f506898bc7f9a6c913fd5095ab1df2233a49b949", size = 15889, upload-time = "2026-09-04T17:09:25.258Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a9/b9/d767b4f6c7ce72b54aaba834b97f97c3c494f1865a37f8b5b9acfb1b2a68/prime_tunnel-0.1.10-py3-none-any.whl", hash = "sha256:6a1cb49a14cfc9622db5cae90665ebe7e7e8cd5d84e963e8c3572bce85288400", size = 16319, upload-time = "2026-06-17T00:01:01.095Z" },
{ url = "https://files.pythonhosted.org/packages/d0/7f/6ea38563db9414ed208758de6e8dc557b20e245787e42568f89531fc6717/prime_tunnel-0.1.11-py3-none-any.whl", hash = "sha256:19c5e02e389e5e61fff1507f07c46db9b05ad01424ff3b6a0cbe66187c957f61", size = 16676, upload-time = "2026-09-04T17:09:24.157Z" },
]
[[package]]
@@ -7042,50 +6966,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/26/b4/9a9ba65154aff853c75b3d7324319d168ad9c69c6097f4aa3c16da7d9ef3/textarena-0.7.4-py3-none-any.whl", hash = "sha256:684784e78278e518066f67557ee93b47c238d16cbbd15d3abdaa3147562d3024", size = 1073570, upload-time = "2025-10-16T14:41:53.965Z" },
]
[[package]]
name = "textual"
version = "8.2.7"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "markdown-it-py", extra = ["linkify"] },
{ name = "mdit-py-plugins" },
{ name = "platformdirs" },
{ name = "pygments" },
{ name = "rich" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/9b/7a/c519db0aba5024f86e71e9631810bfdd6866ed2c8695bd7fa34b90e7ef59/textual-8.2.7.tar.gz", hash = "sha256:658f568ff81e30ed43890c3e07520390e5cf1b4763822006e060656b0a88f105", size = 1859249, upload-time = "2026-05-19T10:52:49.531Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a8/f5/c1e18bc0707300a0e90204343abbf7d7acd6fb7ebe03a6d4893b99a234b8/textual-8.2.7-py3-none-any.whl", hash = "sha256:4caaa13a90bc4cf9c6c862c067ccd34fe84e9c161710a2a907a8026313b6bd73", size = 731129, upload-time = "2026-05-19T10:52:51.773Z" },
]
[[package]]
name = "textual-hires-canvas"
version = "0.14.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "numpy" },
{ name = "textual" },
]
sdist = { url = "https://files.pythonhosted.org/packages/20/f0/13f2a30ab7950cc3d5d5a2c893fbe3d40b4d129fd2cd30313260181578c4/textual_hires_canvas-0.14.0.tar.gz", hash = "sha256:0fa512492ddd2cd6c2a970a6beea58f5350f4cf25f40ad14ffd9fa86c6458769", size = 1251440, upload-time = "2026-01-10T22:16:56.708Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/85/ea/e7e6d0f749395d61ca2ab8cda2f3c4e6613800b6b0d0b21f9d1d180c4d42/textual_hires_canvas-0.14.0-py3-none-any.whl", hash = "sha256:8cd67d656387220684449e837dd5809b6c00c5dfee8e4b494414b5837cb5a804", size = 19825, upload-time = "2026-01-10T22:16:54.69Z" },
]
[[package]]
name = "textual-plot"
version = "0.10.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "numpy" },
{ name = "textual" },
{ name = "textual-hires-canvas" },
]
sdist = { url = "https://files.pythonhosted.org/packages/a0/c2/13f9f747e83cd0b740d1bf310e89a006316cfb5acb4e5a4136c12f96340b/textual_plot-0.10.1.tar.gz", hash = "sha256:503db96d849134293228419324eb15efbadf1f1927a2e0a229b54e7a7e5d5292", size = 2451096, upload-time = "2026-02-01T13:27:43.658Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/2a/36/75eba496995e6f9a001cd601972eab753203167dfcccfbf1816e3959d28d/textual_plot-0.10.1-py3-none-any.whl", hash = "sha256:74ff3a8b2d84bd71b3a9abbac95139ff952f190e6bac60c7091911c63a1863ba", size = 50409, upload-time = "2026-02-01T13:27:41.013Z" },
]
[[package]]
name = "thinc"
version = "8.3.13"
@@ -7677,15 +7557,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/93/4f/c43a0a8f0c66fd40a1d6cc47332a5a1d1043e9b331f7070ea701b91a7598/tyro-1.0.13-py3-none-any.whl", hash = "sha256:a0bdb8462c551dd84fc00a76916ce4d37e879c84eefaf34e2165312407cc6c09", size = 185221, upload-time = "2026-04-14T18:21:54.328Z" },
]
[[package]]
name = "uc-micro-py"
version = "2.0.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/78/67/9a363818028526e2d4579334460df777115bdec1bb77c08f9db88f6389f2/uc_micro_py-2.0.0.tar.gz", hash = "sha256:c53691e495c8db60e16ffc4861a35469b0ba0821fe409a8a7a0a71864d33a811", size = 6611, upload-time = "2026-03-01T06:31:27.526Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/61/73/d21edf5b204d1467e06500080a50f79d49ef2b997c79123a536d4a17d97c/uc_micro_py-2.0.0-py3-none-any.whl", hash = "sha256:3603a3859af53e5a39bc7677713c78ea6589ff188d70f4fee165db88e22b242c", size = 6383, upload-time = "2026-03-01T06:31:26.257Z" },
]
[[package]]
name = "unidiff"
version = "0.7.5"
@@ -7837,8 +7708,8 @@ requires-dist = [
{ name = "openai", specifier = ">=2.54.0,<3.0.0" },
{ name = "openenv", marker = "extra == 'openenv'", specifier = ">=0.4.1" },
{ name = "prime-pydantic-config", extras = ["toml"], specifier = ">=0.4.3" },
{ name = "prime-runs", specifier = ">=0.1.2" },
{ name = "prime-sandboxes", specifier = ">=0.2.39" },
{ name = "prime-runs", specifier = ">=0.1.3" },
{ name = "prime-sandboxes", specifier = ">=0.3.0" },
{ name = "prime-tunnel", specifier = ">=0.1.8" },
{ name = "pydantic", specifier = ">=2.12.3" },
{ name = "pyzmq", specifier = ">=27.1.0" },