chore: overhaul public configs/ and examples/ (#3085)

* chore: overhaul public configs/ and examples/

Restructure the public configs/ and examples/ trees for clarity.

- examples/: split into basic/ (core-env tutorials) and advanced/
  (folder-per-model: qwen3-30b-a3b, glm-4.5-air, glm-5.2, minimax-m2.5,
  nemotron-3-super, intellect-3.1), each with a README; drop multinode/
  and the example screenshots.
- configs/: add basic/ (small 2-GPU dev mirrors of the core envs, one folder
  + README each, validated at 1 step); rename debug/algorithms -> debug/algo;
  move debug/{rl,sft} -> debug/fake/{rl,sft}.toml; remove stale/internal
  configs (gsm8k, nemotron_*, hendrycks_math, general_agent, elastic,
  debug/v1, debug/{infer,orch,multimodal}.toml, debug/{hendrycks_sanity,moe,multi_env}).
- Remove the k8s/ Helm chart and its docs.
- Repoint README, docs/, nightly tests, and CI to the new paths; lowercase
  prime-rl throughout docs and READMEs.

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

* chore: drop per-model READMEs in examples/advanced

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

* chore(k8s): keep Helm chart, refresh reverse-text example configs

Keep the k8s/ Helm chart (undo its removal earlier in this branch) and bring
its reverse-text example back in sync with the current config layout.

The chart invoked examples/reverse_text/rl/{orch,infer,train}.toml — a split
config layout flattened into a single rl.toml months ago (#1859), so the
shipped example had pointed at non-existent files. Add current, validated
orch/infer/train configs under k8s/prime-rl/examples/reverse-text/ (split from
examples/basic/reverse_text/rl.toml), point the chart and docs at them, and
COPY k8s/ into the CUDA image so /app/k8s/... resolves at runtime.

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

* chore(configs): hyphenate all directory names in configs/, examples/, k8s/

Normalize directory naming to hyphens, matching the model dirs and logical
ids (reverse-text-v1, prime-rl). Renames the env/task dirs that still used
underscores:

  examples/basic/{reverse_text,alphabet_sort,wiki_search,hendrycks_sanity}
  configs/basic/{reverse_text,alphabet_sort,wiki_search,hendrycks_sanity}
  configs/ci/integration/reverse_text{,_lora,_moe,_multi_run,_rl_opd,_rl_sft,_sft,_sft_lora}

to the same names with hyphens, and updates every path reference (README,
docs, skills, nightly + integration test path args, the cpu_tests
config-import check). Python test files/modules and *.toml filenames keep
underscores.

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

* chore(examples): eval CLI migration, SLURM cleanup, batch sizes, glm-5.2 layout

- Migrate every eval command in examples/basic READMEs from `vf-eval` to the v1
  `eval` CLI (pydantic-config): `-b` -> `--client.base-url`, `--max-tokens`/`-t`
  -> `--sampling.max-tokens`, `--env-args` -> `--args`, plus `-r 3` (v1 defaults
  to 1 rollout; these READMEs report 20x3), `--harness.id null` (these envs train
  with the null harness), and `--no-push`. Drop the now-dead vf-eval skip in
  tests/unit/test_configs.py.
- Remove all SLURM overlays (slurm_rl.toml, slurm_sft.toml) from examples/basic.
  Move the slim-wheel SFT+[slurm] parse fixture to configs/ci/slim_sft.toml and
  repoint cpu_tests.yaml; drop the SLURM section from the hendrycks-sanity README
  and the SLURM line from the start-run skill.
- Tune basic example batch/group sizes: alphabet-sort 256/16, wordle 512/16
  (wiki-search already 512/16).
- Restructure examples/advanced/glm-5.2: inference configs ->
  infer/{pd,pd-llmd}.toml, RL configs -> {swe,swe-llmd}.toml; repoint docs.

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

* docs: fix outdated docs/skills/configs surfaced by v1 audit

Swept docs/, skills/, READMEs, and config TOMLs for outdated content (special
focus on v0->v1 drift). Verified every fix against current code.

docs/
- configuration.md: repoint 5 dead Basic example links to examples/basic/<hyphen>;
  scope the "each dir has a README" claim to basic (advanced dirs are config-only).
- algorithms.md: opd reference-model field is `teacher` not `model`; renderer names
  `glm-5`/`glm-4.5` (were invalid `glm5`/`glm4.5`); rewrite the per-env algorithm
  example in the v1 taskset/harness form (was the v0 bare-`id` form).
- development.md: drop invalid `--data.type null` (SFT DataConfig has no such type).
- inference.md: fix "Dissagregation" typo + dead P/D anchor.
- overview.md: token-in route is `/inference/v1/generate`.

skills/
- monitor-run: correct the metric tables to the real
  {scope}/{subset}/<metric>/<stat> scheme (num_total_tokens, has_error,
  time/wait_for_policy, dispatcher/*); the old seq_len / errored_rollouts /
  scheduler/* / generate_completions names never existed.
- install: drop the deep-gemm mention (no such section) from the description.

READMEs
- examples/README.md: basic runs on 1-8 GPUs (not 2); hyphenate env names.
- configs/README.md: drop stale "standalone entrypoint configs"; hyphenate.
- wiki-search: eval inference uses `--model.*` (not `--inference.model.*`) and drops
  the auto-derived `enable_auto_tool_choice` flag; "native V1 tools" not "MCP".
- reverse-text: fix dead sft/train.toml path -> sft.toml.
- hyphenate configs/basic/* README headings.

configs/
- qwen3-30b-a3b/tool.toml: move `min_tier` into the taskset (was under a v0
  `[...env.args]` block a v1 taskset never reads); group_size alias.
- glm-5.2/swe-llmd.toml: rollouts_per_example -> group_size.

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

* fix(configs): use prime-qwen3 renderer for reverse-text (was default)

The reverse-text configs run PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT, whose
`-SFT` suffix misses MODEL_RENDERER_MAP's exact-match lookup and so fell back to
the DefaultRenderer. reverse-text is single-turn and always sends a system
prompt ([system, user, assistant]); the prime-qwen3 renderer is token-for-token
identical to the model's apply_chat_template for that shape (verified via
render_ids parity), and unlike the stock qwen3 renderer it does not inject an
empty <think></think> block. Switch the 7 standard + 3 distill reverse-text
configs to prime-qwen3.

Kept `default` where no hand-coded renderer fits (each errors on the model's
tokenizer): hendrycks-sanity (DeepSeek-R1-Distill-Qwen-1.5B), reverse-text-moe
(samsja/mini-glm-moe), intellect-3.1 (INTELLECT-3-Base).

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

* fix(configs): use prime-qwen3 (not qwen3) for PrimeIntellect Qwen3 configs

The stock `qwen3` renderer injects an empty <think></think> block the
PrimeIntellect Qwen3 template never emits, so it mismatches these models'
apply_chat_template — single-turn for reverse-text, and every multi-turn shape
for wordle (verified via render_ids parity) — corrupting training tokenization.

- configs/basic/wordle/rl.toml: qwen3 + thinking_retention="all" -> prime-qwen3,
  matching the tutorial examples/basic/wordle (which already uses prime-qwen3).
- configs/debug/algo/{echo,grpo,max_rl,self_distill,mixed_grpo_opd,opd,opd_lora}.toml
  and configs/ci/integration/reverse-text-rl-opd/start.toml: qwen3 -> prime-qwen3
  (all run PrimeIntellect/Qwen3-0.6B-Reverse-Text-{SFT,RL}).

prime-qwen3 handles the PI template's think retention natively, so the explicit
thinking_retention="all" is dropped.

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

* fix(k8s): use prime-qwen3 renderer in reverse-text orch config

The k8s reverse-text orchestrator config was split from the reverse-text example
before that example migrated to prime-qwen3, and the renderer migration was
scoped to configs/ and examples/ — so this one kept the stale `default`. Align
it with the source (PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT → prime-qwen3).

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

* chore(k8s): drop redundant renderer comment in reverse-text orch config

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

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mika Senghaas
2026-07-20 10:59:06 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 256809b2ec
commit 691dd4ef14
144 changed files with 584 additions and 1828 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ jobs:
# The slim wheel intentionally excludes taskset packages, so validate a real
# SFT config here. RL recipes are covered by the full config suite.
for cfg_cls, args in [
(SFTConfig, ["@", "examples/reverse_text/slurm_sft.toml"]),
(SFTConfig, ["@", "configs/ci/slim_sft.toml"]),
]:
cfg = cli(cfg_cls, args=args)
assert cfg.slurm is not None, f"expected [slurm] in {args}"
+1
View File
@@ -85,6 +85,7 @@ COPY packages/ /app/packages/
COPY deps/ /app/deps/
COPY configs /app/configs
COPY examples /app/examples
COPY k8s /app/k8s
COPY benchmarks/scripts /app/benchmarks/scripts
COPY scripts/docker-editable-pretend-versions.sh /app/scripts/docker-editable-pretend-versions.sh
+26 -34
View File
@@ -9,7 +9,7 @@
---
<h3 align="center">
PRIME-RL: Async RL Training at Scale
prime-rl: Async RL Training at Scale
</h3>
---
@@ -29,7 +29,7 @@ PRIME-RL: Async RL Training at Scale
## Overview
PRIME-RL is a framework for large-scale reinforcement learning. It is designed to be easy to use and hackable, yet capable of scaling to 1000+ GPUs. Here is what we think sets it apart:
prime-rl is a framework for large-scale reinforcement learning. It is designed to be easy to use and hackable, yet capable of scaling to 1000+ GPUs. Here is what we think sets it apart:
1. Fully asynchronous RL for high-throughput agentic training at scale.
2. Performant: built to train 1T+ MoE models on 1000+ GPUs with [FSDP2](https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html) for training and [vLLM](https://github.com/vllm-project/vllm) for inference, with FP8 inference, PD disaggregation, EP and CP parallelism, and more.
@@ -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/glm5_llmd/README.md).
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/).
## Models support
@@ -53,7 +53,7 @@ With `[model] impl = "auto"` (the default), the trainer selects that custom stac
| GLM-5 (`glm_moe_dsa`) | `zai-org/GLM-5`, `zai-org/GLM-5-FP8` | yes | ✅ | ✅ |
| Qwen3 MoE (`qwen3_moe`) | `Qwen/Qwen3-30B-A3B`, … | yes | ✅ | ✅ |
| Qwen3.5 MoE (`qwen3_5_moe`) | `Qwen/Qwen3.5-35B-A3B`, … | yes | ✅ | ✅ |
| Qwen3 / Qwen3.5 VLMs | see [advanced.md](docs/advanced.md#vision-language-models) (`qwen3_vl`, `qwen3_5`, `qwen3_5_moe`) | MoE only on MoE VLMs | MoE only | ✅ |
| Qwen3 / Qwen3.5 VLMs | see [advanced.md](docs/advanced.md#multimodal-training) (`qwen3_vl`, `qwen3_5`, `qwen3_5_moe`) | MoE only on MoE VLMs | MoE only | ✅ |
| Poolside Laguna (`laguna`) | `poolside/Laguna-XS.2` | yes | ✅ | ✅ |
| MiniMax M2 (`minimax_m2`) | `MiniMax/MiniMax-M2` | yes | ✅ | ✅ |
| Nemotron H (`nemotron_h`) | `nvidia/Nemotron-3-Nano-30B-A3B`, `nvidia/Nemotron-3-Super-120B-A12B`, … | yes | ✅ | ✅ |
@@ -69,11 +69,11 @@ With `[model] impl = "auto"` (the default), the trainer selects that custom stac
### Prerequisites
Currently, you **need at least one NVIDIA GPU to use PRIME-RL**. If you don't already have access to one, we recommend our [compute platform](https://app.primeintellect.ai) for everything from renting on-demand single GPUs for developing, debugging and small ablations, to [reserving 1000+ GPU clusters](https://app.primeintellect.ai/dashboard/quotes) for production-scale training.
Currently, you **need at least one NVIDIA GPU to use prime-rl**. If you don't already have access to one, we recommend our [compute platform](https://app.primeintellect.ai) for everything from renting on-demand single GPUs for developing, debugging and small ablations, to [reserving 1000+ GPU clusters](https://app.primeintellect.ai/dashboard/quotes) for production-scale training.
### Quick Setup
Set up PRIME-RL in a single command.
Set up prime-rl in a single command.
```bash
curl -sSL https://raw.githubusercontent.com/PrimeIntellect-ai/prime-rl/main/scripts/install.sh | bash
@@ -154,33 +154,25 @@ uv run python -c "import flash_attn"
3. Check that you can run SFT trainer (*this requires 1 GPU*)
```bash
uv run sft @ configs/debug/sft/train.toml
uv run sft @ configs/debug/fake/sft.toml
```
4. Check that you can run the RL trainer (*this requires 1 GPU*)
```bash
uv run trainer @ configs/debug/rl/train.toml
uv run trainer @ configs/debug/fake/rl.toml
```
5. Check that you can run the inference server (*this requires 1 GPU*)
```bash
uv run inference @ configs/debug/infer.toml
uv run inference --model.name Qwen/Qwen3-0.6B
```
*Keep the inference server running in the background for the next steps.*
5.1. Check that you can run the orchestrator against the inference server
6. Check that the full RL stack (inference + orchestrator + trainer) runs end-to-end (*this requires 2 GPUs*)
```bash
uv run orchestrator @ configs/debug/orch.toml
```
5.2. Check that you can run evals against the inference server
```bash
uv run eval @ configs/debug/eval.toml
uv run rl @ configs/basic/reverse-text/rl.toml
```
</details>
@@ -206,29 +198,29 @@ We provide end-to-end training examples in the [`examples`](examples) directory
### Basic Training: 1 to 8 GPUs
Follow this guide to learn the basics of Prime-RL. You can train your own models on 1 to 8 GPUs. Ideal for getting started and exploring the capabilities of the framework. These guides cover most use cases -- single-turn, multi-turn, tool calling, etc. -- on toy environments and small models.
Follow this guide to learn the basics of prime-rl. You can train your own models on 1 to 8 GPUs. Ideal for getting started and exploring the capabilities of the framework. These guides cover most use cases -- single-turn, multi-turn, tool calling, etc. -- on toy environments and small models.
1. [**Reverse Text**](examples/reverse_text/README.md): Train `Qwen3-0.6B` to reverse a small chunk of text. Demonstrates tiny-scale single-turn SFT and RL training. Can be trained on a single consumer GPU in a few minutes, and is ideal for getting started.
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.
1. [**Reverse Text**](examples/basic/reverse-text/README.md): Train `Qwen3-0.6B` to reverse a small chunk of text. Demonstrates tiny-scale single-turn SFT and RL training. Can be trained on a single consumer GPU in a few minutes, and is ideal for getting started.
2. [**Wordle**](examples/basic/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/basic/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/basic/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/basic/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.
### Advanced Training: 32 - 2048 GPUs:
Follow this guide to train large models on hard reasoning and agentic / swe environments.
Follow this guide to train large models on hard reasoning and agentic tasks.
These guides are designed to be run from a Slurm cluster but can also be adapted to k8s deployments.
1. [**Qwen 3 30B - A3B Math**](examples/qwen30b_math/README.md): Train `Qwen3-30B-A3B` to solve hard math problems.
2. [**Qwen 3 30B - A3B SWE**](examples/qwen30b_swe/README.md): Train `Qwen3-30B-A3B` to solve hard SWE problems.
3. [**Intellect-3.1**](examples/Intellect-3.1/README.md): Reproduce our `INTELLECT-3.1` training run.
4. [**MiniMax-M2.5 SWE**](examples/minimax_m2.5_swe/README.md): Train `MiniMax-M2.5` on agentic SWE tasks.
5. [**High-throughput GLM-5**](examples/glm5_pd_disag/README.md): Train `GLM-5` with PD disaggregation and FP8 inference on SWE.
6. [**High-throughput GLM-5 (llm-d)**](examples/glm5_llmd/README.md): One-line SLURM deployment for `GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload — the faster way to run `GLM-5`.
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. [**Nemotron-3-Super**](examples/advanced/nemotron-3-super/): Train the `Nemotron-3-Super-120B` hybrid-Mamba MoE on SWE at 131k context.
4. [**MiniMax-M2.5 SWE**](examples/advanced/minimax-m2.5/): Train `MiniMax-M2.5` on agentic SWE tasks.
5. [**INTELLECT-3.1**](examples/advanced/intellect-3.1/): Reproduce our `INTELLECT-3.1` training run.
6. [**High-throughput GLM-5**](examples/advanced/glm-5.2/): Large-scale `GLM-5`/`GLM-5.2` inference with P/D disaggregation, the `llm-d` router, and FP8.
## Docs
Check out the [docs](docs) directory for in-depth guides on how to use PRIME-RL.
Check out the [docs](docs) directory for in-depth guides on how to use prime-rl.
- [**Overview**](docs/overview.md) - Architecture, install, and a copy-pasteable end-to-end RL run
- [**Configuration**](docs/configuration.md) - TOML composition, CLI overrides, env vars, validation
@@ -276,7 +268,7 @@ If you find our work useful, feel free to cite it using
```tex
@misc{primeintellect2025prime-rl,
author = {Prime Intellect},
title = {PRIME-RL},
title = {prime-rl},
url = {https://github.com/PrimeIntellect-ai/prime-rl},
year = {2025}
}
+15 -1
View File
@@ -1,3 +1,17 @@
# Configs
This directory contains configurations for internal experiments. We do not guarantee that these configurations are functional or up-to-date.
Configurations for running prime-rl.
- **[`basic/`](basic)** — small, 2-GPU (1 trainer + 1 inference) configs for the core
environments, sized to run on a single dev machine. Each mirrors the matching
[`examples/basic/`](../examples/basic) tutorial and is smoke-tested for one step.
Envs: `reverse-text`, `alphabet-sort`, `wiki-search`, `wordle`, `hendrycks-sanity`.
- **`ci/`** — integration and nightly configs used by CI.
- **`debug/`** — throwaway configs for developing the framework itself: `algo/`
(per-algorithm smokes) and `fake/` (fake-data trainer/SFT smokes). Not guaranteed
functional or up to date.
```bash
uv run rl @ configs/basic/<env>/rl.toml
uv run sft @ configs/basic/<env>/sft.toml # where present
```
-36
View File
@@ -1,36 +0,0 @@
max_steps = 100
seq_len = 2048
[wandb]
project = "alphabet-sort-debug"
name = "alphabet-sort"
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
[orchestrator]
batch_size = 512
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 512
[[orchestrator.train.env]]
name = "alphabet-sort"
taskset = { id = "alphabet-sort-v1", min_turns = 2, max_turns = 2 }
harness = { id = "null", runtime = { type = "subprocess" } }
[orchestrator.eval]
interval = 50
[[orchestrator.eval.env]]
name = "alphabet-sort"
num_examples = 50
group_size = 4
taskset = { id = "alphabet-sort-v1", min_turns = 2, max_turns = 2 }
harness = { id = "null", runtime = { type = "subprocess" } }
[trainer]
[inference]
+8
View File
@@ -0,0 +1,8 @@
# alphabet-sort (2 GPU)
Multi-turn task driven by a colocated user simulator, LoRA on `Qwen3-4B`. Dev mirror of
[`examples/basic/alphabet-sort`](../../../examples/basic/alphabet-sort).
```bash
uv run rl @ configs/basic/alphabet-sort/rl.toml
```
@@ -1,11 +1,12 @@
# v1 port of examples/alphabet_sort/rl.toml — identical except the env block, which loads
# the v1 `alphabet-sort-v1` taskset (multi-turn via a colocated vf.User) instead of the v0
# `primeintellect/alphabet-sort` env. Harness runs on the subprocess runtime.
# Alphabet-sort on 2 GPUs (1 trainer + 1 inference) — a multi-turn task driven by a colocated
# user simulator, trained with LoRA on Qwen3-4B. Dev-sized mirror of examples/basic/alphabet-sort.
max_steps = 200
seq_len = 2048
[ckpt] # Checkpoint at the end of training
[deployment]
num_train_gpus = 1
num_infer_gpus = 1
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
@@ -14,9 +15,6 @@ name = "Qwen/Qwen3-4B-Instruct-2507"
project = "alphabet-sort"
name = "alphabet-sort"
[trainer.model]
impl = "auto"
[trainer.model.ac]
freq = 1
@@ -28,7 +26,7 @@ alpha = 64
lr = 1e-5
[orchestrator]
batch_size = 512
batch_size = 128
group_size = 8
[orchestrator.train.sampling]
@@ -39,4 +37,6 @@ name = "alphabet-sort"
taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
harness = { id = "null", runtime = { type = "subprocess" } }
[inference] # Default inference config
[ckpt] # Checkpoint at the end of training
[inference]
+9
View File
@@ -0,0 +1,9 @@
# hendrycks-sanity (2 GPU)
Single-turn math sanity run (reward climbs slowly, meant to run long),
`DeepSeek-R1-Distill-Qwen-1.5B`. Dev mirror of
[`examples/basic/hendrycks-sanity`](../../../examples/basic/hendrycks-sanity).
```bash
uv run rl @ configs/basic/hendrycks-sanity/rl.toml
```
@@ -1,40 +1,34 @@
max_steps = 3000
seq_len = 4096
# Hendrycks-math sanity on 2 GPUs (1 trainer + 1 inference) — a single-turn math env meant to
# run long (reward climbs slowly). Dev-sized mirror of examples/basic/hendrycks-sanity.
[wandb]
project = "hendrycks-math-debug"
name = "hendrycks-math-sanity"
max_steps = 5000
[deployment]
num_train_gpus = 1
num_infer_gpus = 1
[model]
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
[wandb]
project = "hendrycks-sanity"
name = "hendrycks-sanity"
[orchestrator]
batch_size = 256
max_inflight_rollouts = 512
batch_size = 128
group_size = 8
seq_len = 8192
[[orchestrator.train.env]]
name = "hendrycks-math"
taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
harness = { id = "null", runtime = { type = "subprocess" } }
[orchestrator.eval]
interval = 50
[[orchestrator.eval.env]]
name = "aime2024"
taskset = { id = "aime24-v1" }
group_size = 16
[trainer.model.ac]
[trainer.model.compile]
[trainer.model]
seq_len = 16384
[inference.model]
max_model_len = 4096
[log]
level = "debug"
max_model_len = 8192
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
[orchestrator.renderer]
+9
View File
@@ -0,0 +1,9 @@
# reverse-text (2 GPU)
Smallest end-to-end RL loop — single-turn, `Qwen3-0.6B`. Dev mirror of
[`examples/basic/reverse-text`](../../../examples/basic/reverse-text).
```bash
uv run sft @ configs/basic/reverse-text/sft.toml # optional warmup
uv run rl @ configs/basic/reverse-text/rl.toml
```
+40
View File
@@ -0,0 +1,40 @@
# Reverse-text on 2 GPUs (1 trainer + 1 inference) — the smallest end-to-end RL loop
# (single-turn, 0.6B). Dev-sized mirror of examples/basic/reverse-text.
max_steps = 20
seq_len = 2048
[deployment]
num_train_gpus = 1
num_infer_gpus = 1
[model]
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
[wandb]
project = "reverse-text"
name = "reverse-text"
[orchestrator]
batch_size = 128
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 128
[[orchestrator.train.env]]
name = "reverse-text"
taskset = { id = "reverse-text-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
[trainer.optim]
lr = 3e-6
[ckpt] # Checkpoint at the end of training
[inference]
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[orchestrator.renderer]
name = "prime-qwen3"
+19
View File
@@ -0,0 +1,19 @@
# SFT warmup for reverse-text on 2 GPUs. Dev-sized mirror of examples/basic/reverse-text/sft.toml.
max_steps = 100
[deployment]
num_gpus = 2
[ckpt] # Checkpoint at the end of training
[model]
name = "PrimeIntellect/Qwen3-0.6B"
[data]
name = "willcb/R1-reverse-wikipedia-paragraphs-v1-1000"
seq_len = 4096
batch_size = 32
[optim]
lr = 2e-5
+8
View File
@@ -0,0 +1,8 @@
# wiki-search (2 GPU)
Multi-turn tool calling (search a wiki corpus via native V1 tools), LoRA on `Qwen3-4B`. Dev mirror
of [`examples/basic/wiki-search`](../../../examples/basic/wiki-search).
```bash
uv run rl @ configs/basic/wiki-search/rl.toml
```
@@ -1,12 +1,20 @@
max_steps = 500
# Wiki-search on 2 GPUs (1 trainer + 1 inference) — a multi-turn tool-calling task (the model
# searches a wiki corpus via MCP tools), trained with LoRA on Qwen3-4B. Dev-sized mirror of
# examples/basic/wiki-search.
max_steps = 200
seq_len = 4096
[deployment]
num_train_gpus = 1
num_infer_gpus = 1
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
[wandb]
project = "wiki-search-debug"
name = "wiki-search-4b"
project = "wiki-search"
name = "wiki-search"
[trainer.optim]
lr = 1e-5
@@ -22,13 +30,12 @@ target_modules = [
"o_proj",
"gate_proj",
"up_proj",
"down_proj"
"down_proj",
]
[orchestrator]
batch_size = 512
batch_size = 128
group_size = 16
oversampling_factor = 2.0
[orchestrator.train.sampling]
max_completion_tokens = 512
@@ -38,5 +45,7 @@ name = "wiki-search"
taskset = { id = "wiki-search-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
[ckpt] # Checkpoint at the end of training
[inference.model]
tool_call_parser = "hermes"
+9
View File
@@ -0,0 +1,9 @@
# wordle (2 GPU)
Multi-turn Wordle (~6-turn games), `Qwen3-1.7B-Wordle-SFT`. Dev mirror of
[`examples/basic/wordle`](../../../examples/basic/wordle).
```bash
uv run sft @ configs/basic/wordle/sft.toml # optional warmup
uv run rl @ configs/basic/wordle/rl.toml
```
@@ -33,9 +33,6 @@ max_completion_tokens = 1024
[inference] # single inference GPU (no data parallelism)
# Qwen3 finetune with the standard PI template patch (byte-identical to
# PrimeIntellect/Qwen3-0.6B base); always re-emits prior <think> blocks.
# Match that with renderer thinking_retention.
# Fine-tune inherits the PrimeIntellect Qwen3 template byte-for-byte.
[orchestrator.renderer]
name = "qwen3"
thinking_retention = "all"
name = "prime-qwen3"
+20
View File
@@ -0,0 +1,20 @@
# SFT warmup for wordle on 2 GPUs. Dev-sized mirror of examples/basic/wordle/sft.toml.
max_steps = 20
[deployment]
num_gpus = 2
[ckpt] # Checkpoint at the end of training
[model]
name = "PrimeIntellect/Qwen3-1.7B"
[data]
name = "willcb/V3-wordle"
seq_len = 1024
batch_size = 64
micro_batch_size = 1
[optim]
lr = 1e-5
@@ -35,6 +35,7 @@ harness = { id = "null", runtime = { type = "subprocess" } }
enable_lora = true
gpu_memory_utilization = 0.7
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
@@ -34,6 +34,7 @@ harness = { id = "null", runtime = { type = "subprocess" } }
enable_lora = true
gpu_memory_utilization = 0.7
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
@@ -26,6 +26,7 @@ resume_step = -1
[weight_broadcast]
type = "filesystem"
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[renderer]
name = "default"
name = "prime-qwen3"
@@ -2,7 +2,7 @@
# The policy inference deployment is launched by the rl entrypoint on GPU 0;
# the frozen reference server is started externally by the test fixture (see
# tests/integration/test_reverse_text_rl_opd.py) on the same GPU. Trainer
# takes GPU 1. Training config mirrors `reverse_text/start.toml`.
# takes GPU 1. Training config mirrors `reverse-text/start.toml`.
max_steps = 15
seq_len = 2048
@@ -32,7 +32,7 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
base_url = ["http://localhost:8001/v1"]
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -2,7 +2,7 @@
# The policy inference deployment is launched by the rl entrypoint on GPU 0;
# the frozen sampling server is started externally by the test fixture (see
# tests/integration/test_reverse_text_rl_sft.py) on the same GPU. Trainer
# takes GPU 1. Training config mirrors `reverse_text/start.toml`.
# takes GPU 1. Training config mirrors `reverse-text/start.toml`.
max_steps = 15
seq_len = 2048
@@ -33,13 +33,12 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
base_url = ["http://localhost:8001/v1"]
# The student's renderer tokenizes the teacher's messages into the student's
# token space (backfill). Use `default` (wraps the student tokenizer's
# apply_chat_template) so the CE target is faithful to the student's actual
# chat template. The stock `qwen3` renderer reimplements the Qwen format and
# injects an empty `<think></think>` block, which this model's custom template
# does not emit — corrupting the distillation target.
# token space (backfill). Use `prime-qwen3` — it matches this PrimeIntellect
# Qwen3 model's chat template token-for-token (single-turn + system), so the CE
# target stays faithful, without the empty `<think></think>` block the stock
# `qwen3` renderer injects (which this model's template never emits).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -30,6 +30,7 @@ harness = { id = "null", runtime = { type = "subprocess" } }
[inference]
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
@@ -29,6 +29,7 @@ harness = { id = "null", runtime = { type = "subprocess" } }
[inference]
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
+5
View File
@@ -0,0 +1,5 @@
# Minimal SFT config with a [slurm] section — fixture for the slim-wheel config
# parse check in cpu_tests.yaml. On the slim wheel the templates/ data dir is
# absent, so [slurm].template_path must resolve to None instead of erroring.
[slurm]
job_name = "slim-sft-check"
@@ -36,27 +36,27 @@ Every config writes to the default `outputs/` directory, so running two back-to-
```bash
# GRPO (no frozen model)
uv run rl @ configs/debug/algorithms/grpo.toml --output-dir outputs/grpo
uv run rl @ configs/debug/algo/grpo.toml --output-dir outputs/grpo
# MaxRL (no frozen model)
uv run rl @ configs/debug/algorithms/max_rl.toml --output-dir outputs/max_rl
uv run rl @ configs/debug/algo/max_rl.toml --output-dir outputs/max_rl
# OPD (needs the frozen model on port 8001)
uv run rl @ configs/debug/algorithms/opd.toml --output-dir outputs/opd
uv run rl @ configs/debug/algorithms/opd_lora.toml --output-dir outputs/opd_lora
uv run rl @ configs/debug/algo/opd.toml --output-dir outputs/opd
uv run rl @ configs/debug/algo/opd_lora.toml --output-dir outputs/opd_lora
# SFT distillation (needs the frozen model on port 8001)
uv run rl @ configs/debug/algorithms/sft_distill.toml --output-dir outputs/sft_distill
uv run rl @ configs/debug/algorithms/sft_distill_lora.toml --output-dir outputs/sft_distill_lora
uv run rl @ configs/debug/algo/sft_distill.toml --output-dir outputs/sft_distill
uv run rl @ configs/debug/algo/sft_distill_lora.toml --output-dir outputs/sft_distill_lora
# Self-distillation against the live policy (no frozen model)
uv run rl @ configs/debug/algorithms/self_distill.toml --output-dir outputs/self_distill
uv run rl @ configs/debug/algo/self_distill.toml --output-dir outputs/self_distill
# ECHO (no frozen model; multi-turn env)
uv run rl @ configs/debug/algorithms/echo.toml --output-dir outputs/echo
uv run rl @ configs/debug/algo/echo.toml --output-dir outputs/echo
# Mixed per-env algorithms: GRPO + OPD in one run (needs the frozen model on port 8001)
uv run rl @ configs/debug/algorithms/mixed_grpo_opd.toml --output-dir outputs/mixed_grpo_opd
uv run rl @ configs/debug/algo/mixed_grpo_opd.toml --output-dir outputs/mixed_grpo_opd
```
See [docs/algorithms.md](../../../docs/algorithms.md) for what each algorithm does and how to author your own.
@@ -1,6 +1,6 @@
# ECHO on the multi-turn alphabet-sort V1 taskset: GRPO on
# action tokens + weighted CE on the env's observation tokens.
# uv run rl @ configs/debug/algorithms/echo.toml
# uv run rl @ configs/debug/algo/echo.toml
max_steps = 20
seq_len = 4096
@@ -38,11 +38,9 @@ max_completion_tokens = 512
type = "zero_advantage"
enforce = false
# Qwen3 finetune with the standard PI template patch; always re-emits prior
# <think> blocks, matched by renderer thinking_retention.
# Fine-tune inherits the PrimeIntellect Qwen3 template byte-for-byte.
[orchestrator.renderer]
name = "qwen3"
thinking_retention = "all"
name = "prime-qwen3"
[trainer.optim]
lr = 1e-6
@@ -16,7 +16,7 @@ group_size = 16
type = "grpo"
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -16,7 +16,7 @@ group_size = 16
type = "max_rl"
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -6,7 +6,7 @@
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
# Then:
# uv run rl @ configs/debug/algorithms/mixed_grpo_opd.toml
# uv run rl @ configs/debug/algo/mixed_grpo_opd.toml
max_steps = 20
seq_len = 2048
@@ -26,7 +26,7 @@ group_size = 16
type = "grpo"
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -3,7 +3,7 @@
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
# Then:
# uv run rl @ configs/debug/algorithms/opd.toml
# uv run rl @ configs/debug/algo/opd.toml
max_steps = 20
seq_len = 2048
@@ -28,7 +28,7 @@ base_url = ["http://localhost:8001/v1"]
# Teacher rolls out over plain chat-completions (no tokens); the renderer backfills them.
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -3,7 +3,7 @@
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
# Then:
# uv run rl @ configs/debug/algorithms/opd_lora.toml
# uv run rl @ configs/debug/algo/opd_lora.toml
max_steps = 20
seq_len = 2048
@@ -28,7 +28,7 @@ base_url = ["http://localhost:8001/v1"]
# Teacher rolls out over plain chat-completions (no tokens); the renderer backfills them.
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -2,7 +2,7 @@
# policy itself: the reference for each completion is the current model
# conditioned on the expert demonstration — no extra deployment needed.
# reverse-text carries the demonstration in its top-level `answer` field.
# uv run rl @ configs/debug/algorithms/self_distill.toml
# uv run rl @ configs/debug/algo/self_distill.toml
max_steps = 20
seq_len = 2048
@@ -24,7 +24,7 @@ type = "opsd"
demo_key = "answer"
[orchestrator.renderer]
name = "qwen3"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -3,7 +3,7 @@
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
# Then:
# uv run rl @ configs/debug/algorithms/sft_distill.toml
# uv run rl @ configs/debug/algo/sft_distill.toml
max_steps = 20
seq_len = 2048
@@ -28,12 +28,12 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
base_url = ["http://localhost:8001/v1"]
# The student's renderer tokenizes the teacher's messages into the student's
# token space (backfill). Use `default` (wraps the student tokenizer's
# apply_chat_template) so the CE target is faithful to the student's actual
# chat template. The stock `qwen3` renderer injects an empty `<think></think>`
# block this model's custom template never emits, corrupting the target.
# token space (backfill). Use `prime-qwen3` — it matches this PrimeIntellect
# Qwen3 model's chat template token-for-token (single-turn + system), keeping the
# CE target faithful, without the empty `<think></think>` block the stock `qwen3`
# renderer injects (which this model's template never emits).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
@@ -3,7 +3,7 @@
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
# Then:
# uv run rl @ configs/debug/algorithms/sft_distill_lora.toml
# uv run rl @ configs/debug/algo/sft_distill_lora.toml
max_steps = 20
seq_len = 2048
@@ -28,12 +28,12 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
base_url = ["http://localhost:8001/v1"]
# The student's renderer tokenizes the teacher's messages into the student's
# token space (backfill). Use `default` (wraps the student tokenizer's
# apply_chat_template) so the CE target is faithful to the student's actual
# chat template. The stock `qwen3` renderer injects an empty `<think></think>`
# block this model's custom template never emits, corrupting the target.
# token space (backfill). Use `prime-qwen3` — it matches this PrimeIntellect
# Qwen3 model's chat template token-for-token (single-turn + system), keeping the
# CE target faithful, without the empty `<think></think>` block the stock `qwen3`
# renderer injects (which this model's template never emits).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
-2
View File
@@ -1,2 +0,0 @@
[model]
enforce_eager = true
-14
View File
@@ -1,14 +0,0 @@
max_steps = 5
[model]
name = "PrimeIntellect/GLM-0.5B"
moe_use_grouped_mm = false
impl = "custom"
attn = "flash_attention_2"
[model.compile]
[data]
type = "fake"
batch_size = 2
seq_len = 1024
-55
View File
@@ -1,55 +0,0 @@
max_steps = 20
seq_len = 2048
[model]
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
[wandb]
project = "reverse-text-debug"
name = "debug-multi-env"
[orchestrator]
batch_size = 128
group_size = 16
[orchestrator.renderer]
name = "qwen3"
# -- multi train envs --
[[orchestrator.train.env]]
name = "reverse-text-train-1"
taskset = { id = "reverse-text-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
[[orchestrator.train.env]]
name = "reverse-text-train-2"
taskset = { id = "reverse-text-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
# -- multi eval envs --
[orchestrator.eval]
interval = 10
num_examples = 16
group_size = 4
[[orchestrator.eval.env]]
name = "reverse-text-eval-1"
taskset = { id = "reverse-text-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
[[orchestrator.eval.env]]
name = "reverse-text-eval-2"
taskset = { id = "reverse-text-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
interval = 5
[trainer.optim]
lr = 3e-6
[inference]
gpu_memory_utilization = 0.5
[inference.model]
max_model_len = 128
-76
View File
@@ -1,76 +0,0 @@
# 2-GPU debug RL run for the multimodal (renderer) path: Qwen3-VL-4B on
# color-codeword. Sized to actually learn (reward should trend up) while
# staying 2-GPU friendly. Exercises RendererClient + Qwen3VLRenderer end-to-end.
max_steps = 15
seq_len = 4096
[model]
name = "Qwen/Qwen3-VL-4B-Instruct"
[model.vlm]
vision_encoder_attr = "model.visual"
language_model_attr = "model.language_model"
[deployment]
num_train_gpus = 1
num_infer_gpus = 1
gpus_per_node = 2
[orchestrator]
batch_size = 256
group_size = 16
# Image processor is CPU-bound and dominates for VLMs; returns diminish past 4.
pool_size = 4
# Step 0 on Qwen3-VL-4B vs color-codeword can be uniform (all-correct or
# all-wrong), so don't enforce zero-advantage dropping or training would crash
# before any progress.
[[orchestrator.post_batch_filters]]
type = "gibberish"
[[orchestrator.post_batch_filters]]
type = "repetition"
[[orchestrator.post_batch_filters]]
type = "zero_advantage"
enforce = false
[orchestrator.train.sampling]
max_completion_tokens = 64
[[orchestrator.train.env]]
name = "color-codeword"
taskset = { id = "color-codeword-v1", images_per_turn = 1 }
harness = { id = "null", runtime = { type = "subprocess" } }
# Default renderer (AutoRendererConfig) resolves Qwen3-VL-4B-Instruct from
# MODEL_RENDERER_MAP to Qwen3VLRenderer at runtime; no explicit name needed.
[trainer]
[trainer.model]
optimization_dtype = "bfloat16"
reduce_dtype = "bfloat16"
[trainer.optim]
lr = 3e-6
[inference]
[inference.model]
# Workaround for vLLM 0.20.1 Qwen3-VL deepstack buffer bug: when num_scheduled_tokens
# (188) gets padded up to the next cudagraph_capture_size (192), the model's
# _set_deepstack_input_embeds sizes the buffer to 188 but forward() runs with 192,
# triggering "Requested more deepstack tokens than available in buffer". Eager mode
# skips the padding so num_input_tokens == num_scheduled_tokens.
enforce_eager = true
[inference.parallel]
dp = 1
tp = 1
[wandb]
project = "debug"
name = "multimodal"
tags = ["qwen3vl-4b", "color-codeword", "renderer"]
-6
View File
@@ -1,6 +0,0 @@
max_steps = 5
batch_size = 16
[train.sampling]
max_completion_tokens = 16
-54
View File
@@ -1,54 +0,0 @@
# Debug v1 RL run: the v1 `general-agent-v1` taskset (GeneralAgentSolverTaskset) driven by the
# default harness, with the agent and its tool server colocated in a modal sandbox. Copied from
# configs/general_agent/rl_qwen3_4b.toml and rewired for v1 (taskset + harness + renderer; the
# v0 `id = "general-agent-solver-rlm"` env becomes the v1 taskset + a separate harness).
max_steps = 200
seq_len = 32768
[deployment]
num_train_gpus = 4
num_infer_gpus = 4
[wandb]
project = "general-agent-debug"
name = "qwen3-4b-v1"
[ckpt]
interval = 100
keep_last = 1
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
[trainer]
[trainer.model]
cp = 2
[trainer.model.ac]
freq = 1
[trainer.model.compile]
[orchestrator]
batch_size = 256
rollouts_per_example = 8
max_off_policy_steps = 32
[orchestrator.renderer]
name = "qwen3"
[[orchestrator.train.env]]
# v1 general-agent solver taskset; the tool server is colocated in the harness's modal sandbox.
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
harness = { id = "null", runtime = { type = "modal" } }
[inference]
gpu_memory_utilization = 0.85
[inference.model]
max_model_len = 32768
[inference.parallel]
dp = 4
-41
View File
@@ -1,41 +0,0 @@
# GSM8K (v1) — the v1 port of configs/gsm8k/rl.toml. Trains Qwen3-0.6B on GSM8K through the
# v1 env server: the orchestrator spawns a v1 EnvServer for the gsm8k-v1 taskset and trains on
# the returned Traces. Runs on 2 GPUs (1 inference, 1 training):
# uv run inference --model.name PrimeIntellect/Qwen3-0.6B # Inference pane (GPU 0)
# uv run rl @ configs/debug/v1/gsm8k.toml --ckpt # Trainer pane (GPU 1)
max_steps = 100
seq_len = 2048
[wandb]
project = "gsm8k-debug"
name = "gsm8k-v1"
[model]
name = "Qwen/Qwen3-0.6B"
[orchestrator]
batch_size = 512
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 2048
[[orchestrator.train.env]]
taskset = { id = "gsm8k-v1", split = "train" }
harness = { id = "null", runtime = { type = "subprocess" } }
[orchestrator.eval]
interval = 20
num_examples = 256
[orchestrator.eval.sampling]
max_completion_tokens = 2048
[[orchestrator.eval.env]]
taskset = { id = "gsm8k-v1", split = "test" }
harness = { id = "null", runtime = { type = "subprocess" } }
[trainer] # Default trainer config
[inference] # Default inference config
-55
View File
@@ -1,55 +0,0 @@
# v1 analog of examples/hendrycks_sanity/rl.toml — identical config with only
# the env sections swapped to v1 taskset/harness syntax (math-env taskset,
# default harness, modal runtime). Submits to slurm by default; pass --no-slurm
# to run locally.
output_dir = "/beegfs/mika/hendrycks-sanity-v1"
max_steps = 200
[wandb]
project = "hendrycks-sanity"
name = "v1"
[deployment]
num_train_gpus = 4
num_infer_gpus = 4
[slurm]
job_name = "hendrycks-modal"
partition = "all"
[model]
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
[orchestrator]
batch_size = 512
group_size = 8
seq_len = 8192
max_inflight_rollouts = 256
[[orchestrator.train.env]]
name = "hendrycks-math"
taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
harness = { id = "null", runtime = { type = "modal" } }
timeout = { scoring = 300 }
[orchestrator.eval]
interval = 50
[[orchestrator.eval.env]]
name = "aime2024"
taskset = { id = "aime24-v1" }
harness = { id = "null", runtime = { type = "modal" } }
timeout = { scoring = 300 }
group_size = 32
[trainer.model]
seq_len = 16384
[inference.model]
max_model_len = 8192
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
[orchestrator.renderer]
name = "default"
reasoning_parser = "think"
-84
View File
@@ -1,84 +0,0 @@
# Qwen3.5-4B SWE RL on the v1 `r2e-gym-v1` taskset through the rlm harness on the prime runtime.
output_dir = "/beegfs/mika/rlm-swe-qwen35-4b"
max_steps = 400
seq_len = 65536
[slurm]
job_name = "rlm-swe-qwen35-4b"
project_dir = "."
pre_run_command = "prime sandbox delete --label rlm-swe-qwen35-4b -y --plain || true"
[deployment]
type = "multi_node"
num_train_nodes = 1
num_infer_nodes = 1
num_infer_replicas = 2
[wandb]
project = "rlm-swe-debug"
name = "qwen35-4b"
[weight_broadcast]
type = "nccl"
[ckpt]
interval = 50
keep_last = 1
resume_step = -1
[model]
name = "Qwen/Qwen3.5-4B"
# --- Trainer ---
[trainer]
[trainer.model]
cp = 4
cp_style = "ulysses"
[trainer.model.ac]
freq = 1
[trainer.model.compile]
# --- Orchestrator ---
[orchestrator]
batch_size = 256
group_size = 8
max_inflight_rollouts = 512
max_off_policy_steps = 16
# Thinking enabled for the Qwen3.5 renderer.
[orchestrator.renderer]
name = "qwen3.5"
enable_thinking = true
[orchestrator.train.sampling]
temperature = 1.0
[[orchestrator.train.env]]
name = "rlm-swe-r2e"
taskset = { id = "r2e-gym-v1" }
harness = { id = "rlm", runtime = { type = "prime", labels = ["rlm-swe-qwen35-4b"] } }
[orchestrator.prime_monitor]
# --- Inference ---
[inference]
gpu_memory_utilization = 0.85
enable_prefix_caching = true
[inference.model]
max_model_len = 65536
[inference.parallel]
dp = 8
# Qwen3.5-4B is a VL model; skip the vision tower for text-only SWE.
# `language_model_only` is a vLLM MultiModalConfig arg (no prime-rl field) → pass via vllm_extra.
[inference.vllm_extra]
language_model_only = true
-41
View File
@@ -1,41 +0,0 @@
# Debug RL run on the v1 env server (reverse-text starter).
# The orchestrator spawns a v1 EnvServer per env (it never loads the env
# itself), dispatches rollouts by task index, and trains on the returned Traces
# (renderer-tokenized). Light settings for a quick end-to-end smoke.
max_steps = 20
seq_len = 2048
[wandb]
project = "reverse-text"
name = "v1"
[model]
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
[orchestrator]
batch_size = 128
group_size = 16
[orchestrator.renderer]
name = "qwen3"
[orchestrator.train.sampling]
max_completion_tokens = 128
[[orchestrator.train.env]]
taskset = { id = "reverse-text-v1" }
# reverse-text is a pure-text single-turn env: disable the bash tool (the model answers
# directly) and use the subprocess runtime (no docker).
harness = { id = "null", runtime = { type = "subprocess" } }
# No eval block, mirroring examples/reverse_text/rl.toml — this is a train-only
# smoke. Add an [orchestrator.eval] block (with an interval) to exercise eval.
[trainer.optim]
lr = 3e-6
[ckpt]
[inference]
gpu_memory_utilization = 0.5
-118
View File
@@ -1,118 +0,0 @@
# v1 RL run: Qwen3.6-35B-A3B (MoE) on the v1 `scaleswe-v1` SWE taskset, rlm harness on a prime
# sandbox runtime. Each scaleswe row ships its own Docker image (NEEDS_CONTAINER) which the
# Environment injects into the prime sandbox; the agent edits the repo + runs tests there (no MCP
# toolset). Router replay is enabled: trainer.enable_router_replay replays the routed-expert
# decisions returned by inference (enable_return_routed_experts).
#
# Built from configs/debug/v1/r2e_gym.toml (the v1 SWE structure) + the MoE parallelism from
# configs/general_agent/rl_qwen3_30b_a3b.toml. The deployment/parallelism is a starting point off
# the 30B-A3B reference — confirm/adjust for your cluster and the 35B / 65k-context footprint.
max_steps = 400
seq_len = 65536
[slurm]
job_name = "scaleswe-qwen36-35b-a3b-rlm"
project_dir = "."
partition = "all"
# Clean up this run's orphaned prime sandboxes before launch (label == SLURM job name).
pre_run_command = 'timeout 120 prime sandbox delete --label "$SLURM_JOB_NAME" -y || true'
[deployment]
type = "multi_node"
num_train_nodes = 2
num_infer_nodes = 2
[wandb]
project = "scaleswe-debug"
name = "qwen36-35b-a3b-rlm"
[weight_broadcast]
type = "nccl"
[ckpt]
interval = 50
keep_last = 1
resume_step = -1
[model]
name = "Qwen/Qwen3.6-35B-A3B"
# --- Trainer ---
[trainer]
# NCCL collective watchdog timeout — raised from default 600s: scaleswe's slow
# multi-node startup (step-0 swebench eval + slow first SWE batch) was tripping the
# 600s _ALLGATHER_BASE watchdog → SIGABRT trainer crash.
dist_timeout_seconds = 3600
# Replay the routed-expert decisions returned by inference (enable_return_routed_experts)
# so the trainer's MoE routing matches the rollout's — cuts trainer/inference mismatch on A3B.
enable_router_replay = true
[trainer.model]
cp = 2
# Qwen3.6 is a hybrid/linear-attention model — ring CP is unsupported; ulysses
# all-to-all on Q/K/V works with the non-softmax kernels.
cp_style = "ulysses"
# Chunk the LM head over tokens to avoid materializing the full [seq, vocab] logits
# (65k seq × large vocab) — big activation-memory saver. 1024 matches the SWE configs.
fused_lm_head_token_chunk_size = 1024
[trainer.model.ac]
freq = 1
[trainer.model.compile]
# --- Orchestrator ---
[orchestrator]
batch_size = 256
group_size = 16
max_off_policy_steps = 16
[orchestrator.renderer]
name = "qwen3.6"
enable_thinking = true
[orchestrator.train.sampling]
temperature = 1.0
[[orchestrator.train.env]]
name = "scaleswe"
# v1 scaleswe SWE taskset; rlm harness in a prime sandbox using the row's injected Docker image.
taskset = { id = "scaleswe-v1" }
harness = { id = "rlm", runtime = { type = "prime", labels = ["scaleswe-qwen36-35b-a3b-rlm"] } }
[orchestrator.prime_monitor]
# --- Eval: SWE-Bench Verified (first 100 tasks) every 20 steps, rlm harness on prime ---
[orchestrator.eval]
interval = 20
[[orchestrator.eval.env]]
name = "swebench-verified"
taskset = { id = "swebench-verified-v1", use_prime_registry = true }
harness = { id = "rlm", runtime = { type = "prime", labels = ["scaleswe-qwen36-35b-a3b-rlm"] } }
num_examples = 100
group_size = 1
timeout = { rollout = 3600 }
# --- Inference ---
[inference]
gpu_memory_utilization = 0.85
enable_prefix_caching = true
# Return per-token routed-expert decisions to the trainer for router replay
# (pairs with trainer.enable_router_replay).
enable_return_routed_experts = true
[inference.model]
max_model_len = 65536
# Qwen3.6 is not matched by the auto tool-parser resolver; set explicitly so vLLM
# enables auto tool choice (the scaleswe SWE agent sends tool_choice="auto").
tool_call_parser = "qwen3_coder"
[inference.parallel]
dp = 2
tp = 4
-17
View File
@@ -1,17 +0,0 @@
# Testing Elastic Inference
To test the elastic inference pool without having the `rl` entrypoint start the inference server:
1. **Run RL with the elastic config** (orchestrator discovers servers via DNS; it will find `localhost:8000` once the server is started):
```bash
uv run rl @ examples/alphabet_sort/rl_elastic.toml
```
The config uses `[orchestrator.model.client.elastic]` with `hostname = "localhost"` and `port = 8000`. The orchestrator will wait for at least one ready server before starting rollouts.
2. **Start the inference server manually** (in a separate terminal or on another machine):
```bash
uv run inference --model.name Qwen/Qwen3-4B-Instruct-2507 --enable-lora --max-lora-rank 32
```
-46
View File
@@ -1,46 +0,0 @@
# Alphabet sort RL with elastic inference pool (no inference process started by rl).
# Start the inference server manually first, then run: uv run rl @ examples/alphabet_sort/rl_elastic.toml
# The orchestrator discovers servers via DNS (hostname) and only uses ready ones.
# Omitting [inference] means inference = None, so the rl entrypoint will not start an inference process.
max_steps = 200
seq_len = 2048
[ckpt]
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
[wandb]
project = "alphabet-sort"
name = "alphabet-sort-elastic"
[trainer.model]
impl = "auto"
[trainer.model.ac]
freq = 1
[trainer.model.lora]
rank = 32
alpha = 64
[trainer.optim]
lr = 1e-5
[orchestrator]
batch_size = 512
group_size = 8
[orchestrator.train.sampling]
max_completion_tokens = 768
[orchestrator.model.client.elastic]
hostname = "localhost"
port = 8000
sync_interval = 5.0
[[orchestrator.train.env]]
name = "alphabet-sort"
taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
harness = { id = "null", runtime = { type = "subprocess" } }
-30
View File
@@ -1,30 +0,0 @@
max_steps = 5
seq_len = 8192
[wandb]
project = "general-agent-debug"
name = "qwen3-0p6b-rlm"
[model]
name = "Qwen/Qwen3-0.6B"
[orchestrator]
batch_size = 16
rollouts_per_example = 4
[orchestrator.train.sampling]
max_completion_tokens = 4096
[[orchestrator.train.env]]
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
harness = { id = "null", runtime = { type = "modal" } }
[trainer]
[inference]
[inference.model]
max_model_len = 8192
[inference.parallel]
dp = 1
-45
View File
@@ -1,45 +0,0 @@
max_steps = 200
seq_len = 32768
[deployment]
num_train_gpus = 4
num_infer_gpus = 4
[wandb]
project = "general-agent-debug"
name = "qwen3-4b-rlm"
[ckpt]
interval = 100
keep_last = 1
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
[trainer]
[trainer.model]
cp = 2
[trainer.model.ac]
freq = 1
[trainer.model.compile]
[orchestrator]
batch_size = 512
rollouts_per_example = 8
max_off_policy_steps = 32
[[orchestrator.train.env]]
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
harness = { id = "null", runtime = { type = "modal" } }
[inference]
gpu_memory_utilization = 0.85
[inference.model]
max_model_len = 32768
[inference.parallel]
dp = 4
-77
View File
@@ -1,77 +0,0 @@
# GSM8K
In this example, we demonstrate how to train `Qwen3-0.6B` to answer math problems from the GSM8K dataset.
> This example runs on 2 GPUs (1 for inference, 1 for training).
## Setup
The `gsm8k-v1` taskset is included through the Verifiers workspace. After syncing the repository, verify it with:
```bash
uv run python -c "import gsm8k_v1"
```
Start the tmux session:
```bash
bash scripts/tmux.sh
```
## Baseline Evaluation
Start the inference server:
```bash
# In the `Inference` pane
uv run inference --model.name PrimeIntellect/Qwen3-0.6B
```
Evaluate the base model:
```bash
# In the `Trainer` pane
uv run vf-eval gsm8k-v1 \
-a '{"split": "test"}' \
-m PrimeIntellect/Qwen3-0.6B \
-b http://localhost:8000/v1 \
-n 20 \
-t 2048
```
## RL Training
Train with the config file:
```bash
# In the `Trainer` pane
uv run rl @ configs/gsm8k/rl.toml \
--wandb.project your-project-name \
--wandb.name your-run-name \
--ckpt
```
This will write weight checkpoints in `outputs/weights/step_*`. Upload the final checkpoint to HuggingFace:
```bash
uv run hf upload <user>/Qwen3-0.6B-GSM8K-RL outputs/weights/step_100
```
## Evaluation
Evaluate your trained model:
```bash
# In the `Inference` pane
uv run inference --model.name <user>/Qwen3-0.6B-GSM8K-RL
```
```bash
# In the `Trainer` pane
uv run vf-eval gsm8k-v1 \
-a '{"split": "test"}' \
-m <user>/Qwen3-0.6B-GSM8K-RL \
-b http://localhost:8000/v1 \
-n 20 \
-t 2048
```
-31
View File
@@ -1,31 +0,0 @@
max_steps = 100
seq_len = 2048
[wandb]
project = "gsm8k-debug"
name = "gsm8k"
[model]
name = "Qwen/Qwen3-0.6B"
[orchestrator]
batch_size = 512
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 2048
[[orchestrator.train.env]]
name = "gsm8k"
taskset = { id = "gsm8k-v1", split = "train" }
harness = { id = "null", runtime = { type = "subprocess" } }
[trainer] # Default trainer config
[inference] # Default inference config
# Mirror of Qwen/Qwen3-0.6B; PI's template patch always re-emits prior
# <think> blocks. Match that with renderer thinking_retention.
[orchestrator.renderer]
name = "auto"
thinking_retention = "all"
-51
View File
@@ -1,51 +0,0 @@
# Hendryck's Math
In this example, we demonstrate how to train `Qwen/Qwen3-4B-Instruct-2507` to answer math problems from the Hendryck's Math dataset.
> This example runs on 2 GPUs (1 for inference, 1 for training).
## Setup
The taskset is included through the research-environments workspace. After syncing the repository, verify it with:
```bash
uv run python -c "import math_env_v1"
```
Start the tmux session:
```bash
bash scripts/tmux.sh
```
## Baseline Evaluation
Start the inference server:
```bash
# In the `Inference` pane
uv run inference --model.name Qwen/Qwen3-4B-Instruct-2507
```
Evaluate the base model:
```bash
# In the `Trainer` pane
uv run vf-eval math-env-v1 \
-a '{"dataset_name": "PrimeIntellect/Hendrycks-Math", "dataset_subset": "default"}' \
-m Qwen/Qwen3-4B-Instruct-2507 \
-b http://localhost:8000/v1 \
-n 20 \
-t 2048
```
## RL Training
Train with the config file:
```bash
# In the `Trainer` pane
uv run rl @ configs/hendrycks_math/rl.toml \
--wandb.project your-project-name \
--wandb.name your-run-name
```
-38
View File
@@ -1,38 +0,0 @@
max_steps = 500
seq_len = 2048
[wandb]
project = "hendrycks-math-debug"
name = "hendrycks-math"
[model]
name = "Qwen/Qwen3-4B-Instruct-2507"
[orchestrator]
batch_size = 512
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 2048
[[orchestrator.train.env]]
name = "hendrycks-math"
taskset = { id = "math-env-v1", dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", task = { math_verify_timeout = 60 } }
harness = { id = "null", runtime = { type = "subprocess" } }
[orchestrator.eval]
interval = 10
[orchestrator.eval.sampling]
max_completion_tokens = 2048
[[orchestrator.eval.env]]
name = "math500"
taskset = { id = "math500-v1" }
num_examples = 30
group_size = 4
[trainer] # Default trainer config
[inference] # Default inference config
-72
View File
@@ -1,72 +0,0 @@
output_dir = "/data/sami_debug/nemotron-debug"
clean_output_dir = true
max_steps = 5
seq_len = 2048
[slurm]
job_name = "nemotron-4node"
pre_run_command = "uv sync --all-extras --all-packages --group mamba-ssm"
[deployment]
type = "multi_node"
num_train_nodes = 4
num_infer_nodes = 4
[log]
level = "debug"
[wandb]
project = "sami_debug_nemotron"
name = "nemotron-120b-math"
[weight_broadcast]
type = "nccl"
[model]
name = "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16"
[trainer]
dist_timeout_seconds = 1800
[trainer.model]
impl = "custom"
attn = "flash_attention_2"
optim_cpu_offload = true
ep = 8
fused_lm_head_token_chunk_size = 8192
[trainer.model.ac]
freq = 1
[trainer.model.ac_offloading]
max_inflight_activations = 5
[trainer.model.compile]
[orchestrator]
batch_size = 128
group_size = 8
[orchestrator.train.sampling]
max_completion_tokens = 2048
[[orchestrator.train.env]]
name = "hendrycks-math"
taskset = { id = "math-env-v1", dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", task = { math_verify_timeout = 60 } }
harness = { id = "null", runtime = { type = "subprocess" } }
[orchestrator.eval]
interval = 10
[orchestrator.eval.sampling]
max_completion_tokens = 2048
[[orchestrator.eval.env]]
name = "math500"
taskset = { id = "math500-v1" }
num_examples = 30
group_size = 4
[inference.parallel]
tp = 8
dp = 1
-71
View File
@@ -1,71 +0,0 @@
output_dir = "outputs/rl-nemotron-debug"
clean_output_dir = true
max_steps = 500
seq_len = 4096
[slurm]
job_name = "nemotron-sami-debug"
[deployment]
type = "multi_node"
num_train_nodes = 2
num_infer_nodes = 2
[log]
level = "debug"
[wandb]
project = "nemotron_sami_debug"
name = "nemotron-120b-math"
[weight_broadcast]
type = "nccl"
[model]
name = "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16"
[trainer.model]
impl = "custom"
attn = "flash_attention_2"
optim_cpu_offload = true
fused_lm_head_token_chunk_size = 8192
[trainer.model.debug]
random_init = true
num_layers = 8
[trainer.model.ac_offloading]
max_inflight_activations = 5
[trainer.model.ac]
freq = 1
[trainer.model.compile]
[orchestrator]
batch_size = 512
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 4096
[[orchestrator.train.env]]
name = "hendrycks-math"
taskset = { id = "math-env-v1", dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", task = { math_verify_timeout = 60 } }
harness = { id = "null", runtime = { type = "subprocess" } }
[orchestrator.eval]
interval = 10
[orchestrator.eval.sampling]
max_completion_tokens = 4096
[[orchestrator.eval.env]]
name = "math500"
taskset = { id = "math500-v1" }
num_examples = 30
group_size = 4
[inference.parallel]
tp = 4
dp = 4
+1 -1
View File
@@ -142,7 +142,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/glm5_pd_disag/rl.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/glm5_pd_disag/rl.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast (see the [README](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/glm5_pd_disag) for the launch story).
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).
Monitor live queue depths to detect imbalance:
+9 -4
View File
@@ -117,10 +117,15 @@ Both components resolve per environment. Each env inherits `[orchestrator.algo]`
type = "grpo"
[[orchestrator.train.env]]
id = "math-env" # inherits grpo
name = "math"
taskset = { id = "math-v1" }
harness = { id = "null", runtime = { type = "subprocess" } }
# inherits the top-level grpo
[[orchestrator.train.env]]
id = "terminal-env"
name = "terminal"
taskset = { id = "terminal-v1" }
harness = { id = "bash", runtime = { type = "subprocess" } }
algo = { type = "echo" } # this env runs its own algorithm
```
@@ -272,7 +277,7 @@ The per-token training signal is set by `algo.type` and the [algorithm](#the-alg
| `grpo` | `rl` | Group-norm: reward minus per-group baseline, optional length penalty. |
| `max_rl` | `rl` | Mean-normalized group credit (maximum-likelihood RL). |
| `echo` | `rl` + `ce` | Group-norm on action tokens, plus weighted CE on env-provided tokens selected by message role (each role's `alpha` is its ECHO λ), optionally narrowed by a user filter. |
| `opd` | `ref_kl` | On-policy distillation: per-token reverse KL to a reference model (`model`, an inline frozen hosted model), evaluated in the trainer from shipped reference logprobs. No credit — rollouts keep `advantages = None` (advantage-based filters never fire) and ship no advantage stream; `group_size` only fans out sampling. |
| `opd` | `ref_kl` | On-policy distillation: per-token reverse KL to a reference model (`teacher`, an inline frozen hosted model), evaluated in the trainer from shipped reference logprobs. No credit — rollouts keep `advantages = None` (advantage-based filters never fire) and ship no advantage stream; `group_size` only fans out sampling. |
| `opsd` | `ref_kl` | SDFT: per-token reverse KL to a demo-conditioned reference. No credit — rollouts keep `advantages = None` (advantage-based filters never fire) and ship no advantage stream. |
| `sft` | `ce` | Cross-entropy on the sampled tokens. Assigns no advantage — trains on every sampled token. |
@@ -415,7 +420,7 @@ tok.apply_chat_template(messages, tokenize=False)
# (the <think>R1</think> from turn 2 is gone)
```
Hand-coded renderers ship for `qwen3`, `qwen3-vl`, `qwen3.5`, `glm5`, `glm4.5`, `minimax-m2`, `deepseek-v3`, `kimi-k2`, `kimi-k2.5`, `nemotron-3`, `gpt-oss`; anything else falls back to `DefaultRenderer` (a generic `apply_chat_template` wrapper). Pick one via:
Hand-coded renderers ship for `qwen3`, `qwen3-vl`, `qwen3.5`, `glm-5`, `glm-4.5`, `minimax-m2`, `deepseek-v3`, `kimi-k2`, `kimi-k2.5`, `nemotron-3`, `gpt-oss`; anything else falls back to `DefaultRenderer` (a generic `apply_chat_template` wrapper). Pick one via:
```toml
[orchestrator.renderer]
+14 -13
View File
@@ -34,7 +34,7 @@ Field values come from three sources — Pydantic defaults, TOML files (passed w
The `@` token introduces a TOML file. Multiple `@` arguments compose left-to-right, deep-merged — unset fields in an overlay keep the base value:
```bash
uv run rl @ examples/reverse_text/rl.toml # one file
uv run rl @ examples/basic/reverse-text/rl.toml # one file
uv run rl @ base.toml @ overlay.toml # left to right
uv run rl --trainer @ trainer.toml --orchestrator @ orch.toml # per-section
uv run rl @ base.toml --trainer @ trainer.toml # mixed
@@ -206,30 +206,31 @@ For standalone `sft` and `inference` configs, `[env_vars]` applies to that entry
## Examples
The shipped end-to-end examples in [`examples/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples) are the canonical, kept-up-to-date references — the rest of the repo's TOMLs (under `configs/`) are CI- and debug-internal and may drift. Each example directory has its own README with the full launch story.
The shipped end-to-end examples in [`examples/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples) are the canonical, kept-up-to-date references — the rest of the repo's TOMLs (under `configs/`) are CI- and debug-internal and may drift. Each basic example directory has its own README with the full launch story; the advanced examples are config-only.
**Basic** (1–8 GPUs):
- [**Reverse Text**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/reverse_text) — `Qwen3-0.6B` reversing a chunk of text. Tiny single-turn SFT + RL; runs on a single consumer GPU in minutes.
- [**Wordle**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/wordle) — `Qwen3-1.7B` playing Wordle. Multi-turn SFT + RL; 2–4 H100s.
- [**Alphabet Sort**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/alphabet_sort) — `Qwen3-4B-Instruct-2507` sorting names alphabetically. Multi-turn LoRA RL without SFT warmup; one H100.
- [**Wiki Search**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/wiki_search) — `Qwen3-4B-Instruct-2507` answering trivia by web-searching Wikipedia. Multi-turn with tool use.
- [**Hendrycks Sanity**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/hendrycks_sanity) — `DeepSeek-R1-Distill-Qwen-1.5B` on a filtered MATH subset. Useful for algorithm ablations.
- [**Reverse Text**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/reverse-text) — `Qwen3-0.6B` reversing a chunk of text. Tiny single-turn SFT + RL; runs on a single consumer GPU in minutes.
- [**Wordle**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/wordle) — `Qwen3-1.7B` playing Wordle. Multi-turn SFT + RL; 2–4 H100s.
- [**Alphabet Sort**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/alphabet-sort) — `Qwen3-4B-Instruct-2507` sorting names alphabetically. Multi-turn LoRA RL without SFT warmup; one H100.
- [**Wiki Search**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/wiki-search) — `Qwen3-4B-Instruct-2507` answering trivia by searching a Wikipedia corpus. Multi-turn with tool use.
- [**Hendrycks Sanity**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/hendrycks-sanity) — `DeepSeek-R1-Distill-Qwen-1.5B` on a filtered MATH subset. Useful for algorithm ablations.
**Advanced** (32–2048 GPUs, SLURM):
- [**Qwen 3 30B – A3B Math**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/qwen30b_math) — `Qwen3-30B-A3B` on hard math.
- [**Qwen 3 30B – A3B SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/qwen30b_swe) — `Qwen3-30B-A3B` on hard SWE.
- [**INTELLECT-3.1**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/intellect-3.1) — reproduces our INTELLECT-3.1 training run.
- [**MiniMax-M2.5 SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/minimax_m2.5_swe) — `MiniMax-M2.5` on agentic SWE.
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/glm5_pd_disag) — `GLM-5` with P/D disaggregation and FP8 inference.
- [**Qwen3-30B-A3B**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/qwen3-30b-a3b) — `Qwen3-30B-A3B` on math, SWE, and tool use.
- [**GLM-4.5-Air**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-4.5-air) — `GLM-4.5-Air` on search, SWE, and terminal.
- [**Nemotron-3-Super**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/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/examples/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.
### Worked Example: Compose, Override, Dry-Run
Start from a shipped base config, override two fields on the CLI, and dry-run:
```bash
uv run rl @ examples/reverse_text/rl.toml \
uv run rl @ examples/basic/reverse-text/rl.toml \
--wandb.name my-experiment \
--trainer.optim.lr 5e-6 \
--output-dir /tmp/reverse-dry \
+4 -5
View File
@@ -71,7 +71,7 @@ Drop the modeling code under `src/prime_rl/trainer/models/<arch>/` (HF-compatibl
### Register a Mini Preset
Add an entry to [`scripts/mini_moe.py`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/scripts/mini_moe.py) so the smoke-test workflow can build a ~0.5B test model in your architecture. The preset names the config class, picks small dimensions, and wires up the HF + PrimeRL model classes plus a tokenizer source:
Add an entry to [`scripts/mini_moe.py`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/scripts/mini_moe.py) so the smoke-test workflow can build a ~0.5B test model in your architecture. The preset names the config class, picks small dimensions, and wires up the HF + prime-rl model classes plus a tokenizer source:
```python
ARCH_PRESETS = {
@@ -88,7 +88,7 @@ ARCH_PRESETS = {
### Run the Smoke Test
Build the mini model. This creates a ~543M-parameter GLM-4 MoE (1024 hidden, 24 layers, 8 experts) with random weights, copies the tokenizer from the original GLM-4 model, and verifies the HF↔PrimeRL roundtrip is lossless:
Build the mini model. This creates a ~543M-parameter GLM-4 MoE (1024 hidden, 24 layers, 8 experts) with random weights, copies the tokenizer from the original GLM-4 model, and verifies the HF↔prime-rl roundtrip is lossless:
```bash
uv run python scripts/mini_moe.py --arch glm4_moe --output-dir ./mini-glm-moe
@@ -103,10 +103,9 @@ uv run python scripts/mini_moe.py --arch glm4_moe --output-dir ./mini-glm-moe --
Warm up the random-weight mini model with SFT on reverse-text so KL divergence becomes meaningful in the RL phase. Loss drops from ~12 to ~2.5 — the output won't be coherent, but the distribution is non-trivial. A pre-built SFT'd checkpoint lives at [samsja/mini-glm-moe](https://huggingface.co/samsja/mini-glm-moe) if you want to skip this step:
```bash
uv run sft @ configs/debug/moe/sft/train.toml \
uv run sft \
--model.name ./mini-glm-moe \
--data.name PrimeIntellect/Reverse-Text-SFT \
--data.type null \
--max_steps 200 \
--optim.lr 1e-4 \
--ckpt.weights
@@ -115,7 +114,7 @@ uv run sft @ configs/debug/moe/sft/train.toml \
Then run the full RL stack on reverse-text:
```bash
uv run rl @ configs/ci/integration/reverse_text_moe/start.toml \
uv run rl @ configs/ci/integration/reverse-text-moe/start.toml \
--model.name samsja/mini-glm-moe \
--trainer.model.impl custom \
--inference.gpu-memory-utilization 0.7 \
+3 -3
View File
@@ -9,7 +9,7 @@ This page covers the inference configuration and the supported features/deployme
- [Multi-Node](#multi-node)
- [Multi-replica](#multi-replica)
- [Wide-EP](#wide-ep)
- [P/D Dissagregation](#pd-dissagregation)
- [P/D Disaggregation](#pd-disaggregation)
- [Router](#router)
- [Routing policies](#routing-policies)
- [Advanced Configuration](#advanced-configuration)
@@ -26,7 +26,7 @@ This page covers the inference configuration and the supported features/deployme
We support 3 distinct deployment shapes:
- [Single-Node](#single-node) - Runs the inference server on a single node. Useful for debugging, small scale experiments or smaller models. The default deployment shape.
- [Multi-Node](#multi-node) - Runs the inference server on multiple nodes. Useful for large scale experiments or larger models, where latency is not a concern - i.e. single turn inference, long context inference, etc.
- [Disaggregated](#disaggregated) - Runs the inference server on multiple nodes, but disaggregates the prefill and decode stages. Useful for large scale experiments or larger models, where latency is a concern and multi-node deployment creates very high E2E rollout latency, such as agentic workflows.
- [Disaggregated](#pd-disaggregation) - Runs the inference server on multiple nodes, but disaggregates the prefill and decode stages. Useful for large scale experiments or larger models, where latency is a concern and multi-node deployment creates very high E2E rollout latency, such as agentic workflows.
Most of the features are supported for all deployment shapes, with few exceptions. These exceptions are rejected on validation.
@@ -124,7 +124,7 @@ dp = 8
This configuration will run 2 vLLM processes, each with `data_parallel_size_local = 4` and `tp = 2` and expert parallelism spanning 2 nodes. The requests are again routed to these processes via the `vllm-router`.
## P/D Dissagregation
## P/D Disaggregation
This is the most advanced deployment shape. It allows you to disaggregate the prefill and decode stages, with KV cache flowing between them. This is useful for large scale deployments, where there are high requirements on latency, such as agentic workflows spanning 100s of turns.
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://mintlify.com/docs.json",
"navigation": [
{
"group": "PRIME-RL",
"group": "prime-rl",
"pages": [
"overview",
"configuration",
+3 -3
View File
@@ -8,7 +8,7 @@ A `prime-rl` RL run is three cooperating processes:
![Architecture](assets/architecture.png)
- **Inference** — vLLM-backed server (or fleet) holding the current policy. The orchestrator drives rollouts through the token-in `/v1/generate` route via the [`renderers`](https://github.com/PrimeIntellect-ai/renderers) package (OpenAI-compatible chat/completions routes are also exposed for external clients). We are trying to stay up-to-date with the latest vLLM features, you can read more about the supported features and deployment options in the dedicated [inference documentation](inference.md).
- **Inference** — vLLM-backed server (or fleet) holding the current policy. The orchestrator drives rollouts through the token-in `/inference/v1/generate` route via the [`renderers`](https://github.com/PrimeIntellect-ai/renderers) package (OpenAI-compatible chat/completions routes are also exposed for external clients). We are trying to stay up-to-date with the latest vLLM features, you can read more about the supported features and deployment options in the dedicated [inference documentation](inference.md).
- **Orchestrator** — Lightweight CPU process that owns the data plane across many [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) training and eval environments. Each env runs in an isolated subprocess with a variable-size pool of env workers for scalability. The orchestrator drives multi-turn rollouts against the inference fleet (tool use, browsers, sandboxes, long horizons) without re-tokenizing across turns, computes advantages, packs the rollouts into training batches, and relays new weights from trainer to inference.
- **Trainer** — FSDP2 process group that consumes packed rollouts and steps the optimizer. We ship optimized custom modeling code for many MoE / dense / VLM families that unlocks advanced trainer parallelism — expert parallelism (EP, with DeepEP kernels) and context parallelism (CP) for long-sequence training — plus selective activation checkpointing, FP8 training on Hopper+, LoRA, and multi-tenant training (many concurrent LoRA tenants sharing one trainer + inference deployment). You can read more in the dedicated [training documentation](training.md).
@@ -29,10 +29,10 @@ You need at least one NVIDIA GPU (RTX 3090/4090/5090, A100, H100, H200, or B200)
Train an SFT-warmed `Qwen3-0.6B` on the `reverse-text` task — the env is bundled with the [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) submodule so no separate install is needed. This config ships in the repo and runs on two GPUs (one for inference, one for the trainer):
```bash
uv run rl @ examples/reverse_text/rl.toml
uv run rl @ examples/basic/reverse-text/rl.toml
```
The `rl` entrypoint reads `examples/reverse_text/rl.toml`, splits it into per-process sub-configs, picks GPU 0 for inference and GPU 1 for the trainer, launches all three processes, and tees their stdout into `outputs/logs/{trainer,orchestrator,inference}.log`. Within a minute the trainer should log `step 1` and a reward sample; after 20 steps the run completes and final HF-compatible weights land at `outputs/weights/step_20`.
The `rl` entrypoint reads `examples/basic/reverse-text/rl.toml`, splits it into per-process sub-configs, picks GPU 0 for inference and GPU 1 for the trainer, launches all three processes, and tees their stdout into `outputs/logs/{trainer,orchestrator,inference}.log`. Within a minute the trainer should log `step 1` and a reward sample; after 20 steps the run completes and final HF-compatible weights land at `outputs/weights/step_20`.
## Documentation
+3 -3
View File
@@ -226,10 +226,10 @@ gpus_per_node = 8
### Examples
Full multi-node configs ship in [`examples/multinode/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/multinode):
Full multi-node configs ship under [`examples/advanced/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced):
- [`rl.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/multinode/rl.toml) — two-node RL run with NCCL weight broadcast on a 30B MoE policy.
- [`sft.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/multinode/sft.toml) — two-node SFT against the same model.
- [`nemotron-3-super/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/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.
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), and the launcher prints one URL per node. Front the URLs with a router or point clients at any of them.
+3 -3
View File
@@ -45,7 +45,7 @@ This page covers everything you need to launch, observe, checkpoint, and recover
The minimal RL run trains an SFT-warmed `Qwen3-0.6B` on the `reverse-text` task — the env is bundled with the [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) submodule, so nothing else needs to be installed:
```bash
uv run rl @ examples/reverse_text/rl.toml
uv run rl @ examples/basic/reverse-text/rl.toml
```
### Useful Knobs
@@ -166,7 +166,7 @@ See [Algorithms § Multi-Turn Trajectories](algorithms.md#multi-turn-trajectorie
The minimal SFT run trains `Qwen3-0.6B` on the `reverse-text` SFT dataset:
```bash
uv run sft @ examples/reverse_text/sft.toml --wandb
uv run sft @ examples/basic/reverse-text/sft.toml --wandb
```
Multi-GPU and multi-node use torchrun under the hood (the `sft` entrypoint manages this for you — see [Scaling § SFT and Torchrun](scaling.md#sft-and-torchrun) for non-default layouts; multi-node SFT goes through [SLURM](scaling.md#slurm)).
@@ -336,7 +336,7 @@ Requires `PRIME_API_KEY` (set via `prime login` or env var) and an allowlisted t
## Rules of Thumb
- **Start small.** Run `examples/reverse_text/rl.toml` end-to-end on 2 GPUs before scaling. If the smoke run finishes cleanly, your install is good.
- **Start small.** Run `examples/basic/reverse-text/rl.toml` end-to-end on 2 GPUs before scaling. If the smoke run finishes cleanly, your install is good.
- **Batch size ≥ 64.** Smaller batches give noisy gradient estimates and the trainer's overhead-per-step dominates throughput. 64 is the practical floor; 128–512 is the range for quick ablations; production RL often runs at 1024+.
- **Group size ≥ 8.** Bigger groups (`orchestrator.group_size`) make it more likely that a task produces a mix of high- and low-reward rollouts, which is what gives the trainer a usable signal — if all rollouts in a group succeed or all fail, the within-group advantage collapses to zero and the trainer learns nothing from that task. Bigger groups also tighten advantage normalization. 8 is the floor; 16–32 is common.
- **Pin `output_dir` per run.** Sharing a directory across runs will mix rollouts and break resumes. `--output-dir outputs/<unique-name>` is the simplest discipline.
+15 -1
View File
@@ -1,3 +1,17 @@
# Examples
This directory maintains configurations for usage examples of PRIME-RL which are referenced in the [README](../README.md).
End-to-end usage examples for prime-rl, referenced from the top-level [README](../README.md).
- **[`basic/`](basic)** — walk-throughs for the core environments on 1–8 GPUs (baseline eval →
optional SFT warmup → RL → eval), each with its own README:
- `reverse-text` — smallest end-to-end loop (single-turn, 0.6B)
- `alphabet-sort` — multi-turn, user simulator, LoRA
- `wiki-search` — multi-turn tool calling, LoRA
- `wordle` — multi-turn (~6-turn games)
- `hendrycks-sanity` — single-turn math, long-running
- **[`advanced/`](advanced)** — larger, mostly multi-node runs on frontier models, one folder
per model: `qwen3-30b-a3b` (math/swe/tool), `glm-4.5-air` (search/swe/terminal), `glm-5.2`
(large-scale + PD-disaggregated inference), `minimax-m2.5` (swe), `nemotron-3-super` (swe),
`intellect-3.1` (swe).
Dev-sized (2-GPU) counterparts of `basic/` live in [`configs/basic/`](../configs/basic).
@@ -10,8 +10,7 @@
# 2 train + 4 infer nodes. Trainer uses cp=8 (ulysses) plus
# the memory improvements from the GLM-5.1 prod run (research-prod rlm5/prod.toml): LM-head token
# chunking, activation checkpointing (freq=1) + activation offloading (max_inflight=1), optimizer
# CPU offload, and skip-gather / skip-optimizer checkpointing. Derived from
# configs/debug/v1/scaleswe.toml + GLM-4.5-Air model settings from the int5 opencode configs.
# CPU offload, and skip-gather / skip-optimizer checkpointing.
max_steps = 1000
seq_len = 131072
@@ -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 @ configs/glm5.2_16node_llmd/inference.toml
# Launch: uv run inference @ examples/advanced/glm-5.2/infer/pd-llmd.toml
output_dir = "/shared/outputs/glm5.2-16node-llmd"
@@ -80,7 +80,7 @@ weight_decay = 0.0
[orchestrator]
batch_size = 256
rollouts_per_example = 16
group_size = 16
max_inflight_rollouts = 2048
max_off_policy_steps = 8 # 16/32 can be better, 8 is more CPU stable
+110
View File
@@ -0,0 +1,110 @@
max_steps = 1000
# 131k context requires 4 train nodes on the optim-offload profile (on 2 nodes the params/grads
# baseline stays on GPU and long contexts OOM).
seq_len = 131072
[env_vars]
PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
[slurm]
job_name = "nemotron-3-super-swe"
partition = "prod"
# Nemotron-H needs the mamba-ssm kernels; sync that group, then clear this run's orphaned sandboxes.
pre_run_command = 'uv sync --all-extras --all-packages --group mamba-ssm ; timeout 120 prime sandbox delete --label "nemotron-3-super-swe" -y || true'
[deployment]
type = "multi_node"
num_train_nodes = 4
num_infer_nodes = 1
num_infer_replicas = 4
[wandb]
project = "nemotron-3-super"
name = "nemotron-3-super-swe"
[weight_broadcast]
type = "nccl"
timeout = 3600
[ckpt]
interval = 50
keep_last = 1
resume_step = -1
[model]
name = "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16"
[trainer]
dist_timeout_seconds = 3600
enable_router_replay = true
[trainer.model]
impl = "custom"
attn = "flash_attention_3"
# Hybrid-Mamba model: ring CP is unsupported, so use ulysses (capped at 8 by n_groups).
cp = 8
cp_style = "ulysses"
ep = 8
fused_lm_head_token_chunk_size = 1024
optim_cpu_offload = true
[trainer.model.ac]
[trainer.model.ac_offloading]
max_inflight_activations = 1
[trainer.model.compile]
[trainer.ckpt]
skip_gather_master_weights = true
skip_optimizer = true
[trainer.optim]
type = "adamw"
[orchestrator]
batch_size = 256
group_size = 16
max_off_policy_steps = 32
max_inflight_rollouts = 1536
[orchestrator.algo]
type = "grpo"
[orchestrator.algo.length_penalty]
type = "linear"
num_output_tokens_weight = 0.0
num_input_tokens_weight = 0.1
num_turns_weight = 0.1
[orchestrator.renderer]
name = "nemotron-3"
truncate_history_thinking = false
[[orchestrator.train.env]]
name = "scaleswe"
taskset = { id = "scaleswe-v1", use_prime_registry = true }
harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] } }
[orchestrator.prime_monitor]
[orchestrator.eval]
interval = 20
[[orchestrator.eval.env]]
name = "swebench-verified"
taskset = { id = "swebench-verified-v1", use_prime_registry = true }
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] } }
timeout = { rollout = 3600 }
[inference]
enable_expert_parallel = true
enable_return_routed_experts = true
# vLLM disables prefix caching by default for hybrid-Mamba models; SWE turns share long prefixes.
enable_prefix_caching = true
[inference.model]
max_model_len = 131072
[inference.parallel]
tp = 8
@@ -32,16 +32,13 @@ freq = 1
[orchestrator]
batch_size = 512
rollouts_per_example = 16
group_size = 16
max_off_policy_steps = 32
[[orchestrator.train.env]]
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } }, min_tier = 1 }
harness = { id = "null", runtime = { type = "modal" } }
[orchestrator.train.env.args]
min_tier = 1
[inference]
gpu_memory_utilization = 0.85
Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

-5
View File
@@ -1,5 +0,0 @@
# Usage: uv run rl @ examples/alphabet_sort/rl.toml @ examples/alphabet_sort/slurm_rl.toml
output_dir = "outputs/alphabet-sort"
[slurm]
job_name = "alphabet-sort"
@@ -38,12 +38,14 @@ uv run inference --enable-lora --model.name Qwen/Qwen3-4B-Instruct-2507
Evaluate the base model:
```bash
# In the `Trainer` pane
uv run vf-eval alphabet-sort-v1 \
uv run eval alphabet-sort-v1 --harness.id null \
-m Qwen/Qwen3-4B-Instruct-2507 \
-b http://localhost:8000/v1 \
--client.base-url http://localhost:8000/v1 \
-n 20 \
--max-tokens 768 \
--env-args '{"min_turns": 3, "max_turns": 3, "min_names_per_turn": 1, "max_names_per_turn": 4, "task": {"similarity_power": 8, "power_per_turn": false}}'
-r 3 \
--sampling.max-tokens 768 \
--args '{"min_turns": 3, "max_turns": 3, "min_names_per_turn": 1, "max_names_per_turn": 4, "task": {"similarity_power": 8, "power_per_turn": false}}' \
--no-push
```
We got an **average reward of ~0.26** across 20×3 rollouts. The model achieves **0% perfect attempts** (no rollouts score 1.0) and **0% perfect examples** (no examples have all 3 rollouts at 1.0). The model shows high variance and struggles on most examples, with the high similarity power (8) heavily penalizing even small errors, and the scores aren't different for most attempts.
@@ -86,12 +88,11 @@ The correct alphabetical order by last name should be: Akman, Cakir, Durgun. The
We train with LoRA (rank 32, alpha 64) for 100 steps.
![RL](rl.png)
*Check out the logs on [W&B](https://wandb.ai/primeintellect/alphabet-sort-4b-lora/workspace?nw=nwuserandrewpi).*
```bash
# In the `Trainer` pane
uv run rl @ examples/alphabet_sort/rl.toml \
uv run rl @ examples/basic/alphabet-sort/rl.toml \
--wandb.project ... \
--wandb.name ...
```
@@ -114,12 +115,14 @@ uv run inference --enable-lora --model.name PrimeIntellect/Qwen3-4B-Instruct-Alp
```bash
# In the `Trainer` pane
uv run vf-eval alphabet-sort-v1 \
uv run eval alphabet-sort-v1 --harness.id null \
-m PrimeIntellect/Qwen3-4B-Instruct-AlphabetSort-RL \
-b http://localhost:8000/v1 \
--client.base-url http://localhost:8000/v1 \
-n 20 \
--max-tokens 768 \
--env-args '{"min_turns": 3, "max_turns": 3, "min_names_per_turn": 1, "max_names_per_turn": 4, "task": {"similarity_power": 8, "power_per_turn": false}}'
-r 3 \
--sampling.max-tokens 768 \
--args '{"min_turns": 3, "max_turns": 3, "min_names_per_turn": 1, "max_names_per_turn": 4, "task": {"similarity_power": 8, "power_per_turn": false}}' \
--no-push
```
Way better! Our model now gets an **average reward of ~0.81** with **73% perfect attempts** (44/60 rollouts score 1.0) and **65% perfect examples** (13/20 examples have all 3 rollouts at 1.0).
@@ -25,8 +25,8 @@ alpha = 64
lr = 1e-5
[orchestrator]
batch_size = 512
group_size = 8
batch_size = 256
group_size = 16
[orchestrator.train.sampling]
max_completion_tokens = 768
@@ -11,15 +11,7 @@ Because our trainer is asynchronous, we perform only one gradient step per batch
Schedule training locally on a node with 8 GPUs
```bash
uv run rl @ examples/hendrycks_sanity/rl.toml \
--wandb.project your-project \
--wandb.name your-run
```
Or schedule the same training via SLURM
```bash
uv run rl @ examples/hendrycks_sanity/rl.toml @ examples/hendrycks_sanity/slurm_rl.toml \
uv run rl @ examples/basic/hendrycks-sanity/rl.toml \
--wandb.project your-project \
--wandb.name your-run
```
@@ -27,7 +27,7 @@ uv run inference --model.name Qwen/Qwen3-0.6B
```bash
# Run this in the `Trainer` pane
uv run vf-eval reverse-text-v1 -m Qwen/Qwen3-0.6B -b http://localhost:8000/v1 -n 20 --max-tokens 1024
uv run eval reverse-text-v1 --harness.id null -m Qwen/Qwen3-0.6B --client.base-url http://localhost:8000/v1 -n 20 -r 3 --sampling.max-tokens 1024 --no-push
```
This is of course just a quick vibe check and no full-fledged evaluation, but we can see that the model struggles with this task. In this specific instance, we got an **average reward of ~0.05** across the 20x3 rollouts. Let's do some training!
@@ -36,14 +36,13 @@ This is of course just a quick vibe check and no full-fledged evaluation, but we
We will fine-tune `PrimeIntellect/Qwen3-0.6B` ([HF](https://huggingface.co/PrimeIntellect/Qwen3-0.6B)), which is a clone of `Qwen/Qwen3-0.6B` ([HF](https://huggingface.co/Qwen/Qwen3-0.6B)) with a chat template suitable for multi-turn RL, on `willcb/R1-reverse-wikipedia-paragraphs-v1-1000` ([HF](https://huggingface.co/datasets/willcb/R1-reverse-wikipedia-paragraphs-v1-1000)) which contains 1K examples of reversals of small paragraphs.
![SFT](sft.png)
*Check out the logs of the SFT run on [W&B](https://wandb.ai/primeintellect/examples?nw=s3p14m48jod).*
To train on a single GPU, run
```bash
# In the `Trainer` pane
uv run sft @ examples/reverse_text/sft.toml \
uv run sft @ examples/basic/reverse-text/sft.toml \
--wandb.project ... \
--wandb.name ...
```
@@ -55,7 +54,7 @@ To train on multiple GPUs, run
uv run torchrun \
--local-ranks-filter 0 \
--nproc-per-node ... \
src/prime_rl/trainer/sft/train.py @ examples/reverse_text/sft/train.toml \
src/prime_rl/trainer/sft/train.py @ examples/basic/reverse-text/sft.toml \
--wandb.project ... \
--wandb.name ...
```
@@ -72,12 +71,11 @@ We have uploaded the final model as [`PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT
For the RL we will only do 20 steps at 8x16 rollouts, for a total batch size of 128 and sequence length 128. Because of the small context, training should be extremely quick.
![RL](rl.png)
*Check out the logs of the RL run on [W&B](https://wandb.ai/primeintellect/examples?nw=yxjwjc556do).*
```bash
# Run this in the `Trainer` pane
uv run rl @ examples/reverse_text/rl.toml \
uv run rl @ examples/basic/reverse-text/rl.toml \
--model.name ... \
--wandb.project ... \
--wandb.name ...
@@ -102,7 +100,7 @@ uv run inference --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL
```bash
# Run this in the `Trainer` pane
uv run vf-eval reverse-text-v1 -m PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL -b http://localhost:8000/v1 -n 20 --max-tokens 1024
uv run eval reverse-text-v1 --harness.id null -m PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL --client.base-url http://localhost:8000/v1 -n 20 -r 3 --sampling.max-tokens 1024 --no-push
```
Way better! Now we get an **average reward of ~0.8**.
@@ -133,7 +131,7 @@ Exec into the trainer pod and run SFT:
```bash
kubectl exec -it my-exp-trainer-0 -- bash
uv run sft @ /app/examples/reverse_text/sft.toml --output-dir /data/outputs
uv run sft @ /app/examples/basic/reverse-text/sft.toml --output-dir /data/outputs
# This will save checkpoints to /data/outputs/weights/step_100
```
@@ -180,15 +178,15 @@ If you prefer to run RL components manually, keep `autoStart: false` and exec in
```bash
# Terminal 1 - Inference
kubectl exec -it my-exp-inference-0 -- bash
uv run inference @ /app/examples/reverse_text/rl/infer.toml
uv run inference @ /app/k8s/prime-rl/examples/reverse-text/infer.toml
# Terminal 2 - Orchestrator
kubectl exec -it my-exp-orchestrator-0 -- bash
uv run orchestrator @ /app/examples/reverse_text/rl/orch.toml --output-dir /data/outputs --client.base-url '["'$INFERENCE_URL'"]'
uv run orchestrator @ /app/k8s/prime-rl/examples/reverse-text/orch.toml --output-dir /data/outputs --client.base-url '["'$INFERENCE_URL'"]'
# Terminal 3 - Trainer
kubectl exec -it my-exp-trainer-0 -- bash
uv run trainer @ /app/examples/reverse_text/rl/train.toml --output-dir /data/outputs
uv run trainer @ /app/k8s/prime-rl/examples/reverse-text/train.toml --output-dir /data/outputs
```
### Access Outputs and Checkpoints
@@ -215,10 +213,10 @@ kubectl exec -it my-exp-inference-0 -- bash
uv run inference --model.name /data/outputs/weights/step_20
# Back in trainer pod, run evaluation
uv run vf-eval reverse-text-v1 \
uv run eval reverse-text-v1 --harness.id null \
-m /data/outputs/weights/step_20 \
-b $INFERENCE_URL \
-n 20 --max-tokens 1024
--client.base-url $INFERENCE_URL \
-n 20 -r 3 --sampling.max-tokens 1024 --no-push
```
### Clean Up
@@ -236,4 +234,4 @@ kubectl delete pvc prime-rl-shared-data
- Kubernetes services for component communication
- Auto-start capability with proper networking configured
See the [K8s deployment guide](../../k8s/README.md) for more details on scaling, distributed training, and advanced configurations.
See the [K8s deployment guide](../../../k8s/README.md) for more details on scaling, distributed training, and advanced configurations.
@@ -27,6 +27,7 @@ lr = 3e-6
[inference]
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
# suffix misses the MODEL_RENDERER_MAP exact match).
[orchestrator.renderer]
name = "default"
name = "prime-qwen3"
@@ -1,6 +1,6 @@
# Wiki Search
In this example, we demonstrate how to train `Qwen3-4B-Instruct-2507` to answer trivia questions by searching through a Wikipedia corpus using multi-turn tool use. This example highlights several key features of PRIME-RL and verifiers environment features:
In this example, we demonstrate how to train `Qwen3-4B-Instruct-2507` to answer trivia questions by searching through a Wikipedia corpus using multi-turn tool use. This example highlights several key features of prime-rl and verifiers environment features:
- **Single-file configuration**: All training settings (trainer, orchestrator, and inference) are specified in a single `rl.toml` file
- **LoRA training**: Efficient fine-tuning using LoRA (Low-Rank Adaptation) on attention and MLP layers
@@ -70,18 +70,20 @@ Start the inference server:
```bash
# In the `Inference` pane
uv run inference --enable-lora --model.name Qwen/Qwen3-4B-Instruct-2507 --model.enable_auto_tool_choice --model.tool_call_parser hermes
uv run inference --enable-lora --model.name Qwen/Qwen3-4B-Instruct-2507 --model.tool_call_parser hermes
```
Evaluate the base model:
```bash
# In the `Trainer` pane
uv run vf-eval wiki-search-v1 \
uv run eval wiki-search-v1 --harness.id null \
-m Qwen/Qwen3-4B-Instruct-2507 \
-b http://localhost:8000/v1 \
--client.base-url http://localhost:8000/v1 \
-n 20 \
--max-tokens 512
-r 3 \
--sampling.max-tokens 512 \
--no-push
```
## RL Training
@@ -90,7 +92,7 @@ Train with the unified config file:
```bash
# In the `Trainer` pane
uv run rl @ examples/wiki_search/rl.toml \
uv run rl @ examples/basic/wiki-search/rl.toml \
--wandb.project your-project-name \
--wandb.name your-run-name
```
@@ -112,16 +114,18 @@ Evaluate your trained model:
```bash
# In the `Inference` pane
uv run inference --enable-lora --model.name <user>/Qwen3-4B-Instruct-WikiSearch-RL --inference.model.enable_auto_tool_choice true --inference.model.tool_call_parser hermes
uv run inference --enable-lora --model.name <user>/Qwen3-4B-Instruct-WikiSearch-RL --model.tool_call_parser hermes
```
```bash
# In the `Trainer` pane
uv run vf-eval wiki-search-v1 \
uv run eval wiki-search-v1 --harness.id null \
-m <user>/Qwen3-4B-Instruct-WikiSearch-RL \
-b http://localhost:8000/v1 \
--client.base-url http://localhost:8000/v1 \
-n 20 \
--max-tokens 512
-r 3 \
--sampling.max-tokens 512 \
--no-push
```
## Taskset Configuration
@@ -25,11 +25,11 @@ Before training, we want to get a baseline score and test how well `Qwen3-1.7B`
uv run inference --model.name Qwen/Qwen3-1.7B
```
Then, use the `vf-eval` entrypoint to evaluate the model in the `wordle` environment. We evaluate on the 20 evaluation examples which are distinct words not appearing in the training set of the environment. We constrain the response length to 1024 tokens as this should be more than enough to play a full game.
Then, use the `eval` entrypoint to evaluate the model in the `wordle` environment. We evaluate on the 20 evaluation examples which are distinct words not appearing in the training set of the environment. We constrain the response length to 1024 tokens as this should be more than enough to play a full game.
```bash
# Run this in the `Trainer` pane
uv run vf-eval wordle-v1 -m Qwen/Qwen3-1.7B -b http://localhost:8000/v1 -n 20 -t 1024
uv run eval wordle-v1 --harness.id null -m Qwen/Qwen3-1.7B --client.base-url http://localhost:8000/v1 -n 20 -r 3 --sampling.max-tokens 1024 --no-push
```
We got an **average reward of ~0.2** across the 20x3 rollouts. From the summary, we can see that the most of the reward is coming from format and partial rewards. In fact, the model does not guess the correct word within any game, leading to a win rate of **0%**. Looking at some samples, it is evident repeatedly submitting guesses in the wrong format and is not able to revise its strategy from the environment feedback. Let's do some SFT warmup to get the model to learn the format of the environment.
@@ -38,14 +38,13 @@ We got an **average reward of ~0.2** across the 20x3 rollouts. From the summary,
We will fine-tune `PrimeIntellect/Qwen3-1.7B` ([HF](https://huggingface.co/PrimeIntellect/Qwen3-1.7B)), which is a clone of `Qwen/Qwen3-1.7B` ([HF](https://huggingface.co/Qwen/Qwen3-1.7B)) with a chat template suitable for multi-turn RL, on `willcb/V3-wordle` ([HF](https://huggingface.co/datasets/willcb/V3-wordle)). It is a multi-SFT dataset with traces of Wordle games from the environment. A few steps should be enough to get the model to learn the expected response format of the environment.
![SFT](sft.png)
*Check out the logs of the SFT run on [W&B](https://wandb.ai/primeintellect/examples?nw=h8yesgpmst).*
To train on a single GPU, run
```bash
# In the `Trainer` pane
uv run sft @ examples/wordle/sft.toml \
uv run sft @ examples/basic/wordle/sft.toml \
--wandb.project ... \
--wandb.name ...
```
@@ -57,7 +56,7 @@ To train on multiple GPUs, run
uv run torchrun \
--local-ranks-filter 0 \
--nproc-per-node ... \
src/prime_rl/trainer/sft/train.py @ examples/wordle/sft.toml \
src/prime_rl/trainer/sft/train.py @ examples/basic/wordle/sft.toml \
--wandb.project ... \
--wandb.name ...
```
@@ -72,15 +71,14 @@ We have uploaded the final model as [`PrimeIntellect/Qwen3-1.7B-Wordle-SFT`](htt
## RL
Finally, we will do multi-turn RL against the `wordle` environment using the model `PrimeIntellect/Qwen3-1.7B-Wordle-SFT` ([HF](https://huggingface.co/PrimeIntellect/Qwen3-1.7B-Wordle-SFT)), we obtained from the SFT warmup. We will do sizable RL training, with 100 training steps, each generating training batches of 64x16 rollouts, for a total batch size of 1024, at a context length of 4096.
Finally, we will do multi-turn RL against the `wordle` environment using the model `PrimeIntellect/Qwen3-1.7B-Wordle-SFT` ([HF](https://huggingface.co/PrimeIntellect/Qwen3-1.7B-Wordle-SFT)), we obtained from the SFT warmup. We will do sizable RL training, with 100 training steps, each generating training batches of 32x16 rollouts, for a total batch size of 512, at a context length of 4096.
![RL](rl.png)
*Check out the logs of the RL run on [W&B](https://wandb.ai/primeintellect/examples?nw=2isof8knxo5).*
```bash
# Run this in the `Trainer` pane
uv run rl @ examples/wordle/rl.toml \
uv run rl @ examples/basic/wordle/rl.toml \
--model.name ... \
--wandb.project ... \
--wandb.name ...
@@ -105,7 +103,7 @@ uv run inference --model.name PrimeIntellect/Qwen3-1.7B-Wordle-RL
```bash
# Run this in the `Trainer` pane
uv run vf-eval wordle-v1 -m PrimeIntellect/Qwen3-1.7B-Wordle-RL -b http://localhost:8000/v1 -n 20 --max-tokens 1024
uv run eval wordle-v1 --harness.id null -m PrimeIntellect/Qwen3-1.7B-Wordle-RL --client.base-url http://localhost:8000/v1 -n 20 -r 3 --sampling.max-tokens 1024 --no-push
```
Way better! Our model now wins **~60%** and gets an average reward of **~1.5**.

Some files were not shown because too many files have changed in this diff Show More