Skip to content

cvc::nav's checkpoint scrubber: every checkpoint of a training run deployed, k beside step 0 - #1259

Merged
transfix merged 5 commits into
feat/nav-labfrom
feat/nav-scrub
Nov 16, 2026
Merged

transfix merged 5 commits into
feat/nav-labfrom
feat/nav-scrub

Conversation

@transfix

@transfix transfix commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #1258. This adds the checkpoint scrubber, for watching a policy learn. Every checkpoint that a training history names is deployed on one scenario, headless, and the view shows checkpoint k beside step 0. It ports the behaviour of CVC-Lab/GRL-SNAM#181 into cvc::nav and covers cvc::nav's own trainer: a coef_trainer with history_path and checkpoint_prefix writes cvc.nav.coef_train_history/v1 and .cvcnav checkpoints, so no torch is involved.

cvc::nav (cvc/nav/nav_scrub.h)

  • read_training_history() reads JSON lines: cvc::nav's history, GRL-SNAM's, or any whose records carry a kind.
    • Every numeric leaf becomes a series named <kind>.<path>, e.g. step.loss or checkpoint.heads.alpha.mean.
    • Checkpoints name a blob (or checkpoint), resolved beside the history first. A .pt is listed as skipped and a missing file as missing.
    • The pick comes from the end record's selected_step, or from "selected": true.
    • A file can hold several runs; one is picked by index.
  • The scenario is a world described by an input trace's header: the built-in rooms (default_scenario, with portable random draws) or a recorded trace (scenario_from_trace).
    • scenario_hash() covers the world, its agents and settings, the ticks, the scrubber's version and libcvc's.
  • deploy_checkpoint() replaces the world's own policy with the blob for every agent and runs a one-arm arms_run.
  • scrub() deploys each checkpoint, or reads its run from the cache at <history>.scrub/<blob sha256 16>-<scenario hash>.cvcrun.
  • Seven metrics are taken from each run's last tick: reached share, time, path, ticks penetrating, least and mean clearance, and distance left to the goal.
  • The report is cvc.nav.scrub/v1.
  • scrub_view drives the view:
    • the checkpoint can be picked from a combo, a slider, Previous/Next, or a click on a chart;
    • the metric chart puts step 0 on a dashed line, beside the table and the training curve;
    • step 0's log and k's are stacked into one replay, so the Stats/Ledger and ghosts show at the play head. The play head keeps its time across picks.
  • cvc nav scrub HIST [--scenario TRACE] [--agents N] [--seed S] [--ticks T] [--run R] [--report R.json] [--no-cache].
  • A shipped component nav_lab_scrub.ari with units nav_lab_scrub, nav_lab_training and nav_lab_episode.
  • pycvc: nav_scrub_create/info/report/log/world/view_update/prev/next/pick/pick_step/step/restart/seek.
  • pycvc_gl: pycvc_gl.nav_lab scrub HIST draws the scenario's grid as boxes and the two ghosts with their tracks (nav_lab_scrub.ari).

Tests (all passing locally)

  • gtest nav_scrub_test (8 tests), including:
    • a coef_trainer run's history and checkpoints are read;
    • one blob deployed twice gives identical output, every column except the wall time;
    • checkpoint 0 deployed equals the untrained arm: coef_trainer(cfg, seed)'s initial policy run as an arm beside the default, tick for tick;
    • every checkpoint is deployed once and cached, and a second scrub reads all of them back identically;
    • another scenario deploys again;
    • the view's controls.
  • cvc_cli_test NavScrubDeploysEveryCheckpointAndCachesIt.
  • test_pycvc_nav_lab.py (142 checks) and test_pycvc_gl_nav_lab.py (33 checks).

python -m pycvc_gl.nav_lab scrub on a 60-step coef_trainer run trained on the built-in blocks' own map. Ticks penetrating fall from 106 to 0 and the distance left to the goals falls from 71 m to 54 m. Checkpoint 60 (orange) is shown beside step 0 (blue):

scrub

cvc nav scrub on the same history prints the same eleven rows. pycvc_gl's view read them from the same cache, because the scenario hash matched the C++ host's.

Next: the Pages demo (examples/ariadne/nav_scrub, a C++ Ariadne host that trains, deploys and scrubs in the page), stacked on this PR.

…ployed, k beside step 0

Watch a policy learn. read_training_history() reads a training history (cvc::nav's own
coef_trainer history, cvc.nav.coef_train_history/v1, or GRL-SNAM's: JSON lines whose checkpoint
records name a .cvcnav blob), and scrub() deploys every checkpoint on one scenario, headless, as a
one-arm arms_run: the built-in blocks (a walled square of city blocks) or a recorded input trace's
world. Each run is a run log cached at <history>.scrub/<blob sha16>-<scenario hash>.cvcrun, the
hash covering the world, agents, settings, ticks and the versions. scrub_view shows checkpoint k
beside step 0: the deployed metric against the step with step 0 dashed, the table, a curve from
the history, and both runs' Stats and Ledger at the play head (three more units in
nav_lab_panels.ari).

