Skip to content

scrub: lean run logs packed losslessly (run_log/v2): bundles 167 -> 96 MB, the page 188 -> 129 MB - #194

Merged
transfix merged 2 commits into
fix/scrub-wallsfrom
feat/scrub-log-shuffle
Nov 19, 2026
Merged

transfix merged 2 commits into
fix/scrub-wallsfrom
feat/scrub-log-shuffle

Conversation

@transfix

Copy link
Copy Markdown
Contributor

The scrub page's run logs, packed losslessly: the 30 run bundles go from 167.5 MB to 96.2 MB, and a first visit to the scrub page from about 188 MB to about 129 MB (gzip).

Stacked on #192. The base is fix/scrub-walls, since #192 changes the same files (pages/assemble.py, pages.yml, scrub.py, the docs). ci.yml runs only on PRs into main, so tests, black and ruff ran locally (below). This PR goes to main once #192 merges.

The format

A lean run log is now stored as grl_snam.run_log/v2. The arrays and meta are the same as v1, but the arrays are packed into one packed uint8 member, and meta["packed"] gives the encoding (delta-shuffle) and each array's name, dtype and shape:

  1. The arrays of one dtype form one vector, each array flattened time first.
  2. Each value's bit pattern is stored as its difference from the value before. These are unsigned integers that wrap, so the difference is exact.
  3. The bytes are shuffled: every value's first byte, then every second byte, and so on.
  4. npz deflates the result, as before.

