Repository navigation
fix: give every process its own complete component config - #4909
Merged
Merged
Conversation
This was referenced Dec 2, 2026
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 2, 2026 22:05
a3d5f43 to
2d30c55
Compare
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 2, 2026 22:33
a647625 to
787e6f2
Compare
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 2, 2026 22:48
787e6f2 to
c96a100
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c47fe38. Configure here.
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 3, 2026 00:15
c47fe38 to
55882f3
Compare
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 3, 2026 00:47
55882f3 to
c4c2bb2
Compare
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 3, 2026 01:13
16752ca to
bf1358c
Compare
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 3, 2026 01:45
f5ac012 to
a2c9615
Compare
This was referenced Dec 3, 2026
Every entrypoint now gives the config of each process it launches through one API: components() returns the built configs, keyed by the JSON file stem, and placement() says where each runs under the same keys. dump_components() dumps them whole, with no excludes. The local, SLURM and external launchers all use it, so the per-process JSON is the same for every launcher. - InferenceConfig no longer subclasses EngineConfig. The engine and router configs come from engine_config(role=...) and router_config(). The P/D role logic moves from for_pd_role into engine_config. - RouterConfig is strict and holds only what vllm-router reads. The local launchers run the router and engine as separate processes. - The SFT and pretrain trainer configs move to configs/components with a SupervisedTrainerSection. The trainer reads a trainer.json without launch fields. - Files: inference.json -> engine.json (engine-<role>.json under P/D), eval.json -> online-eval.json, new router.json. <entrypoint>.json is a full dump; the single-node SLURM relaunch overrides slurm, dry_run and clean. - Env worker pools are keyed envs/<split>/<source> in components() and in PRL_ENV_ADDRESSES. - The SFT check that an in-memory weight broadcast needs inference moves from the launcher into SFTConfig. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The k8s operator ran the server with the trainer's JSON, so its config had to ignore unknown keys. components() now emits a modelexpress-server config (port and log dir) with a CPU-only placement whenever the run starts its own server, and the config rejects unknown keys like every other component. The local launchers take the port from the same builder. The operator must pass --port and --log-dir (or the new JSON) instead of trainer.json; the old config already accepts both flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The public [weight_broadcast] of rl and sft no longer takes the NCCL host or inference_world_size. Both were launcher-filled: validators wrote inference_world_size into the section, and the NCCL host was "localhost" except on the multi-node trainer. The process configs (WeightBroadcastConfig) still carry both fields. The builders fill them from the deployment, so trainer.json and orchestrator.json are complete before allocation. The multi-node sft trainer now reads host 0.0.0.0 from its JSON, so the sbatch drops the flag. Host-dependent flags ($MASTER_ADDR, the ModelExpress host) stay on the command line. ModelExpress keeps its public host: it names a server that the run does not start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EngineConfig took three flat P/D fields (use_pd_kv_transfer, pd_decode_blocks_ttl_s, pd_spill_to_store) that only the launcher sets. One pd_kv_transfer sub-config replaces them. It holds the deployment's bidirectional_kv_transfer, and only engine_config(role=) sets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launchers still changed component configs after components(): write_component_configs filled the env pools' address_file and made their output_dir absolute, the sft launcher swapped in an online-eval config with a resolved resume_step, the local launchers passed --server.require-admin-token and the attempt log dir, and the multi-node sbatch scripts built the vllm-router command from template variables instead of router.json. Now each JSON is the whole config that its process reads: - The rl and sft engine builders set server.require_admin_token. - The online-eval config carries the trainer's resume and checkpoint root. The process resolves its resume step at start. The trainer blocks in its startup broadcast until online-eval receives it, so it cannot add a checkpoint first. A resume_step from an external launcher (eval-resume.json) still takes precedence. - The ModelExpress server config keeps the run's log dir. - The multi-node scripts run `router @ router.json` and pass only the engine URLs (--worker-urls, or --prefill-urls and --decode-urls). Host- and attempt-dependent wiring stays on the command line at process start: the env pools' --address-file, the attempt log dir of a local ModelExpress server, and the engine URLs. The env pools' output_dir stays relative: set_save_root resolves it in each process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 3, 2026 03:29
1f4679c to
1704303
Compare
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
mikasenghaas
changed the base branch from
feat/engine-component
to
feat/public-internal-configs
December 3, 2026 03:30
The disaggregated engine_config validated one EngineConfig with the section's kv_cache_offload and hisparse, then set the role's values. Native offload on prefill with HiSparse on decode then failed at resolve, though main accepts it. Pass the role's kv_cache_offload and hisparse into the build so the validators see the final values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mikasenghaas
force-pushed
the
fix/config-overrides
branch
from
December 3, 2026 03:36
1704303 to
c86c474
Compare
cabrinha
approved these changes
Dec 3, 2026
skpulipaka26
approved these changes
Dec 3, 2026
skpulipaka26
left a comment
Contributor
There was a problem hiding this comment.
LGTM from the Model Factory / operator side. Prod and develop are pinned on v0.11.1.dev123 so no import-path shims are needed here; we will follow up with dual-compatible updates in model-factory-iac, platform, and prime CLI before bumping RL_FFT_DEFAULT_IMAGE_TAG.
mikasenghaas
added a commit
that referenced
this pull request
Dec 3, 2026
…#4899) ## Summary **Why.** rl and sft compose several processes, and they nested each process's whole config. Users could set keys that the launcher always fills or that no process reads, e.g. `trainer.output_dir` next to the top-level `output_dir`, or `inference.slurm` next to `[slurm]`. Some of these values were silently overwritten. A single-node `orchestrator.env_worker_pool_replicas` hung the run. `uv run inference` had the same mix: it was both the public entrypoint and the bare engine that each SLURM rank ran. **Idea.** Separate what users write from what a process reads, in the package and in the classes: ``` configs/entrypoints/ RLConfig, SFTConfig, PretrainConfig, EvalConfig, InferenceConfig (EntrypointConfig) configs/components/ TrainerConfig, OrchestratorConfig, EngineConfig, RouterConfig, ... (ComponentConfig) section (user writes) component config (process reads) filled by the entrypoint TrainerSection TrainerConfig + output_dir, weight_broadcast OrchestratorSection OrchestratorConfig + output_dir, weight_broadcast, env_worker_pool_replicas EngineSection EngineConfig + weight_broadcast ``` An entrypoint nests only sections. A component config extends its section with the launcher-filled fields, so the two cannot drift. A builder per process (`RLConfig.trainer_config()`, `orchestrator_config()`, ...) validates the component config from the section plus the entrypoint's values. Example: `TrainerConfig.output_dir` comes from `RLConfig.output_dir / run.name`. - `EngineConfig` is what one engine process reads. A new `engine` script serves it without a router, and the SLURM ranks run `uv run engine` with engine-only JSON. `InferenceConfig` stays the public entrypoint. - Keys that no process reads go: the sft `[eval]` run fields, `log.interval` and `log.log_data` where no loop reads them, and the rl shared `[monitors.wandb] offline`. `inference.backend_port` follows `server.port + 100` unless set. - `test_config_layout` checks that each script parses the config of its role, and that components never import entrypoints. The package README states the config rules. - Next in the stack: every process gets its own complete JSON (#4909), the package layout (#4919), and resolving each value in one place (#4928). ## Breaking Remove these keys. Each now fails as an unknown key: - rl: `trainer.output_dir`, `trainer.weight_broadcast`, `orchestrator.output_dir`, `orchestrator.weight_broadcast` (set `output_dir`, `run.name` and `[weight_broadcast]`), `orchestrator.env_worker_pool_replicas`, `inference.weight_broadcast`, `inference.slurm` (set `[slurm]`), `inference.output_dir`, `inference.dry_run`, `inference.use_pd_kv_transfer`, `inference.pd_decode_blocks_ttl_s`, `inference.pd_spill_to_store`, `[monitors.wandb] offline` (set it on `trainer` and `orchestrator`). - sft: `inference.weight_broadcast`, `inference.deployment`, `inference.slurm`, `inference.output_dir`, `inference.dry_run`, the three `inference.pd_*` keys, and `[eval]` `model`, `weight_broadcast`, `broadcasts_dir`, `max_steps`, `resume_step`, `output_dir`, `log`, `monitors`. - All entrypoints: `log.interval` outside the orchestrator, eval and online-eval logs; `log.log_data` outside the sft trainer log. These values now fail with an error that names the fix: an explicit single-node `inference.vllm.data_parallel_size` that does not fill `deployment.num_infer_gpus`, and `inference.vllm.max_lora_rank` below the LoRA rank. Import paths change, with no aliases: | Old | New | |---|---| | `prime_rl.configs.{rl,sft,pretrain,supervised,eval}` | `prime_rl.configs.entrypoints.{...}` | | `prime_rl.configs.{trainer,orchestrator,env_worker_pool,router}` | `prime_rl.configs.components.{...}` | | `prime_rl.configs.inference.InferenceConfig` | `prime_rl.configs.entrypoints.inference` | | `prime_rl.configs.inference.*` (engine blocks), `setup_dummy_load` | `prime_rl.configs.components.engine` | | `prime_rl.configs.diff` | `prime_rl.utils.diff` | | `prime_rl.entrypoints.{trainer,orchestrator,env_worker_pool,router}` | `prime_rl.components.{...}` | | `apply_multi_node_dp_env` (`prime_rl.entrypoints.inference`) | `prime_rl.components.engine` | | `RouterEntrypointConfig` / `RouterConfig` (backend union) | `RouterConfig` / `RouterBackendConfig` | Python API: `RLConfig.trainer`, `.orchestrator` and `.inference` are sections. Call the builder for a filled field, e.g. `config.trainer_config().output_dir`. Outside prime-rl, the `prime` CLI's schema worker and the k8s operator's engine render (`run_engine.py`) import the old paths. PrimeIntellect-ai/prime#1284 reads both. #4909 lists every launcher break of the stack. - **Custom SLURM templates.** The multi-node and P/D ranks now run `uv run engine @ "$CONFIG_PATH"` on engine-only JSON, which has no `router` key. A custom `slurm.template_path` copied from `main` that still runs `uv run inference @ "$CONFIG_PATH"` on each rank fails without an error: `InferenceConfig` then defaults to a vllm-router, so every rank starts its own router on `server.port` and moves its engine to `backend_port`. Migration: run `uv run engine` on the ranks, as `_launch_rank.sh.j2` does. ## Verification On 2569ff7, on macOS without torch or vllm: - **Launcher output.** I dry-ran the `rl`, `sft` and `inference` launchers for 103 cases: every checked-in config that loads, plus synthetic P/D, Mooncake, multi-node, single-node SLURM and sft online-eval cases. Against `main` (47f3ec3), every value a process reads is unchanged. The JSONs only lose the removed keys above (`log.interval`/`log.log_data`, `router`/`backend_port` in the per-rank files, the launcher-filled section fields in `rl.json` and `sft.json`). The sbatch scripts start the ranks with `uv run engine` in place of `uv run inference`. - **Engine ≡ routerless inference.** `test_engine_serves_per_rank_configs_like_a_routerless_inference` parses the multi-node and P/D per-rank JSON under `EngineConfig` and under `InferenceConfig --router None`, which the ranks ran before. Both give the same vLLM namespace, including `kv_transfer_config`. - **Tests.** The config, launch, router, resume, client, dynamo and algorithm tests: 879 passed. | Change removed | Result | | --- | --- | | `output_dir` back on `TrainerSection` | `test_entrypoints_reject_component_fields_their_launcher_fills`: `DID NOT RAISE` | | `env_worker_pool_replicas` back on `OrchestratorSection` | `DID NOT RAISE` (2 cases) | | `offline` back on the rl shared `[monitors.wandb]` | `DID NOT RAISE` | | engine-only fields in the per-rank JSON | `test_engine_serves_per_rank_configs_…`: `router: Extra inputs are not permitted` | | a component imports an entrypoint | `test_config_layout`: `components/router.py imports prime_rl.configs.entrypoints.rl` | These rows ran before the restack, on earlier commits of this branch and of the closed #4905. This PR keeps the code under test unchanged. No GPU run. ## Merge order Base of the stack: this PR → #4909 → #4919 → #4928. Rebase each onto `main` after a squash merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **High Risk** > This is a breaking public import and CLI layout change across the whole repo; external tools (e.g. Prime CLI, k8s operator) must adopt the new paths before merge/deploy. > > **Overview** > Reorganizes **`prime_rl.configs`** by role: **`entrypoints/`** for user-written configs (`RLConfig`, `SFTConfig`, `EvalConfig`, `InferenceConfig`, …) and **`components/`** for per-process configs (`TrainerConfig`, `OrchestratorConfig`, `RouterConfig`, `EnvWorkerPoolConfig`, online eval). Adds **`EntrypointConfig`** and **`ComponentConfig`** base markers; component configs now inherit **`ComponentConfig`**. > > Splits the former flat layout: **`EvalConfig`** moves to **`entrypoints/eval`**; inference is split into **`entrypoints/inference`** (public **`InferenceConfig`**) plus **`components/engine`** (vLLM, deployment, KV offload) and **`components/router`** (router backends). **`Live` / diff utilities** move from **`prime_rl.configs.diff`** to **`prime_rl.utils.diff`**. **`RouterEntrypointConfig`** becomes **`RouterConfig`**; the old router backend union is **`RouterBackendConfig`**. > > **`uv run`** script entrypoints for **`trainer`**, **`orchestrator`**, **`router`**, and **`env-worker-pool`** now target **`prime_rl.components.*`** instead of **`prime_rl.entrypoints.*`**. CI slim-import checks, docs, and skills are updated to the new import paths. **All old `prime_rl.configs.{rl,trainer,inference,...}` import paths are removed** (no aliases). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ab4c7ee. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mikasenghaas
added a commit
that referenced
this pull request
Dec 3, 2026
…ks (#4919) ## Summary **Why.** After #4899 and #4909 the configs split by who writes them, but the modules still mix concerns. `components/trainer.py` holds the model, MoE, optimizer, loss, data and checkpoint configs. `shared.py` holds ten unrelated blocks. Two `ModelConfig` and two `CheckpointConfig` classes exist. Config logic also sits outside the package: `utils/validation.py` holds the rl shared-field table, and `utils/config.py` mixes config helpers with CLI helpers. A human or an agent cannot find a field from its TOML path. **Idea.** One layout, navigable by TOML path, and rules that tests enforce. The PR only moves code and adds docstrings: no field, default or launcher output changes. ``` prime_rl/configs/ base.py BaseConfig, EntrypointConfig, ComponentConfig, Placement, build_component_config, dump_components, dump_resolved_config, default_output_dir entrypoints/ rl, sft, pretrain, eval, inference, _supervised components/ trainer/ __init__ (TrainerSection, TrainerConfig), sft, pretrain, base, model, moe, optim, loss, data, ckpt orchestrator/ __init__ (OrchestratorSection, OrchestratorConfig), sources, sampling, curriculum, ckpt engine/ __init__ (EngineSection, EngineConfig), vllm, kv_cache, deployment router.py env_worker_pool.py online_eval.py modelexpress_server.py blocks/ weight_broadcast, deployment, slurm, monitors, log, client, run, ckpt, model, algorithm, length_penalty, transport ``` `[trainer.optim]` is in `components/trainer/optim.py`. `[orchestrator.train.source]` is in `components/orchestrator/sources.py`. `test_config_package_follows_its_rules` and `test_config_utils_hold_no_config_logic` enforce the [package README](https://github.com/PrimeIntellect-ai/prime-rl/blob/feat/configs-layout/packages/prime-rl-configs/README.md#package-layout) rules: 1. A module in `components/` defines at most one `ComponentConfig`, and each entry in `components/` defines one. No module outside `components/` defines one. 2. Each class name is unique in the package. 3. Imports go one way: `entrypoints` → `components` → `blocks` → `base`. 4. A module stays under about 400 lines (the test allows 450). `entrypoints/rl.py` is the one exception. 5. Each config class and each field has a docstring that says what it does, without repeating the type, the default or the bounds. 6. `prime_rl.utils` holds helpers that know no config (`cli`, the `mode` checks, config diffs, parser names) and imports nothing from `prime_rl.configs`. - Docstrings for 104 classes and 47 fields that had none. Docstrings that repeated a default are cut. - Review fixes: `InferenceConfig.components()` is typed `dict[str, ComponentConfig]`, `RLConfig.auto_setup_draft_swaps` moves below the fields (still the first `after` validator), and a stray TODO and two stale "per-node config" remarks go. ## Breaking Python import paths. Old paths fail with `ImportError`; there are no shims. | Old module (`prime_rl.configs.`) | New module (`prime_rl.configs.`) | | --- | --- | | `components.base`, `entrypoints.base` | `base` | | `shared` | `blocks.{ckpt,client,deployment,log,model,run,slurm,transport,weight_broadcast}` | | `algorithm`, `monitors` | `blocks.algorithm`, `blocks.monitors` | | `algorithm` (`LengthPenaltyConfig` and its variants) | `blocks.length_penalty` | | `components.trainer` | `components.trainer` (section, config) and `components.trainer.{base,ckpt,data,loss,model,moe,optim}` | | `components.sft_trainer`, `components.pretrain_trainer` | `components.trainer.sft`, `components.trainer.pretrain` (data configs in `components.trainer.data`) | | `components.supervised_trainer` | `components.trainer.base` | | `components.orchestrator` | `components.orchestrator` and `components.orchestrator.{ckpt,curriculum,sampling,sources}` | | `components.engine` | `components.engine` and `components.engine.{deployment,kv_cache,vllm}` | | `entrypoints.supervised` | `entrypoints._supervised` | `dump_components` and `build_component_config` move from `prime_rl.utils.config` to `prime_rl.configs.base`. `env_worker_pool_key` moves to `components.env_worker_pool`. `BaseConfig` is no longer re-exported from `prime_rl.utils.config`; import it from `prime_rl.configs.base`. `TokenizerConfig` moves to `blocks.model`. Class renames: | Old | New | | --- | --- | | trainer `ModelConfig`, `CheckpointConfig` | `TrainerModelConfig`, `TrainerCheckpointConfig` | | orchestrator `ModelConfig`, `CheckpointConfig` | `OrchestratorModelConfig`, `OrchestratorCheckpointConfig` | | engine `WeightBroadcastConfig` | `EngineWeightBroadcastConfig` | | rl `DeploymentConfig`, `SingleNodeDeploymentConfig`, `MultiNodeDeploymentConfig` | `RLDeploymentConfig`, `RLSingleNodeDeploymentConfig`, `RLMultiNodeDeploymentConfig` | | supervised `SingleNodeDeploymentConfig`, `MultiNodeDeploymentConfig` | `SupervisedSingleNodeDeploymentConfig`, `SupervisedMultiNodeDeploymentConfig` | Config helpers, also with no shims: | Old | New | | --- | --- | | `prime_rl.utils.validation.propagate_shared_fields` | `prime_rl.configs.entrypoints.rl.propagate_shared_fields` | | `prime_rl.utils.config.{dump_resolved_config,default_output_dir}` | `prime_rl.configs.base` | | `prime_rl.utils.config.resolve_client_roles` | `prime_rl.configs.blocks.client` | | `prime_rl.utils.config.{rgetattr,rsetattr}` | removed (unused) | `prime-rl-configs` declares `pydantic>=2.0.0` (was `>=1.10.13`; `prime-pydantic-config` already needs 2). TOML and CLI keys do not change. ## Verification On 92c8097, on macOS without torch or vllm: - **Launcher output.** I dry-ran the 103 launcher cases. Every written file is byte-identical to #4909 (c86c474), except one sbatch comment line in 11 P/D scripts ("per-node config" → "role's engine config"). - **Imports.** For every `from prime_rl.configs… import` and `from prime_rl.utils.config import` in the repo, the module defines each name. This covers `orchestrator.py` and `eval/online.py`, which need triton to import whole. The Slim-install CI check imports the moved helpers from their new paths. - **Schemas.** On the first layout commit, the JSON schemas of all 14 entrypoint and component configs matched #4909 except the `description` text (after inlining `$ref`s, because the renames change `$defs` names). - **Tests.** The config, launch, router, resume, client, dynamo, algorithm, model-source, control, dashboard and parser tests: 921 passed. The rule tests fail when a rule breaks: | Change made | Result | | --- | --- | | Second `ComponentConfig` in `components/router.py` | `components/router.py defines ['ExtraConfig', 'RouterConfig']` | | `ComponentConfig` in `blocks/log.py` | `blocks/log.py defines ['ExtraConfig'] outside components/` | | `RouterConfig` subclasses `BaseConfig` | `components/ entries without a component config: ['router']` | | Second `LoRAConfig` in `blocks/model.py` | `LoRAConfig is defined in prime_rl.configs.blocks.model and prime_rl.configs.components.trainer.model` | | `blocks/log.py` imports a component | `blocks/log.py (blocks) imports prime_rl.configs.components.router` | | `components/router.py` imports an entrypoint | `components/router.py (components) imports prime_rl.configs.entrypoints.eval` | | `blocks/algorithm.py` grows to 459 lines | `blocks/algorithm.py has 459 lines; split it along its TOML sub-tables` | | Docstring of `ModelExpressServerConfig.port` removed | `ModelExpressServerConfig lacks docstrings for ['port']` | | Docstring of `ModelExpressServerConfig` removed | `ModelExpressServerConfig lacks docstrings for ['<class>']` | | `utils/diff.py` imports `prime_rl.configs.base` | `diff.py imports ['prime_rl.configs.base']` | ## Merge order #4899 → #4909 → this PR → #4928. Rebase onto `main` after each squash merge. - PrimeIntellect-ai/prime#1284 reads `dump_components` from `prime_rl.configs.base`. Release it before hosted runs use an image with this PR. Its schema worker uses only the `prime_rl.utils.config` module by name, so the helper moves do not break it. - This PR adds no break for the k8s operator: the commands and modules it runs do not move. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Large-scale import and module moves with no compatibility shims; any missed consumer or downstream package still on old paths will fail at import time, though runtime config behavior is meant to be unchanged. > > **Overview** > Restructures **`prime-rl-configs`** so TOML paths map to modules: shared pieces live under **`blocks/`**, per-process configs under **`components/`** (with **`trainer/`**, **`orchestrator/`**, and **`engine/`** split into submodules instead of large single files), and user entrypoints stay in **`entrypoints/`**. **`base.py`** now owns **`BaseConfig`**, **`ComponentConfig`**, **`EntrypointConfig`**, **`build_component_config`**, **`dump_components`**, **`dump_resolved_config`**, and **`default_output_dir`** (moved out of **`prime_rl.utils.config`**). **`prime_rl.utils`** is no longer allowed to import config modules; **`propagate_shared_fields`** moves to **`entrypoints.rl`**. > > This is a **breaking** change for Python imports only: old paths like **`configs.shared`**, monolithic **`components.trainer`** / **`components.engine`** / **`components.orchestrator`**, and several renamed types (**`TrainerModelConfig`**, **`OrchestratorModelConfig`**, **`EngineWeightBroadcastConfig`**, RL/supervised deployment config renames) have **no shims**. Call sites across benchmarks, CI slim checks, docs, and **`pretrain/train`** are updated. **`pydantic>=2.0.0`** is declared explicitly; README documents layout rules enforced by tests. TOML/CLI keys and launcher JSON are intended to stay unchanged. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 92c8097. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mikasenghaas
added a commit
that referenced
this pull request
Dec 3, 2026
## Summary **Why.** After #4909, every process reads a complete component config. But the values in those configs were still resolved in many places: - `rl` copied run-level fields (`max_steps`, `resume`, `ckpt`, `monitors`, `rollout_transport`) into `[trainer]` and `[orchestrator]`, and then checked that the copies were equal. - Defaults applied only when a field was absent from `model_fields_set`. A resolved config counts every field as set, so parsing `rl.json` or `sft.json` again could build different components. - Builders set values on configs that were already validated, and those values skipped the validators. - Six code paths sized the engines' data parallelism and API servers, each with its own rules. - prime-rl read nine untyped vLLM pass-through keys with `getattr`. - P/D role settings reached a rank twice: from the engine JSON, and from the sbatch (`ROLE_EXTRA`, role env exports). - The `rl` and `sft` validators wrote derived values into the user's sections, so results depended on validator order. **Idea.** Resolve each value in one place, from values only, and validate it once: ``` user TOML ──► RLConfig (sections as written; validators only check) │ ├─ resolved_inference() LoRA, router replay, NVFP4, dummy load, │ sampling masks, engine_layout() ├─ orchestrator_config() draft swaps, score-centering logprobs, │ client URLs, metrics roles ▼ components() ──► built and validated once ──► cross-process checks (NVFP4, speculative logprobs) ``` - **Run-level fields** exist once, at the top level of `rl`. The builders pass them in, as they pass `output_dir`. A setting in such a block that only one process reads stays in that process's section: `[trainer.ckpt]` (`async_save`, `remote`, `skip_dataloader`, `skip_optimizer`), `[orchestrator.ckpt]` (`rollouts`, `rollouts_save_timeout`), `[orchestrator.monitors.file]` (`trace_sample`, `live`). The builders merge the two parts. - **Explicit "derive it" values.** `None`, or `"auto"` where `None` already has a meaning, replace the `model_fields_set` checks (14 → 0). A client keeps its default `base_url` until a launcher fills it, and the builders find that default by its value. - **Validate once.** The builders merge every value first and validate once. `copy_validated` replaces `model_copy(update=…)`. - **One layout function.** `engine_layout()` / `fit_engines()` in `components/engine/layout.py`. `data_parallel_size` and `api_server_count` default to `"auto"`. - **Typed vLLM fields.** `tokenizer`, `load_format`, `speculative_config`, `quantization_config`, `moe_backend`, `pipeline_parallel_size`, `headless` and `data_parallel_{start_rank,address}`. A `None` is not passed to vLLM. - **P/D role settings** come only from `engine-<role>.json`. The sbatch passes only host-dependent values (`data_parallel_address`, `data_parallel_rank`). - **Builders derive, validators check.** `rl.json` and `sft.json` keep what the user wrote. Checks that span processes run on the built configs. So a speculative draft in `decode_vllm_overrides` is checked like one on `[inference.vllm]`. - Out of scope: the top-level run fields (`run.name`, `weight_broadcast`, `deployment.num_infer_nodes`, `slurm.template_path`) are still filled by validators. ## Breaking - **Run-level fields of `rl`.** Each field now has one place: - `[trainer]` and `[orchestrator]` no longer take `max_steps`, `resume` or `rollout_transport`. Set them at the top level. - `[ckpt]` takes only what both processes share: `interval`, `keep_last`, `keep_interval`, `output_dir`. Move `interval` and the others out of `[trainer.ckpt]` and `[orchestrator.ckpt]` into `[ckpt]`. Move `rollouts` and `rollouts_save_timeout` from `[ckpt]` to `[orchestrator.ckpt]`, and `async_save` and `remote` from `[ckpt]` to `[trainer.ckpt]` (e.g. `--ckpt.rollouts` → `--orchestrator.ckpt.rollouts`). A `[trainer.ckpt]` or `[orchestrator.ckpt]` without `[ckpt]` raises. - `[monitors]` turns the monitors on for both processes. `[orchestrator.monitors]` takes only `file.trace_sample` and `file.live`, which leave the top-level `[monitors.file]`. - `SharedWandbConfig`, `SharedMonitorsConfig` and `SharedCheckpointConfig` are removed. `rl` rejects `monitors.wandb.offline = true`. - research-prod at 906b2e8d: `int4/rl/prod/rl.toml` must move `rollouts` and `rollouts_save_timeout` from `[ckpt]` to `[orchestrator.ckpt]`. Its other 112 configs that parse on `main` parse unchanged. - **`None` means "derive it".** To get the old result, set an explicit value: `kv_load_failure_policy = "fail"` under bidirectional P/D, explicit `inference_metrics_roles`, explicit `admin_base_url`. - **Engine layout.** An explicit `data_parallel_size` or `data_parallel_size_local` that does not fill the GPUs now raises on multi-node and P/D (before, it was kept). An explicit `api_server_count` stays, but under `nccl` or `modelexpress` weight broadcast it must not be below the engine's local data parallel ranks. A lower count now raises: vLLM then starts too few workers, and the weight transfer waits forever. `VllmConfig().data_parallel_size` and `.api_server_count` are `"auto"` until a layout resolves them. - **`max_lora_rank`.** An explicit `inference.vllm.max_lora_rank` larger than the trainer's LoRA rank now stays. Before, `rl` and `sft` replaced it with the trainer's rank, so vLLM now allocates the larger LoRA buffers. Remove the key to serve exactly the trainer's rank. A smaller value now raises. - **Typed vLLM keys.** A wrong type in one of the nine keys fails at resolve time instead of in vLLM. - **Derived values leave the sections.** `config.inference.vllm.enable_lora`, `.data_parallel_size`, `config.orchestrator.speculative_decoding`, the score-centering `sampling.logprobs` and the client URLs keep the user's values. Read the derived values from `engine_configs()`, `orchestrator_config()`, `online_eval_config()` or `resolved_inference()`. `rl.json` and `sft.json` now hold the user's values (e.g. `api_server_count = "auto"`); the component JSONs are unchanged. - **sbatch templates.** `inference.sbatch.j2` and `multi_node_rl.sbatch.j2` lose the template vars `prefill_env_vars`, `decode_env_vars`, `prefill_vllm_extra_json`, `decode_vllm_extra_json` and `prefill_deepep_high_throughput`. A custom template that uses them or `ROLE_EXTRA` breaks. A P/D role's `env_vars` now reach the engine only when it starts, not as a shell export before `uv run`. So they win over the per-rank `UCX_NET_DEVICES` pinning, and a variable that must exist before Python starts (e.g. `LD_PRELOAD`) no longer takes effect. - **Hosted runs: the `inference` component of PrimeIntellect-ai/prime#1284.** Its `legacy_inference` dumps the `[inference]` section, which now keeps the user's values. I ran the worker against #4919 and this PR. On this PR the hosted engine loses the derived `data_parallel_size` and `api_server_count` (they become `"auto"`, so the engine runs DP = 1 while `trainer.json` waits for N transfer workers), `enable_lora` and `max_lora_rank`, `enable_return_routed_experts`, `enable_return_sampling_mask` and `load_format = "dummy"`. The SFT online-eval split also loses the derived `client.admin_base_url`. Fix in the worker: dump `config.resolved_inference()` when the schema has it, and take the eval JSON from `dump_components(config)["online-eval"]`. - `InferenceSection.engine_config` takes `require_admin_token` before `role`. Pass `role=` by keyword. - **Builder errors.** A builder (`trainer_config()`, `engine_config()`, ...) that gets an invalid value raises `ValueError` (`The TrainerConfig that this config builds is invalid: <path>: <message>`), not the component's `ValidationError`. Entrypoint parsing still raises `ValidationError`. - No checked-in config changes. ## Verification On 3603799, on macOS without torch or vllm. CI runs the full unit suite. **End to end over every checked-in config.** I dry-ran the local and SLURM launchers for 104 cases. They cover every checked-in `rl`, `sft` and `inference` TOML and documented overlay stack, plus synthetic multi-node, P/D, SLURM and SFT online-eval cases. For each case, the script checks four things: 1. The entrypoint parses, as on `main`: 102 of 104 parse on `main` and on every PR of the stack. My script picks the wrong entrypoint for the other 2, so they skip on `main` too. 2. **Round trip.** The entrypoint's dump parses again to the same dump and the same `dump_components()`. 3. **Fixed point.** Each of the 402 component JSONs parses into its class and dumps unchanged. 4. **Per-process values** match the snapshot of #4919. | Tip | Entrypoint dump not a fixed point | Components change after re-parse | Component JSON not a fixed point | | --- | --- | --- | --- | | #4909 (c86c474) | 3 (SFT `vllm.tokenizer`) | 11 (SFT `vllm.tokenizer`, P/D prefill `kv_load_failure_policy` `recompute` → `None`) | 0 | | #4919 (92c8097) | 3 | 11 | 0 | | this PR (3603799) | 0 | 0 | 0 | - **Launcher output vs. #4919.** The dry-run JSON differs in key order and in these fields: - `trainer.json` and `orchestrator.json`: `monitors.file.float_decimals = 6` in the two `color-codeword` configs now reaches both processes (it was 4). - `engine.json`: the new typed vLLM keys at their defaults, and `data_parallel_size_local = 1` (was `null`) in `recipes/intellect-3.1` and `recipes/minimax-m2.5` (DP = 1, so vLLM behaves the same). - `rl.json`, `sft.json`: the user's values, as listed under Breaking, and in `rl.json` the component-only checkpoint and trace settings under `[trainer]` and `[orchestrator]`. The builder refactor leaves every component JSON and sbatch of #4919 byte-identical. - **P/D sbatch.** Before c165715, all 72 vLLM settings in `ROLE_EXTRA` and all 49 role env exports across the 11 P/D cases matched `engine-<role>.json`, with 0 mismatches. So dropping them from the sbatch leaves each rank's settings unchanged. - **Speculative drafts in P/D overrides.** `rl` now rejects score centering with a speculative draft in `decode_vllm_overrides` (`With speculative decoding, sampler logprobs … need truncated train sampling`), as it does for a draft on `[inference.vllm]`. #4919 accepts it. - **Single-node SLURM `inference` with `deployment.type = "multi_node"` and `num_nodes = 1`.** The sbatch now runs `engine` per rank. #4919 runs `uv run inference` on the engine-only `inference.json`, which fails. - **research-prod (906b2e8d).** I parsed its 167 documented config stacks from `research-prod/prime-rl` on `main` (42e1e43) and on this PR. 113 parse on `main`, and the same 113 parse here. The env packages of `int4/rl/prod/rl.toml` are missing on my machine, so I swapped its train sources for a stub. With its two `[ckpt]` lines moved, it resolves to the same values as on `main`: trace sample 0.1 without live traces, checkpoints every 20 steps with rollouts and a 180 s timeout, and DP 8 / 8 local / 8 API servers per engine. Its NUMA sbatch template still finds its one `uv run orchestrator` line. - **Tests.** The 17 config, launch, router, resume, client, dynamo, algorithm and model-source test files: 990 passed in 7 s. The first six rows ran on the commits of the closed #4921–#4925, before they were folded into this PR. Rows 15–19 ran on 1c92480, the last three on 3603799, the others on 2ba08c1. | Change removed | Result | | --- | --- | | run-level fields in `_run_fields()` | `test_run_level_fields_reach_trainer_and_orchestrator` fails | | prefill policy derived from the value (back to `fields_set`) | `test_resolved_configs_parse_to_the_same_components[rl-pd-bidirectional]` fails | | role vLLM overrides validated with the build (back to `setattr`) | `test_engines_and_routers_are_built_whole[rl-pd-prefill-overrides]` fails | | LoRA → 1 API server in `engine_layout` | `test_rl_engine_layout[…trainer4]`: `(4, None, 4) != (4, None, 1)` | | `speculative_config` field (back to an extra) | 130 tests fail | | P/D role drafts in `speculative_configs` | `test_a_pd_role_draft_without_its_own_weights_fails_under_a_dummy_target`: did not raise | | LoRA in `resolved_inference()` | `test_rl_sections_keep_the_values_the_user_wrote` fails | | NVFP4 env defaults in `resolved_inference()` | `test_rl_nvfp4_experts_set_up_matching_engines` fails | | NVFP4 check on the built engines | same test: did not raise | | draft fill in `orchestrator_config()` | `test_modelexpress_serves_a_draft_and_swaps_it` fails | | score-centering logprobs in `orchestrator_config()` | `test_rl_launcher_config_roundtrip`: `None == 4` | | metrics roles in `orchestrator_config()` | `test_modelexpress_under_pd_transfers_to_every_prefill_and_decode_gpu` fails | | speculative sampler-logprobs check on the built configs | `test_rl_checks_settings_that_must_agree_on_the_built_configs`: did not raise | | SFT LoRA, client URLs or dummy load in the builders | `test_sft_sections_keep_the_values_the_user_wrote` fails | | default `base_url` found by value (back to `model_fields_set`) | `test_resolved_configs_parse_to_the_same_components[rl-inference-port]` and `[sft-online-eval-port]` fail | | API-server check under in-memory weight broadcast | `test_in_memory_weight_transfer_needs_an_api_server_per_rank`: did not raise | | wired configs copied in `build_component_config` | `test_components_share_no_run_level_instance` fails | | component name in builder errors | `test_a_component_error_names_the_component` fails | | `is_multi_node` in `inference.sbatch.j2` (back to `num_nodes > 1`) | `test_a_one_node_multi_node_deployment_runs_its_engine_per_rank` fails | | `[trainer.ckpt]` / `[orchestrator.ckpt]` merged into the component checkpoint | `test_ckpt_takes_shared_settings_at_the_top_and_component_settings_in_the_sections` and both `test_ckpt_rollouts_*` tests fail | | trace options of `[orchestrator.monitors.file]` merged | `test_trace_options_reach_only_the_orchestrator` fails | | check that a component ckpt section needs `[ckpt]` | `test_ckpt_takes_shared_settings_…`: did not raise | The old `rl` check for llm-d with router replay is gone: the inference section's own check now catches it on the resolved config, so the test still raises. No GPU run. The P/D sbatch evidence ran on 5456cb0, before this branch's rebase onto the new #4919 tip. ## Merge order Merge last, after #4899 → #4909 → #4919. It is stacked on #4919 (`feat/configs-layout`). Rebase it onto `main` after each squash merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **High Risk** > Large breaking config/API surface (CLI paths, engine layout validation, sbatch template vars) affects every RL/SFT launch; mis-derived engine DP/API counts can deadlock weight transfer. > > **Overview** > **Config layout.** `rl` now owns run-wide settings only at the top level (`max_steps`, `resume`, `[ckpt]`, `[monitors]`, `rollout_transport`). Component sections hold side-specific knobs (`[trainer.ckpt]`, `[orchestrator.ckpt.rollouts]`, `[orchestrator.monitors.file]`). Builders merge run + section into validated component JSON once via `build_component_config` / `copy_validated`, instead of copying fields through `propagate_shared_fields` and post-hoc equality checks. > > **Inference derivation.** New `resolved_inference()` (and SFT analogue) centralizes dummy load, LoRA, router replay, NVFP4 env, sampling masks, and **`engine_layout()`** / `fit_engines()` for `data_parallel_size` and `api_server_count` (defaults `"auto"`). vLLM options move from untyped extras to typed fields on `VllmConfig`. P/D role engines are built only from `engine_config()` JSON—SLURM templates drop `ROLE_EXTRA` / role-specific vLLM override template vars. > > **Orchestrator wiring** moves into `orchestrator_config()` (draft swaps, score-centering logprobs, client/admin URLs, disaggregated metrics roles). Cross-process checks (NVFP4 engines, speculative + sampler logprobs) run on built `components()`. > > **Docs and launchers** switch CLI examples to prefixed paths (`--orchestrator.ckpt.rollouts`, `--trainer.ckpt.async-save`). Run owners and Prime monitor read `config.monitors` / `config.max_steps` at entrypoint level; `rl` rejects shared W&B offline mode. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 3603799. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Why. After #4899, each process has a component config, but each launcher (local, SLURM, the k8s operator) still assembled the per-process JSON its own way: excludes, renames, and patches after the build. So the JSON a process read depended on who launched it. Some processes had no config of their own: the router read the engine's
inference.json, and the operator ran the ModelExpress server withtrainer.jsonandextra="ignore".Idea. Each entrypoint returns every process it launches from one API, and every launcher writes it as is:
A launcher never rewrites a component JSON. Every value known before the launcher has hosts is in the JSON. Only host- or attempt-dependent wiring goes on the command line at process start: the engine URLs of a multi-node router (
router @ router.json --worker-urls …), each env pool's--address-file,--weight_broadcast.host $MASTER_ADDR, and the attempt log dir of a local ModelExpress server.RouterConfigis strict and holds only what vllm-router reads. Locally, the router and the engine run as separate processes, as on SLURM and k8s. llm-d has noRouterConfig.ModelExpressServerConfig(port, log_dir)for amodelexpressbroadcast.InferenceSection.engine_config(role=...)builds a P/D role engine and replacesfor_pd_role.EngineConfig.pd_kv_transferreplaces the three flat P/D fields.inference_world_size), so[weight_broadcast]no longer takes them.server.require_admin_token. The online-eval config carries the trainer'sresume, and the process resolves its resume step at start.components()when it validates, so a config that resolves can always launch.components()yet. They break on this PR; see Launchers outside prime-rl.Breaking
Remove these keys. Each now fails as an unknown key:
[weight_broadcast]:hostfornccl, andinference_world_sizeforncclandmodelexpress. The builders fill both.modelexpresskeepshost: it names a server that the run does not start.use_pd_kv_transfer,pd_decode_blocks_ttl_s,pd_spill_to_store(the deployment sets them per role).sft with an
ncclormodelexpressweight broadcast and no[inference]now fails at validation. The launcher raised this before.Files in
configs/attempt_<n>/resolved/:inference.json→engine.json;inference-{prefill,decode}.json→engine-{prefill,decode}.json; sfteval.json→online-eval.json. New:router.json, andmodelexpress-server.jsonfor amodelexpressweight broadcast. Behind a router,engine.jsonhasserver.port = backend_port.rl.json,sft.json,pretrain.jsonandinference.json(theinferenceentrypoint) are full dumps, includingslurm,dry_runandclean. The single-node SLURM job relaunches them with--slurm None --no-dry-run --no-clean.orchestrator.json.engine*.jsonsetserver.require_admin_token = true. A launcher that starts them must setPRIME_RL_ADMIN_TOKENorPRIME_RL_ADMIN_TOKEN_SHA256, or pass--no-server.require-admin-token.engine-{prefill,decode}.jsonholdpd_kv_transfer.online-eval.jsonaddsresumeandckpt_output_dir. Env pool JSONs hold noaddress_fileand a relativeoutput_dir.SLURM templates: the multi-node scripts run
uv run router @ $CONFIG_DIR/router.jsonwith the engine URLs as flags. A custom template that includes_launch_router.sh.j2must pass four arguments and buildROUTER_ARGSas router flags.CLI:
python -m prime_rl.entrypoints.modelexpress_serverreads a strictModelExpressServerConfig. Pass--portand--log-dir, or@ modelexpress-server.json.Env:
PRL_ENV_ADDRESSESkeys areenvs/<split>/<source>, thecomponents()keys (was<split>/<source>).Python API:
RLConfig.inference_config()andSFTConfig.inference_config()→engine_configs()androuter_config().InferenceConfig.for_pd_role(role)→engine_config(role=role).InferenceConfig.to_namespace()→config.engine_config().to_namespace().InferenceConfigis no longer anEngineConfig.dump_rl_components,dump_pd_componentsanddump_env_worker_pool_components→dump_components(config).keep_engine_fieldsis gone.build_vllm_router_cmd→router_command(RouterConfig).ModelExpressServerConfigmoves to the components package;portandlog_dirare required.NCCLWeightBroadcastSectionandModelExpressWeightBroadcastSection; the*WeightBroadcastConfigclasses are the process configs.config.weight_broadcast.inference_world_size→config.inference_world_size.env_worker_pool_config()takes noaddress_file; launchers pass--address-fileat start.Launchers outside prime-rl
I built the pod commands of the k8s operator on model-factory-iac
main(17d27957) for hosted runs that PrimeIntellect-ai/prime#1284 compiles. Then I parsed each command with prime-rlmain(42e1e43) and with this PR as first written (16752ca). The cases were rl single-node, rl multi-node, rl with amodelexpressbroadcast, sft with online evals, and sft without evals. Onmainall 23 commands parse. On this PR 5 fail. #4899 changes none of them. I reran the parse on f5ac012 and on the old stack top, where the prime#1284 worker readsdump_components: the same 5 fail.router @ inference.json --server.host … --server.port …--server,--vllm,--log, …Extra inputs are not permittedrouter @ router.jsonwith--worker-urls, or--prefill-urlsand--decode-urls, as the multi-node sbatch scripts now do. Pass--intra-node-data-parallel-sizewhen one URL serves several DP ranks.router.jsonisdump_components(config)["router"], which no PrimeRun carries yet.python -m prime_rl.entrypoints.modelexpress_server @ trainer.json --log-dir …--port Field required, and every trainer key is extra--port <weight_broadcast.port> --log-dir …. Images from before this PR parse the same flags.configs.prefillandconfigs.decode)inference @ inference-{prefill,decode}.jsonuse_pd_kv_transfer,pd_*,log.interval,log.log_dataare extraengine @ engine-{prefill,decode}.json. Give the enginesPRIME_RL_ADMIN_TOKEN_SHA256(and the orchestrator the token), or pass--no-server.require-admin-token.run_engine.py)InferenceConfig.to_namespace()AttributeError(andImportErrorfrom #4899 first)config.engine_config().to_namespace(). Import fromprime_rl.configs.entrypoints.inference.env-worker-pool @ env-server-<n>.jsonlog.intervalorlog.log_dataPRL_ENV_ADDRESSES(PrimeIntellect-ai/model-factory-iac#3893, open)<split>/<source>envs/<split>/<source>.supervised_online_eval)weight_broadcastfrom the section, whichsftfilled withinference_world_sizeinference_world_size, which defaults to 1. A hosted SFT online eval overncclormodelexpresswith more than one inference GPU waits for transfer workers that never join.weight_broadcastfromconfig.weight_broadcast_config()("0.0.0.0"as the trainer's NCCL host on multi-node), or take both JSONs fromdump_components.prime trainwith a released CLIprime_rl.configs.{rl,sft,pretrain},dump_rl_componentsImportErrorwhen it compiles the run (from #4899)These still parse: the trainer (
prime_rl.trainer.{rl,sft}.train @ trainer.jsonwith--weight_broadcast.*and--rollout_transport.*), the orchestrator,prime_rl.eval.online @ … @ eval-resume.json(itsresume_stepstill takes precedence),inference @ inference.json --router None, and the resume cleanup's imports.For hosted training, this means:
modelexpressbroadcast also fails at the ModelExpress pod. An sft run without evals still works.prime traincannot submit P/D: the CLI rejectsdeployment.type = "disaggregated"onmainand on this PR. So the P/D break hits only PrimeRuns that are written by hand.ncclormodelexpressand more than one inference GPU hangs at its first weight broadcast.router.json, and update the operator's router and ModelExpress commands.Verification
On c86c474, on macOS without torch or vllm:
engine.jsonholds the old per-rankinference.jsonvalues, exceptserver.portbehind a router (8000 → 8100) andserver.require_admin_token.router.jsonholds the values of the old router command line. Env pool JSONs dropaddress_fileand addstore_dir: null.rl.jsonandsft.jsondrop the weight broadcasthostandinference_world_size; the trainer and orchestrator JSONs keep both values.bash -n. I ran each script's URL block with four fake hosts and parsedrouter @ router.jsonwith the flags it builds. Each vllm-router command has the same policy, host, ports, P/D retries and bidirectional TTL as the old template command.server.port = backend_portbehind a routertest_engine_behind_a_router_listens_on_the_backend_portfailspd_kv_transferon role engineskv_cache_offloadandhisparsein the P/D engine buildtest_pd_role_connectorsfails:HiSparse does not work with native KV cache offloadwrite_component_configsrewritesaddress_fileagaintest_rl_launcher_writes_exactly_the_componentsand the sft one failserver.require_admin_tokenon the rl enginestest_rl_components_carry_the_router_and_one_engine_per_pd_rolefailsinference_world_sizefill inweight_broadcast_configtest_sft_online_evals_size_the_in_memory_transfer_grouptest_rl_trainer_alone_binds_the_nccl_rendezvous_on_multi_nodefailsresumein the online-eval buildertest_online_eval_resumes_where_the_trainer_doesfailsrouter.jsonin_launch_router.sh.j2test_multi_node_launchers_start_the_router_from_its_configfailsRLConfig.placement()test_entrypoints_place_every_component_they_launchfails (3 cases)modelexpress-serverentry incomponents()test_modelexpress_server_reads_its_own_config_not_the_trainersfailModelExpressServerConfigRegex pattern did not matchRLConfig.validate_componentstest_rl_validates_the_component_configs_it_builds:DID NOT RAISEThe table ran on earlier commits of this PR with the same code under test. No GPU run.
Merge order
#4899 → this PR → #4919 → #4928. Rebase onto
mainafter each squash merge. Do not ship an image with this PR to hosted training before the changes in Launchers outside prime-rl are live.🤖 Generated with Claude Code
Note
Medium Risk
Large contract change to resolved JSON shapes and launcher/operator commands; misaligned external orchestrators could fail startup or hang weight broadcast, but behavior is validated via
components()at config resolve time.Overview
Unifies how run configs become per-process JSON so local, SLURM, and external launchers all use the same builders instead of excludes, renames, and post-hoc patches.
Each entrypoint now exposes
components(),placement(), anddump_components()with stable keys (trainer,engine/engine-prefill/engine-decode,router,envs/<split>/<source>,modelexpress-server, …). Launchers write those blobs as-is; only host-dependent wiring (router URLs,--address-file, NCCL rendezvous) stays on the CLI.Inference is split into real components:
RouterConfigis strict and router-only; P/D engines come fromInferenceSection.engine_config(role=...)withEngineConfig.pd_kv_transferinstead of flatuse_pd_kv_transferfields; resolved artifacts renameinference*.json→engine*.jsonplus newrouter.json. RL/SFT launch local router and engine processes separately.Supervised/RL config layout moves trainer sections into dedicated component modules; weight broadcast uses section vs process config with
weight_broadcast_config()fillinginference_world_sizeand NCCL host. Online eval configs gain trainerresume/ckpt_output_dirfor aligned resume behavior.Docs and
AGENTS.mdare updated for the new API. This is a breaking change for custom SLURM templates, k8s operator pod commands, env pool key prefixes, and several removed TOML fields.Reviewed by Cursor Bugbot for commit c86c474. Bugbot is set up for automated code reviews on this repo. Configure here.