10bc02c6dccf34f7e1f86af83794de92d0dbb60c
67
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
10bc02c6dc |
fix(config): round-trip materialized RLConfig; deprecate wandb.shared (#2649)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* fix(rl-config): accept matching shared/sub duplicates so materialized config round-trips The single-node SLURM launcher (``rl_slurm`` for ``deployment.type == "single_node"``) dumps the fully-resolved ``RLConfig`` to ``<output_dir>/configs/rl.toml`` and the sbatch script re-runs ``uv run rl @ rl.toml``. ``propagate_shared_fields`` writes both shared keys (``output_dir``, ``wandb.project``, ...) *and* the matching sub-config keys (``trainer.output_dir``, ``orchestrator.wandb.project``, ...) during the first-load propagation; ``model_dump`` preserves both. On re-load the ``if sub_set: conflict`` check fired even though both keys had the same value — treating a no-op round-trip as ambiguity. Tighten the check to ``if sub_set and sub != shared_value``: genuine conflicts still raise (a CLI-shared override silently no-opping against an inconsistent sub-config value still surfaces), but matching values are accepted so the materialized config re-loads cleanly. ``output_dir`` and ``wandb.name`` compare against their *transformed* sub-config values (``output_dir → /run_default`` and ``-trainer``/``-orchestrator`` suffixes in non-shared mode). Verified end-to-end on the hendrycks-sanity example for all three RL deployments: local dry-run, single-node SLURM (submitted job 21902 from the materialized rl.toml — config re-loaded, all three subprocesses spawned, wandb shared run id preserved across trainer + orchestrator), multi-node SLURM dry-run (write_subconfigs path). Co-authored-by: Cursor <cursoragent@cursor.com> * chore(rl): deprecate wandb.shared, hardcode shared W&B mode Shared W&B mode (single run for trainer + orchestrator) has been the default on the rl entrypoint since #1330 and is the only mode anyone uses. The non-shared mode — two separate runs suffixed ``-trainer`` / ``-orchestrator``, gated on ``wandb.shared = false`` — was kept around as the legacy fallback and as the reason the validator's ``wandb.name`` propagation needed custom asymmetric ``expected``/conflict logic. Drop the non-shared path: * ``SharedWandbConfig.shared`` is removed from the schema. A ``mode="before"`` validator pops the field from input dicts with a ``FutureWarning`` so existing configs that still set ``shared = true`` (or ``false``) keep loading. * ``validate_shared_not_offline`` becomes ``validate_not_offline``: ``wandb.offline = true`` at the shared level is rejected because shared mode is always on and needs server connectivity. The escape hatch is to set ``offline`` per sub-config (``[trainer.wandb] offline = true``, ``[orchestrator.wandb] offline = true``). * ``propagate_shared_fields`` collapses the ``wandb.name`` block into a plain ``propagate("wandb.name", "trainer.wandb.name", "orchestrator.wandb.name")``. The ``expected``/conflict-against- transformed-value machinery is gone; only ``output_dir`` still needs the custom block because of its asymmetric ``/run_default`` suffix. * ``rl_local`` always sets ``WANDB_SHARED_MODE`` / ``WANDB_SHARED_RUN_ID`` for subprocesses (no ``if config.wandb and config.wandb.shared`` gate). * The multi-node SLURM template (``multi_node_rl.sbatch.j2``) drops the ``{% if wandb_shared %}`` gates and always exports the shared env vars + ``WANDB_SHARED_LABEL``. The ``wandb_shared`` template variable is removed from both call sites in ``rl_slurm``. * Configs that still set ``shared = true`` (``configs/nemotron_debug``, ``configs/nemotron_4node``) are cleaned up. * Docs + the runtime info log are updated. Verified end-to-end on hendrycks-sanity (job 21919, single-node SLURM): the materialized rl.toml round-trips through the validator, both trainer and orchestrator log ``Using shared W&B mode (label=…, primary=…)``, and the W&B run name is the verbatim shared name (no ``-trainer``/``-orchestrator`` suffix). 234 config-related unit tests pass. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
6d17559422 |
Consume the typed RendererConfig surface (#2635)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* Consume the typed RendererConfig surface Reshapes the orchestrator / SFT renderer plumbing around ``renderers.RendererConfig`` (the typed discriminated union) instead of flat strings + booleans. - ``configs.shared.RendererConfig`` now composes ``renderers.RendererConfig`` as a single ``settings`` field; ``pool_size`` stays as a separate prime-rl-side concern. The flat ``name`` / ``tool_parser`` / ``reasoning_parser`` / ``preserve_*`` fields are gone. - ``setup_inference_pool`` / ``setup_clients`` / ``StaticInferencePool`` / ``ElasticInferencePool`` collapse their six-arg renderer surface to a single ``renderer_config: RendererConfig | None`` plus the orthogonal ``renderer_model_name`` / ``renderer_pool_size`` fields. - Orchestrator + SFT trainer call sites pass the typed config straight through to ``create_renderer(tokenizer, config.renderer.settings)``. - Cross-env / unmapped-model validators rewritten to inspect ``renderer.settings`` (discriminated-union shape) instead of the flat field names. - Tests updated to construct typed configs (``Qwen3VLRendererConfig()``, etc.) and assert against the new call shapes. Pins ``deps/renderers`` and the ``prime-rl-configs`` ``renderers`` dep to the renderers PR's tip (``4c9099debbc9bc4fcc3eb6a118bbfa5c364ec395``) until it merges and a dev release ships. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Bump renderers pin to the merged v0.1.8.dev27 The typed-config refactor landed on renderers main as ``c86c50b`` (tag ``renderers-v0.1.8.dev27``). Switching: - ``deps/renderers`` submodule pointer → ``c86c50b`` - ``prime-rl-configs`` git URL pin → ``@renderers-v0.1.8.dev27`` Same commit, more readable, and stable to anyone reading the diff after the feature branch is deleted. PyPI dev release for the same version is pending a publisher-config fix; once it lands the git URL pin can collapse to a plain ``renderers>=0.1.8.dev27`` PyPI pin. * Migrate in-repo TOMLs to the typed renderer schema The new RendererConfig accepts only `settings` (typed `renderers.RendererConfig` discriminated union) and `pool_size`, so flat `name`/`reasoning_parser`/`preserve_*` keys under `[orchestrator.renderer]` now fail pydantic validation. Move those keys under `[orchestrator.renderer.settings]`. `pool_size` stays in the outer block. Two configs that only set `preserve_all_thinking` gain an explicit `name = "auto"` since the discriminator is required. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use renderers.RendererConfig directly; None means MITO Per Mika's review: drop prime-rl's RendererConfig wrapper that nested the renderers' discriminated union under a ``.settings`` field. The wrapper bought a parallel ``pool_size`` attribute but cost a clunky two-level TOML layout and made every call site dereference ``.settings``. Use ``renderers.RendererConfig`` (the typed discriminated union) as the field type directly. Pool size moves up one level to ``orchestrator.renderer_pool_size``. ``use_renderer: bool`` is gone — ``renderer: RendererConfig | None`` with ``None`` for MITO replaces it (consistent with how SFT, optimizer, and other optional sub-configs express absence). TOML callers spell MITO with ``renderer = "None"``, which ``prime_pydantic_config.BaseConfig._none_str_to_none`` coerces back to Python None. Net effect on TOMLs is a wash with the previous commit: 26 in-repo configs lose the ``.settings`` indirection they gained yesterday, and one (multimodal) splits ``pool_size`` out of the renderer block. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Pin renderers via PyPI now that 0.1.8.dev27 is published The slim ``prime-rl-configs`` wheel (installed standalone, outside the workspace) now resolves ``renderers`` from PyPI instead of the git tag URL it used while the dev release was waiting on PyPI trusted-publisher config. The full ``prime-rl`` workspace still pulls renderers from the ``deps/renderers`` submodule, so this only affects downstream slim consumers. Re-locks to refresh the lockfile against the same workspace state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Lazy-import renderers in the typed config schema The slim ``prime-rl-configs`` install path (configs only, no GPU deps) asserts that importing the config classes doesn't pull in ``transformers``. ``from renderers import RendererConfig`` at the top of ``orchestrator.py`` / ``sft.py`` broke that: ``renderers/__init__`` eagerly imports every concrete renderer module (DefaultRenderer, Qwen3Renderer, …), each of which imports ``transformers.tokenization_utils.PreTrainedTokenizer``. Defer the renderers import via: - ``TYPE_CHECKING``-guarded ``from renderers import RendererConfig`` so static type checkers still see the typed discriminated union. - ``renderer: Any`` field annotation at runtime, so no resolution happens at class definition. - ``model_validator(mode="before") _resolve_renderer`` that lazy-imports ``renderers``, fills the orchestrator default (``AutoRendererConfig()``), and coerces dict input through the typed union via ``TypeAdapter``. SFT's default stays ``None``. End-user semantics unchanged; class import is now transformers-free. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Restore typed renderer field; pin renderers to dev28 dev28 lazy-loads concrete renderer classes via PEP 562 ``__getattr__`` (renderers#64), so ``from renderers import RendererConfig`` no longer drags ``transformers`` into ``sys.modules``. The slim-install CI gate is satisfied without the prior workaround. Drop the ``Any`` annotation and the ``_resolve_renderer`` model-validator that lazy-resolved the discriminated union from ``OrchestratorConfig`` and ``SFTConfig``. The fields are typed ``RendererConfig | None`` again, and pydantic does the full discriminator validation at class definition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Bump deps/renderers (dev28) and deps/verifiers (typed ClientConfig) - deps/renderers c86c50b -> 2ec28a8 — picks up the PEP 562 ``__getattr__`` so the workspace install path also lazy-loads concrete renderer classes. - deps/verifiers 04651be -> d107442 — adds the typed ``ClientConfig.renderer_config`` field that ``setup_clients`` forwards. Fixes the unit-test ``test_setup_clients_assigns_renderer_and_dp_rank_headers`` AttributeError on ``renderer_config``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Preserve MITO across orch.toml round-trip; drop RendererConfig alias Two cleanups on the typed renderer surface: 1. Per Samsja: drop the ``RendererConfig as RendererSettings`` alias in ``client.py`` / ``elastic.py``. The alias was a workaround for the former local ``RendererConfig`` wrapper class; with that gone, we just import ``RendererConfig`` from renderers directly. 2. Per Cursor bugbot: ``OrchestratorConfig.renderer = None`` (MITO) was silently dropped by ``model_dump(exclude_none=True)``, so any saved ``control/orch.toml`` would reload as the default ``AutoRendererConfig()`` (TITO). Add a wrapping ``model_serializer`` that re-injects ``renderer = "None"`` (string) when the field is ``None``, matching what ``BaseConfig._none_str_to_none`` accepts on reload. MITO and TITO now round-trip through TOML. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address mika review on #2635: rename pool_size, drop factory, trim docstring - renderer field uses direct AutoRendererConfig() default (frozen, no factory needed) - renderer_pool_size -> pool_size on OrchestratorConfig; cascade through client.py, elastic.py, orchestrator.py call sites and the test; vf.ClientConfig kwarg name (verifiers-side) stays renderer_pool_size - shorter docstring on the renderer field Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Bump deps/verifiers to f9c68eb2 (both renderer PRs merged to main) Picks up verifiers main with PR #1463 (surface every parsed tool_call, drop status filter) and PR #1468 (pipe chat_template_kwargs into typed RendererConfig) now that both are merged. verifiers 0.1.15.dev11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Eli Gottlieb <eli@primeintellect.ai> |
||
|
|
c1f6fbdd3b |
docs: big revamp (#2602)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* docs: rewrite into 8 task-oriented pages with auto-generated reference Replaces 22 small/uneven docs files with 8 longer pages modeled on the verifiers docs: each page opens with a TOC, content is grouped by task (configure, train, scale, …) instead of by feature, and a single auto-generated reference page covers every config field. New pages: overview, configuration, training, scaling, algorithms, advanced, faqs, reference. reference.md is generated by scripts/generate_docs_reference.py from the Pydantic config models; regenerate with `uv run python scripts/generate_docs_reference.py`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: fix stale claims found in source verification pass - algorithms.md: max_async_level default is 1 (not 2); default loss includes the Kimi-K2.5 KL regularizer (was wrongly claimed to drop it); update the formula to show the full L = -PG + tau_KL * KL form; filter table is `[[orchestrator.filters]]` (plural) - training.md: checkpoint paths nest under `checkpoints/step_N/{trainer, orchestrator}/` rather than separate hierarchies; --inference-gpu-ids / --trainer-gpu-ids don't exist — use --deployment.num-{infer,train}- gpus and pin physical GPUs via CUDA_VISIBLE_DEVICES; update max_async_level prose to match the new default - scaling.md: same GPU-flag fix throughout the single/multi-GPU examples; correct the claim that Muon + optim_cpu_offload is unsupported (only fsdp_cpu_offload is blocked) - configuration.md: there is no generic PRIME_* env var override mechanism in pydantic-config — rewrite the env vars section to list the specific named vars that individual fields read as defaults - advanced.md: add the qwen3_vl_moe entry to the VLM registry table; the small-scale MoE RL config lives at configs/ci/integration/reverse_text_moe/start.toml, not .../rl/ - faqs.md: update the max_async_level Q&A to match the new default Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci: enforce docs/reference.md stays in sync with configs Adds two safety nets so the auto-generated reference can't silently drift from the Pydantic config models: - Pre-commit hook (local): re-runs scripts/generate_docs_reference.py whenever a config class or the generator itself is staged. If the generated file changes, pre-commit fails the commit so the contributor re-stages the regenerated reference. - GitHub Actions (CI): a small workflow runs the generator and `git diff --exit-code docs/reference.md`. Catches anyone who bypassed the pre-commit hook. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: rename pre-commit hook id to docs-reference Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(overview): tighten landing page - Quick run now uses examples/reverse_text/rl.toml; the env is bundled with the verifiers submodule so no prime env install is needed, and the tmux helper is documented elsewhere instead of duplicated here - Architecture bullets advertise the SOTA features per process: vLLM multi-node + FP8 + P/D disaggregation for inference; FSDP2 + EP (incl. DeepEP) + CP + selective AC + FP8 + LoRA + multi-run for the trainer - Drop the "Use prime-rl when you want to" bullets and the CPU-only SFT smoke check — the landing page reads cleaner without them Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(configuration): trim and reorganize - Drop the env-vars section entirely (and the precedence callout that referenced it) — the page is now strictly TOML + CLI. The few named env vars that individual fields read as defaults are out of scope for the config docs and stay in the per-feature pages (training.md, etc.) - Drop the entrypoint enumeration and the W&B/output-dir recommendation blurb in the intro - Reword "@ introduces a TOML file" so the sentence doesn't lead with an inline code token; convert the "Mind the space" hint to a blockquote - Drop --output-dir from the convenience-flag list (it's just another override, not a special flag) - Note that --dry-run is available on rl, sft, and inference only — the standalone trainer and orchestrator configs don't have a dry_run field - Split "Booleans, None, and lists" into one section each, matching the pydantic-config README style; add a Dicts section - Drop the "Prefer --ckpt" convention bullet — checkpointing is covered in training.md and didn't belong in the config conventions Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(training): drop redundant OpenAI-compatible prefix on vLLM server vLLM is an OpenAI-compatible server by default; the prefix in the entrypoints table was just noise. Other mentions of "OpenAI-compatible" describe the API surface or third-party endpoints and stay. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(training): trim and restructure per review - Quick-start now uses examples/reverse_text/rl.toml; drop the prime env install and tmux preamble (covered elsewhere) - Add a "Useful CLI flags" subsection: --ckpt, --wandb, --orchestrator. prime-monitor (Prime Lab), --clean-output-dir, --output-dir, --max-steps, --dry-run - Mention the env-server / env-worker fan-out in the orchestrator bullet under "What each process does at runtime" - Restrict the Key knobs table to orchestrator-only args; drop max_async_level, max_completion_tokens, inference, trainer rows; rename rollouts_per_example row to lead with "Group size" - SFT Launch now uses examples/reverse_text/sft.toml; drop the CPU fake-data smoke alternative - "two distillation modes" -> "three training modes" (rl/opd/sft) - Drop the long-run checkpoint-combo recommendation - Drop the trainer+orchestrator lockstep note from Resuming a run - Swap order: Platform monitoring now appears before Prometheus + BetterStack under Observability; show --orchestrator.prime-monitor CLI invocation - Rename "Metrics that matter" -> "Important metrics"; drop the live vLLM curl snippet - Drop "Eyeball the reward distribution", "Match inference.parallel.tp", and "Set max_async_level deliberately" rules of thumb - Add new rules of thumb: batch size >= 64; group size >= 8 with the reasoning that all-succeed / all-fail groups give the trainer no signal because the within-group advantage collapses - Drop the Common Issues section entirely Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: trim scaling layout table and move multi-node logs to training - scaling.md: drop the 1-GPU row and the "Production MoE with long contexts" row from the "Choosing a layout" table; the disaggregated prefill/decode page section is still findable via its own H2 - scaling.md: drop the trailing "Multi-node logs" section (heading + TOC entry); the content now lives next to single-node log layout - training.md: fold the multi-node tree into "Log files" with the single-node skip note inlined; add live-tail recipes and the per-rank torchrun debug note; mention the tmux helper works on a SLURM head node Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(algorithms): add Renderers section, trim renderer prose - New Renderers section explains why best-effort interleaving works: the renderer guarantees the exact-prefix invariant by construction via bridge_to_next_turn. Lists the renderer API surface and the hand-coded model coverage - Drop the verifiers trajectories-design-note link from Discontinuous trajectories and the --trajectory-strategy branching deprecation - Drop preserve_all_thinking workaround mentions from algorithms.md and faqs.md (reference.md still documents the fields) - Leave a TODO(blog-post-url) for the PI site writeup Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: refresh FAQ + training W&B claim + recommend prime eval faqs.md: - Drop the "override an env var in TOML" Q&A (matches the configuration page where env vars are no longer documented as a generic override) - Drop the "max_async_level" Q&A; replace with a max_off_policy_steps Q&A — the more impactful knob to tune on long agentic rollouts - Drop the outdated "two W&B runs per RL job" Q&A; default is shared now (wandb.shared = true) - Drop the SFT-section Q&As that referenced preserve_all_thinking or were too thin to keep - Switch the "evaluate without training" recipe from vf-eval to prime eval run (the Prime CLI is the recommended entrypoint) training.md: - Fix the W&B section to describe the new default: shared single run (wandb.shared = true), with the legacy split as opt-out - Add max_off_policy_steps to the Key knobs table - Switch the eval example from vf-eval to prime eval run Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(faqs): drop the CP <= 8 recommendation Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(faqs): drop the vLLM log-quieting and KV-cache pressure Q&As Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(faqs): drop the Environments Hub install Q&A Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(faqs): drop the Models and environments section Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(overview): second tightening pass - Inference bullet now leads with the local default (token-in /v1/generate via renderers; OpenAI-compatible routes called out as the external-client path) and adds DP/TP/EP with deepep + flashinfer all-to-all backends + EPLB, P/D disaggregation behind vllm-router, CPU KV-cache offload, and router replay (FP8 MoE numerical-parity feature). Weight broadcast is filesystem or NCCL. - Orchestrator bullet now leads with "owns the data plane across many verifiers training and eval environments" plus the per-env isolated subprocess + variable-size env-worker pool. - Trainer bullet drops "torchrun-launched" and surfaces the custom modeling code as the enabler for advanced trainer parallelism (EP with DeepEP, CP for long sequences). - Drop the [AIPO] link in the async paragraph (off-policy-aware PG + KL regularizer, no paper handle); also drop the "AIPO loss" mention from the Algorithms blurb in "Where to go next" so the page is internally consistent. - Quick-run command is now bare: uv run rl @ examples/reverse_text/rl.toml (no --wandb.* / --ckpt). - Drop the trailing scaling pointer (Scaling is already linked in "Where to go next"). Co-authored-by: Cursor <cursoragent@cursor.com> * docs(configuration): second tightening pass - Drop the entrypoint-splitting paragraph ([trainer] / [orchestrator] / [inference] table lifting); covered elsewhere. - Rename "TOML files and composition" -> "TOML composition", and "Special syntax" -> "Syntax". - Open "Sources and precedence" by naming the three sources (Pydantic defaults, TOML files, CLI flags) up front, then layering them. - Drop the "(-- is a kebab-case marker)" parenthetical from CLI overrides; turn the snake/kebab note into a callout. - Drop the --help / --dry-run convenience-flag block and the "--dry-run is the single most useful debugging tool" prose; the bash example is enough. - Reorder Syntax subsections to mirror the pydantic-config README: Booleans -> Lists -> Dicts -> Optional sub-configs -> None -> Discriminated unions -> Environments. None moves down and is cross-linked from "disabling an optional sub-config". - Booleans example swapped from --ckpt (which is itself an optional sub-config) to --clean-output-dir (a real bool = False field), showing both --flag and --no-flag forms. - Lists / Dicts now show TOML and CLI on the *same* field name so the mapping is obvious (target_modules for lists, env.0.args for dicts), and add the "lists are replaced wholesale" overlay note + "dicts deep-merge across sources" detail. - Add a callout on validation aliases (rollouts_per_example still works after the rename to group_size) — only material gap vs the pydantic-config README that's relevant to end users. - Worked example: --dry-run is now the final flag. - Drop the Conventions section. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): second tightening pass - Rename "RL training" -> "RL trainer" and "SFT training" -> "SFT trainer" (and update the page intro accordingly). - Entrypoints table: clarify that `uv run rl` wraps the trainer, orchestrator, and inference server in one launch — runs locally for single-node experiments and submits to SLURM for single- or multi-node when [slurm] is set. Drop the trailing "rl is a convenience wrapper" paragraph. - RL trainer Launch: minimal command is now bare `uv run rl @ examples/reverse_text/rl.toml` (no flags). Drop the GPU-placement paragraph + multi-GPU example (covered in scaling.md). - Replace "Useful CLI flags" + "Key knobs" + "What each process does at runtime" with one consolidated "Useful knobs" section split into three sub-tables: data-and-algorithm, monitoring, run management. - Add training environments ([[orchestrator.train.env]] for multi-env training) - Add eval environments ([[orchestrator.eval.env]] + orchestrator.eval.interval) - Add monitoring entries: orchestrator.log.vf_level, --wandb, --orchestrator.prime-monitor - Move Training modes from a top-level section into RL trainer as a subsection (it's RL-entrypoint-specific). - Drop the standalone Evaluations section — eval syntax is covered in configuration.md and the eval-knobs row in Useful knobs links to `prime eval` for one-off evals. - Drop the optimization_dtype / reduce_dtype rule of thumb. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): SFT trainer metrics + tools column + minor renames - Drop "-via-orchestrator" from the Training modes heading and the internal/cross-doc anchors. The mode value is just `sft` and the short title reads cleaner. - Drop "and the tmux helper" from the Console output subsection title; the tmux helper is still documented in the section body. - Important metrics is now split into RL trainer and SFT trainer subsections so the SFT-only metrics (loss/mean, val/loss, progress/{epoch,num_samples,num_tokens}, optim/zero_grad_ratio, per-subset mixing ratios, MoE max_vio + routing_confidence, perf/peak_memory + the time/* breakdown) are documented. - SFT Dataset format gains a Tool definitions paragraph: rows can carry a `tools` column (OAI function-calling format) or `tool_defs` (verifiers rollout format), as either a list of dicts or a JSON-encoded string. `tool_defs` is auto-converted to OAI shape before being passed into the chat template's `tools=...` argument. `chat_template_kwargs` rows pass through verbatim. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): rename 'Saving HF weights for serving' -> 'Serving checkpoints' Co-authored-by: Cursor <cursoragent@cursor.com> * docs: cross-link the agent skills from training + configuration Adds a callout under the intro of training.md and configuration.md pointing at the equivalent skill files for AI agents working in this repo: - training.md -> skills/training/SKILL.md (top-level routing) + skills/training/start-run/SKILL.md (launch details) + skills/training/monitor-run/SKILL.md (check-in / restart). - configuration.md -> skills/configs/SKILL.md. The skills aren't part of the published Mintlify nav, so the links go to GitHub blob URLs. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): fold Important metrics into RL + SFT trainer sections The standalone "## Important metrics" section is gone. Each trainer subsection now ends with its own "### Important metrics" covering only the metrics relevant to that flow: - RL trainer / Important metrics: reward + rollout signals from the orchestrator, mismatch_kl + entropy + grad_norm from the trainer, and the trainer/orchestrator/vLLM performance grid. - SFT trainer / Important metrics: loss/mean, val/loss, progress counters, optim signals, MoE max_vio + routing_confidence, and the perf/{throughput,mfu,peak_memory} + time/* breakdown. TOC updated to point at #important-metrics (RL) and #important-metrics-1 (SFT) — Mintlify de-duplicates with the same -N suffix scheme it already uses for the two Launch subsections. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): drop Prometheus and BetterStack subsection Not ready for end-user docs yet. Both knobs (trainer.metrics_server.port, trainer.heartbeat.url) are still in reference.md for anyone who needs them, just no narrative coverage. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): tighten Useful knobs language - Use "task" not "prompt" for the conceptual unit ingested by the orchestrator (rows for batch_size and group_size, plus the matching Rules of thumb wording). - group_size: drop the "Used for advantage normalization and pass@k estimation" trailer; the row name is enough. - max_off_policy_steps: rename "throughput-vs-noise dial" to just "off-policy dial". - eval row: drop the "Scores land in trainer logs and W&B as eval/{env}/{avg@k,pass@k}" + `prime eval` trailer; keep the row scoped to what the knob does. - Add log.level to the Monitoring table (trainer/orchestrator process log level, $PRIME_LOG_LEVEL fallback, per-process or global on rl). - Drop --ckpt from Run management; checkpointing has its own section. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): trim RL Performance table to the bottleneck signals Drop the throughput/MFU/async-lag/KV-cache rows from the RL trainer Performance table — they're either generic perf metrics already covered by the SFT trainer's perf table or vLLM-internal. The two remaining rows (time/wait_for_batch, time/wait_for_ckpt) are the useful diagnostic — they tell you which side is the bottleneck. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): refresh chat-template prefix-property paragraph The old wording recommended only patched checkpoints / a custom chat template as the fix for position-dependent templates. The renderer-based path landed in SFT (use_renderer flag) and is now the primary recommended fix, but it's still off by default (use_renderer: bool = False on SFTConfig), so the patched- checkpoint path also still works — and is what examples/reverse_text/sft.toml uses today via PrimeIntellect/ Qwen3-0.6B. Rewrite the paragraph to cover both fixes: - Renderer path: use_renderer = true, lists the hand-coded renderers, calls out the VLM unsupported case. - Patched template path: the prime-rl-patched checkpoint or a user-supplied template that preserves thinking. Cross-link both to Algorithms § Renderers and § Multi-turn trajectories. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): fix SFT data row (data.name, drop default data.type) - data.type = "sft" is the discriminated-union default for SFTConfig.data, so users don't need to spell it out. - The dataset path field is data.name, not data.path. Confirmed against SFTDataConfig.name in packages/prime-rl-configs/src/ prime_rl/configs/sft.py. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): drop loss/nan_count from SFT trainer metrics Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): drop the Environments section Environment installation, authoring, and multi-env mixing are already covered concisely in configuration.md (Environments syntax) and training.md (Useful knobs row pointing at the same). The advanced.md duplicate just spread the same material across three subsections without adding anything material. - Drop the section + its TOC entries. - Update the page intro and overview.md "Where to go next" to stop advertising "environments deep-dive" / "environments installation and authoring". Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): rename "MoE models" -> "Custom modeling" + "LoRA" -> "LoRA training" The first section was conceptually about our custom modeling stack (model.impl = "custom"/"auto", the family registry, EP backends), not about MoE specifically — even though the supported families happen to be MoE-heavy. Rename so the section title matches the defining feature. Bump LoRA to "LoRA training" for parity with the trainer-oriented section names elsewhere on the page. Update the page intro and TOC entries to match. No external doc links to the renamed anchors (#moe-models, #lora) so nothing else to fix. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): drop 'Poolside' prefix from Laguna family row Co-authored-by: Cursor <cursoragent@cursor.com> * docs: rename Vision-language models -> Multimodal training Standardize on "multimodal training" as the section title: - advanced.md: "## Vision-language models" -> "## Multimodal training" + "### Multi-turn VLM training" -> "### Multi-turn training" (the parent context is already multimodal). "### Enabling VLM mode" stays because it's literally enabling the [model.vlm] config block. - advanced.md page intro: "vision-language models" -> "multimodal training". - advanced.md custom-modeling cross-link to (#vision-language-models) -> (#multimodal-training). - overview.md "Where to go next" blurb: align the Advanced bullet's language ("MoE training" + "VLMs") with the destination's section titles ("Custom modeling" + "multimodal training"). reference.md still mentions "vision-language model" in auto-generated descriptions sourced from Pydantic field docstrings. Those are out-of-scope for this rename; would need a config docstring change. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): drop the DeepEP grad-clip-disable tradeoff aside Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): fix the freeze_vision_encoder + LoRA claim The bullet said the combo "has no effect under LoRA (LoRA freezes everything non-adapter regardless)". Source check: packages/prime-rl-configs/.../trainer.py:591-597 now contains a vlm_freeze_incompatible_with_lora validator that explicitly *rejects* the combo with an error. So the user-facing behavior is not silent-no-op, it's a config validation failure. Other bullets in the Limitations list verified against source and are correct as written: - "No multimodal-safe truncation": confirmed in trainer/batch.py (input_ids / mm_token_type_ids truncated to seq_len; mm_kwargs passes through unchanged). - "bfloat16 mandatory": confirmed by the vlms_require_bfloat16 validator in trainer.py. - "Images aren't logged to monitors": confirmed — no image / pixel handling in src/prime_rl/utils/monitor/. The "Higher KL mismatch with multi-image inputs" bullet is left unchanged for now — flagged for review separately because the cited rationale ("minor numerical differences between trainer and vLLM image processing") no longer matches reality after the renderer- only multimodal path landed (#2473): the renderer now owns image processing end-to-end and both sides consume the same pre-processed pixel_values / image_grid_thw. The empirical observation may still hold but the reason given would be stale. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): drop the Multi-turn training subsection The render/pack/forward rendition lived close to internal code and felt out of scope for the user-facing Advanced page; the spawn-method hint that ended it can move elsewhere if needed. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): rename Multi-run manager -> Multi-tenant training User-facing framing now leads with the actual use case: many concurrent LoRA tenants sharing a single trainer + inference deployment, which is the topology behind hosted training on the Prime Intellect platform (Lab). The MultiRunManager class still exists in code and is name-checked in the section body — only the section title and surrounding prose change. - advanced.md: rename TOC entry + H2 + open paragraph; drop the now- redundant "primary use case today" trailer (Lab is in the intro). - advanced.md LoRA section: reword the cross-link. - overview.md: trainer description bullet now says "multi-tenant training" instead of "multi-run manager"; "Where to go next" Advanced bullet renamed similarly. - scaling.md: parenthetical aside on optim_cpu_offload incompatibility updated for consistency. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): trim multi-tenant training to user-facing surface only Drop the per-run filesystem layout, Run discovery / Eviction / Hooks subsections — these are MultiRunManager internals (run_* dir discovery, evicted.txt protocol, hook lifecycle) that don't belong in a user-facing Advanced page. The pointer to src/prime_rl/trainer/runs/ still tells anyone who needs the API where to look. The remaining section is one paragraph: what multi-tenant training buys you, that Lab is the production user, and the trainer.max_concurrent_runs entry point. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: add a Development page; move "Testing MoE at small scale" off Advanced Advanced was mixing user-facing features (custom modeling, multimodal, LoRA, multi-tenant training) with developer-facing workflows (building a tiny MoE for modeling-code iteration, adding a new architecture). Split the latter into a new Development page so each audience reads only what's relevant. - New page: docs/development.md, scoped to "developing on prime-rl itself". Contains the unchanged Testing MoE at small scale recipe (build/verify mini model, SFT warmup, RL on reverse-text) and the Adding a new architecture how-to. - advanced.md: drop the section + TOC entry; rewrite the page intro to point at Development for developer-side workflows. - mint.json: insert "development" in the nav between "advanced" and "faqs". - overview.md "Where to go next": add the Development bullet, drop "small-scale MoE testing" from the Advanced bullet. - README.md docs index: same split (Advanced + Development as two separate bullets). No external links to the moved anchors needed updating; the only existing cross-link was the relocated TOC entry in development.md itself. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(algorithms): fold Renderers into Multi-turn trajectories Renderers existed as a top-level section because they were added in a follow-up, but conceptually they're the mechanism that makes best-effort interleaving safe — splitting them apart forced a forward-reference and duplicated the "exact-prefix invariant" framing. - Demote "## Renderers" to "### Renderers" inside "## Multi-turn trajectories", placed between Best-effort interleaving and Discontinuous trajectories. - Move the Qwen3 thinking-stripping example from Best-effort interleaving into Renderers — it's the failure case the renderer fixes, so it reads better adjacent to the family list / config block. - Drop the "Workaround: use a chat template that preserves thinking" trailer; the patched-checkpoint workaround for SFT is already documented in training.md and isn't relevant in the orchestrator context (use_renderer defaults to true). - Open Multi-turn trajectories with a forward-link to Renderers so the reader knows the safety mechanism is coming. - TOC updated; both #multi-turn-trajectories and #renderers anchors preserved (only their nesting changes), so the existing cross- links from training.md and faqs.md keep working. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(algorithms): drop max_async_level tuning + reframe as fixed one-step max_async_level is being deprecated as a user-facing knob (hardcoded to 1; matching reframe in docs/async.md on feat/deprecate-max-async- level). Update algorithms.md so the long-form treatment matches. - Drop the "### Tuning max_async_level" subsection (the k=0/1/2/>=3 table) and the NCCL-needs-max_async_level=1 line that follows it — both become vacuous when k is fixed at 1. - Reword the Async / off-policy training intro to describe the one-step overlap directly instead of "up to k steps where k = max_async_level". - Step semantics: rho_inference is now pi_{max(0, n-1)}, with prose "inference is exactly one step behind the trainer" replacing the generic "gap is at most k steps". - Drop the Tuning entry from the page TOC. Other docs (overview.md intro, training.md rule of thumb, faqs.md two entries, scaling.md NCCL-example comment) still mention max_async_level and are now stale; will clean those up in the next turn unless flagged otherwise. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(development): add Test suite + Pre-commit hooks sections Pull in the testing- and contributor-workflow content from README and the GitHub Actions configs so contributors don't have to dig through .github/workflows/ to figure out what runs where. New sections in development.md: - Test suite - Layout: tests/unit/, tests/integration/, tests/nightly/ — what each tier is for, with the actual file names contributors will encounter. - Running tests locally: pytest one-liners (everything, unit-only, integration-only, -m "not gpu", -m gpu, single file). - CI workflows: a 3-row table covering cpu_tests.yaml, gpu_tests.yaml (matrix list pulled verbatim from the workflow), and nightly_tests.yaml — including the trigger conditions (cpu = always, gpu = non-draft, nightly = scheduled + workflow_dispatch) and the runners (ubuntu-latest, vm/4xa6000, research-cluster). - Markers: gpu + slow, both declared with --strict-markers in pyproject.toml. - Pre-commit hooks - uv run pre-commit install - Currently configured hooks: ruff check/format and docs-reference (regenerator that fails the commit if docs/reference.md would drift). Plus update the Development pitch in overview.md "Where to go next" and README.md docs index to mention the new scope. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(algorithms): fold Length penalties into Default advantage Length penalties are configured under [orchestrator.length_penalty] and layer on top of *any* advantage function — they're conceptually not a standalone advantage variant. Move them into Default advantage where readers will see the option while reading about advantages. Drive-by: clean up the parenthetical hint in Default advantage. The old version listed "length penalties tied to turn count" as a reason to write a custom advantage, which conflicts with the actual turn-count length penalty being a built-in. New wording points length-penalty users at the now-adjacent built-in section, and points custom-advantage users at trajectory-metadata-driven shaping (sub-agents, relative-rank, …). TOC entry for #length-penalties dropped; no external doc links to that anchor. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(advanced): add Difficulty pools + Online difficulty filtering Covers the two complementary buffer-side mechanisms for keeping the trainer batch high-signal. Verified each claim against src/prime_rl/orchestrator/buffer.py and packages/prime-rl-configs/ src/prime_rl/configs/orchestrator.py. - Difficulty pools (buffer.easy_threshold / hard_threshold + easy_fraction / hard_fraction): per-problem running-average reward is compared to the thresholds; problems hitting either bound move to easy/hard pool and stop being sampled. Pool assignments persist across checkpoints (easy_examples.jsonl / hard_examples.jsonl); *_fraction lifts a fraction of pooled problems back into normal on resume / start. - Online difficulty filtering (buffer.online_difficulty_filtering bool): groups whose avg reward is exactly 0.0 or 1.0 are dropped from the buffer because their within-group advantage is zero (DR-GRPO produces no signal). Counted under filtered_rollouts/ {env}/{easy,hard} for visibility. - The tradeoff bit the user asked for explicitly: with ODF on each trainer step's effective batch is dense + predictable, but the orchestrator pays for the throw-away rollouts and may need a higher oversampling_factor; if time/wait_for_batch is already high on the trainer, ODF can starve the loop. - ODF is orthogonal to the pools — ODF reacts to the current group's reward distribution, pools track the running per-problem average. Configs often use both. Plus a one-line page-intro update + TOC entries. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: relocate Difficulty pools + ODF from Advanced to Algorithms Both are buffer-side controls over what reaches the trainer — same conceptual category as Filters and the loss/advantage knobs. Algorithms is the right home; Advanced is for orthogonal feature sets (LoRA, multi-tenant, custom modeling, multimodal). Promote each to its own top-level section. - algorithms.md: new "## Difficulty pools" and "## Online difficulty filtering" sections, inserted between Filters and Multi-turn trajectories. TOC updated. - advanced.md: section + TOC entries + page-intro mention removed. Content unchanged from the previous commit on Advanced — same threshold / fraction / persistence claims, same ODF tradeoff explanation, same cross-link to oversampling_factor. ODF section back-links to Difficulty pools for the orthogonality note. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(development): split MoE-debug recipe; promote "Adding a new architecture" - "Adding a new architecture" promoted to its own top-level section, placed *before* the renamed Debugging MoE recipe so the natural reading order is "here's how to wire up a new arch -> here's how to smoke-test it". Step 3 of the recipe now forward-links to Debugging MoE instead of "the three steps above". - "Testing MoE at small scale" -> "Debugging MoE". The page is already titled Development, so the qualifier was redundant. - Subsection titles drop the "Step N:" prefixes (the page-level TOC already implies sequence) and switch to sentence case for consistency with the rest of the docs: - Step 1: build and verify a mini model -> Build and verify a mini model - Step 2: SFT warmup -> SFT warmup (already correct) - Step 3: RL on reverse-text -> RL on reverse-text (already correct) - TOC updated; README docs index pitch swaps "small-scale MoE testing" -> "debugging MoE" to match the new section title. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(development): tighten Debugging MoE subsections - "### Build and verify a mini model" -> "### Create mini model". The roundtrip-verify body covers the "and verify" half; the shorter title is enough. - Merge "### SFT warmup" + "### RL on reverse-text" into one "### Smoketest training" subsection. The two were always run together as a single end-to-end smoke test (warmup so KL is meaningful, then RL stack), so a single subsection with two code blocks reads better than two artificially-split ones. - TOC updated. No external doc links to the old sub-anchors. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: rename Worked example -> Examples; update reference generator User-facing docs no longer reference configs/ directly — examples/ is the only "we keep this up to date" surface, the rest is CI- and debug-internal: - configuration.md: launch line + worked-example switched to examples/reverse_text/rl.toml. Section renamed "Worked example" -> "Examples" with a curated tour of the 10 README examples (basic 1-8 GPU + advanced SLURM tiers); the compose / override / dry-run walkthrough lives as a "### Worked example" subsection. - training.md: drop the "Debug configs for all variants ship under configs/debug/training_modes/" pointer in the Training modes section. The prose already explains how to set the mode. - scaling.md: P/D inference now points at examples/glm5_pd_disag/ rl.toml (with a link to its README) instead of the configs/-side inference-only TOML. - faqs.md: install-verify and smoke-test recipes both switch from configs/debug/sft and configs/gsm8k to examples/reverse_text. Reference generator (scripts/generate_docs_reference.py): - Drop "from the Pydantic config models" from the page header. - Move the regenerate command + structural notes from the header to a new "## About this page" footer. - Wrap the Type column in code spans so list[int], int | None, etc. render as code instead of plain text. fmt_type now emits literal `|` (GFM accepts pipes inside code spans inside table cells; no escaping needed). - Walk list-of-BaseModel fields. Previously orchestrator.train.env / orchestrator.eval.env / orchestrator.filters were rendered as one row showing the default repr; their leaf fields never showed up. New _list_inner_models() detects both list[X] (single model) and list[Annotated[Union[A | B], discriminator]] (discriminated union of list items, e.g. filters: list[FilterConfig]). Index placeholder rendered as <n> to match the CLI form (--orchestrator.train.env.0.id ...). Regenerate reference.md: +5k chars, mostly the new env/filter list-item subsections that were missing before. development.md still references two CI-tested configs/ paths (configs/debug/moe/sft/train.toml, configs/ci/integration/ reverse_text_moe/start.toml) — those are validated by the reverse_text_moe GPU integration test on every PR, so they don't risk drifting. Flagging in case the user wants those swapped too. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(training): correct batch-size rule of thumb 128-512 is the range for quick ablations, not production. Production RL often runs at 1024+. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: relocate "Disaggregated prefill/decode inference" to Advanced P/D disaggregation is a feature you opt into for large-MoE serving, not a step on the single-GPU -> 1000-GPU scaling ladder. It pairs naturally with Custom modeling / multi-tenant / multimodal as a specialized inference topology, so Advanced is the right home. - scaling.md: drop the section + TOC entry + "disaggregated prefill/decode inference" from the page intro. Page intro now forward-links to Advanced for users who came in for P/D. - advanced.md: append the section after Multi-tenant training, unchanged content (P:D ratio table, glm5_pd_disag example link, queue-depth monitoring snippet, UCX 1.19 build-from-source note). TOC + page-intro list updated. - overview.md "Where to go next": drop disagg from the Scaling bullet, add to the Advanced bullet. Anchor preserved (#disaggregated-prefilldecode-inference) — no external doc links to it survived the move check. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(scaling): correct the Single GPU section The previous claim "trainer and inference server can share a GPU" via the rl launcher was wrong. Verified against src/prime_rl/entrypoints/rl.py:86-99: the launcher partitions visible GPUs strictly (inference 0..N-1, trainer N..N+M-1) and raises ValueError when total_requested_gpus > len(physical_gpu_ids). Setting CUDA_VISIBLE_DEVICES=0 + --num-infer-gpus 1 + --num-train-gpus 1 makes total=2, visible=1, validation fails before anything launches. What actually works for single-GPU RL is the manual three-pane launch: each of uv run {inference,orchestrator,trainer} is an independent process with no cross-process GPU validation, so pinning CUDA_VISIBLE_DEVICES=0 on inference *and* trainer lets them share the same physical GPU. - Drop the misleading `uv run rl` recipe. - Promote the manual three-pane recipe to the canonical single-GPU path, with CUDA_VISIBLE_DEVICES=0 spelled out on both the inference and trainer panes. - Lead with SFT (where single-GPU is the default and just works). - Add an explicit "single-GPU RL is for debugging only" caveat. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(scaling): collapse Single GPU / multi-GPU / Multi-node manual into one umbrella - New umbrella section "## Single-node vs. multi-node deployment" framing the [deployment] discriminated union as the user-facing knob: single_node runs locally; multi_node currently goes through SLURM. Subsections nest beneath: - ### Single GPU (unchanged content from "## Single GPU") - ### Single-node multi-GPU (unchanged from "## Single-node multi-GPU") - #### RL placement - #### SFT and torchrun - ### Multi-node (new short pointer to ## SLURM with two cross- links to the existing RL / SFT-and-inference examples) - The umbrella section opens with a callout that manual multi-node launches are technically possible but reimplement what the SLURM launcher does — the user's preferred framing. - Drop "## Choosing a layout" entirely (the new umbrella section conveys the same routing more naturally + the layout table was going stale). - Drop "## Multi-node (manual)" entirely (RL training, SFT training, Multi-node inference subsections all gone). Anyone who needs the manual recipe can replicate what the SLURM templates do. Cross-link fixes: - training.md SFT § Launch line previously pointed at scaling.md#sft-training (under "## Multi-node (manual)"). Now points at scaling.md#sft-and-torchrun for non-default single-node layouts and scaling.md#slurm for multi-node. - faqs.md "Multi-node without SLURM or K8s?" answer updated: from "yes, see [Scaling § Multi-node (manual)]" to "not currently documented; technically possible but reimplements the SLURM launcher". Page intro adjusted to match the new structure ("multi-node SLURM and Kubernetes deployments" -> "single-node and multi-node deployments"). Co-authored-by: Cursor <cursoragent@cursor.com> * docs: drop Kubernetes coverage for now The K8s Helm chart at k8s/prime-rl/ still ships, but the user-facing docs are dropping coverage until the chart and the matching guide are re-validated together. - scaling.md: drop the "## Kubernetes" section + TOC entry. Page intro already covered (was reworded earlier in the restructure). - overview.md "Where to go next": drop "Kubernetes guides" from the Scaling bullet. - README.md docs index: drop "Kubernetes" from the Scaling bullet. The two passing-mention "k8s" / "Kubernetes" lines in README (Overview features list, Advanced Training Examples adaptability note) are left as-is — they describe codebase capability, not docs coverage. Reference.md still mentions Kubernetes liveness probes in an auto-generated field docstring; that's source-side, out of scope for this pass. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(development): tighten test-suite layout bullets - Drop the example test filenames from the tests/integration/ bullet — they're a moving list and not the point. - Reframe the tests/nightly/ bullet around what it does (runs the examples/ configs to catch regressions) instead of listing the individual nightly tests by name. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(development): drop the nightly 24h-timeout / research-cluster aside Co-authored-by: Cursor <cursoragent@cursor.com> * docs(development): polish 'Adding a new architecture' prose - Replace the bare 'To add (e.g.) Kimi 2.5:' opener with a one-line framing of the two-step contract: implement modeling code, register a mini preset for smoke-testing. - Bold the leading verb on each numbered step so the structure reads as a checklist. - Step 1 now nudges readers at glm4_moe/ and qwen3_moe/ as templates for the modeling code. - Step 2 explains *what* the preset is for ('build a ~0.5B test model in your architecture') rather than just listing fields. Path now links to scripts/mini_moe.py. - Step 3 says what the smoke-test actually exercises (roundtrip + SFT + RL stack) so users know what 'smoke-test' means here. Co-authored-by: Cursor <cursoragent@cursor.com> * ci(docs-reference): add minimal GITHUB_TOKEN permissions CodeQL alert actions/missing-workflow-permissions (security/code-scanning/19) flagged the new workflow for relying on the repo's default GITHUB_TOKEN permissions. The workflow only checks out code (contents: read), syncs deps via uv, runs the doc generator, and runs git diff. None of that needs write scope on any resource type. Pin to contents: read at the workflow level — explicit minimum that satisfies the rule. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: refresh architecture + async diagrams - assets/architecture.png: replace with the new diagram (trainer + orchestrator + inference deployment, GPU layout per process, data + scheduling + weight-broadcast arrows). Was 511k 96dpi, now 111k @ 200dpi from architecture.pdf. - assets/two-step-off-policy.png removed; assets/async-pipeline.png replaces it with the cleaner one-step-overlap diagram (trainer steps g_0..g_n above, inference samples with theta_{n-1} below). algorithms.md image reference + alt text updated to match the post-deprecation "one-step overlap" framing. - assets/rollout-timeline.png added but not yet referenced. It's a continuous-time view showing rollouts spanning policy boundaries (policies pi_{i-2}, pi_{i-1}, pi_i on the x-axis with rollout bars crossing the boundaries) — that's the picture behind max_off_policy_steps, not max_async_level. Want me to drop it into algorithms.md (e.g. above the off-policy / max_off_policy discussion) or save it for later? Co-authored-by: Cursor <cursoragent@cursor.com> * docs: normalize package mentions to [\`pkg\`](github-url) User-facing prose mentions of verifiers / renderers / research- environments / pydantic-config now consistently render as code-spans with a github link to the package. Affected lines: - overview.md: orchestrator-bullet [verifiers](url) (dropped the bare-text variant), install paragraph (linked all three submodules individually), quick-run paragraph. - algorithms.md: "Since [\`verifiers\` v0.1.8]..." (added backticks around the package name in the release-tag link). - training.md: SFT \"verifiers submodule\" launch line, useful-knobs vf_level row, tool-defs paragraph. Intentionally left alone: - algorithms.md \`verifiers.RolloutOutput\` (dotted-path code ref; whole expression already in code). - algorithms.md / training.md [renderers](#renderers) / [Renderers] (#renderers) (internal anchors to the in-page section, more useful than the github repo for a reader inside the doc). - algorithms.md "Hand-coded renderers ship for ..." and "the renderers writeup on the PI blog" — generic prose, not a package mention. - reference.md docstring-sourced mentions ("verifiers package", "renderers package", etc.) — those come from Pydantic field docstrings; would need source-side edits + regen. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(overview): drop the async-by-default + loss summary paragraph Out of date with the max_async_level deprecation and duplicates content already covered properly in algorithms.md (one-step overlap framing + the AIPO/KL loss math). Architecture bullets above already mention async semantics where relevant. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(overview): tighten 'Where to go next' to one-line pitches Co-authored-by: Cursor <cursoragent@cursor.com> * docs(readme): collapse test-suite commands into one code block Was four separate code blocks separated by one-line prose; now a single bash block with inline-comment annotations for each variant. Reads cleaner and matches the test-suite block in development.md. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: review-pass cleanups (max_async_level fallout, anchor fix, smoke-test) Self-review found a handful of small inconsistencies and stale claims that survived earlier passes. Stale max_async_level references (now hardcoded to 1, so any prose that treats it as tunable is wrong): - faqs.md: "If growing, drop max_async_level or LR" -> drop max_off_policy_steps. NCCL FAQ no longer says "requires max_async_level=1" — that constraint is vacuous. - training.md Rules of thumb: NCCL/max_async_level=1 dropped from the dry-run validator example; CP / flash-attention example stays. - scaling.md NCCL example: drop the trailing "# synchronous; max_async_level forced to 1" comment. Other accuracy / consistency fixes: - faqs.md hardware FAQ: drop "you can co-locate both on a single GPU" — verified earlier that the rl launcher rejects this; the manual three-pane recipe is the actual single-GPU path. Cross- link to Scaling § Single GPU. - faqs.md max_off_policy_steps wording: "throughput-vs-noise knob" -> "off-policy dial" to match algorithms.md / training.md. - training.md sft.data.loss_mask cross-link: anchor was reference.md#sft-data (the discriminated-union heading); the loss_mask sub-table actually lives at #sft-data-sft-loss-mask. - development.md "Smoketest training" -> "Smoke-test training" in the section title and TOC anchor, matching the hyphenated verb form ("smoke-test the new architecture") used in the page body. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: review-pass cleanup (drop FAQs, Title Case, smell fixes) Four asks rolled in: 1. **Drop docs/faqs.md entirely.** Removed the file plus all its cross-references: docs/mint.json nav, README.md docs index, and docs/overview.md "Documentation" list. The standalone Q&A page wasn't pulling its weight against the verifiers tone reference. 2. **Title Case all headings** across the user-facing pages so the visual style matches deps/verifiers/docs/* (which uses "Hosted Training" / "Performance Trade-offs" etc., not sentence case). Anchors are slug-based (lowercase + hyphen), so internal #links survive the case flip — only the link text in cross-doc "§ Section" references needed updating (training.md → Algorithms § Multi-Turn Trajectories, training.md → Scaling § SFT and Torchrun, scaling.md → Configuration § TOML Composition, scaling.md → SLURM § RL Example / SFT and Inference Examples). 3. **Rename overview.md "Where to go next" → "Documentation"** for symmetry with the verifiers landing page. 4. **Smell fixes**: a. algorithms.md had two near-identically-named subsections ("### The default loss" under Async with the loss math, and "### Default loss" under Loss with the mode dispatch). Collapse: the loss math now lives under "## Loss > ### Default Loss" together with the rl/opd/sft mode-dispatch bullets; the Async section is just intro + step semantics. One source of truth. b. reference.md auto-generated docstring mentions of "verifiers package" / "renderers package" / "renderers library" / "renderers.parsers" / "Registered verifiers environment ID" now render as [`pkg`](github-url) links. Source-side edits in packages/prime-rl-configs/src/prime_rl/configs/{shared, orchestrator,sft}.py, then regenerated reference.md. Net: faqs.md deletion (-198) dominates; everything else is small churn for case + anchor consistency. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: tightening pass after main merge Restructure + accuracy fixes that were piled up locally during the SSH-signing block earlier today. - configuration.md: note that reusing an env id requires a unique name; drop the "See each environment's README on the Hub" tail. - development.md: collapse "Adding a New Architecture" + "Debugging MoE" (with its Create Mini Model + Smoke-Test Training subsections) into a single "## Adding a New Model" with three subsections — Implement the Modeling Code, Register a Mini Preset, Run the Smoke Test. Page intro updated. - scaling.md: drop "## Single GPU" subsection; rename "## Single-Node Multi-GPU" -> "## Single-Node" so "Single-Node vs. Multi-Node Deployment" has just two clean children. Drop the manual-multi- node prose. Drop the [slurm] field reference table; rename the section to "## [deployment] Block" and link to reference.md. Collapse the two example subsections into one "## Examples" with pointers to examples/multinode/{rl,sft}.toml. Rename "## CPU Optimizer Offload" -> "## Optimizer Offloading". Add new "## LM Head Chunking" subsection covering the fused_lm_head_token_chunk_ size knob. Drop torchrun phrasing in the SFT scaling subsection, the CP recommendation paragraph, "(offloads checkpoints to CPU)" parenthetical, "RL gradient-accumulation amortization" line, attn = "flash_attention_2" from the memory-tight recipe, dry-run invaluable line. - algorithms.md: drop the Step Semantics subsection heading (body stays); replace the AIPO link with a plain "DPPO + KL similar to Kimi-K2.5" framing. - advanced.md: drop the "## Custom vs HF Implementations" subsection heading; the body becomes the lead content under "## Custom Modeling". - overview.md + README.md: pitch updates ("adding a new architecture" -> "adding a new model"; FAQs row already gone). Co-authored-by: Cursor <cursoragent@cursor.com> * docs: drop the auto-generated reference page and its tooling Removes everything in the reference-generation pipeline: - docs/reference.md — the 197k-char auto-generated field reference. - scripts/generate_docs_reference.py — the generator that walks Pydantic config trees, discriminated unions, list-of-models, etc. - .github/workflows/docs-reference.yaml — the CI guard that ran the generator and failed on git diff drift. - .pre-commit-config.yaml — drops the local docs-reference hook that re-ran the generator on staged config-class edits. Knock-on cleanup of cross-references: - mint.json: drop the "reference" page from nav. - overview.md / README.md: drop the Reference bullet from the Documentation list / docs index. - configuration.md: drop the two trailing "See [Reference] ..." pointers (under Discriminated Unions and at the end of the Examples section). - training.md: drop the "for the full field reference see [Reference]" tail in Useful Knobs; the loss_mask row no longer cross-links and just lists the four roles. - scaling.md: drop the [Reference § trainer.model] DeepEP pointer and the [Reference § slurm] pointer in the [deployment] block. - algorithms.md: drop the [Reference § orchestrator length penalties] line. - development.md: simplify the Pre-Commit Hooks section — only the ruff hook remains, so the configured-hooks bullet list goes away. Co-authored-by: Cursor <cursoragent@cursor.com> * revert: drop github-url docstrings on config fields The earlier edits added [\`verifiers\`](github-url) / [\`renderers\`] (github-url) markdown to a handful of Pydantic field docstrings so the auto-generated docs/reference.md rendered them as code-spans with links. With reference.md now removed, those annotations are inert clutter inside the runtime config classes — they don't render anywhere user-facing. Restore the three affected files to their state on main: - packages/prime-rl-configs/src/prime_rl/configs/orchestrator.py - packages/prime-rl-configs/src/prime_rl/configs/sft.py - packages/prime-rl-configs/src/prime_rl/configs/shared.py Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
e792f9cf88 |
chore(orchestrator): hardcode async-barrier semantics, drop max_async_level + strict_async_level (#2631)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* chore: deprecate user-facing max_async_level, hardcode to 1 Removes `max_async_level` as a user-configurable knob on `OrchestratorConfig`, `TrainerConfig`, and the shared `RLConfig`, and replaces internal usage with a constant `MAX_ASYNC_LEVEL = 1` in `prime_rl.utils.utils`. This was the only value compatible with NCCL weight broadcast, and exposing it invited misconfiguration (the trainer/orchestrator values had to match, and bench mode + a few configs overrode it ad-hoc). Drops the now-redundant NCCL validators on both sub-configs and the shared-field propagation/validator for `max_async_level`. Also removes the bench-mode `max_async_level = int(1e9)` workaround (no replacement flag). Closes #2630. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(async): drop MAX_ASYNC_LEVEL mention, describe as one-step overlap Co-authored-by: Cursor <cursoragent@cursor.com> * refactor: simplify step logic now that async lag is fixed at one Now that the trainer/orchestrator always run with a one-step async barrier, inline the value where it actually appears (scheduler ckpt math, trainer broadcast skip, filesystem cleanup) and drop the indirection through a ``MAX_ASYNC_LEVEL`` constant — the value is a design invariant, not a configuration knob, and naming it as a constant just made it look tunable. - scheduler: factor out ``_async_away_ckpt_step()`` so both ``_compute_next_ckpt_step`` and ``_apply_policy_update`` share a single source of truth, skip the ``get_latest_ckpt_step`` filesystem read entirely in strict mode, and clean up the awkward ``>1 step(s) ahead`` log line. - trainer: replace ``last_async_level_steps`` with a ``nccl_broadcast_unused`` flag that names the actual reason the broadcast is skipped (NCCL receivers have torn down). Filesystem broadcast still writes through to the final step for resume support. - ``maybe_clean``: drop the ``async_level`` parameter (only one caller, fixed value) and document why we delete the dir from two trainer steps ago. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(scheduler): drop _async_away_ckpt_step helper, inline step math The helper wrapped a single ``max(self.step - 1, 0)`` and was being called three times across two methods, adding indirection without saving anything. Inline it with a localized comment explaining the one-step lag invariant in each method, and flatten ``_compute_next_ckpt_step`` so the strict path is a guard around the latest-ckpt lookup rather than a separate early return. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: deprecate user-facing strict_async_level The strict-mode branch existed to support an "always exactly one step behind" reproducibility/ablation knob, but it's never been the default and exposing it just complicated the scheduler. Drop the field on ``OrchestratorConfig``, the constructor parameter on ``Scheduler``, and collapse ``_compute_next_ckpt_step`` to the single non-strict path (``max(step - 1, 0, latest_ckpt)``). Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(scheduler): drop redundant 0 clamp in _compute_next_ckpt_step ``latest_ckpt_step`` already falls back to 0 (via ``... or 0``), so it dominates the explicit ``0`` argument in every case — including ``self.step == 0`` startup, where ``latest_ckpt_step`` is also 0. Dropping it makes the intent clearer: advance to at least step - 1, or to whatever the trainer has broadcast if that's newer. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(changelog): note max_async_level / strict_async_level removal as breaking Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
3b386a4489 |
chore: drop teacher_inference from rl entrypoint (#2629)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The `rl` entrypoint now only manages student-policy inference. External teachers (OPD, local-vLLM SFT) must be started manually and pointed at via `[orchestrator.teacher.client]`. Removed: - `[teacher_inference]` block from `RLConfig` - `deployment.num_teacher_gpus` (`SingleNodeDeploymentConfig`) - `deployment.num_teacher_nodes` (`MultiNodeDeploymentConfig`) - launcher code that spawned/monitored the teacher inference subprocess - related validators (`auto_setup_teacher_inference`, `_stub_orchestrator_teacher_for_auto_setup`, `validate_no_teacher_in_multinode`, `teacher_inference_not_supported`) Fixes #2627 Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
ae1461e7a1 |
docs: fix stale slurm config examples and references (#2619)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The docs and a couple of example READMEs described slurm usage that no longer matches the real config system - users following them would hit validation errors. - docs/slurm.md: drop bogus `toml_files = [...]` (not a pydantic-config feature) and document the real `@ base.toml @ overlay.toml` compose syntax. Rename `[orchestrator.sampling]` and `[[orchestrator.env]]` to the current `train`-scoped paths, swap `max_tokens` for `max_completion_tokens`, repoint dead `examples/hendrycks_math/` links to `examples/multinode/`, fix the inference example filename and `--dry-run` flag usage - examples/hendrycks_sanity/README.md: the slurm command was invoking the overlay alone (which fails validation), compose base + overlay - examples/wiki_search/README.md: stale `[[orchestrator.env]]` path |
||
|
|
20f6449e1f |
refactor: rename rollouts_per_example to group_size (#2599)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Renames the orchestrator-level, [orchestrator.eval] group-level, and per-env [[orchestrator.eval.env]] fields. The old name still parses as a validation alias in both TOML and CLI, so existing configs keep working unchanged. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
c95a943c39 |
feat(scheduler): train on partial groups instead of dropping on rollout error (#2590)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat(scheduler): train on partial groups instead of dropping on rollout error When an individual-scoring env returns N rollouts for a single example and one errors out, scrap only the failed rollout — keep the survivors and ship the group through as soon as every dispatched rollout has come back (success or failure). Group-scoring envs still drop the whole group on any failure because their per-rollout scores are computed against the now-missing rollouts. To make variable-size groups round-trip through advantage computation, group rollouts by (env_name, example_id) instead of positional slicing, and bucket groups by size so each advantage_fn call still sees a uniform 2D rewards tensor. Singleton groups produce zero advantage and get filtered out by the existing zero-advantage filter — no special-casing. Closes #2585. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(advantage): make advantage_fn per-group Drop the bucket-by-size workaround in compute_advantages by changing the advantage_fn contract: AdvantageInputs.rollouts is now a single group (list[RolloutOutput]) and AdvantageOutputs.advantages is 1D. The framework calls advantage_fn once per group, which works cleanly for variable-size groups (partial-group training). BREAKING: second change to this public API in three weeks. Custom advantage functions must drop the outer list dim. Migration documented in CHANGELOG.md and docs/bring-your-own-algorithms.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(advantage): return list[float] from advantage_fn Drops the torch tensor from the public AdvantageOutputs contract; internal math stays in torch and converts via .tolist() at the boundary. Same partial- group support, simpler downstream consumers (no more .tolist() / no shape gymnastics in custom advantages). BREAKING (folds into the per-group change in the previous commit): custom advantage functions must return AdvantageOutputs(advantages=[...]) rather than a tensor. CHANGELOG entry and docs example updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(scheduler): log each rollout failure inline, drop GroupState.last_failure_reason The reason is now logged at the moment the failure is observed (one warning per failed rollout) instead of being stashed on the group and replayed at finalization. Removes the per-group field entirely and avoids the "first vs latest wins" semantic question that came up in review - each log line carries its own actual reason. Finalization warnings only carry counts now. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(scheduler): drop verbose comment on GroupState.failed_rollouts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
ea2f390045 |
feat: renderer-only multimodal path — rip MITO branch, pack pixel_values from renderer (#2473)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: drop use_renderer=True VLM skip; pack pixel_values from renderer interleave_rollout now consumes renderer-emitted multi_modal_data on each trajectory step (when present), packs the per-image pixel_values and image_grid_thw onto the TrainingSample, and computes mm_token_type_ids — no VLMImageCache lookup required when the rollout went through a multimodal renderer. VLMImageCache stays as the fallback for MITO/chat-completions rollouts. build_trajectory_step (renderers package) was updated separately to surface mm_data on its output, so the pretokenize-fallback path also carries images through correctly. Other changes: - orchestrator config: removed validate_renderer_vs_vlm validator that previously rejected use_renderer=True for VLMs (it's now supported). - e2e test: a real Qwen3VLRenderer + RendererClient -> /inference/v1/generate mock POST, plus a roundtrip through vllm's GenerateRequest pydantic model and decode_mm_kwargs_item. Strongest end-to-end check we can run without a GPU. - 20-step A/B configs for color-codeword (feat-renderer vs main-mito), both logging to W&B project 'multimodal-renderer'. 126 orchestrator unit tests pass (+2 new for renderer-mm packing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(orchestrator): rip MITO multimodal path, renderer-only for VLMs Delete the MITO chat-completions multimodal branch from the orchestrator and the ~370 lines of image-cache/preprocess machinery in trajectories.py that supported it. VLM training now goes through the renderer path exclusively — the renderer owns the processor, ships byte-identical pixel_values to both vLLM (via /inference/v1/generate features) and the trainer (via mm_kwargs). Renderer-shipped mm_token_type_ids: the orchestrator reads the renderer's `mm_token_type_id_map` property (1=image_pad, 2=video_pad) and stamps a per-token list onto each TrainingSample. Trainer's `_get_qwen3_vl_mm_token_type_ids` auto-path remains as a fallback but the renderer is now the source of truth. forward() now takes a generic `mm_kwargs: dict` (e.g. {pixel_values, image_grid_thw}) instead of the Qwen3-VL-specific (pixel_values, image_grid_thw) keyword pair, so adding new VLM families (Gemma3, LLaVA, etc.) doesn't require touching forward. Config validator: orchestrator.use_renderer must be true when model.vlm is set — fail at config-load instead of producing cryptic runtime errors. Test cleanup: drop 25 tests for removed helpers (VLMImageCache, _extract_images, etc.); update the one remaining renderer-mm trajectory test to pass `mm_token_type_ids_mapping` directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: align with renderer-multimodal PR surface (configs + deps + tests) CI was failing for three reasons after the cherry-pick of the renderer multimodal commits onto current origin/main. Three fixes: 1. Multimodal configs missing the renderer flag pair. The orchestrator config validator (added in the same PR) requires ``use_renderer = true`` when ``model.vlm`` is set, AND it's mutually exclusive with ``use_token_client`` (default ``true``). Three configs (``rl_color_codeword_test.toml``, ``rl_color_codeword.toml``, ``ci/nightly/multimodal_color_codeword.toml``) needed both flags set explicitly in ``[orchestrator]``. Delete ``rl_color_codeword_main_mito.toml`` — that was the A/B reference for the legacy MITO path, which this PR rips out. With MITO gone the config is no longer runnable; the ``rl_color_codeword_feat_renderer`` counterpart already covers the new renderer-driven path. 2. ``test_model_forward.py`` was still calling ``forward(..., pixel_values=..., image_grid_thw=...)``. ``forward()`` now takes a generic ``mm_kwargs: dict`` (so adding new VLM families doesn't require touching the trainer signature) — update both tests to pass ``mm_kwargs={"pixel_values": ..., "image_grid_thw": ...}`` instead. 3. ``renderers`` / ``verifiers`` deps stale. The orchestrator imports ``MultiModalData`` from ``renderers.base`` (introduced in the companion renderers PR) and threads ``multi_modal_data`` end-to-end via the verifiers ``RendererClient`` changes. Pin both to their feature branches until the upstream PRs merge and PyPI / git rev-pins are bumped: - renderers @ feat/multimodal-vlm - verifiers @ feat/renderer-multimodal-passthrough Drops the ``renderers==0.1.6`` PyPI pin (the new symbols are post-0.1.6). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump renderers + verifiers to latest feature-branch commits Picks up: - renderers c3feaa5: RendererPool implements Renderer protocol structurally (callers can drop pool unwrap + isinstance branching), size=1 fast path, is_multimodal helper with per-type cache. - verifiers 64f2555a: bugbot pass — multimodal dispatch fix (was broken for pooled renderers), tighter is_json_serializable, response-tokens mm_data strip on intermediate steps. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump renderers + verifiers to pick up isinstance dispatch fix Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: drop renderers git source, pin to released 0.1.7 renderers v0.1.7 is now on PyPI with the multimodal feature set this branch consumes (RenderedTokens, MultiModalData, MultimodalRenderer protocol, mm_token_type_id_map, RendererPool delegation). verifiers still pinned to feat/renderer-multimodal-passthrough until that companion PR merges. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: repin verifiers to main + bump renderers to 0.1.8.dev2 The multimodal renderer-passthrough work has merged on verifiers (verifiers#1346 → c7731bbb, on main since 2026-05-12), so we no longer need the feature-branch pin. Switching to a `rev =` pin on main (f633365f) — consistent with how every other git source in this file is pinned — and bumping renderers to 0.1.8.dev2 to match what verifiers main now requires. Pin updates: - verifiers: branch `feat/renderer-multimodal-passthrough` (0.1.14 @ 397b8aa5) -> rev `f633365f` (0.1.15.dev7) - renderers: `>=0.1.7` -> `>=0.1.8.dev2` - prime-sandboxes: 0.2.22 -> 0.2.26 (transitive from verifiers main) - fastokens added (transitive from renderers 0.1.8.dev1+; renderers routes `load_tokenizer` through fastokens by default) What's in the verifiers delta (397b8aa5..f633365f) that touches our surface: - `RendererClient.from_native_response` migrated to renderers' `ParsedToolCall` dataclass shape and filters non-OK parse attempts (verifiers#1366 / renderers#22). Internal — the Response we consume is unchanged. - Routed-experts payloads now flow as opaque bytes through the chat completions clients (verifiers PRs around the `routed_experts` changes). Prime-rl consumes the surface that emits these; no caller change needed. Test plan: - [x] `uv run pytest tests/unit/orchestrator` — 101 passed against the new pins, including `test_qwen3_vl_e2e` which exercises the renderer -> RendererClient -> /inference/v1/generate roundtrip path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: drop renderers version pin, defer to verifiers' transitive constraint We import directly from `renderers` (orchestrator + tests), so the dep needs to be declared — but pinning a floor here is just second-guessing verifiers, which already requires `renderers>=0.1.8.dev2`. Let verifiers be the source of truth for the version. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(trainer): drop mm_token_type_ids auto-compute, trust renderer The auto-compute path (`_get_qwen3_vl_mm_token_type_ids`) was preferred over the renderer-shipped `mm_token_type_ids` in `forward()`. For Qwen3-VL the auto function never returns `None` (allocates `torch.zeros_like(input_ids)` then masked_fills), so the explicit orchestrator-shipped list was silently discarded — contradicting both the "renderer is source of truth" design and the trajectories.py comment noting the explicit list produces ~30x lower mismatch KL. The new `vlm_requires_renderer` validator (this PR) mandates the renderer for every VLM config, so the auto path is no longer reachable as a real fallback. Deleting it. The renderer's `mm_token_type_id_map` is now the sole source of truth, exactly as advertised. Also adding the CHANGELOG entry the validator missed — removing the `[model.vlm]` + `use_renderer = false` combo is a breaking config change per CHANGELOG.md's stated policy. The remaining `if "image_grid_thw" not in mm_kwargs` branch is *not* renderer-replaceable: it skips `position_ids` for MRoPE families because HF's Qwen-VL `forward()` internally recomputes 3D positions from `image_grid_thw` and breaks if given the trainer's pre-computed 1D `position_ids`. Duck-typed against the kwargs schema so any future MRoPE family that ships `image_grid_thw` is handled without a `model_type` enumeration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(orchestrator): union per-step delta mm_data across sample's step range verifiers ≥ c7731bbb (PR #1346 merge) replaced ``_strip_intermediate_mm_data`` with ``_delta_intermediate_mm_data`` (commit 9aafa659): each trajectory step now carries only the items whose ``mm_hash`` was NOT in the prior step's cumulative set, with multiset-aware semantics. The intended contract is that per-window assemblers union deltas to recover the per-sample cumulative. Prime-rl's ``interleave_rollout`` was that assembler but still read ``prepared_steps[last_step_idx].get("multi_modal_data")`` alone, assuming the last step held the cumulative set. With the new delta encoding, the last step often holds **0 items** (everything was a duplicate of step 0's cumulative set) — so the trainer was given pixel_values for only the first turn's images. For ``color-codeword`` with ``max_turns=2, images_per_turn=2`` (4 images total), the trainer saw a subset → wildly wrong attention → mismatch KL jumped from ~0.04 to ~7 (>100× regression). On Qwen3-VL the model raised ``ValueError: Image features and image tokens do not match`` when the delta drop left the trainer with fewer feature blocks than placeholder runs. Fix: track ``start_step_idx`` per active sample and concatenate ``mm_items`` / ``mm_hashes`` across ``[start_step_idx, last_step_idx]`` in step order. No dedup here — verifiers' delta already handled cross-step dedup with multiset semantics (legitimate duplicate placeholders, where the same image appears in two turns' separate placeholder runs, are preserved). Test plan: - ``uv run pytest tests/unit/orchestrator/test_trajectories.py`` — 20 passed - ``uv run pytest tests/unit/orchestrator tests/unit/train`` — 216 passed, 6 skipped, 1 xfailed - ``uv run rl @ configs/multimodal/rl_color_codeword_feat_renderer.toml`` on 2× RTX PRO 6000: Step 0 KL **0.020** (was 7.0), Step 1 **0.090**, Step 2 **0.253** — all within the baseline range published in #2473 (max 0.487 across 20 steps). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(orchestrator): track explicit step indices per sample for mm union interleave_rollout used (start_step_idx, last_step_idx) to bound the mm_data union per sample. When agents interleave (e.g. agent1 at steps 0,1,3 and agent2 at step 2), the range [0,3] over-collects step 2 and agent2's delta mm_items leak into agent1's sample.mm_kwargs — placeholder count vs. patch count mismatches at the VLM forward. Replace the (start, last) pair with the explicit list of prepared_steps positions merged into the sample. _union_step_mm_data iterates the list directly, so non-owned steps are skipped by construction. Non-interleaved trajectories produce step_indices = [0..N], iterating identically to the old range — bit-for-bit unchanged for the common path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: eligotts <78387377+eligotts@users.noreply.github.com> |
||
|
|
eaf95997f7 |
feat: first-class sft+opd training modes (#2546)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add student eval inference pool for SFT hard distillation When teacher_rollout_model is configured for SFT distillation, the orchestrator now supports a separate student inference pool for online evals and weight sync. Previously, configuring [inference] alongside teacher_rollout_model was forbidden — evals either ran on the teacher or were skipped entirely. Changes: - Relax RLConfig validator to allow [inference] + teacher_rollout_model - Create eval_inference_pool from config.client when teacher_rollout_model is set, pointing at the student vLLM server - Route eval calls and weight updates to the student pool - Add eval_inference_pool param to Scheduler for weight sync targeting - All existing RL/soft-distill paths are unchanged (eval_inference_pool defaults to inference_pool when no teacher_rollout_model is configured) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: keep hard distill student eval pool optional * fix: scope teacher rollout routing * fix: address teacher rollout review comments * fix: clarify teacher rollout client routing * fix: honor teacher rollout client type * refactor(orchestrator): rename model/teacher_model to student/teacher Consolidates 3 training modes (rl, opd, sft) under a unified config structure: `student` (always present) and `teacher` (optional, role determined by `training_mode`). Removes scattered flags (`use_sft_loss`, `update_student_inference_weights`) in favour of a single discriminator. Backward-compat aliases (`model` → `student`, `teacher_model` → `teacher`) keep existing TOML configs parsing without changes. Also adds `configs/reverse_text/debug_{rl,opd,sft}.toml` for local mode debugging. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(configs): cap reverse-text debug eval at 64 examples Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(configs): cap reverse-text debug eval completion tokens at 128 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(configs): use correct PI inference teacher model name qwen/qwen3-4b-instruct doesn't exist on PI inference; use Qwen/Qwen3-4B-Instruct-2507 instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(configs): use qwen3-30b-a3b-instruct as debug teacher model Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(configs): correct teacher model name to qwen3-30b-a3b-instruct-2507 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(client): add headers_from_env to ClientConfig Maps header names to env var names, resolved at client setup time. Analogous to api_key_var but for arbitrary headers. Useful for e.g. X-Prime-Team-ID when hitting the PI inference API. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(client): auto-inject X-Prime-Team-ID header for PI inference When ClientConfig.base_url targets pinference.ai, auto-add a headers_from_env mapping for X-Prime-Team-ID -> PRIME_TEAM_ID so team billing works without each config repeating the boilerplate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(configs): set debug eval to 256 rollouts (64 examples x 4) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(configs): use local vLLM teacher for debug OPD instead of PI inference PI inference is OpenAI-compatible but doesn't expose vLLM's /inference/v1/generate prefill endpoint that compute_teacher_logprobs needs - so OPD against PI inference 404s. SFT mode kept working because that path only hits /chat/completions. Switch debug_opd.toml to use the existing teacher_inference auto-setup: set num_teacher_gpus = 1, and an empty [orchestrator.teacher] block to satisfy the orchestrator validator (which runs before auto_setup_teacher_inference can populate it). The validator chain spins up a local vLLM teacher on port 8001 using the same reverse-text student model. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs+validate: training modes grid + cross-config constraints - Add docs/training_modes.md with the rl/opd/sft role grid, implications (e.g. OPD needs local vLLM teacher, SFT teacher is any OAI-compatible endpoint), and minimal config per mode. Linked from mint.json nav. - Add validate_training_mode_loss_consistency on RLConfig enforcing: sft mode <-> sft loss type, opd mode requires teacher_tau > 0, non-sft modes forbid sft loss type. These cross orchestrator and trainer fields so they live on RLConfig (per-component validators in OrchestratorConfig already cover the within-orchestrator constraints). - Fix debug_sft.toml to set trainer.loss.type = "sft" (was relying on default loss which is now explicitly rejected). - Make training_mode explicit in debug_rl.toml and debug_opd.toml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(configs): lift training_mode to RLConfig + point debug teacher at local vLLM - Add shared training_mode field to RLConfig (rl | opd | sft). A mode="before" validator propagates it into orchestrator.training_mode and (for sft) trainer.loss.type before nested validation runs. Must be a before-validator because OrchestratorConfig.validate_training_mode would otherwise reject configs like training_mode = "opd" + [orchestrator.teacher] - the orchestrator-level default of "rl" would conflict with the teacher block before the after-validator could propagate the shared value. - Point debug_opd and debug_sft at a manually-deployed teacher vLLM (Qwen3-0.6B-Reverse-Text-RL on localhost:8001). Add a comment with the exact teacher start command at the top of each config. Drop the num_teacher_gpus auto-launch from debug_opd since we now use the external teacher. - Set student inference gpu_memory_utilization = 0.5 in all three debug configs (matches the teacher's mem budget, leaves room when both are co-located). - Add configs/reverse_text/README.md with the start commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: drop GPU-occupancy runtime check; teacher uses uv run inference - Remove check_gpus_available in rl entrypoint - it raised RuntimeError when other processes held GPUs, which blocked iterating with a long-lived teacher inference server on a sibling GPU. - Update debug_opd / debug_sft / README to start the teacher via uv run inference (the prime-rl variant) instead of raw vllm serve. Same port (8001), same model, same flags. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(configs): accept legacy flat [orchestrator.model.lora] layout Pre-refactor, orchestrator.model was a ModelConfig directly (name, lora, trust_remote_code, vlm). After the student/teacher rename it's a RolloutModelConfig wrapping ModelConfig + ClientConfig, so existing [orchestrator.model.lora] TOML sections stopped parsing because they landed on the wrong nesting level. Add a mode="before" validator on RolloutModelConfig that detects a flat ModelConfig dict (any of {name, trust_remote_code, vlm, lora} at the top level, no nested model/client keys) and re-nests it under "model". This lets the three existing LoRA configs revert to their original syntax. Also fix examples/alphabet_sort/sft_distill_hard.toml: hoist training_mode to the top-level shared field so trainer.loss.type = "sft" gets auto-set (previously the orchestrator-only flag triggered the new sft/loss consistency validator). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(orchestrator): split into student_inference + teacher_inference pools Replace the "one pool plus optional teacher-client overlay" model with two explicit pools: - student_inference: InferencePool | None - Required for rl/opd, optional for sft (set iff [inference] is configured) - Target for evals, weight broadcast, and inference metrics - When None, online evals and policy updates are skipped automatically - teacher_inference: InferencePool | None - Set whenever orchestrator.teacher is configured (opd or sft) - Source of teacher logprobs in opd - Source of train rollouts in sft - Always MITO (chat completions) for simplicity; external OAI-compatible teachers (PI inference, OpenAI) work as drop-in endpoints Scheduler now takes both pools and resolves the rollout target internally (rollout_inference = teacher_inference if sft else student_inference). The old _resolve_rollout_request_target overlay is gone - the rollout pool serves rollouts directly. Fixes a latent bug where SFT-mode LoRA updates would overwrite scheduler.model_name and route subsequent teacher requests with the student's LoRA name. Also: - Drop setup_external_rollout_model (logic is now inline + clearer) - Rename setup_rollout_inference_pool -> setup_student_inference_pool; always handles only the student pool, teacher is plain setup_inference_pool - Log the resolved training_mode + one-line description at orchestrator start - Update tests: cover both sft (rollout != student) and rl (rollout = student) LoRA paths; drop the now-obsolete teacher-overlay scheduler test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs+configs: legacy [orchestrator.client] shim + merge OPD doc into training_modes - Add _accept_top_level_client validator on OrchestratorConfig: legacy [orchestrator.client...] re-nests under [orchestrator.student.client...] matching the existing _accept_flat_model_layout shim pattern. Revert configs/elastic/rl.toml back to the original [orchestrator.client.elastic] syntax. - Revert configs/ci/integration/reverse_text_multi_run/orchestrator.toml [model.model] -> [model]; the flat-layout shim on RolloutModelConfig already handles it (verified). - Merge docs/on_policy_distillation.md into docs/training_modes.md. The training_modes page is now the single entry point; OPD-specific details (external teacher, pure distillation, monitoring, VLM, params) live as subsections. Delete the standalone OPD page. - Drop the redundant "Initializing static inference pool" / WandbMonitor / PrimeMonitor init logs - they duplicate the immediately-preceding per-pool init line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(orchestrator): probe teacher for prompt_logprobs before training In OPD mode, send a tiny probe request to the teacher's /inference/v1/generate endpoint after the pool is ready. If the endpoint 404s or doesn't return prompt_logprobs, raise an informative error pointing at docs/training_modes.md instead of crashing mid-training with a 404. Verified that PI inference fails this probe on all three plausible routes: - /inference/v1/generate -> 404 - /v1/chat/completions with logprobs=true -> logprobs:null in response - /v1/completions with echo=true,logprobs=1 -> 404 Also add configs/reverse_text/debug_sft_thinking.toml: SFT from qwen3-30b-a3b-thinking-2507 via PI inference (sft path needs only chat completions, so PI inference is fine here). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(orchestrator): deprecate use_token_client (server-tokenized TITO) Drop the server-tokenized TITO path (``openai_chat_completions_token`` / ``/v1/chat/completions/tokens``). The orchestrator now picks between renderer-backed TITO (``use_renderer = true``, default) and MITO (``use_renderer = false``, fallback for VLMs and external teacher rollouts). - Remove ``OrchestratorConfig.use_token_client`` field and its validators - Drop the TITO branch in ``setup_rollout_inference_pool`` - Drop the obsolete TITO warning in ``setup_inference_pool`` and flip the default ``train_client_type`` to ``openai_chat_completions`` in ``StaticInferencePool`` / ``ElasticInferencePool`` - Strip ``use_token_client = false`` from configs/examples/docs that carried the no-op fallback line - CHANGELOG entry documenting the breaking removal Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(inference): remove server-side TITO route Drop the ``/v1/chat/completions/tokens`` endpoint and the ``OpenAIServingChatWithTokens`` / ``ChatCompletionRequestWithTokens`` wrappers now that no client routes to them. Also drop the obsolete ``base()`` helper and unused imports from ``server.py``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor: require student_inference in all training modes Student inference was already required for rl/opd and optional for sft; making it required everywhere simplifies the orchestrator + scheduler: - Drop has_student_inference / enable_policy_updates gating - student_inference: InferencePool (no longer Optional) in Scheduler.__init__ - Weight broadcast init, weight sync, metrics collector, eval routing, and shutdown all unconditionally use student_inference - Drop the now-stale OPD probe (will revisit in a follow-up PR) - Add is_vlm property on BaseModelConfig; replace local is_vlm vars in the orchestrator with config.student.model.is_vlm - Merge the two legacy student-layout shims on OrchestratorConfig into one before-validator (_accept_legacy_student_layout) covering both [orchestrator.client.*] and flat [orchestrator.model.<k>] paths - Drop redundant pool / WandbMonitor / PrimeMonitor init log lines - Reorder OrchestratorConfig fields: training_mode > student > teacher - Drop "OAI" from RolloutModelConfig.client description - Update docs/training_modes.md: SFT student inference is now required; evals and weight sync are unconditional Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(configs): default OPD to pure distillation (teacher_tau=1, adv_tau=0) auto_setup_training_mode now seeds trainer.loss defaults when training_mode is opd: teacher_tau=1.0 and adv_tau=0.0 (pure distillation: drop the reward signal, full weight on the teacher KL). User-provided values still win via setdefault. Also accept training_mode set only inside [orchestrator] - same auto-setup applies for both the shared top-level and orchestrator-local forms. Drop the redundant [trainer.loss] teacher_tau = 0.5 block from configs/reverse_text/debug_opd.toml; verified the auto-setup applies end-to-end (3 train steps, teacher logprobs computed each step, clean exit). Also drop the now-redundant InferencePool type annotation on self.rollout_inference - both branches assign a definite InferencePool now that student_inference is non-Optional. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(configs): rename debug_sft_thinking -> debug_sft_external; drop examples/alphabet_sort/sft_distill_hard.toml debug_sft_external describes the role better - external SFT teacher via OAI-compatible endpoint (PI inference). The "thinking" label was about the specific model the config picks (qwen3-30b-a3b-thinking-2507), not about what the config demonstrates. Drop examples/alphabet_sort/sft_distill_hard.toml: configs/reverse_text/ debug_sft* are the canonical SFT examples now. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(tests): unbreak CPU tests after student/teacher rename + headers_from_env - tests/unit/train/test_runs.py: orchestrator config attribute access changed from config.model.name to config.student.model.name after the RolloutModelConfig rename. - tests/unit/utils/test_elastic.py: MagicMock client_config needs headers_from_env set to {} - the field was added in this PR and the test's hand-built mock missed it (pydantic rejects MagicMock as a dict). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(orchestrator): strip logprobs from train sampling in sft mode The trainer in sft mode reconstructs teacher tokens via the student tokenizer - it never reads inference-side logprobs from the teacher endpoint. Stripping logprobs at runtime lets external reasoning-model endpoints (openai/gpt-5*, etc.) accept the rollout request - they reject logprobs with 400 invalid_request "logprobs are not supported with reasoning models". Done at orchestrator-startup time on each TrainEnv's sampling_args rather than as a public config field, since this is a mode-specific runtime concern. Also: bump configs/reverse_text/debug_sft_external.toml to use openai/gpt-5-mini (faster than qwen3-30b-a3b-thinking-2507). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(configs): bump debug_sft_external for gpt-5-mini reasoning budget gpt-5-mini's max_completion_tokens budget includes reasoning tokens. At 128 the model burned the whole budget on internal CoT before producing the final answer, returning empty content. Raise to 2048 and set reasoning_effort=minimal so the chat-completions response includes the actual output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: fix stale SFT references after the student/teacher refactor - skills/config/SKILL.md: update the SFT hard distill section - orchestrator.teacher_model -> orchestrator.teacher, drop the "student inference is optional" guidance (the orchestrator now unconditionally sets up student_inference), and add a note that shared training_mode auto-propagates to trainer.loss.type. - rl.py: auto_setup_inference_client docstring referenced the deleted setup_external_rollout_model function. Rewrite to explain what the validator actually does for each mode. Also note the behavior change in the PR description: SFT now requires [inference] (was previously optional). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(loss): batch-driven loss dispatch via TrainingSample.training_mode Replace TrainingSample/MicroBatch.sft_loss bool with training_mode literal (rl|opd|sft). The trainer's compute_loss reads training_mode from the micro batch and dispatches: - "sft" -> sft_loss_fn (masked NLL on teacher tokens) - "rl" -> default_loss_fn with (adv_tau=1.0, teacher_tau=0.0) - "opd" -> default_loss_fn with (adv_tau=0.0, teacher_tau=1.0) Taus move from trainer.loss config to compute_loss's mode->tau table and flow into LossInputs per batch; DefaultLossConfig drops the teacher_tau / adv_tau fields. The orchestrator stamps each sample with config.training_mode at the same point it used to set sft_loss. Packer enforces same-mode packing (samples with different training_mode cannot share a micro batch). RLConfig drops the OPD tau auto-setup + "opd requires teacher_tau > 0" validator + the validate_teacher_model teacher_tau gate (all redundant under batch-driven dispatch). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(loss): dedicated opd_loss_fn instead of routing taus through inputs Replace the per-batch adv_tau/teacher_tau routing through LossInputs with a dedicated opd_loss_fn that lives alongside default_loss_fn and sft_loss_fn. A bit of code dup in opd_loss_fn (clone of default's DPPO math) makes the two paths read as separate losses rather than the same function with magic multipliers. - setup_loss_fn -> setup_loss_fns: returns a dict {training_mode: LossFn}. rl uses the configured loss (default/custom). opd uses opd_loss_fn (only available when loss_config is DefaultLossConfig). sft is always available. - compute_loss takes loss_fns + training_mode, looks up the right fn. - opd_loss_fn requires teacher_logprobs (raises otherwise). - LossInputs no longer carries adv_tau/teacher_tau - those values are baked into each loss fn. - Add validator: opd mode requires trainer.loss.type = "default". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(loss): drop trainer.loss type discriminator + shared training_mode Now that loss dispatch is fully batch-driven (TrainingSample.training_mode), the trainer.loss type union and the shared RLConfig.training_mode propagator are redundant. Flatten: - Delete SFTLossConfig (the mode implies it; no fields). - trainer.loss: DefaultLossConfig = DefaultLossConfig() (flat, not a union). - trainer.custom_loss: CustomLossConfig | None = None - optional override for rl-mode loss only; opd and sft always use opd_loss_fn / sft_loss_fn. - setup_loss_fns(loss_config, custom_loss) always returns all three keys - mixed-mode batches dispatch correctly at the trainer level (orchestrator still stamps a single mode per run; that's a separate concern). - Drop RLConfig.training_mode shared field, the auto_setup_training_mode before-validator, and validate_training_mode_loss_consistency. The orchestrator-level [orchestrator] training_mode is the single source. Move training_mode = "sft" out of top-level into [orchestrator] in the three SFT debug configs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(rl entrypoint): warn for missing [inference] in all modes (incl. sft) After the always-require-student refactor, sft runs need a student inference pool too (orchestrator unconditionally creates it for evals + weight sync). The old "sft mode, using teacher for rollouts" info log was correct under the old semantics but now silently puts the user on a path where the orchestrator hangs waiting for a non-existent student server at the default localhost:8000. Replace with a single warning that prints the configured student base_url and flags the hang risk. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(loss): make opd_loss_fn's tau values explicit (adv_tau=0, teacher_tau=1) Mirror default_loss_fn's structure literally: declare the two tau locals at the top, then use them in the same `adv_tau * advantages + teacher_tau * teacher_kl.detach()` expression. The "this is the default loss with those specific knobs baked in" relationship is now visible in the code rather than hidden in a substituted expression. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(loss): restore DefaultLossConfig.adv_tau + LossConfig union (rl-only) - DefaultLossConfig regains adv_tau (= 1.0). default_loss_fn reads it. - trainer.loss is back to a discriminated union of DefaultLossConfig | CustomLossConfig (drop SFTLossConfig stays dropped). type discriminator restored. - trainer.loss only applies to rl-mode batches. opd and sft batches dispatch unconditionally to opd_loss_fn / sft_loss_fn - they don't read trainer.loss. - opd_loss_fn is self-contained: the DPPO/KL knobs (dppo_mask_*, kl_tau) are baked in as module-level _OPD_* constants matching DefaultLossConfig's defaults. No loss_config parameter. - Drop the trainer.custom_loss sibling field (subsumed by the union). Also add debug_opd_lora.toml + bump lr to 1e-4 in both lora debug configs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(loss): inline opd_loss_fn knobs (no named locals/constants) Drop the module-level _OPD_* constants and the local adv_tau/teacher_tau bindings - inline the literal values into the math. Keeps the parallel structure to default_loss_fn visible: `0.0 * advantages + 1.0 * teacher_kl` in the same place default_loss_fn has `loss_config.adv_tau * advantages`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(loss): trim opd_loss_fn docstring Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: update reverse_text README — add lora configs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * polish: auto-disable renderer in sft + CHANGELOG + log/shim cleanup - OrchestratorConfig auto-sets use_renderer=False when training_mode='sft' via an after-validator placed before the renderer validators in declaration order, so the user doesn't have to set it. Drop the rejecting branch in validate_training_mode + the explicit use_renderer=false lines in the three sft debug configs. - CHANGELOG: add a "first-class training_mode + batch-driven loss dispatch" entry covering the breaking removals (orchestrator.use_sft_loss, orchestrator.teacher_rollout_model, trainer.loss.type='sft' / SFTLossConfig, trainer.loss.teacher_tau) with migration notes. - _accept_legacy_student_layout: use set(ModelConfig.model_fields) instead of hardcoding the field list, so new ModelConfig fields are picked up automatically. - Trim the orchestrator startup log to just '(<training_mode>)'; the prose description was redundant with docs/training_modes.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(configs): unbreak OPD auto-wiring when num_teacher_gpus is set Add a mode="before" validator on RLConfig that stubs an empty [orchestrator.teacher] block when deployment.num_teacher_gpus is set and the user didn't write one. Without this, OrchestratorConfig.validate_training_mode ("opd requires orchestrator.teacher") fires during nested validation - before auto_setup_teacher_inference can wire the teacher from teacher_inference. Repro that now passes: RLConfig.model_validate({ "deployment": {"num_teacher_gpus": 1}, "trainer": {}, "orchestrator": {"training_mode": "opd"}, "inference": {}, }) -> auto_setup_teacher_inference fills in orchestrator.teacher.client.base_url = ["http://localhost:8001/v1"] and model.name from teacher_inference. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(training_modes): shrink mode-comparison table + add sft/opd teacher note Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(configs): move training-mode debug configs to configs/debug/training_modes/ The reverse-text debug configs are about exercising the training modes, not about reverse-text specifically. Move to configs/debug/training_modes/ and drop the debug_ prefix from each filename (the directory name carries it). configs/reverse_text/debug_rl.toml -> configs/debug/training_modes/rl.toml configs/reverse_text/debug_opd.toml -> configs/debug/training_modes/opd.toml configs/reverse_text/debug_opd_lora.toml -> configs/debug/training_modes/opd_lora.toml configs/reverse_text/debug_sft.toml -> configs/debug/training_modes/sft.toml configs/reverse_text/debug_sft_lora.toml -> configs/debug/training_modes/sft_lora.toml configs/reverse_text/debug_sft_external.toml -> configs/debug/training_modes/sft_external.toml configs/reverse_text/README.md -> configs/debug/training_modes/README.md Update path references in each TOML's header comment, the README, and docs/training_modes.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(configs): drop auto pinference team-id, rename student-shortcut shim - ClientConfig.auto_setup_pinference_team_header dropped. The hostname-sniff was implicit magic. Configs that need the X-Prime-Team-ID header against PI inference set it explicitly under [...client.headers_from_env] now. Update configs/debug/training_modes/sft_external.toml accordingly and drop the auto-injection note from the file header. - Rename OrchestratorConfig._accept_legacy_student_layout (with leading underscore + "backward-compat" framing) to fold_student_shortcuts. The shim is more than a back-compat: it's the ergonomic path for rl configs too, letting users write [orchestrator.model.name] / [orchestrator.client] rather than [orchestrator.student.model.name] / [orchestrator.student.client]. Docstring reframed accordingly. Teacher has no equivalent shortcut on purpose: rl mode forbids teacher, so the same shortcut routing to two roles would be ambiguous. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(tests): update multi_run CLI args after student rename test_reverse_text_multi_run.start_orchestrator passes --client.base-url and --model.lora.name as CLI flags to `uv run orchestrator`. After the student rename, those tyro args don't exist anymore (they're now --student.client.base-url and --student.model.lora.name). tyro rejects them before the fold_student_shortcuts before-validator can re-nest the dict, so the orchestrator process exits immediately and the test times out waiting for "Step 11" to appear in the log. Rename both CLI args to their new student-scoped form. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Timothy Kostolansky <39891386+tim0120@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
87ab84b666 |
chore(orchestrator): deprecate use_token_client (#2549)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore(orchestrator): deprecate use_token_client (server-tokenized TITO) Drop the server-tokenized TITO path (``openai_chat_completions_token`` / ``/v1/chat/completions/tokens``). The orchestrator now picks between renderer-backed TITO (``use_renderer = true``, default) and MITO (``use_renderer = false``, fallback for VLMs and external teacher rollouts). - Remove ``OrchestratorConfig.use_token_client`` field and its validators - Drop the TITO branch in ``setup_rollout_inference_pool`` - Drop the obsolete TITO warning in ``setup_inference_pool`` and flip the default ``train_client_type`` to ``openai_chat_completions`` in ``StaticInferencePool`` / ``ElasticInferencePool`` - Strip ``use_token_client = false`` from configs/examples/docs that carried the no-op fallback line - CHANGELOG entry documenting the breaking removal Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(inference): remove server-side TITO route Drop the ``/v1/chat/completions/tokens`` endpoint and the ``OpenAIServingChatWithTokens`` / ``ChatCompletionRequestWithTokens`` wrappers now that no client routes to them. Also drop the obsolete ``base()`` helper and unused imports from ``server.py``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
4748472b9f |
docs: add testing-moe-at-small-scale to mint.json navigation (#2542)
Release / Push CUDA image to Docker (push) Canceled after 0s
Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> |
||
|
|
b22e768fc4 |
docs: fix typos and grammar errors in documentation (#2544)
Release / Push CUDA image to Docker (push) Canceled after 0s
* docs: fix "seemless" typo Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> * docs: fix model name Qwen-4B to Qwen3-4B Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> * docs: fix "violation to" grammar error Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> * docs: fix "asynchronoously" typo Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> * docs: fix duplicate "the the" Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> --------- Signed-off-by: alelpoan <155192176+alelpoan@users.noreply.github.com> |
||
|
|
66ff00d117 |
make renderers default for rollouts (#2521)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
5e6f7ebae8 |
feat(advantage): add num_turns option to efficiency shaping (#2384)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat(advantage): add num_turns option to efficiency shaping Replaces `length_shaping: bool` with `shaping_metric: Literal["length", "num_turns"] | None` so the same correctness-gated efficiency shaping can score rollouts by trajectory turn count instead of completion-token count. Generalizes the helper to operate on a per-rollout cost tensor; both metrics are plumbed through `AdvantageInputs`. * fix(advantage): remove extra blank line for ruff I001 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(advantage): rename shaping_metric -> length_penalty Per review feedback, use clearer name and shorter literal values: shaping_metric: Literal["length", "num_turns"] -> length_penalty: Literal["tokens", "turns"] Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(advantage): pass full rollouts through AdvantageInputs AdvantageInputs now holds list[list[vf.RolloutOutput]] grouped by problem instead of separate rewards/completion_lengths/num_turns tensors. Custom advantage fns can read any rollout metadata; inputs.rewards is kept as a convenience property for the common case. Per @mikasenghaas review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(advantage): drop AdvantageInputs.rewards convenience property Per @samsja review: with rollouts as the single source of truth, the rewards property was a partial holdover. Custom advantages now extract rewards directly from rollouts, matching how all other metadata is read. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(advantage): regression test for per-problem advantage isolation Two-problem case with very different reward scales — catches cross-group leakage, slicing/transpose bugs, and out-of-order assignment in the flat -> grouped -> flat round-trip through compute_advantages. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
9eeffdb6fb |
feat: drop filtered rollouts instead of masking (#2277)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: drop filtered rollouts from training batch instead of masking
Previously, enforced filters zeroed the completion_mask on detected
rollouts but still sent them through the entire training pipeline.
This wastes compute on samples that contribute nothing to the loss.
Now, `apply_filters` returns the subset of rollouts that should be
sent to the trainer. Enforced-detected rollouts are excluded before
pretokenization, VLM cache building, and sample construction.
The trainer handles the resulting empty batches ("phantom steps") by
skipping forward/backward and logging `data/is_empty_batch`.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: retry empty filtered batches instead of passing them to trainer
Keep the invariant that the trainer only receives non-empty batches. If
all rollouts are filtered out, regenerate the batch (up to 3 retries)
and crash the orchestrator on sustained failure. Warn at <=10% trainable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: drop redundant num_rollouts guard
The retry loop only breaks when len(filtered_rollouts) > 0, which implies
num_rollouts > 0, so the guard is unreachable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: expand low-trainable-ratio warning with env review hint
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: drop empty-df guard and inline filtered metrics
filtered_rollouts is guaranteed non-empty after the retry loop, so the
empty-df branch is unreachable and the intermediate locals add no value.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: hoist MAX_EMPTY_BATCH_RETRIES to module scope
Also rename the loop var and warning message to "retry N/MAX" so the
counter excludes the initial attempt and reads less ambiguously.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: adjust log style in filter retry warnings
Drop trailing periods and replace ";" with " - " as clause separator.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: clarify low-trainable-ratio warning hint
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor: compute metrics over all rollouts, drop only from trainer
Metric logging reverts to main's semantics: all rollouts contribute to
prefill_len, decode_len, samples_per_rollout, and results_df. Filtered
rollouts are still pretokenized and interleaved, but their samples are
simply not added to train_examples. Also inline the generate_batch
coroutine since it is awaited immediately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor: move filter flags to rollout["filter"] + is_filtered
Per-filter detection booleans now live under rollout["filter"], and a
top-level rollout["is_filtered"] captures whether any enforcing filter
triggered. The orchestrator uses is_filtered directly as the keep gate
(no more id() mapping). apply_filters no longer returns filtered_rollouts
- the in-place flags are the single source of truth. Also unbound-var
fix for retry-loop locals, and per-env filter/<env>/<flag>_rate logging
that mirrors the metrics logging pattern.
Both new fields are serialized to train_rollouts.jsonl via save_rollouts,
which already writes all top-level rollout keys.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: cap to 3 total batch-generation attempts, not 3 retries
Rename MAX_EMPTY_BATCH_RETRIES to MAX_EMPTY_BATCH_ATTEMPTS and have the
loop run exactly that many times. Warning now reports the attempt that
just failed ("Attempt N/3 ... retrying").
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: log error line before raising on exhausted retries
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: align filter metric key names with per-env logging
Rename filter/total_detected_rate -> filter/detected_rate and
filter/total_enforced_rate -> filter/is_filtered_rate so the overall
keys mirror the per-env filter/<env>/is_filtered_rate naming.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor: unify filter logging under filter/{all,<env>}/{<filter>,is_filtered}
Move is_filtered into results_df so it can be aggregated per-env like
is_truncated. filter_df now holds just per-filter detection booleans.
apply_filters no longer returns an aggregate metrics dict - the
orchestrator derives the rates uniformly across the "all" and per-env
scopes, with symmetric key naming and no _rate/_count suffixes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: rename rollout["filter"] to rollout["filters"] + log keys
Aligns with the plural configs list and the rollout-level "filters"
namespace. Log keys change from filter/{all,<env>}/... to
filters/{all,<env>}/....
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat: self-evict orchestrator when batches carry no learning signal
Write control/evicted.txt before raising, so the multi-run manager
skips the run on rediscovery instead of treating it as a hard crash.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
660633077c |
feat: make vision encoder optionally trainable (#2066)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
1692a67d90 |
chore: unify log directories (#2150)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore: unify log directories across local and SLURM deployments
Remove Python file logging (log.file config) — deployment-level capture
(stdout redirect for local, tee for SLURM) is sufficient. This eliminates
duplicate log files and simplifies the logging architecture.
Key changes:
- Remove log.file config option and JsonFileSink from logger
- Rename .stdout -> .log for deployment-captured logs
- Unify SLURM logs from slurm/ into logs/ (same as local)
- Trainer shows rank 0 only, all rank logs in logs/trainer/torchrun/
- Multi-node SLURM: logs/trainer/node_N.log, logs/inference/node_N.log
- Symlink logs/trainer.log -> trainer/node_0.log (multi-node)
- Historical per-job logs under logs/slurm/job_{id}/
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: update env log paths in docs to match actual structure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: simplify env and torchrun logging sections
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: include per-node and per-rank log paths in log messages
Show where to find node-level logs (for multi-node) and per-rank
torchrun logs in the startup log messages for RL, SFT, and inference.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: extract format_log_message to shared utility
Move format_log_message from rl.py to utils/pathing.py and reuse it
in SFT and inference entrypoints, eliminating duplicated formatting logic.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: remove historical per-job SLURM log copies
The job_* log copies in logs/slurm/ added complexity without much value.
SLURM's own job output log (job_%j.log) already serves as the historical
record.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: move tmux helper section to bottom of logging.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: consolidate tmux.sh and slurm_tmux.sh into one script
Log paths are now unified across local and SLURM, so both scripts
were tailing the same files. Merge into a single tmux.sh with a Logs
window (4 panes tailing trainer/orchestrator/envs/inference) and a
Monitor window (nvtop + htop).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: fix logger docs to match actual behavior
setup_logger doesn't raise when called twice (it reconfigures).
get_logger always works (auto-initializes a default if needed).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: remove incorrect env_worker_logs reference
The env_worker_logs config field is defined but never read — env worker
logs are written unconditionally.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: remove dead env_worker_logs config field
Defined but never read anywhere in the codebase.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: add router logs to slurm monitoring section
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: mention per-node and per-rank trainer logs in performance section
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: generalize config path references to {output_dir}/configs/
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: template rendering bugs and improve log message labels
- Fix Jinja2 tags on same line as tee commands (broken bash output)
- Rename "Trainer:" to "Trainer (rank 0):" in log messages
- Rename "Nodes:" to "All nodes:" and "Per-rank:" to "All ranks:"
- Make per-rank log line a tail -F command following torchrun structure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: include stderr in all-ranks log tail command
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: update stale log paths in examples, SFT tests, and pathing test
- Fix torchrun glob: **/*.log → */*/*/*.log (tail -F doesn't support **)
- Update 5 example READMEs from slurm/latest_* to logs/ paths
- Update SFT tests from logs/trainer/rank_0.log to logs/trainer.log
- Update pathing test fixture to match new log structure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: clean up log message code and fix test bug
- Remove hardcoded "Showing rank 0 logs only" message from trainers
(already communicated via format_log_message)
- Derive env_log_dir inside format_log_message instead of requiring
callers to pass it
- Fix test_pathing double mkdir crash (FileExistsError)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: split LogConfig into TrainerLogConfig and OrchestratorLogConfig
- TrainerLogConfig adds ranks_filter (configures torchrun
--local-ranks-filter, defaults to [0]) and log_data
- OrchestratorLogConfig adds vf_level
- Base LogConfig retains level and json_logging
- ranks_filter is passed through to SLURM templates
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: keep LogConfig as-is, only extend with TrainerLogConfig
Revert OrchestratorLogConfig — keep vf_level and log_data on the base
LogConfig for safety. Only TrainerLogConfig extends with ranks_filter.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: remove "(rank 0)" from trainer log message
ranks_filter is now configurable so it may show more than rank 0.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: use total_infer_nodes for log hint and add CHANGELOG entries
- Fix num_infer_nodes using per-replica count instead of total, which
suppressed "All nodes" hint for multi-replica inference
- Add CHANGELOG entries for removed config fields and new ranks_filter
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: use `uv run sft` entrypoint in SFT integration tests
The SFT tests were calling torchrun directly, bypassing the SFT
entrypoint which handles stdout redirection to trainer.log. This caused
tests to read stale/wrong log files from the shared output directory.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: add --clean-output-dir to initial SFT integration tests
The SFT entrypoint validates that output_dir doesn't contain stale
checkpoints. Since output_dir is session-scoped and shared across test
modules, the SFT tests need --clean-output-dir on the initial run.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: add --clean-output-dir to RL integration tests too
All integration tests sharing the session-scoped output_dir should
clean on initial run to avoid stale checkpoint validation errors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
63331ad8b1 |
revamp docs and readme (#2116)
Release / Push CUDA image to Docker (push) Canceled after 0s
* update readme * fix revamp-readme * update readme * add real world example * add real world example * add swe and deepdive * add qwen example * add intellect 3.1 example * add minimax swe * add all * fix wording and typos across example READMEs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix README links and wording, add memory usage doc reference Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * updare training * fix glm5 PD disagg config: num_infer_nodes must equal prefill + decode num_infer_nodes was 16 but prefill (4) + decode (4) = 8. Set num_infer_nodes = 8 with num_infer_replicas = 2 for 16 total. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix model table: move INTELLECT-3 to glm4_moe, add Trinity as afmoe Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * updare training * address PR review comments - Restore accidentally deleted examples/hendrycks_sanity/ from main - Restore installation section (uv sync, FA3, python/flash-attn checks, eval step) - Fix model table description: trainer works with HF/Prime ModelForCausalLM, not "built on HF Transformers" - Improve activation checkpointing description and explain freq parameter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ecd0809280 |
feat: disaggregated prefill-decode inference with multi-replica support (#2030)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: disaggregated prefill-decode inference with multi-replica support Extracted PD disaggregation changes from PR #2010. Adds: - Disaggregated deployment type with separate prefill/decode nodes - vLLM kernel format weight transfer (avoids HF checkpoint round-trip) - Pause/resume lifecycle for draining in-flight requests during weight updates - Admin URL separation (bypass router for direct server access) - Multi-replica inference support - NIXL/UCX, DeepEP, and vllm-router install scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: remove vLLM kernel format weight transfer This PR should focus on PD disaggregation only. The kernel format transfer path (fused projections, stacked experts, FP8 quantization) is a separate optimization that can be added back in a dedicated PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style: fix ruff formatting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review comments - Raise error if tp != 1 in disaggregated mode instead of silently overriding - Revert auto_setup_model to main's version (FP8 model name logic not needed for PD) - Revert nccl.py broadcast to main's inline style (method extraction was for kernel format) - Add try/finally around weight update to ensure engines are always resumed - Fix sample config: num_infer_nodes=3 + num_infer_replicas=2 to pass validation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add disaggregated P/D support to inference SLURM template Extends the existing inference.sbatch.j2 template with conditional disaggregated mode support. When deployment type is "disaggregated", the template splits nodes into prefill/decode groups with per-replica vllm-router, NIXL KV transfer, and DeepEP expert parallelism. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * add inference disag slurm * add extra deps * add extra deps * fix eps * fadd stuff * fadd stuff * fadd stuff * fix smth * move deep-gemm from dep group to disagg extra for --all-extras Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: configurable deep-gemm via use_deep_gemm config field Rebuild deep-gemm from vLLM 0.17 recommended commit (477618c). Add use_deep_gemm bool to InferenceConfig that sets VLLM_USE_DEEP_GEMM=1 in the sbatch template. Only works with per-tensor FP8 models (e.g. GLM-5-FP8). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * wip * add config * add deps * fix studfs * fix studfs * use vllm router from matej * feat: add X-Session-ID header for prefix cache affinity in PD inference Monkey-patch verifiers' OpenAI clients to inject X-Session-ID (derived from example_id) on every inference request. The vllm-router uses this header for sticky routing so that all requests for the same example hit the same decode node, enabling prefix cache reuse. Also updates hendrycks_math config for disaggregated PD with EP. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Revert "feat: add X-Session-ID header for prefix cache affinity in PD inference" This reverts commit 12deff893d0c5053273c25a537b6979be601eb6a. * delete slurm * feat: sticky routing, deep-gemm support, and P/D cleanup - Add extra_headers_from_state to ClientConfig for per-request dynamic headers (X-Session-ID from example_id for sticky routing) - Auto-configure session headers in RL runs - Pass use_deep_gemm to disagg RL template (VLLM_USE_DEEP_GEMM=1) - Add --intra-node-data-parallel-size 1 to P/D router args - Fix uv sync: remove stale --group fp8-inference (deep-gemm now in disagg extra) - Update verifiers to f6ff5274 (extra_headers_from_state support) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: update verifiers to main (f5580acd) Points to merged extra_headers_from_state support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: update disagg rl config for Qwen3-30B-A3B (1P+1D) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: add disaggregated inference guide and GLM-5 config (#2077) * chore: add reasoning_parser to GLM-5 inference config (#2081) Enables vLLM to split reasoning_content from content natively, so verifiers saves it as a separate field in trajectories. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Enable none * Feat: skip master weights gather * updates deps * remove configs --------- Signed-off-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: hallerite <git@hallerite.com> Co-authored-by: Matej Sirovatka <54212263+S1ro1@users.noreply.github.com> Co-authored-by: S1ro1 <matej.sirovatka@gmail.com> Co-authored-by: Mika Senghaas <mail@mikasenghaas.de> |
||
|
|
d803065204 |
feat: add explicit vlm config flag for VLM detection (#2063)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
7ef29a7660 |
feat: accept messages column for SFT (#2074)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: accept `messages` column for SFT * return list instead of tuple * elif prompt |
||
|
|
40da51a235 |
SFT distillation: bug fixes, VLM support, and pretokenization optimization (#2053)
Release / Push CUDA image to Docker (push) Canceled after 0s
* SFT distillation with teacher endpoint * streamline SFT distillation rollout/eval model split * fix sft reconstruction and default loss scaling regressions * simplify SFT distillation by removing eval inference split * chore: apply ruff formatting * docs: add changelog entries for RolloutModelConfig, SFTLossConfig, and CustomLossConfig Co-authored-by: will brown <willccbb@users.noreply.github.com> * refine external SFT rollout path and cleanup tests * refactor shared SFT chat-template tokenization logic * fix: remove dead store in _tokenize_step_from_messages full_ids was tokenized via _render_messages then immediately overwritten by build_incremental_token_mask, wasting a tokenization pass per step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove unused _should_add_generation_prompt from trajectories Duplicate of should_add_generation_prompt in utils/chat_template.py, never called anywhere. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: pass top_k and min_p for both token and non-token client paths Explicitly disable top-k and min-p filtering on all vLLM requests, not just the token client path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove redundant test_rl_config_external_rollout_mode_rejects_inference Redundant with the Pydantic model validator definition. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: correct CHANGELOG field name to teacher_rollout_model Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: pass tool definitions through pretokenize pipeline When external teacher rollouts have tool_defs, convert them to OAI format and pass through to build_incremental_token_mask so that tokenization includes tool definition tokens from the chat template. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: enable collapse_consecutive_tool_messages in pretokenization Matches the SFT data pipeline behavior. Without this, parallel tool call responses cause an assertion failure in incremental tokenization when the chat template re-renders consecutive tool messages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: handle dict tool_defs in _convert_tools_to_oai_format Tool definitions arrive as plain dicts after ZMQ msgpack serialization (verifiers' msgpack_encoder calls model_dump() on Tool pydantic objects). Use duck-typed accessor to support both dict and object forms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: VLM processor support in SFT distillation pretokenization For VLM models, the tokenizer alone produces only 1 <|image_pad|> token per image, but the model expects the count to match actual image patches. Thread the processor through pretokenize → render_messages → build_incremental_token_mask so that processor.apply_chat_template (which expands image placeholders correctly) is used when available. Also move pretokenize before build_vlm_image_cache in the orchestrator, since the cache build strips image data from messages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: replace incremental token mask with direct completion masking In the SFT distillation path, completion is always a single assistant message (enforced by verifiers' parse_response_message), so the completion mask is trivially all-True. Replace N incremental tokenizer/processor calls from build_incremental_token_mask with a single render_messages call. For VLM models this avoids redundant image preprocessing on every incremental prefix. Added assertion to guard the single-assistant-role assumption. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove duplicate SFT distillation configs Keep examples/alphabet_sort/sft_distill_hard.toml as the canonical example config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: always request logprobs in sampling args logprobs=True was only set when use_token_client=True, but non-token- client paths (e.g. external APIs) also need logprobs for RL training. return_token_ids remains gated behind use_token_client since it is vLLM-specific. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove test_rl_config_external_rollout_mode_rejects_token_client Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: set checkpoint_ready in non-policy-update path When enable_policy_updates is False (SFT distillation), generate_batch skipped calling checkpoint_ready.set(). This worked by accident because the event starts set and is only cleared inside maybe_update_policy (which is never called in this path), but would deadlock if anything else ever cleared the event. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address PR review feedback - Revert loss_scale regression: use loss_mask-based scaling unconditionally - Move setup_external_rollout_model to orchestrator/utils.py - Clarify log message to say "SFT distillation mode" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: truncate prompt_ids to common prefix to prevent corrupted token sequences When tokenizing trajectory steps from messages, the prompt-only and full (prompt+completion) tokenizations can diverge at a boundary (non-prefix split). Previously, the full prompt_ids was returned even when split_idx < len(prompt_ids), producing corrupted sequences where prompt_ids + completion_ids != full_ids. This broke interleaving (extension property checks fail on mismatched prefixes) and fed invalid token sequences to the trainer. Fix: use full_ids[:split_idx] as prompt_ids so the concatenation always equals full_ids exactly. Verified across GLM-4, Qwen3, Qwen2.5, Qwen2.5-VL tokenizers and tested end-to-end SFT distillation on alphabet-sort, wiki-search, tic-tac-toe, and color-codeword (VLM) environments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restore non-prefix tokenization debug log after prompt_ids truncation The previous commit truncating prompt_ids to full_ids[:split_idx] made the debug log condition always false (split_idx < split_idx). Track the original prompt length before overwrite so the log fires correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: William Brown <williambrown97@gmail.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: will brown <willccbb@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
d5c7240676 |
Feature: Add platform integration. (#1896)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
e113981a4e |
feat: add pre_run_command and common SLURM scheduling options (#1988)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: add configurable pre_run_command for SLURM jobs Allow running a cleanup command on compute nodes before starting the job (e.g. `sudo pkill -f vllm`). Configured via `slurm.pre_run_command`. For multi-node jobs, the command runs on all nodes via srun. Replaces the hardcoded `pkill -9 -f vllm` in the inference template with the configurable option. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: tighten whitespace in template pre_run_command blocks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: run pre_run_command on head node only, avoid shell quoting issues Drop the srun bash -c wrapper from multi-node templates. The command now runs directly on the head node (same as single-node), which avoids single-quote injection when the user's command contains quotes. Users who need all-nodes execution can wrap with srun themselves: pre_run_command = "srun bash -c \"pkill -f vllm || true\"" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add CHANGELOG entry for slurm.pre_run_command Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add nodelist, exclude, account, and time SLURM options Add commonly needed SLURM scheduling fields to SlurmConfig: - nodelist: target specific nodes - exclude: exclude specific nodes - account: charge to a SLURM account - time: set maximum wall time Also extract common slurm fields into SlurmConfig.template_vars to avoid duplicating them across every template.render() call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clean up Jinja2 whitespace for optional SBATCH directives Use {%- if %} to strip leading newlines so no blank lines appear when optional fields are unset. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: run pre_run_command after env setup in single-node templates Single-node templates ran pre_run_command before cd, .env sourcing, and venv activation. Move it after setup to match multi-node and inference templates. Update docs to clarify execution context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
bf71516c91 |
individual rollouts (#1865)
Release / Push CUDA image to Docker (push) Canceled after 0s
* individual-rollouts * fixes * fix group based scoring envs * ruff * ruff pls * Fix inflight sample metric semantics Co-authored-by: faresobeid <faresobeid@users.noreply.github.com> * fixes * Delete tests/unit/orchestrator/test_scheduler.py Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com> * fix: off-policy off-by-one - cancel when off_policy_steps >= max Made-with: Cursor * Fix off-policy increment race in scheduler Co-authored-by: faresobeid <faresobeid@users.noreply.github.com> * adress comments * ruff --------- Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: faresobeid <faresobeid@users.noreply.github.com> |
||
|
|
68e443b833 |
inference entrypoint (#1898)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add SLURM scheduling support for standalone inference entrypoint Move inference entrypoint to src/prime_rl/entrypoints/inference.py following the SFT/RL patterns. Add opt-in [slurm] and [deployment] config sections to InferenceConfig for submitting inference as SLURM jobs. Supports single-node and multi-node (independent vLLM replicas per node, no cross-node parallelism). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * use single inference template * add dry run and remove launcher fields * correctly resolve union/annotated types * log msg * export urls * switch to 0.0.0.0 * fix vllm * move * update changelog * pass seed * align with sft/rl entrypoint * use config dir helper * update docs and skill for inference SLURM entrypoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add back writing config * add comment * Revert "add comment" This reverts commit 1481510decd244174049e1392ca51c1b7b29b294. * Revert "add back writing config" This reverts commit a67e8dfe3e57f5906fee0cb6f8fd299c148ecca5. * remove non-user facing changelog items * fix ruff * fix infer entrypoint * bump pydantic_config * multi node is 2 nodes by default * use rev --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
6f6fa002a5 |
fix: replace removed teacher_gpu_ids with deployment.num_teacher_gpus in docs (#1929)
Release / Push CUDA image to Docker (push) Canceled after 0s
The on-policy distillation docs referenced teacher_gpu_ids which was removed from RLConfig and replaced by the [deployment] section with num_teacher_gpus. Users following the docs would get a pydantic extra_forbidden error. Closes #1924 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
5ae5079478 |
validate mint.json pages exist before syncing docs (#1912)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
82652c7393 |
add output_dir safety check to prevent accidental overwrites (#1872)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add output_dir safety check to prevent accidental overwrites Training now raises FileExistsError when output_dir already contains files from a previous run, unless explicitly resuming (ckpt.resume_step) or opting in to clean (clean_output_dir=true). This encourages using unique per-experiment output directories and prevents silent data loss. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move output_dir validation to entrypoints (before SLURM submission) Validate in sft()/rl() dispatch functions instead of pydantic validators or train() functions. This ensures the check runs before sbatch submit while keeping config parsing side-effect-free. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove old clean flag from RLConfig local path The old `clean` field (default True) silently deleted logs, rollouts, and broadcasts on every local RL run. This is now superseded by the explicit `clean_output_dir` flag on the trainer configs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move clean_output_dir to RLConfig and use shared ckpt for resume check clean_output_dir belongs on the top-level RLConfig (next to output_dir), not on the trainer sub-config. The resume check now uses config.ckpt (the shared checkpoint config) instead of config.trainer.ckpt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update err message * Fix stray paren in error message, ensure dirs exist after clean, add changelog - Fix stray ) in FileExistsError message text - Create output_dir after validate_output_dir in both entrypoints so it exists even after a clean - Add log_dir.mkdir in RL local path (was previously done by maybe_clean) - Add CHANGELOG entries for clean_output_dir and clean removal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * only raise if checkpoints exists * Make RLConfig.output_dir non-optional and fix docs to match actual behavior output_dir is always a Path after validation, so type it as Path with default Path("outputs"). Fix docs/changelog that incorrectly said the safety check triggers on "non-empty" dirs — it only triggers on dirs containing checkpoints. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add changelog entry for output_dir type change and SLURM validation removal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add env var to never clean output dir safeguard --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
1826b18927 |
unify rl and sft slurm entrypoints to enable single-node slurm deployments (#1859)
Release / Push CUDA image to Docker (push) Canceled after 0s
* fuse rl-slurm and rl * also migrate sft slurm * Move SLURM templates to templates/ and rename to multi_node_* - rl_slurm.sh.j2 → templates/multi_node_rl.sh.j2 - sft_slurm.sh.j2 → templates/multi_node_sft.sh.j2 - Remove src/prime_rl/slurm/ directory entirely - Update template path references in rl.py and sft/train.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update * add single node template * allow setting env vars everywhere * fixes * fix * rename to .sbatch * update scripts * update configs * adopt deployment and slurm config for sft * rename slurm.template -> slurm.template_path * style * make inference optional again and some misc bug fixes * update examples * fix configs * rewrite slurm docs for unified entrypoints and fix slurm_sft.toml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix config * deprecate hf hub offline in sft slurm * only HF_HUB_OFFLINE in multi_node * tail with -F * exclude deployment * update changelog * move templates * update branch * fix output dir * do not allow None partition * fix * revert env_vars * remove env_vars entries from changelog Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * address bugbot * extract sft entrypoint * move entrypoints * cleanup logic in sft local * fix single node sft slurm * fix * fix: resolve SLURM template path relative to package for editable installs Co-authored-by: Cursor <cursoragent@cursor.com> * add changelog line --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
7eade4f7e1 |
Add SFT SLURM entrypoint (#1832)
Release / Push CUDA image to Docker (push) Canceled after 0s
* add SFT SLURM entrypoint (`sft_slurm`) Adds a `sft_slurm` CLI that mirrors `rl_slurm` but for SFT training. The config extends `SFTTrainerConfig` directly (no `[trainer]` nesting) with slurm-specific fields (num_nodes, gpus_per_node, etc.). Includes a simplified Jinja2 SLURM template with no inference/orchestrator nodes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add sft example * add SFT MoE SLURM example and slim down SFT docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add sft slur config to tests --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
5c3008b3a5 |
Remove reload_weights_on_start dead code (#1829)
Release / Push CUDA image to Docker (push) Canceled after 0s
* dont reload weights by default * Remove reload_weights_on_start config and dead code path The reload_weights mechanism was a no-op in practice: vLLM servers start with base weights already loaded, and LoRA runs already skipped the reload. Remove the config field, server endpoint, client function, and orchestrator branching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove helo/orchestrator.toml from branch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add changelog entry for reload_weights_on_start removal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Mika Senghaas <mail@mikasenghaas.de> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
a77725e5c0 |
refactor(slurm): move NCCL and runtime configs from template to config (#1818)
Release / Push CUDA image to Docker (push) Canceled after 0s
* refactor(slurm): move NCCL and runtime configs from template to config - Add port/timeout fields to SharedWeightBroadcastConfig - Propagate port/timeout in auto_setup_weight_broadcast - Add auto_setup_slurm_nccl validator that sets: - orchestrator.num_train_workers from SLURM topology - trainer.weight_broadcast.host to 0.0.0.0 - trainer.weight_broadcast.inference_world_size from SLURM topology - Add validate_inference_config to catch missing inference config early - Remove hardcoded env vars and CLI args from SLURM template Only --weight_broadcast.host $MASTER_ADDR and --client.base-url remain as CLI args (runtime values from SLURM). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(slurm): add rl_slurm entrypoint and update docs - Add rl_slurm script entrypoint to pyproject.toml - Update docs to use `uv run rl_slurm` instead of `uv run python -m prime_rl.slurm.rl` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: sami jaghouar <sami@primeintellect.ai> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
3102ca47cb |
Add SLURM entrypoint with Jinja2 template (#1774)
Release / Push CUDA image to Docker (push) Canceled after 0s
* refactor config * Add SLURM entrypoint with Jinja2 template and tmux launcher Adds a new `rl_slurm` entrypoint that resolves the full RL config, dumps sub-configs as TOML, renders a SLURM batch script from a Jinja2 template, and submits it via sbatch (with --dry-run option). Includes a tmux launcher for monitoring trainer/orchestrator/inference logs and documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix ruff formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slurm): sync orchestrator output dir with cleanup Co-authored-by: samsja <samsja@users.noreply.github.com> * test(configs): include slurm config parser in config loading test Co-authored-by: samsja <samsja@users.noreply.github.com> * add auto dir * fix(slurm): move auto_setup_output_dir to BaseRLConfig so SLURM entrypoint propagates output_dir RLSLURMConfig extends BaseRLConfig, not RLConfig, so the validator that propagates output_dir to trainer and orchestrator was never running. This caused the Jinja template cleanup to target wrong paths and the trainer to pick up stale rollouts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add args * feat(slurm): make config more flexible and self-contained - Replace base_dir/env_file/venv with single project_dir - Add gpus_per_node (default 8) to remove hardcoded GPU counts - Add nodes_per_fsdp_group to auto-compute dp_replicate - Use -m module syntax for torchrun instead of file path - Derive .env and .venv paths from project_dir Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix many stuff * add math * addexamples * add moe example * docs(slurm): update to Hendrycks Math examples with MoE config Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add required output_dir to slurm example configs --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: samsja <samsja@users.noreply.github.com> Co-authored-by: sami jaghouar <sami@primeintellect.ai> |
||
|
|
67ab5d1da6 | add mini moe (#1759) | ||
|
|
6fd4f698c2 |
docs: fix typos (#1751)
* Fix typo in precedence explanation in configs.md Signed-off-by: crStiv <cryptostiv7@gmail.com> * Fix typos and improve clarity in deployment.md Signed-off-by: crStiv <cryptostiv7@gmail.com> --------- Signed-off-by: crStiv <cryptostiv7@gmail.com> |
||
|
|
31b48b8b10 |
env worker integration (#1714)
* start env servers for env group * bump * working reverse-text * correctly set log levels * use client configs everywhere + make val work * cycle through clients via inference pool * update model name * deprecate env worker * implement evals * deprecate evals+synthesize * deprecate serialization * use all clients for evals * simplify config * fix types and use inference pool for opd * bring back logging intercept * setup env client/server in prime-rl * externalize running env server * style * bring back rate limiter on scheduler * revert vf branch * back to custom branch * do not double asyncio * bring back eval * fix cpu tests * bump vf * add math group config * remove stop server call * add logs * remove last mentions of vf.State * deprecate some configs * more * remove eval + cpu integration tests * remove evals + synthesize configs * bump vf * fix branch with vlm cache * do not reference rollout status * use correct model name * stop teacher infer pool if setup * update changelog * deprecate server discovery (unused) * fix env id stripping * use updated model name for evals * strip env version on env server * remove server discovery tests * bump vf * do not fail if env server not yet up * add elastic sanity check * update docs * use extra env kwargs consistently across orch and env server * update math group config * update cfg * use dynamic model name in final evals * add extra_env_kwargs to changelog * resolve vf merge conflicts * assert lora name not None * fix unit tests * fix types * add hendrycks math sanity check * bump vf * do not double repeat eval inputs * do not duplicate eval inputs * lower avg@ * Initialize logger in env-server before install_env (#1743) install_env() calls get_logger() which requires the logger to be set up first. This was missing in env-server but present in orchestrator. * disable vf logging on orch * Fix elastic autoscaling: use base model for health checks (#1745) The health check was using `model_name` which gets updated to the LoRA adapter name after training starts. New inference servers only have the base model, so they would fail health checks and never get added to the pool. Store the original model name as `base_model_name` and use it for health checks, allowing new servers to be discovered and have the LoRA adapter loaded on them. --------- Co-authored-by: JannikSt <JannikSt@users.noreply.github.com> Co-authored-by: William Brown <williambrown97@gmail.com> |
||
|
|
922582d04f |
set VLLM_WORKER_MULTIPROC_METHOD=spawn by default (#1740)
* auto set necessary vllm vars for vlms * make spawn general * remove unnecessary vllm env var & improve docs |
||
|
|
8dbd955a06 | best-effort interleaving (#1674) | ||
|
|
f870f3cbd8 |
Feature: bring your own algorithms (#1715)
Release / Push CUDA image to Docker (push) Canceled after 0s
* update loss interface * refactor: rename grpo_loss to prime_rl_loss and consolidate loss interface - Rename grpo_loss to prime_rl_loss (uses LossConfig directly) - Move LossInputs, LossOutputs, LossFn from loss_interface.py into loss.py - Remove loss_interface.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: add bring-your-own-loss support for custom loss functions - Add CustomLossConfig with path and kwargs fields - Add LossConfigType union (LossConfig | CustomLossConfig) - Update setup_loss_fn to handle custom loss imports - Add _import_object helper for dynamic imports - Add test for custom loss configuration - Add docs/bring-your-own-loss.md documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: add bring-your-own advantage function support - Add AdvantageInputs/AdvantageOutputs dataclasses - Add CustomAdvantageConfig with path and kwargs - Add setup_advantage_fn for custom advantage imports - Refactor compute_advantages to use the new interface - Add tests for custom advantage configuration - Rename docs to bring-your-own-algorithms.md with both loss and advantage sections Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: rename path to byo_function in custom configs More descriptive name that ties into the "bring your own" concept. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: address PR review feedback - Extract import_object to shared utils (deduplicate from loss.py and advantage.py) - Add pydantic discriminator types for LossConfigType and AdvantageConfigType - Rename byo_function to import_path (standard Python terminology) - Rename grpo_advantage to default_advantage - Fix train.py AttributeError when using CustomLossConfig - Fix docs: per-example terminology, loss/advantage descriptions, config examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update prime_rl_loss description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: handle custom loss metrics in training loop and restore extra=forbid on AdvantageConfig - Guard mismatch_kl access in micro-step and step logging (custom loss may not emit it) - Change AdvantageConfig base from BaseModel to BaseConfig to restore extra="forbid" validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: rename prime_rl_loss to default_loss_fn Consistent with default_advantage naming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: simplify loss setup logging Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: rename default_advantage to default_advantage_fn Consistent with default_loss_fn naming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
4fb4639616 | add multi-turn support for multi-modal RL (#1703) | ||
|
|
36959cbbac | add multimodal training (experimental) (#1680) | ||
|
|
0ca5739f75 |
Allow trainer to evict runs that write bad batches (#1634)
* add run eviction logic * add some tests * add run eviction to docs * update rename in index * make packer evict runs it doesnt like * add check for teacher logprobs * dont error on idx not found in case we double evict * remove stale test * this log is quite spammy * rename config folder to control |
||
|
|
c3de771b0d |
[Refactor] rename Runs -> RunsManager and cleanup hooks (#1619)
* better runs docs * some renamin * missed tests * missed comments * meraid docs render in gh according to CC [skip ci] * better diagram [skip ci] * Update docs/runs.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com> * docs update * rename to MultiRunManager * guard the discovery apis rom being used by non master ranks * variable renaming * sync runs to synchronize state * dont register master only hooks on non master * encapsulate lora hook registration into run manager setup --------- Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
a1271501b8 |
Fix: Add k8s doc to docs folders and update mint config (#1597)
* Add k8s docs to docs content and update mint config. * Revert change. * Revert deployment. |
||
|
|
0e5940f82b |
refactor logging on environment in orch (#1594)
* remove logging * add per env logging * log to one file when having multiple worker * intercept verifier log * intercept verifier log * intercept verifier log * Add worker tag to env worker logger for identification Co-authored-by: sami <sami@primeintellect.ai> * Update changelog for logging config changes Co-authored-by: sami <sami@primeintellect.ai> * Rename env worker log config flag Co-authored-by: sami <sami@primeintellect.ai> --------- Signed-off-by: samsja <55492238+samsja@users.noreply.github.com> Co-authored-by: sami jaghouar <sami@primeintellect.ai> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
bceb0ccebf |
Logging tmux script panes (#1590)
* docs: simplify tmux logging section Co-authored-by: sami <sami@primeintellect.ai> * docs: trim tmux logging usage snippet Co-authored-by: sami <sami@primeintellect.ai> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: sami <sami@primeintellect.ai> |
||
|
|
4ff009d2ec |
update docs for logging (#1588)
Co-authored-by: sami jaghouar <sami@primeintellect.ai> |
||
|
|
e3dbf2ad86 |
feat: Add keep_interval to checkpointing config (#1521)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: sami <sami@primeintellect.ai> |