10bc02c6dccf34f7e1f86af83794de92d0dbb60c
57
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
fa191e589b |
refactor(config): propagate shared RL fields via before-validator (#2565)
Release / Push CUDA image to Docker (push) Canceled after 0s
pydantic-config 0.3 (drop-tyro, #2564) removed the typed-default mirror that previously round-tripped CLI args through tyro. With that gone, a ``mode="before"`` validator on RLConfig now sees a clean dict-of-dicts and can propagate shared top-level fields into the right sub-config keys *before* sub-configs are constructed. Sub-configs' own ``mode="after"`` validators then see the resolved values (e.g. ``OrchestratorConfig.auto_setup_tokenizer`` sees the propagated ``student.model.name`` at the moment it derives ``tokenizer.name``, instead of running with the stale class default and then being patched up by a load-bearing RL-level re-derive). Replaces eight per-field ``auto_setup_*`` ``mode="after"`` validators with a single ``auto_setup_shared_configs`` ``mode="before"`` validator using a ``fill``-if-absent helper. The previous fix-up at the RL level (``auto_setup_tokenizer``'s "no shared tokenizer: re-derive from (now-correct) model names") silently overrode explicit ``[orchestrator.tokenizer] name = ...`` values; with the before-validator, explicit sub-config values survive untouched. Also: - keep per-field mutex ``validate_no_shared_field_conflicts`` — duplicating a field in shared + sub-config is still ambiguous and the mutex catches it explicitly. - drop ``RLConfig.max_model_len`` — declared but never wired to a validator. Users set ``inference.model.max_model_len`` directly. - move ``auto_setup_session_headers`` from RLConfig onto ``OrchestratorConfig`` (now ``self.student.client``), so the hosted orchestrator entrypoint also enforces it when loading standalone. - collapse the per-field ``validate_shared_*`` calls into a single ``validate_shared_configs`` ``mode="after"`` validator that runs the full consistency suite post-construction. - add ``validate_shared_seq_len`` to ``utils.validation`` and the propagation map; ``seq_len`` now also goes through the same flow. Tests (``tests/unit/test_configs.py``): 24 new cases covering propagation of ``model.name`` / ``tokenizer`` / ``seq_len`` / ``max_steps`` / ``output_dir`` / ``[ckpt]`` / ``[wandb]``, the per-field mutex on every shared key, the "empty shared block coexists with sub-block" rule, the "disjoint shared + sub fields coexist" rule, and end-to-end CLI override of ``--seq-len`` propagating through TOML. Crucially, ``test_explicit_subconfig_tokenizer_name_survives_shared_model_propagation`` regression-tests the case that the old RL-level fix-up silently broke: shared ``[model] name`` propagates everywhere it should, but an explicit ``[orchestrator.tokenizer] name`` is left alone. Three in-repo configs were tripping the new mutex; same fixes: - configs/hendrycks_math/sanity.toml: drop redundant ``[trainer.model] name`` - examples/hendrycks_sanity/rl.toml: drop redundant ``[trainer.model] name``, move shared ``seq_len = 8192`` under ``[orchestrator]`` so the trainer keeps its longer 16384 context - examples/glm5_pd_disag/rl.toml: split shared ``[model] name`` into per-component names (trainer = GLM-5 BF16, orchestrator + inference = GLM-5-FP8 to satisfy ``validate_shared_model_name``). Closes #2430. Supersedes #2517 — the same approach, rebased onto post-tyro pydantic-config which removes the need for the ``_dump_preserving_discriminators`` workaround the original PR carried. CPU suite (matches cpu_tests.yaml): 374 passed. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
1f26eeeb52 |
feat: convert config field descriptions to docstrings + config simplification (#2567)
Release / Push CUDA image to Docker (push) Canceled after 0s
* chore(configs): convert field descriptions to PEP 224 docstrings Now that the pydantic-config bump supports attribute docstrings, switch every config field from ``Annotated[T, Field(description=...)]`` to a plain typed assignment plus a single-line docstring on the next line. ``Field(...)`` is kept only where it carries other metadata (``ge=``/``gt=``, ``validation_alias=``, ``default_factory=``). Descriptions are tightened: dropped redundant restatements of the field name, dropped mentions of defaults and aliases (the help renderer shows those automatically), and dropped pydantic model docstrings (mostly redundant). Net change is ~1.4k fewer lines across the seven config modules. Bumps the pydantic-config submodule to pick up MRO-aware docstring extraction (so inherited fields keep their description) and ``default_factory`` rendering in --help. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(configs): drop trivial sub-config docstrings, base DUV variants on BaseConfig - Drop sub-config field docstrings that just restated the field name (e.g. ``"""Logger configuration."""`` on ``log: LogConfig``). Without the docstring the help renderer falls back to ``<path> options`` for the panel title, which is just as readable. Keep docstrings that carry real info (gating semantics, propagation, side-effects, etc.). - Switch every discriminated-union variant (and standalone ``BaseModel`` configs like ``KVCacheOffloadConfig``) from ``BaseModel`` to ``BaseConfig`` and drop the per-class ``model_config = ConfigDict(extra="forbid")`` line — ``BaseConfig`` already bakes in ``extra="forbid"`` and the TOML ``"None"`` → ``None`` coercion, so this is both leaner and more consistent (some variants previously had ``extra="forbid"``, others did not). - Fix typo in ``examples/wordle/sft.toml`` (``micro-batch-size`` → ``micro_batch_size``) that was silently dropped under the old ``extra="ignore"`` and would now be rejected. - Bump pydantic-config submodule to the merged upstream commit (PrimeIntellect-ai/pydantic-config#12) for MRO-aware docstring extraction and ``default_factory`` rendering in ``--help``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(deps): bump pydantic-config to merged help-rendering fixes Picks up PrimeIntellect-ai/pydantic-config#13: per-panel flag column widths, 60-char cap on the flag column with oversize flags rendered on their own line, inline ``(default: X)`` in place of the right-aligned annotation column, and title/flag wrapping so the box always fits the terminal width. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(deps): bump slim-wheel pydantic-config floor to 0.3.0.dev82 The PyPI floor on ``prime-pydantic-config`` only matters for the slim wheel install (plain ``pip install prime-rl-configs`` outside the uv workspace). Bump it to ``0.3.0.dev82``, the dev release auto-published when PrimeIntellect-ai/pydantic-config#13 merged — the help-rendering fixes prime-rl now relies on for clean ``--help`` output. Workspace installs are unaffected; they keep resolving ``prime-pydantic-config`` editable from ``deps/pydantic-config`` via the root ``[tool.uv.sources]`` override. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.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> |
||
|
|
6591943919 |
feat(orchestrator): validate renderer auto-resolution at config time (#2537) (#2540)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
66ff00d117 |
make renderers default for rollouts (#2521)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
d2f36c9f65 |
feat: per-batch loss type override for hosted SFT hard distill (#2271)
Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: per-batch loss type override for hosted SFT hard distill Add loss_type field to TrainingSample and MicroBatch transport types so the orchestrator can stamp samples with a loss override (e.g. "sft") that the trainer dispatches per-batch. This allows a shared multi-tenant trainer to handle both RL and SFT distill runs on the same cluster. When teacher_rollout_model is configured, the orchestrator sets loss_type="sft" on each sample. The trainer's compute_loss checks the field and swaps to sft_loss_fn for that batch, falling back to the configured default when None (fully backward compatible). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: explicit loss_type field, sft_loss bool, no auto-derive Address review feedback: - Replace loss_type: str | None with sft_loss: bool on TrainingSample and MicroBatch (simpler, no string matching) - Add explicit loss_type: Literal["rl", "sft"] on OrchestratorConfig instead of auto-deriving from teacher_rollout_model presence - Orchestrator stamps sample.sft_loss based on config.loss_type, not teacher presence — user explicitly opts in - Update validator: loss_type="sft" requires teacher_rollout_model (direction reversed from "teacher implies sft") - Update example TOML with explicit loss_type = "sft" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * change to boolean * conistency * refactor: rename need_sft_loss to use_sft_loss and tighten hosted SFT invariants - Rename `OrchestratorConfig.need_sft_loss` to `use_sft_loss` (clearer intent). - Move the orchestrator-only SFT distill invariants (use_sft_loss paired with teacher_rollout_model, use_token_client coupling) from RLConfig onto OrchestratorConfig so the hosted `orchestrator` entrypoint enforces them too, not just the combined `rl` entrypoint. - Shrink RLConfig.validate_external_rollout_inference to the one truly cross-config check (teacher_rollout_model vs self.inference). - Drop redundant `[trainer.loss] type = "sft"` from the alphabet_sort example so `use_sft_loss` is the single obvious knob. - Access micro_batch["sft_loss"] directly in train.py (required TypedDict field, no fallback needed). - Document the override in skills/config/SKILL.md. * test: cover hosted SFT loss override --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
d2718f5f65 |
chore: rename deprecated orchestrator config keys (#2327)
Release / Push CUDA image to Docker (push) Canceled after 0s
Rename '[orchestrator.sampling]' -> '[orchestrator.train.sampling]', '[[orchestrator.env]]' -> '[[orchestrator.train.env]]', and 'max_tokens' -> 'max_completion_tokens' across all configs to remove reliance on the deprecated auto-translation. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
ad3134ac03 |
fix 32-> 30 (#2287)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
8c5aa67aa5 |
fix 2.5 -> qwen (#2286)
Release / Push CUDA image to Docker (push) Canceled after 0s
|
||
|
|
1a1a39619a |
chore: refactor env groups + a bunch of deprecations (#2193)
Release / Push CUDA image to Docker (push) Canceled after 0s
* ckpt * chore: flatten env group config and move env_ratios to per-env ratio field - Remove ValConfig and all val-related orchestrator code (not part of env group refactor) - Move env_ratios from BufferConfig to per-env ratio field on EnvConfig - Fix merge artifacts: train_env_names -> train_envs.names, env_cfg.server.address -> env_cfg.address - Add validator ensuring env ratios are all-or-nothing across envs - Update tests and example configs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: simplify orchestrator env setup and auto-detect group scoring - Extract spawn/connect/shutdown into Envs class with atexit cleanup - Auto-detect group rubric envs and use run_group instead of deferred scoring - Remove deferred_group_scoring_tasks, max_concurrent from EnvConfig - Fix stale eval references (eval_env_set, eval_env_names, config.eval.num_examples) - Use Sequence[EnvConfig] for covariant type compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: introduce Env wrapper class and simplify orchestrator plumbing - Env wraps vf.Environment + config with per-env state (group scoring, max_retries, ratio, spawn/connect/shutdown, generate_rollout/generate_group) - EvalEnv extends Env with num_examples, rollouts_per_example, and evaluate() - Envs is now a thin container over Env instances - Scheduler uses env.uses_group_scoring and env.generate_* directly instead of maintaining parallel dicts/sets - Buffer iterates Env instances directly for datasets and ratios - evaluate_and_log replaces evaluate_env, taking an EvalEnv directly - Tests use make_env/make_envs helpers for cleaner Env construction Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: store sampling_args on Env, remove temp scheduling from orch - sampling_args set once at env init via Envs.set_sampling_args() - Remove per-step compute_temperature + set_sampling_args from training loop - get_sampling_args no longer takes temperature param - Add TrainEnv/EvalEnv subclasses with distinct get_dataset behavior - EvalEnv.get_dataset calls get_eval_dataset, base Env uses get_dataset - Buffer no longer needs eval flag — uses env.get_dataset() polymorphically - Raise on connect if address not configured Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: type-narrow TrainEnv constructor to TrainEnvConfig Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: set sampling args at env init, compute once per orchestrator - TrainEnvs takes SamplingConfig and computes train sampling args once - EvalEnvs takes EvalSamplingConfig and computes eval sampling args once - Remove set_sampling_args, get_eval_sampling_args calls from orchestrator loop - evaluate_and_log uses eval_env.sampling_args directly - Access max_retries and ratio through config instead of duplicated attrs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: inline vf_utils into Env, rename get_sampling_args - Inline run_rollout/run_group logic into Env.generate_rollout/generate_group - Make uses_group_scoring a property on Env (reads rubric directly) - Rename get_sampling_args -> get_train_sampling_args - Move get_eval_sampling_args from eval_utils to utils (next to train variant) - Rename vf_env -> _env Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: set sampling_args from orchestrator, rename to run_rollout/run_group - Remove sampling config from TrainEnv/EvalEnv constructors - Orchestrator computes sampling args and sets via Envs.set_sampling_args() - Rename generate_rollout -> run_rollout, generate_group -> run_group Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove dead code, inline spawn/connect into Env - Remove dead vf_utils functions: run_rollout, spawn_env_server, setup_env_client, wait_for_env_servers, task_uses_group_scoring - Inline spawn logic (ZMQEnvServer.run_server) directly into Env.spawn() - Inline connect logic (ZMQEnvClient) directly into Env.connect() - Convert name and uses_group_scoring from properties to attributes - Clean up unused imports from vf_utils Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: revert math_group config changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove commented-out TrainEnvConfig stub Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: inline evaluate/generate/run_group into EvalEnv - EvalEnv.evaluate() now contains the full eval pipeline (get inputs, round-robin clients, gather groups, collect results) - Remove run_group, generate, evaluate functions from vf_utils - Remove dead constants (DEFAULT_RETRIES, DEFAULT_STATE_COLUMNS, REQUIRED_STATE_COLUMNS) from vf_utils Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: inline eval pipeline into EvalEnv, remove semaphore and dead code - EvalEnv.evaluate() now handles rollout generation, metrics, and logging - Support group scoring in evaluate() via requires_group_scoring branch - Rename uses_group_scoring -> requires_group_scoring - Remove semaphore (set_semaphore, get_semaphore) and max_concurrent config - Remove log_eval_results, evaluate_and_log — eval_utils down to ckpt_step + pass@k - Remove strip_env_version, add EnvConfig.stripped_id property - Use model_name consistently Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: resolve num_workers in configs, cleanup naming and logging - Resolve train env num_workers in OrchestratorConfig from max_inflight_rollouts - Resolve eval env num_workers in EvalEnvConfig from num_examples * rollouts_per_example - Remove resolve_num_workers from vf_utils, max_concurrent from Env.spawn() - Rename by_task -> by_env in scheduler - Add EnvConfig.stripped_id property, remove strip_env_version function - Use debug-level logs for spawn/connect - Use prime-rl logger in process utils instead of loguru - Fix eval_envs unbound error when no eval config - Add multi_reverse_text test config without external server Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: make Envs generic over env type for correct type narrowing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: fix tests — remove val config from all TOML files, fix task->env_name - Remove [orchestrator.val] sections from all config files (ValConfig removed) - Fix test_scheduler: task= -> env_name= in InflightRolloutInfo - Warn when eval env defaults to 4 workers due to num_examples=-1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: unify rollout dispatch with Env.run() helper - Env.run() dispatches to run_rollout or run_group based on requires_group_scoring and rollouts_per_example, always returns list - Scheduler and EvalEnv.evaluate() both use env.run() — no more branching - Unified result handling in scheduler (single path for both modes) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: rename EnvBuffer -> Buffer, BufferSet -> Buffers, narrow to TrainEnvs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: Buffer takes TrainEnv directly, gets its own dataset Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: merge Buffer naming — Buffer is the public API, _EnvBuffer is internal Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: stop hijacking vf task field for env identification - Remove example["task"] = env.name override in buffer - Change default hash_keys from ["task", "prompt"] to ["env_name", "prompt"] - Add env_name column to wandb and prime monitor logging - task field now purely vf-internal (set by verifiers, not overridden) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restore eval interval gate, verification.enabled flag, and minor cleanups - Restore `if eval_ckpt_step is not None` guard so evals run at interval steps only - Use `self.verification.enabled and env.score_rollouts` so global flag is respected - Fix stray `)` in spawn log message - Fix `update_pools` return type annotation (str, not list[str]) - Use `get_logger().warning()` instead of `warnings.warn()` in EvalEnvConfig Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: add changelog entries for env group refactor breaking changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: improve EnvConfig and EvalEnvConfig field descriptions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: silence noisy eval num_workers warning in config validator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove dead parse helpers, fix ratio field description - Remove unused parse_num_completion_tokens and parse_is_truncated_completions - Fix ratio description: ratios are relative weights, not required to sum to 1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove env-var modules, inline os.environ into World - Delete utils/envs.py and trainer/envs.py (97 lines of env-var parsing ceremony) - Inline os.environ.get() calls directly in World.__init__ - Remove dead parse helpers and fix ratio field description Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove temp scheduler, avoid list alloc in buffer sampling - Delete TemperatureSchedulerConfig and temp_scheduling module - Make SamplingConfig.temperature a plain float (default 1.0) - Use tuple(dict) + random.choice for buffer sampling instead of materializing a list of values on every call Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: merge spawn+connect into Env.start(), add requires_env_server_spawn - Env.start() spawns (if needed) and connects in one call - Envs.start() does the same for all envs in parallel - Add requires_env_server_spawn property for readability - Move spawn logic to private _spawn() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: split run into run_rollout/run_group, fix eval group scoring - Env.run_rollout() returns a single RolloutOutput - Env.run_group() returns list[RolloutOutput] for group-scoring envs - EvalEnv.evaluate() dispatches correctly: n*k individual run_rollout calls for non-group envs, n run_group(k) calls for group-scoring envs - Replace _get_eval_inputs with own logic (get_dataset + flat repeat) - Scheduler normalizes single/list results via isinstance check - Progress bar tracks n*k rollouts in both eval modes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: simplify evaluate() dispatch into single run_with_progress Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: define run_with_progress per branch to avoid misleading param Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: move get_dataset to TrainEnv, inline get_eval_dataset in evaluate Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: load eval dataset once in EvalEnv constructor Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove redundant total_count variable in evaluate Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * mini * update config * chore: remove score_rollouts from EnvConfig, fix group scoring reschedule - Remove score_rollouts field from EnvConfig (was internal, not user-facing) - Fix group-scoring envs: discard entire group on partial failure and reschedule from scratch (group rewards require all rollouts together) - Fix "Eval environments ready" -> "Eval environment(s) ready" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove VerificationConfig, rollout scoring is always enabled - Delete VerificationConfig class and verification field from OrchestratorConfig - Remove validate_verification_config validator - Stop setting score_rollouts in extra_env_kwargs (defaults to True in verifiers) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: wrap single run_rollout result in list in scheduler run_rollout returns a single RolloutOutput, not a list. Without wrapping, iterating over the dict yields keys instead of the rollout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: rename n/k to descriptive names in evaluate, fix k shadowing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove unused num_rollouts param from update_pools Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: rename InflightRolloutInfo to InflightRequest dataclass Convert from NamedTuple to dataclass for direct mutation of off_policy_steps, and rename to better reflect what it represents. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: count rollouts not tasks for group-scoring capacity and metrics inflight_rollout_count, cancel_inflight_rollouts, and drop_group all counted tasks (1 per group request) instead of actual rollouts. This caused the capacity check to allow up to rollouts_per_example × more concurrent rollouts than max_inflight_rollouts intended. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: document skip_first removal in changelog Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: rename envs to train_envs in Scheduler, move RolloutInput into Env Narrows the Scheduler's dependency from generic Envs to TrainEnvs and moves vf.RolloutInput construction into Env.run_rollout/run_group so callers just pass plain dicts. Fixes a missed self.envs reference in generate_batch that would have caused an AttributeError at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: update Scheduler kwarg from envs to train_envs in orchestrator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: use composition for TrainConfig/EvalConfig, add per-env sampling - OrchestratorConfig uses composition (train: TrainConfig) instead of inheriting TrainEnvsConfig; before validator preserves [[env]] and [sampling] TOML compat - Rename SamplingConfig -> TrainSamplingConfig, TrainEnvsConfig -> TrainConfig - Drop EvalEnvsConfig, inline into EvalConfig - TrainEnvConfig supports per-env sampling overrides merged via model_dump(exclude_unset=True) so only explicit keys override group defaults - Resolve sampling args at TrainEnvs/EvalEnvs construction, remove set_sampling_args - Remove temperature from logged metrics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: restore group-level num_examples/rollouts_per_example on EvalConfig These fields were on EvalConfig on main and got dropped during the refactor. Re-add them with resolution via model_fields_set so group defaults propagate to per-env configs unless explicitly overridden. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: terminate env servers in parallel during shutdown Send SIGTERM to all processes first, then join all — avoids sequential 25s timeouts when multiple env servers are slow to exit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: move usage_reporter.close() outside _graceful_shutdown Ensures the usage reporter is closed even if the shutdown task times out, matching the pre-refactor behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * better logs * test config * chore: move sampling args resolution to config classes - Add `to_sampling_args()` methods on TrainSamplingConfig and EvalSamplingConfig, replacing standalone get_*_sampling_args functions - Resolve vLLM-specific extra_body defaults at config validation time in OrchestratorConfig, removing the is_vllm flag from TrainEnv/TrainEnvs - Add per-env sampling field to EvalEnvConfig with group-level merge, matching the existing TrainEnvConfig pattern - Use model_fields_set for sampling fallthrough instead of None sentinel - Add deprecation warnings for [[orchestrator.env]] and [orchestrator.sampling] shorthand with auto-translation - Update multi_reverse_text config to exercise per-env eval sampling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove unused EvalSaveHFConfig Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * minor * docs: update CHANGELOG with recent config changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: restore top_k and min_p fields on EvalSamplingConfig Keep these fields with concrete defaults (-1 and 0.0) to avoid a breaking change. They flow into extra_body when non-default. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: copy group sampling config when resolving per-env defaults Envs without explicit sampling overrides received a shared reference to the group-level config object. resolve_env_config then mutated vLLM defaults into that shared object, contaminating the group config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use orchestrator.train.env in SLURM entrypoint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: only send non-default eval sampling args to inference server EvalSamplingConfig.to_sampling_args() was sending temperature=1.0 and top_p=1.0 even when the user didn't set them. This overrode the inference server's own defaults, changing eval results vs main. Now only includes fields that differ from defaults, matching the old None-based behavior where unset fields were omitted entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: revert EvalSamplingConfig to nullable fields Concrete defaults caused temperature=1.0 and top_p=1.0 to always be sent to the inference server, overriding its own defaults and changing eval results. Nullable fields with None = "defer to server" is the correct semantic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
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> |
||
|
|
09a6875f11 |
migrate config system to pydantic_config (#1915)
Release / Push CUDA image to Docker (push) Canceled after 0s
* migrate config system from pydantic-settings to pydantic_config Replace the custom pydantic-settings wrapper (BaseSettings, parse_argv, toml_files inheritance) with the external pydantic_config library which provides tyro-backed CLI parsing, @ syntax for TOML files, and deep merge of configs + CLI overrides. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update pydantic-config to fix-tyro branch and fix benchmark CLI args for tyro - Switch dependency from refactor-tyro to fix-tyro branch (includes validators moved upstream) - Simplify config.py by removing validators now in pydantic_config - Fix benchmark script to use tyro subcommand syntax for optional nested configs (compile, ac, ac-offloading) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update pydantic-config to include bare flag support for Optional configs The benchmark script's --model.compile and --model.ac bare flags now work without changes, thanks to upstream pydantic_config handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update pydantic-config to main (includes AvoidSubcommands fix) Fixes dict[str, Any] tyro parser errors and union subcommand issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update pydantic-config to include sub-field override fix Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
7104dbdb5d |
hendrycks sanity ci (#1900)
Release / Push CUDA image to Docker (push) Canceled after 0s
* do not oversample hendrycks sanity (trainer bottlenecks) * put hendrycks sanity into nightly config * remove duplicate utils |
||
|
|
5b15e54e88 |
chore: move tool_call_parser resolution from config validation to server startup (#1882)
Release / Push CUDA image to Docker (push) Canceled after 0s
The auto-detection ran at config time via a model_validator, but the model name may not be final yet (e.g. RLConfig propagates it later), requiring a hacky reset+re-resolve in auto_setup_model(). Moving the lookup to server() ensures we always resolve against the final model name. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
4b0ecdb223 |
add hendrycks sanity check exp (#1873)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Flesh out hendrycks sanity example README Add explanation of the sanity check methodology (perfectible dataset filtering), setup instructions, and training commands for local/SLURM. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update examples * Add hendrycks sanity to training examples list in README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update readme --------- 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> |
||
|
|
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> |
||
|
|
65ba487034 |
bump vf (dfc473c) (#1708)
* bump vf * use ckpt consistently * fix imports * make env worker run * fix utils used in eval and synthesize endpoint * restore old semaphore behavior * remove unnessary semaphore setup * set max_concurrent_groups * fix to make concurrency global * fix key error * access oai_tools safely * use vf retries * use new types * consistent tool handling * misc |
||
|
|
a57550349c |
Lieger kernel model deprecation (#1691)
* Deprecate liger kernel model impl Co-authored-by: sami <sami@primeintellect.ai> * Remove liger_kernel impl option Co-authored-by: sami <sami@primeintellect.ai> * Restore historical changelog note Co-authored-by: sami <sami@primeintellect.ai> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: sami <sami@primeintellect.ai> |
||
|
|
42e09073f6 |
Add missing [ckpt] section to reverse_text rl.toml (#1653)
* Add missing [ckpt] section to reverse_text rl.toml The README.md documents that `outputs/weights/step_20` will be created after RL training, but the rl.toml was missing the [ckpt] section. Without this section, no weight checkpoints are saved because `setup_ckpt_managers()` returns (None, None) when ckpt_config is None. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add missing [ckpt] section to other example configs Also adds [ckpt] section to: - examples/wiki_search/rl.toml - examples/reverse_text/sft/train.toml - examples/reverse_text/rl/train.toml These training configs were missing checkpoint configuration, which would result in no weights being saved after training. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
c2f90c8a28 |
change LoRA alpha default to 32 (#1567)
* change LoRA alpha default to 32 * bugbot fixes * LR fix * use alpha=64 in alphabet_sort config * adjust LR for CI configs * Apply suggestion from @Jackmin801 Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com> * lr moved to optim * check step 9 now that lr is lower --------- Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com> Co-authored-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com> Co-authored-by: Jackmin801 <ongjackm@gmail.com> |
||
|
|
e75677fcbd |
[Feat] multi run optim args (#1555)
* orchestrator config is ok and component integrations look satisfactory * rename lora_name to lora.name in orchestrator * fix in rl.py * multilora independent scaling factors * train.py changes * changes to runs * update tomls for lora.name * set the default lora rank to trainers * set lora scaling dtype to bf16 * missed lora_name -> lora.name * allow run to reset the lora globals * damn these configs got hands * i feel like i might have made my life hard for no reason. ah well, im lazy to think of somethin better rn * set higher default lr on orch side * fix configs for non-master ranks |
||
|
|
29be89daf5 |
Fix LoRA merge fallback (#1456)
* Fix LoRA docs: enable-lora + adapter-only broadcast * Updated the NCCL worker to use model_runner.model.runnable |
||
|
|
67af6779a7 |
[fix] error if train seq len too short and add arg for setting in rl.py (#1455)
* error if train seq len too short and add arg for setting in rl.py * change all configs to use root seq len * update changelog * just inline the util --------- Signed-off-by: Jackmin801 <56836461+Jackmin801@users.noreply.github.com> |
||
|
|
3147f5fed3 | fix: set model seq len (#1452) | ||
|
|
8dccae6374 |
Token-in vLLM endpoint (#1422)
* duplicate chat completinos endpoint into /generate * serve chat with token in functionality * use field to avoid misleading warning * nicer error msg * lock feature branch * make use tokens prompt configurable * use setter and print info * bump * include inference * do not print warning log (logs all the time) * bump * bump + bring back warning log * bump vf * bump vf * use dp=6 in wordle example * no deepcopy and no warning * do not tokenize on the server * add field names so that tokens is cached and no warning of unrecognized field is shown * bump vf * auto install * bump vf * bump vf + set vllm tokenize method * skip applying chat template * Revert "skip applying chat template" This reverts commit 43c6a2b2a835fbf2def3ed93571ec3c3a2aa945c. * Revert "do not tokenize on the server" This reverts commit 918219176773ad45bd45e749e0e596d6d1a7e423. * bring back log * use route /v1/chat/completions/tokens * fix log * bump vf and make everything configurable * bump and more informative log * bump and make non-exact tokenization default * use token prompts by default * remove retokenization issue from docs * rename class * bump vf * fix auto asc setup for lora * bump vf * bump vf * bump vf * bring back setter * bump vf * bump vf to latest prime-rl * Explicitly catch env errors (#1416) * add math python example * use ac * update rl instructinos * use 8 gpus and no ac * use offline filtering and val split because inference a bit too quick * 12k seq len, 2k max tokens, 300 steps * use hendrycks math with 512 tokens/turn * zero completion on error * log error rate * update math python to use vf version * fix arg * fix completion mask type * fix tests * handle empty trajectories case * add changelog * bump vf * log err rate and err distribution * fix instance * bump vf * fix dropna only on err col * also mask out first turn in interleaved mode * handle skipped rollouts * Revert "Explicitly catch env errors (#1416)" This reverts commit c1aa49253d417b024645c33a69f99554322924c6. * bump vf * add asc comment |
||
|
|
e25953539a | Move LoRA out of experimental section (#1440) | ||
|
|
3bd4f012c7 |
fix(examples): restore missing wandb.png for alphabet-sort example (#1417)
The image was accidentally removed in a previous cleanup commit. Restores the W&B training metrics screenshot. |
||
|
|
d250c4a8e3 |
Update examples (#1414)
* setup default wandb project and name * use 8 gpus and limit context * higher seq len and default config because err's on no logprob on dummy response * run wiki search on 8 gpus again * run for 200 steps * us tp/ dp in wordle * 3-5 turns in alphabet sort |
||
|
|
04a32f747a |
Run examples in nightly test suite (#1394)
* run reverse text example * use alphabet sort example * add wordle example to nightly ci * use wiki search from examples |
||
|
|
91182b7d64 |
Fix auto-configure LoRA (#1392)
* add auto setup arguments required for lora * more explicit default name and also broadcast by default * ensure env var needed for dynamic lora is workign * import whole module to get lora routes * import vllm after validating config to set env var * minor changes in alignment * update alphabet sort * allow configuring max lora rank * update warning * do not enable lora explicitly in wiki-search (not required) * raise runtime error if lora + nccl |
||
|
|
e6e3acb796 | reasoning_parser option; fix wiki-search config (#1389) | ||
|
|
1a28ff3d99 |
Nightly CI (#1371)
* rename to test_configs * cleanup unit tests * update sft integration test * working sft tests * fix eval ci * synthesize integration tests * rl integration test * enable lora flag in inference config * add lora integration tests * Move utils and fixtures around * use tmp output dir * use shared wandb project * bring back world reset * update wandb names * remove reverse text configs (moved to ci) * fix rl examples * remove vllm server fixture * Minor changes * add nightly ci * Add nightly CI * install prime in ci to enable auto install * add pull pull request trigger * make workflow visible when pr against main * Add more experiments, auto-discovery, parallelize across runners * build matrix correct * fix configs * use tp for 7b * update configs * add wordle * remove tool install * add logging on fail * print logs on error and auto skip if failed * use fixture to auto skip on error * use team id and base url * log stdout on install error * use auto install in examples * Retrigger CI * use the same config for example and nightly reverse text * do not use default interval in shared ckpt config * match example * add inference * no lora in ci * add hendrycks math * update configs * do not use commit hash as its recorded by wandb anyways * use qwen 1.7b * increase batch size * add acereason * add cron schedule * name envs * higher bs and no online filtering * Split cpu tests into unit and integration and inject secrets * Retrigger CI * use util to check for error * kill stray process (make containerized soon) * try using docker setup * Retrigger CI * Retrigger CI * set 24h timeout * enable lora and no difficulty filtering in configs * make lora work * update wiki search configs * update alphabet sort example * disable ac * use 4 train gpus hendrycks * adjust configs from examples * only eval aime24 * udpate acerason * use 4 trainer, 4 inference for acereason * bring back sep bc otherwise i dont see logs?! * allow autosetup dp * longer cleanup timeout period * 200 steps alphabet sort * clean exit on orchestrator * revert changes to configs and examples unrelated to this pr * no online filtering in wiki search example * remove trigger to run nightly ci on pr against main [skip ci] * fix running integration tests * remove misplaced assert * remove legacy test [skip ci] |
||
|
|
34ac604392 |
Cleanup configs (#1362)
* add gsm8k configs * fixes * update hendrycks math configs * fix hendrycks * delete intellect math * rename to use underscore * update multi reverse text * delete skywork acerason * update acereason math * remove skywork math configs * use rl.toml for alphabet sort examle * add rl toml to reverse text (but keep old way for k8s deployment) * update wordle * add local ranks filter * use rl.toml for acereason * translate deepscaler * add new config test * clear toml files if argv parsing fails * small fixes in tests |
||
|
|
cf41eaa362 |
Ensure all examples are functional (#1358)
* add wiki search to readme * update alphabet sort to prime org * fix wiki search * use -t abbrev |
||
|
|
49d7999ca9 |
Bump verifiers to 0.1.8 (trajectories refactor) (#1315)
* Return token IDs and prompt logprobs unconditionaly * Remove parsing utils patches * Bump vf * Bump vf to be able to use logprob pydantic hotfix * Change to rollouts per example * First working run * Make trajectory strategy configurable * Fix branching rollouts converter * Bring back computing advantages with our config * Roll back compute advantages changse * Fix unit test * Truncate when preparing rl sample * correct interleave rollout * Never mask or zero truncated rollout * Rework interleave trajectory and add tetsts * Basic tests for client (need some more work) * edit * Update default sampling args * revert changes on batch * adjust everything to make it run * Extract typing * Bring back some logging * add debug alphabet sort multi turn env * show mismatches * Remove assertions * Do not put advantages in results df * quick rl config * set max seq len so that truncation computed * Use smaller model bc 4b instruct is too good * Export is truncated * use deepseek distill * add quick rl wiki search * Bring back lora to fit on my little machnie * Fix tests * add utils and tests for serializing state * add utils for serializing state and tests * serialize state before saving buffer * Less verbose warning * add docs for strategy * revert comment out * bring back sample logging * remove trajectory strategy from scheduler * comment for jack * correctly log rollouts * log input ids as string * Make client test gpu only * Bump vf version to veresion on prime-rl branch * use deepcopy * allow logprob to be dict * add missing prefix * make evals work |
||
|
|
79b288a743 | Update README files in reverse_text and wordle examples to replace '--weights' with '--ckpt' (#1354) | ||
|
|
33ec40b36a |
K8s Support, Helm Chart and reverse text example on k8s (#1307)
* add basic helm chart based k8s support with reverse text example * sleep once training completes instead of restarting * cleanup k8s docs * remove redundant logs * nitpick on docs * improve prime-rl example * fix logic issue in examples * additional readme perfectionism * adjust get pods command * removing nccl for now, will come back later with ib support for k8s * apply valid k8s findings |
||
|
|
613d136158 |
wiki-search example; bump verifiers commit (#1256)
* wiki-search example; bump vf commit * uv.lock * readme * readme |
||
|
|
449b3eba4d |
Implement validation split (#1211)
* Rename to env * Move env specific configs into the right place * Implement val spit and overlap train,val and eval * Fix test * Support multi-env training and evals * Fix log * Change orch config * Multi env evals * Move training semaphore out so that it is also used for evals * Add multi-env train example configs * Fix configs * Minor * Move seed * Do not double validate a step * Add multi env train/val/eval training example configs * Make pbar description configurable * Validate every interval * Write batch before awaiting val and eval results * Quicker evals * Pin commit * Do not limit concurrency by default * Comment on future TODO * Update configs * Support multi-env training and evals * Fix log * Change orch config * Multi env evals * Move training semaphore out so that it is also used for evals * Add multi-env train example configs * Fix configs * Refactor rollout type * Use dataframe for metric computation and add task into rollout * Log per env rewards * Bump verifiers * Fix tests * Update configs * Bring back old truncation logic * Rename to val config * Update wandb keys * Update configs * Minor config change * Val step follows orch step * Do not change example * Only log val reward on interval steps |
||
|
|
72db541b52 |
Support multi-env training/evals (#1212)
* Support multi-env training and evals * Fix log * Change orch config * Multi env evals * Move training semaphore out so that it is also used for evals * Add multi-env train example configs * Fix configs * Refactor rollout type * Use dataframe for metric computation and add task into rollout * Log per env rewards * Bump verifiers * Fix tests * Update configs * Bring back old truncation logic |
||
|
|
090b67ce6b |
Allow simpler pattern-matching for lora module names (#1203)
* allow simpler pattern-matching for lora module names * tweak examples |
||
|
|
1ab90006ea |
Fix slow CI time (#1169)
* Fix reverse text seq len * Also fix in configs * Also revert debug config to run faster * Quicker reverse text sft * more * Match trainer path tests as well |
||
|
|
9a0070b1b6 |
Remove micro batch size hparam (always 1) (#1155)
* remove micro batch size hparam (always 1) * fix seqlen naming * Delete outputs/run-yde2afem/final_summary.json Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com> * Delete outputs/run-zjmwwtda/final_summary.json Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com> --------- Signed-off-by: faresobeid <111092724+faresobeid@users.noreply.github.com> |