The environment hosting entrypoint launches a broker and a pool of episode workers. Calling that unit an "env server" obscures the source → pool replica → broker/workers hierarchy. This follow-up to #4375 names those roles consistently. - Rename the command to `uv run env-worker-pool`, its schema to `EnvWorkerPoolConfig` in `prime_rl.configs.env_worker_pool`, and the orchestrator field to `env_worker_pool_replicas`. - Rename `EnvServerPool` to `EnvWorkerPool`, `EnvServer` to `EnvWorker` in `prime_rl.env.worker`, and `serve_env` to `run_env_worker_pool`. Process titles distinguish `PRL::EnvBroker` and `PRL::EnvWorker`. - Update the RL/eval launchers, the shared SFT/pretrain launcher, SLURM templates, config helpers, CI paths, dashboard text, docs, and the affected skills. Document per-source configuration, pool replicas, and worker concurrency. - Anchor the root virtualenv ignore rule so it does not hide `src/prime_rl/env/` on case-insensitive filesystems. `[serve]`, the wire protocol, pool sizing/dispatch behavior, and run artifact paths are unchanged. This is a naming change; direct worker-to-sink data delivery remains separate work. ## Breaking names | Before | After | | --- | --- | | `env-server` | `env-worker-pool` | | `prime_rl.configs.env_server.EnvServerConfig` | `prime_rl.configs.env_worker_pool.EnvWorkerPoolConfig` | | `OrchestratorConfig.env_server_replicas` | `OrchestratorConfig.env_worker_pool_replicas` | | `prime_rl.env.pool.EnvServerPool` | `prime_rl.env.pool.EnvWorkerPool` | | `prime_rl.env.server.EnvServer` | `prime_rl.env.worker.EnvWorker` | | `prime_rl.env.serve_env` | `prime_rl.env.run_env_worker_pool` | | `EnvClient.wait_for_server_startup` | `EnvClient.wait_for_pool_startup` | ## Validation - 447 focused CPU tests passed (env, configs, supported orchestrator/eval/transport tests, dashboard artifacts and pathing); four cases deselected. Tests requiring unavailable `torch`, `vllm`, and TextArena dependencies were excluded. - Temporary smoke script exercised static pools with 1/2 workers and elastic pools capped at 1/unbounded: address discovery, task/error round-trip through the broker and worker, process titles, graceful shutdown, and IPC cleanup all passed. The smoke env deliberately raises an episode error; it does not call inference. - Both wheels build; wheel contents and the renamed console entrypoint verified. Entrypoint help, touched TOML parsing, Ruff, and `pre-commit run --all-files` pass. - The deep-backlog ZMQ test timed out after 18 seconds on both unchanged base `c0ad9e9f4` and this branch, so it was deselected. No GPU training run. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Breaking renames span the CLI, Python imports, and orchestrator config fields; behavior is unchanged but existing scripts and TOML must be updated. > > **Overview** > Renames the environment-hosting stack so **source → broker → workers** is explicit: the CLI becomes **`uv run env-worker-pool`**, config schema **`EnvWorkerPoolConfig`** (`prime_rl.configs.env_worker_pool`), and orchestrator **`env_worker_pool_replicas`** replace the old `env-server` / `EnvServerConfig` / `env_server_replicas` names. > > Runtime symbols align with that model—**`EnvWorkerPool`**, **`EnvWorker`**, **`run_env_worker_pool`**, broker/worker process titles (**`PRL::EnvBroker`** / **`PRL::EnvWorker`**), and **`EnvClient.wait_for_pool_startup`**. RL/SFT/eval launchers, SLURM templates, pathing helpers, CI filters, dashboard copy, docs, and skills are updated to match; **`[serve]`**, the ZMQ wire protocol, and artifact paths stay the same. > > **.gitignore** anchors **`/ENV/`** so a root `ENV` venv directory is not confused with **`src/prime_rl/env/`** on case-insensitive filesystems. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 47c74d92f30d54524ad2e0c79ae1dae0e42def31. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Qwen3-30B-A3B
RL on the 30B-A3B MoE across three domains: math, SWE, and agentic tool use. The Thinking checkpoint trains math and SWE; the tool config trains the Instruct checkpoint with colocated tools on Prime Intellect Sandboxes. All configs use the custom MoE trainer implementation with expert parallelism (ep = 8), the AdamW optimizer, NCCL weight broadcast, and W&B logging. swe.toml adds cp = 2 context parallelism for its 131k context; the other two run at 32k.
| Config | Trains on | Evals on | Runtime | Topology |
|---|---|---|---|---|
math.toml |
i3_math |
aime2025 (every 25 steps) |
subprocess — runs locally, no sandbox |
2 train + 2 infer nodes |
swe.toml |
r2e-gym (bash harness) |
swebench-verified (every 25 steps) |
sandbox (Prime Intellect by default) | 2 train + 2 infer nodes |
tool.toml |
general-agent (colocated tools) |
— | prime |
1 train + 1 infer node |
sft/h200/ |
SFT on PrimeIntellect/INTELLECT-3-SFT-10K (math) |
— | — | 2 train nodes |
tool.toml is the odd one out: 400 steps, group_size = 16, checkpoints every 50 steps with keep_last = 1, and inference at dp = 2 / tp = 4. math.toml and swe.toml run 512-task batches with checkpoints every 100 steps.
Requirements
- A Slurm cluster with 8-GPU nodes and a shared filesystem. This guide assumes the shared filesystem is mounted at
/shared— adjust to your own path. - Sandboxes (
swe.tomlandtool.toml) — these agents run in Prime Intellect Sandboxes. Install theprimeCLI separately and log in:
uv tool install prime
prime login # or: prime config set-api-key <your-key>
To run on your own infrastructure instead, swap env.agent.runtime on the source for a runtime your environments support (e.g. a local Docker backend).
-
Environment variables, exported in the shell you launch from — the launcher passes its environment to every component:
WANDB_API_KEY— every config logs to W&B ([monitors.wandb]).HF_TOKEN— optional; the Qwen checkpoints are public, but a token avoids rate limits.
math.toml needs none of the above beyond W&B: its agents run as local subprocesses in the env workers.
Setup
Clone prime-rl onto the shared filesystem and install everything, including the environments — they are opt-in uv workspace members, so --all-packages is required:
git clone https://github.com/PrimeIntellect-ai/prime-rl.git /shared/prime-rl
cd /shared/prime-rl
git submodule update --init -- deps/verifiers deps/renderers deps/prime-envs deps/pydantic-config
uv sync --all-extras --all-packages
Tweak before launching
- None of the configs set a
[slurm] partition— sbatch picks your cluster default. Override with--slurm.partition <your-partition>. --output-dirdefaults tooutputs/next to the checkout; on a cluster, point it at the shared filesystem.- Validate the full config without submitting a job by appending
--dry-run: it writes<run_dir>/launcher/rl.sbatchplus the resolved per-process configs, and exits.
Start the run
The rl entrypoint submits an sbatch job whenever the config has a [slurm] table — there is no separate launcher. From the shared checkout:
uv run rl @ examples/advanced/qwen3-30b-a3b/math.toml \
--output-dir /shared/outputs/qwen30b \
--run.name qwen30b-math
Swap math.toml for swe.toml or tool.toml to run the other domains. Pass --run.name: the run directory is <output_dir>/<run_name> and you need a stable name to resume later (unset, it auto-generates as <envs>--<model>--<short-id>).
Monitor with the dashboard
Start the local run dashboard on the head node — it only reads the run directories, so it is safe to point at a live run while the job is training:
uv run dashboard /shared/outputs/qwen30b # serves http://localhost:7788
If the head node is remote, forward the port from your laptop and open http://localhost:7788 in a browser:
ssh -L 7788:localhost:7788 <head-node>
Pick the run and you get five views:
- Metrics — the W&B-style overview, read from the run's
metrics.jsonl. Watchreward/{all,env}/meantrend upward over steps, andseq_len/*+is_truncated/*for rollout health. - Configs — the launch TOML next to the merged, resolved per-process configs the run actually started with.
- Trace — a per-episode rollout viewer with per-token overlays (advantage, entropy, sampling mismatch, loss/content masks), showing the transcript, a wall-clock timeline of the rollout, a terminal replay of model and tool activity, and a semantic graph of the model-call chain.
- Logs — the merged component logs (trainer, orchestrator, inference), also on disk under
<run_dir>/logs/. - Reports — markdown reports written to
<run_dir>/reports/, if any tooling produces them.
Pass several output directories to track parallel experiments side by side (uv run dashboard /shared/outputs/a /shared/outputs/b); a taken port automatically bumps to the next free one. SLURM stdout/stderr and the generated sbatch script land in <run_dir>/launcher/.
Checkpoint, resume, export
Checkpoints land in <run_dir>/checkpoints/step_<N> — every 100 steps for math.toml/swe.toml, every 50 steps (keep_last = 1) for tool.toml. To resume, re-run the same command with --resume (latest checkpoint) or --resume.step <N>, the same --run.name / --output-dir, and a --max-steps at least the target final step:
uv run rl @ examples/advanced/qwen3-30b-a3b/math.toml \
--output-dir /shared/outputs/qwen30b \
--run.name qwen30b-math \
--resume --max-steps 1000
Trainer checkpoints are DCP-sharded; export HF-format weights with:
uv run python tools/convert_dcp_to_bf16.py /shared/outputs/qwen30b/qwen30b-math/checkpoints/step_100
See Training for the full knobs and metrics reference, and Scaling for SLURM and multi-node details.
SFT
The SFT configs live under sft/h200/. They are tuned for two 8-GPU H200 nodes and train only (no inference nodes). Combine the base config with a data overlay:
uv run sft @ examples/advanced/qwen3-30b-a3b/sft/h200/base.toml @ examples/advanced/qwen3-30b-a3b/sft/h200/math-10k.toml \
--output-dir /shared/outputs/qwen30b \
--run.name qwen30b-sft-math
This starts an SFT run with the following setup:
- The model is
Qwen/Qwen3-30B-A3B-Instruct-2507, trained with the custom MoE implementation, expert parallelism (ep = 8), full activation checkpointing with offloading, and AdamW. - The data is
PrimeIntellect/INTELLECT-3-SFT-10K(math split), at a 32k sequence length with a batch of 16 samples per step.
For a fake-data dry run, add fake.toml instead of the data overlay. base.toml sets [slurm] partition = "all" and HF_HOME = "/home/huggingface". Change both to match your cluster. For longer contexts, raise data.seq_len and set model.cp to split each sequence across GPUs. You can monitor the SFT run with the same dashboard.