Skip to main content

Flight recorder + doctor for RL fine-tuning runs (GRPO/PPO): record everything, diagnose failures early.

Project description

rlprobe

Flight recorder + doctor for RL fine-tuning runs (GRPO / PPO and variants).

RL fine-tuning fails in ways that are slow, silent, and expensive: a run can look healthy on its loss curves for hours while the policy quietly collapses (entropy → 0), reward-hacks (padding answers for length), or escapes its reference model (KL blowup). rlprobe records a complete, replayable account of a training run at near-zero overhead, then diagnoses it against a catalog of 14 known failure signatures — live during training (with optional auto-halt) or post-hoc.

from rlprobe.integrations.trl import attach

trainer = GRPOTrainer(...)        # your existing setup
attach(trainer, "runs/my-run")    # ← one line
trainer.train()
$ rlprobe doctor runs/my-run
CRITICAL ENTROPY_COLLAPSE | onset ~step 212 | confidence 90%
entropy fell from ~2.31 to ~0.048 — the policy is (near-)deterministic and
exploration is dead, while reward has plateaued (classic collapse pair)

try:
  • add/increase an entropy bonus
  • raise the sampling temperature during rollouts
  • check whether the reward is saturated (nothing left to explore for)

Install

pip install rlprobe[trl]      # with the TRL integration
pip install rlprobe           # core only (manual API + doctor; no torch needed)

What it does

  • Flight recorder — per-step scalar metrics, per-sample forensics (prompts, completions, rewards, advantages, GRPO group ids), discrete events, and full run config, written to a self-contained run directory. Async writer, never blocks training, flushes on crash/SIGTERM, <2% step-time overhead, verified at 100k-step scale.
  • Doctor — deterministic detectors (trend tests, sustained thresholds, changepoints — no ML magic) for 14 failure signatures: KL blowup, entropy collapse, length reward-hacking, format gaming, clip saturation, degenerate GRPO groups, advantage collapse, value divergence, NaN/grad pathology, truncation starvation, repetition spirals, reward-std death, positional KL asymmetry, throughput rot. Ranked findings with onset step, evidence, and remediations.
  • Live guardianrlprobe watch tails a growing run and alerts (webhook support); attach(trainer, run_dir, halt=True) stops training automatically on critical, high-confidence findings.
  • Post-mortem suiterlprobe report (self-contained HTML), rlprobe diff (where did run B diverge from A?), rlprobe samples / rlprobe show (forensic queries down to individual completions).
  • Framework-agnostic core — the TRL callback is a thin layer over a manual API (Recorder.log_step / log_samples / log_event) that any training loop can call.

No GPU needed to try it — the synthetic run generator fabricates realistic pathological recordings:

rlprobe synth runs/demo --pathology entropy_collapse
rlprobe doctor runs/demo
rlprobe report runs/demo

Documentation

Full docs live in docs/ (mkdocs; pip install -e ".[docs]" && mkdocs serve): quickstart, the failure-signature catalog — each signature explained as RL-debugging documentation in its own right — the recording format, and the API & CLI reference.

Development

pip install -e ".[dev,trl]"
pytest
ruff check src tests examples benchmarks

Design history and phase-by-phase implementation notes: HANDOFF.md.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rlprobe-0.1.0.tar.gz (68.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rlprobe-0.1.0-py3-none-any.whl (60.4 kB view details)

Uploaded Python 3

File details

Details for the file rlprobe-0.1.0.tar.gz.

File metadata

  • Download URL: rlprobe-0.1.0.tar.gz
  • Upload date:
  • Size: 68.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rlprobe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5413655d0c605038c5a61aea0d4d759c8e84a355407728f7ff925c50a78732c6
MD5 349e1e5eaaed5a9777579d297c4d77cd
BLAKE2b-256 03f409df04129e97f7a9002429cbefffcf3b98df906fa7e28cece5f7ee7befd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rlprobe-0.1.0.tar.gz:

Publisher: release.yml on Nick-2908/rlprobe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rlprobe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rlprobe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 60.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rlprobe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6bd91caaa81b5a04e06c78ada549c57dd70c968cbe6d070bf3184b728ff930c
MD5 9d7aa98ccb7fef73eaa05c47fd35ae4f
BLAKE2b-256 37b72e09d6dcc3071d832e520f6669daf3ca0930f65e8b59d24c4123d2fef9de

See more details on using hashes here.

Provenance

The following attestation bundles were made for rlprobe-0.1.0-py3-none-any.whl:

Publisher: release.yml on Nick-2908/rlprobe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page