Skip to content

v0.11.1.dev17

@samsja samsja tagged this 24 Nov 03:24
## Summary

- **The Prime monitor is off by default** for `rl`, `sft` and `eval`,
like W&B. Turn it on with `--monitors.prime` or a `[monitors.prime]`
table. Before this change, every launch without a Prime account failed
until it passed `--no-monitors.prime`. A Prime account here means an API
key and a team enabled for external training runs.
- **An enabled monitor still fails loudly.** The launch fails with the
same actionable errors as before when the key is missing or the platform
refuses the registration (no team, or a team outside the allowlist). So
does an RL trainer started without the `rl` launcher. The error paths in
`monitors/prime.py` are unchanged.
- **Hosted runs keep logging.** This is its own commit (`feat(monitors):
log to a platform launch's run with the monitor off`). `prime train`
builds each component's config from the prime-rl-configs defaults, so
hosted components would now get `monitors.prime = null`.
`monitors.setup()` turns the Prime monitor on when the platform created
the run: `$RUN_ID`, or `$PRIME_RUNS_EVAL_ID` for a hosted eval. The
local `rl`/`sft` launcher and the SLURM run owner set `RUN_ID` only
after they register a run, which needs the monitor on, so local runs
stay off. `PRIME_RUNS_MODE=disabled` still keeps a hosted run off the
platform. The commit can be dropped if the platform passes
`--monitors.prime` itself.
- **Cleanup.** This is also its own commit. The `--no-monitors.prime`
flags in the integration tests, the parallel-invariance regression test,
the eval regression workflow and `docs/scaling.md` are gone, because the
default covers them.
- The docs (`docs/training.md`, `docs/eval.md`), the
`MonitorsConfig.prime` docstring and the tooltip on the dashboard's
"View on Prime" button describe the new default.

#4096 turned the monitor on by default. This PR makes it opt-in again.
An enabled monitor still fails loudly, as #4096 and #4244 set up.

## Breaking

- Local `rl`, `sft` and `eval` runs no longer log to Prime unless they
pass `--monitors.prime` or set `[monitors.prime]`.
- Hosted runs (`RUN_ID`, `PRIME_RUNS_EVAL_ID`) keep logging to their
platform run.
- An eval started before this change saved its resolved config with the
monitor on. Resuming it needs `--monitors.prime` (or
`--resume.skip-checks`), because the resume check compares the whole
config.

## Verification

- `uv run pytest tests/unit/train/sft/test_prime_monitor.py
tests/unit/utils tests/unit/monitors tests/unit/test_configs.py`: 441
passed, 8 failed. All 8 failures are
`tests/unit/utils/test_dcp_export.py::test_layer_export_matches_original_hf_weights[*]`
with `indexed_attention requires sm_80, sm_90, sm_100, sm_103, this
device is sm_120`. That is a kernel architecture check on the local GPU,
outside the monitor code.
- The new `test_a_platform_launch_turns_the_monitor_on` fails without
the `monitors.setup()` change and passes with it.
- `ruff check` and `ruff format --check` pass on the changed Python
files.
- End to end, without a Prime account (empty `HOME`, `PRIME_API_KEY`
unset):
- `uv run sft @ configs/debug/fake/sft.toml --max-steps 2`: trains 2
steps and exits 0. The trainer initializes only the file monitor, and
the console shows no Prime line.
- The same with `--monitors.prime`: fails at launch with `The prime
monitor found no Prime API key. Authenticate with prime login (or set
PRIME_API_KEY), or turn the monitor off with --no-monitors.prime`.
- The same with `--monitors.prime` and `PRIME_API_KEY=invalid` (no
team): fails at launch with `Failed to register the Prime run
(ConfigurationError: A training run needs a team ...). Select a team
with prime switch (or set PRIME_TEAM_ID), or turn the monitor off with
--no-monitors.prime`.
- `uv run torchrun --standalone --nproc-per-node 1
src/prime_rl/trainer/rl/train.py @ configs/debug/fake/rl.toml
--max-steps 2` (no launcher, no monitor flag): trains 2 steps with the
file monitor only.
- The same trainer with `RUN_ID=<id> PRIME_RUNS_MODE=disabled`, a
simulated platform launch that makes no platform calls: logs
`Initializing monitors (prime, file)` and `Prime run disabled`, then
trains 2 steps.
- Config resolution with `--dry-run`:
- `uv run rl @ examples/basic/reverse-text/rl.toml --monitors.prime
--dry-run` sets `monitors.prime` in both the resolved trainer config and
the resolved orchestrator config. Without the flag, both are `null`.
- `uv run eval @ configs/ci/integration/gsm8k-eval.toml --monitors.prime
--dry-run` resolves `monitors.prime` to `{"name": ...}`. Without the
flag, it is `null`.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes default observability and launch behavior (runs without Prime
credentials now succeed), with a narrow exception for hosted
`RUN_ID`/`PRIME_RUNS_EVAL_ID`; resume/config compatibility for older
evals is the main footgun.
> 
> **Overview**
> **The Prime platform monitor is now opt-in** for `rl`, `sft`, and
`eval`: `MonitorsConfig.prime` defaults to `None` instead of a live
config, so local runs no longer need `--no-monitors.prime` or a Prime
API key. Enable streaming with **`--monitors.prime`** or a
`[monitors.prime]` table (same pattern as W&B).
> 
> **Hosted/platform launches still log to Prime** when
`monitors.setup()` sees `RUN_ID` or `PRIME_RUNS_EVAL_ID` and would
otherwise leave `prime` unset—it injects `PrimeMonitorConfig()` so
components attach to the run the platform already created.
> 
> Docs, the dashboard “View on Prime” tooltip, CI/regression workflows,
and integration tests are updated to match (removed
`--no-monitors.prime` where the new default suffices). A unit test
covers the hosted auto-enable path.
> 
> **Breaking:** local runs stop uploading to Prime unless explicitly
enabled; resuming old evals that resolved with Prime on may need
`--monitors.prime` or resume skip-checks.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e29441b99ea041cf77d6aa9b83d6c1b25856975a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Assets 2
Loading