Unpacking needs only numpy and zlib (diff/cumsum on unsigned ints, a transpose, np.load), which is what the page has in ariglx-web.

  • RunLog.save(lean=True) writes v2. A full save is still a plain v1 npz, so --log and the cars template's readers are unchanged.
  • RunLog.load reads v1 and v2, so today's lean logs still read. An older GRL-SNAM refuses a v2 log by its schema instead of misreading the packed bytes.
  • Cache: scrub's deploy_all reads a v1 lean log it finds in its cache and packs it in place. It is the same run, so it is not deployed again. pages.yml's scrub run cache key goes from scrub-runs-v4 to v5; the key also changes with grl_snam/**, so CI deploys again either way.

Measured

On the cached deploy of #192 (libcvc 4.0.0, three data sets × five seeds × two plants, 1230 lean logs of 71 series × 1200 ticks):

per log all logs bundles (raw / gzip -9) scrub page, first visit (gzip)
v1, today 126.4 KB 159.2 MB 167.5 / 153.8 MB 187.5 MB (Humvee alone 116.5 MB)
v2 69.8 KB 87.9 MB 96.2 / 95.0 MB 128.8 MB (Humvee alone 85.3 MB)
  • A run's bundle is now 3.3–3.7 MB on the Humvee and 2.9–3.0 MB on kinematic. A five-seed set is 15–18 MB a plant.
  • The page totals use the real ariglx-web 4.0.0 host (34 MB gzip, mostly ariglx.wasm).

Other layouts measured on the 41 Humvee world-units/retrain seed 0 logs (KB a log; today 138.6):

layout KB a log
byte shuffle, one npz member per array 109.8
byte shuffle, one blob (dtype-grouped) 91.1
xz, no shuffle 86
delta + shuffle, one blob (this PR) 79.8
deflate level 9 instead of npz's 6 about 0.5% more off

Most of the gap between per-array shuffling and one blob is the 71 members' zip headers, plus deflate restarting for each member.

Not done (option only): keep every 2nd tick. On top of v2 it gives 45.9 KB a log against 80.5 KB (same logs), but it halves the time resolution. float16 was ruled out: the energy series overflow, and positions near 300 m get 0.25 m steps.

Verified

  • Bit for bit, real data. All 1230 deployed logs packed by assemble.py --scrub --scrub-cache (all 1230 cached, packed, none deployed again) read back equal to their v1 originals: same arrays, dtypes, shapes and bytes, and the same meta apart from the schema. All 1230 logs inside the 30 bundles are v2.

  • Tests. New tests in tests/learning/test_learning_runlog.py:

    • packing is exact for NaNs with payloads, ±inf, -0.0, subnormals, wrapping differences, several arms, bool/uint16/int64, and 0-d and empty arrays;
    • a lean log reads back bit for bit;
    • a v1 lean log (as written before this PR) still reads, and packs to the same arrays;
    • a full save of a loaded v2 log is v1 again;
    • load refuses an unknown encoding, a short or long blob, and an unknown schema.

    tests/test_ariadne_scrub.py checks that deploy_all packs a v1 cached log in place and leaves a v2 one alone.

  • Local run. tests/learning/, test_ariadne_scrub.py, test_ariadne_live_arms.py, test_lab_acceptance.py, test_ariadne_cars.py and test_ariadne_ports.py on the libcvc 4.0.0 closure: 156 passed, 9 skipped. 2 failed on No module named 'click': the deploy closure has no click, and those tests (test_grl_snam_subcommands_pass_through, test_the_cli_command) don't touch the run log.

  • Lint. black 26.5.1 and ruff 0.16.0, both from cvcpkg: clean.

  • Browser. pages/smoke.mjs on the assembled site (ariglx-web 4.0.0, headless Chrome) passed all 9 cases. The scrub page started in 26.8 s and showed retrain/seed0: checkpoint 22 of 41, step 2100; 30 runs in 3 data sets ... on 2 plants, with the world drawn.

Docs

  • pages/README.md, pages/assemble.py, grl_snam/ariadne/README.md, scrub.py and the landing card: the new sizes ("about 95 MB" added to a first visit, was 170 MB).
  • runlog.py's docstring describes v2.

…5% of their size

A lean log's arrays are packed into one uint8 array: the arrays of a dtype in one
vector (each flattened time first), each value's bit pattern as its difference from
the one before (unsigned, wrapping: exact), the bytes shuffled (all first bytes, then
all second bytes, ...), deflated by npz as before. numpy alone unpacks it, as the
scrub page does in the browser. One member instead of 71 also drops the zip's
per-member headers and deflate's cold start for each.

- RunLog.save(lean=True) writes v2; a full save is v1 as before.
- RunLog.load reads v1 and v2, so today's lean logs still read; an older reader
  refuses a v2 log by its schema instead of misreading it.
- scrub's deploy_all packs a v1 lean log it finds in its cache: the same run.
- pages.yml: the scrub run cache key v4 -> v5.
…page 188 -> 129 MB)

Measured on the cached deploy of #192 (libcvc 4.0.0, three sets on two plants), its 1230
lean logs packed in place by assemble --scrub-cache and checked bit for bit against
the originals: 2.9-3.0 MB a run's bundle on kinematic, 3.3-3.7 MB on the Humvee; a
first visit to the scrub page about 129 MB gzip (85 MB on the Humvee alone).
@transfix
transfix merged commit 06880b5 into fix/scrub-walls Nov 19, 2026
1 of 2 checks passed
transfix added a commit that referenced this pull request Nov 20, 2026
…combo, and a UI guide (#192)

In the checkpoint scrubber, the cars drove through the buildings. That was not a drawing bug. The scrubber deployed every checkpoint on nav's `kinematic` bicycle, which has no collision response, and the recorded runs really went through the buildings. This PR moves the scrubber onto the Jolt Humvee, which collides with the world, adds a way to pick the plant, and adds a short guide to the UI.

## What changes

- **The Humvee is the default plant.** `scrub.ari`'s `init:` seeds `nav_plant.vehicle` to `humvee`; `--plant` and `--set` still override it. A car that drives into a building now stops against it.
- **A Plant combo.** The Scrub window gets a Plant combo when the runs were deployed on more than one plant. It shows the same run at the same training step on the other plant, as the Set combo does across data sets. The view groups runs by data set and plant, and the Run combo lists a set's runs on the current plant.
  - **Natively:** `--plant` may be given more than once (`--plant humvee --plant kinematic`). Every checkpoint is deployed on each plant, cached per plant. One `--report` still holds one plant's run, and asking for two is refused.
  - **On the Pages page:** `pages/assemble.py --scrub-plants` (default `humvee kinematic`) deploys each set on each plant. When a page has more than one plant, its bundles move to `data/<plant>/<set>/<run>.scrub.zip`. The page opens on the Humvee, and the Plant combo switches to the kinematic runs for comparison. pages.yml lists the reports per plant, and its run cache key moves to v4.
- **`docs/scrubber-guide.md`**, a short guide. It covers each window (Scrub, Training, Episode, Stats, Ledger, Simulation), the six signs of a policy converging on useful behaviour, the warning signs, and what today's runs show. The scrub section of `grl_snam/ariadne/README.md` links to it.

## What the Humvee shows

The full re-deploy, as the site build does it: three sets × five seeds × 41 checkpoints × both plants, 1200 ticks each on the generated world, libcvc 4.0.0 (the closure pages.yml pins). No checkpoint reaches the goal on either plant.

| set | plant | ticks penetrating | least clearance | path | left to the goal |
|---|---|---|---|---|---|
| retrain | kinematic | 375–636, every checkpoint | −28.9 m | 480–631 m | 272–353 m |
| retrain | humvee | 0 | 1.33 m | 414–415 m | 579–580 m |
| fixed/retrain | kinematic | 372–634, every checkpoint | −28.9 m | 479–636 m | 231–350 m |
| fixed/retrain | humvee | 0 at 199 of 205, 71–186 at 6 | −25.7 to 49.0 m | 303–472 m | 503–667 m |
| world-units/retrain | kinematic | 355–459, every checkpoint | −29.8 m | 471–485 m | 329–339 m |
| world-units/retrain | humvee | 0 | 0.70–0.82 m | 212–218 m | 588 m |

- **What "ticks penetrating" counts.** It is the ticks a car's centre is on a cell the navigator marks blocked: a building, or deep water. On this world most of them are not buildings. libcvc 4.0.0's generated world marks dry ground between its −4 m water level and −0.5 m as deep water. transfix/libcvc#1374 fixes that.
- **On kinematic, the progress was never real.** Every checkpoint spends 355 to 636 of its 1200 ticks on blocked cells. 79–93% of those ticks are on the mislabelled water, and the rest are in buildings.
- **On the Humvee, two sets come to one outcome.** In `retrain` and `world-units/retrain`, whatever the seed or the step, the car meets a building and stays against it. That is the honest picture for the page and for the guide: these policies do not route around a building.
- **The six `fixed/retrain` Humvee checkpoints that penetrate are not in a building.** They count 71 to 186 ticks penetrating with no building contact. They drive into a dry basin near (−290, 175), 0.6–3.5 m above the water level. The navigator reads it as deep water, and the physics has nothing there to collide with (transfix/libcvc#1374). The page's runs are deployed on libcvc 4.0.0, so these counts stay until a libcvc with that fix is released and the runs are deployed again.

## Defaults and cost

- **Deploying on the Humvee costs about 10% more time than kinematic:** 106 s against 96 s for one run of 41 checkpoints. The site build's deploy of all 30 runs took 4058 s here.
- **Shipping both plants doubles the page's run logs, so this PR now carries #194** (squash 06880b5 on this branch).
  - In the old format, a run's bundle is 5.8–6.1 MB on the Humvee and 5.1–5.3 MB on kinematic. The 30 bundles total 167 MB.
  - That is over arigl-web's 128 MiB cap on a page's document set (`max_bytes` in libcvc 4.0.0's `doc_fetch.h`). On fd3ef7a the pages job dropped 7 bundles and scrub failed to start.
  - #194 packs the lean run logs losslessly (`run_log/v2`). The bundles come to 96.2 MB, and a first visit to about 129 MB.
  - `--scrub-plants humvee` builds a page with the Humvee alone.
- **Earlier kinematic runs stay readable:** a report records its plant, and `scrub --view` shows it.

## Tests

- `tests/test_ariadne_scrub.py`:
  - The module fixture pins `--plant kinematic`, so it still compares checkpoint 0 with `live --arms --plant kinematic`.
  - New: the default plant is the Humvee.
  - New: `--plant` given twice deploys both plants, the Plant combo keeps the same run and step, and `--report` with two plants is refused.
  - The assemble deploy test pins `--scrub-plants kinematic`.
- `tests/test_ariadne_browser.py`, new: a two-plant page names its bundles `data/<plant>/<set>/<run>.scrub.zip` and opens on the Humvee.
- Locally on the pages.yml closure (libcvc 4.0.0, CPU): both files pass, 39 tests plus 1 GL-only skip.
- black 26.5.1 and ruff 0.16 (CI's versions) are clean.
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