cvc nav scrub HIST prints every checkpoint's metrics and writes a cvc.nav.scrub/v1 report;
pycvc binds the scrubber, and pycvc_gl.nav_lab scrub draws it. One blob deployed twice is the same
run, and checkpoint 0 deployed is the untrained policy's arm (nav_scrub_test). The behaviour is
GRL-SNAM's ariadne scrub (CVC-Lab/GRL-SNAM#181).
# Conflicts:
#	docs/ARIADNE.md
#	src/cvc/ariadne/components/INDEX.ari
#	src/cvc/ariadne/components/nav_lab_ledger.ari
… and deploying in the page (#1260)

* nav_scrub: the checkpoint scrubber in libcvc's demo gallery, training and deploying in the page

examples/ariadne/nav_scrub is a C++ Ariadne host for cvc::nav's scrubber. With no --history it
trains cvc::nav's own coef_trainer for 60 steps on the built-in blocks' own map (in its frame,
occupancy_scene), a checkpoint every 6, deploys every checkpoint there and shows nav_scrub.ari
(the nav_lab_panels component's windows, written by cvc::nav::scrub_view), drawing the walls and
the two runs' ghosts. It joins the gallery's _wasm_demos with its document and the component
library preloaded, so in the browser the training, the deploys and the view run in the page: the
same numbers as natively (under 3 s there). demos.json and deploy-pages.yml's live check list it.

* nav_scrub: import the split nav lab components
@transfix
transfix merged commit e030b03 into feat/nav-lab Nov 16, 2026
1 of 6 checks passed
@transfix
transfix deleted the feat/nav-scrub branch November 16, 2026 00:26
transfix added a commit that referenced this pull request Nov 16, 2026
…point scrubber, and a Pages demo (#1258)

* cvc::nav arms: policies side by side, the Stats and Ledger, the run log and its replay

Several navigation policies run side by side in cvc::nav, one sim_world each, on the same world
from the same starts to the same goals, stepped in lockstep (arms_run). A retarget moves every
arm's goals on the same tick and starts a leg. Each tick records, per arm and agent, the pose,
size, drive telemetry, the books against U_nav (dU, drive, projection, context, dKE, residual)
and the plant ledger, and per arm the wall time and the Stats row, into cvc::nav's run log
(cvc.nav.run_log/v1, JSON lines, read back value for value).

The Stats and Ledger windows are a shipped component (nav_lab_panels.ari), written from a run log
at a tick by nav_panels (the live run at its last tick, a replay at its play head, so the cells
are the same). pycvc binds the arms, the run log, the replay view and the plant ledger's items;
pycvc_gl.nav_lab runs arms live and replays a run log; cvc nav log prints one. The behaviour is
GRL-SNAM's live --arms and replay (CVC-Lab/GRL-SNAM#175, #176). docs/NAV_LAB.md.

* run_log: a JSON-quoting helper named quoted() is ambiguous with std::quoted under libc++

(cherry picked from commit 74856dffb86aa26653eef739f6077dd60352bc31)

* nav lab: a component file per unit named after it; finish() closes the streamed run log

The shipped-component check (AriadneComponents.ShippedComponentsLoadClean) wants each file in
src/cvc/ariadne/components to hold a unit named after it: nav_lab_panels.ari is now
nav_lab_stats.ari (the Stats window) and nav_lab_ledger.ari (the Ledger), each in INDEX.ari, and the
documents import both. arms_run::finish() now closes the file it streams the log to, so the log is
whole and free to read, move or remove at once: Windows refused to remove it while the run still
held it (NavArms.TheLogReadsBackValueForValue).

* nav_arms_test: a fused multiply-add leaves dKE a last bit off zero on arm64; compare near

* cvc::nav's checkpoint scrubber: every checkpoint of a training run deployed, k beside step 0 (#1259)

* cvc::nav's checkpoint scrubber: every checkpoint of a training run deployed, k beside step 0

Watch a policy learn. read_training_history() reads a training history (cvc::nav's own
coef_trainer history, cvc.nav.coef_train_history/v1, or GRL-SNAM's: JSON lines whose checkpoint
records name a .cvcnav blob), and scrub() deploys every checkpoint on one scenario, headless, as a
one-arm arms_run: the built-in blocks (a walled square of city blocks) or a recorded input trace's
world. Each run is a run log cached at <history>.scrub/<blob sha16>-<scenario hash>.cvcrun, the
hash covering the world, agents, settings, ticks and the versions. scrub_view shows checkpoint k
beside step 0: the deployed metric against the step with step 0 dashed, the table, a curve from
the history, and both runs' Stats and Ledger at the play head (three more units in
nav_lab_panels.ari).

cvc nav scrub HIST prints every checkpoint's metrics and writes a cvc.nav.scrub/v1 report;
pycvc binds the scrubber, and pycvc_gl.nav_lab scrub draws it. One blob deployed twice is the same
run, and checkpoint 0 deployed is the untrained policy's arm (nav_scrub_test). The behaviour is
GRL-SNAM's ariadne scrub (CVC-Lab/GRL-SNAM#181).

* nav_scrub_test: each test trains in a directory of its own (ctest runs them in parallel processes)

* nav_scrub: the checkpoint scrubber in libcvc's demo gallery, training and deploying in the page (#1260)

* nav_scrub: the checkpoint scrubber in libcvc's demo gallery, training and deploying in the page

examples/ariadne/nav_scrub is a C++ Ariadne host for cvc::nav's scrubber. With no --history it
trains cvc::nav's own coef_trainer for 60 steps on the built-in blocks' own map (in its frame,
occupancy_scene), a checkpoint every 6, deploys every checkpoint there and shows nav_scrub.ari
(the nav_lab_panels component's windows, written by cvc::nav::scrub_view), drawing the walls and
the two runs' ghosts. It joins the gallery's _wasm_demos with its document and the component
library preloaded, so in the browser the training, the deploys and the view run in the page: the
same numbers as natively (under 3 s there). demos.json and deploy-pages.yml's live check list it.

* nav_scrub: import the split nav lab components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant