Skip to content

fix(lane D): cut the settlement's public windows once on the eval host (live 2026-12-01) - #1052

Merged
tensorlink-dev merged 1 commit into
mainfrom
laned-public-cut-once
Dec 1, 2026
Merged

tensorlink-dev merged 1 commit into
mainfrom
laned-public-cut-once

Conversation

@tensorlink-dev

Copy link
Copy Markdown
Contributor

Problem (live 2026-12-01)

Each lane D settlement spends ~12.5 min per checkpoint on the eval host in python -m cascade.eval.lane_d_forecasts public: ~16 cores re-read and re-cut the same 5,000 drawn public windows (GiftEvalPretrain + RMISC blobs, slow loop-mounted volume) before a short GPU burst. The draws are fixed by the boundary block hash and are the same for every digest, so 7 digests come to about 90 min.

Design

  • New cascade/eval/lane_d_public_cut.py with a CutCache that writes one file per cut_key. The key is the sha256 of the draws (each carries index_sha256, which pins the data revision), the block hash, max_channels, context/horizon/contexts, keep and CUT_SCHEMA.
    • Format: magic, header JSON, raw array payload. The header records each array's dtype, shape and offset, each record's key order, the drops, and the payload's length and sha256.
    • Writes are atomic: a temp file, fsync, then os.replace. Stale temp files are swept after 1 h.
    • A file that is corrupt, partial, oversized, has trailing bytes, or carries a different key is deleted, and the windows are cut again.
    • The cache keeps a byte budget (default 16 GiB, oldest use evicted first, a hit refreshes the mtime) and keeps at least 2 GiB free on the volume.
    • Windows that would not round-trip exactly, and writes that fail, are skipped and served uncached.
  • public_scores_entry(cut_cache=) loads the judged windows and data drops from the cache. On a miss it runs the unchanged read/cut/keep_public path (now _cut_public_windows) and stores the result.
  • The public CLI defaults the cache to <public cache dir>/cut (the validator already passes --public-cache-dir). --cut-cache-dir overrides the location and --cut-cache-budget-bytes 0 turns it off.
  • The box's request, the SSH timeout -k and the eval lock are unchanged. A run killed mid-cut stores nothing, and the next retry cuts again, as it does today. A retry after a validator or host restart reuses the first digest's cut.

Expected

  • The first digest of a settlement costs about what it costs today.
  • Each later digest only loads the cut file (one sequential read plus a sha256 check), then forecasts and scores. That should take a few minutes, depending on the cut's size on the volume, against ~12.5 min now.

Byte-identity

The cut file holds the same windows that were read: the arrays' raw bytes, dtype and shape, the records' JSON and key order. Forecasting and scoring code is unchanged. The tests compare json.dumps(reply, sort_keys=True) uncached vs cache-miss vs cache-hit (new process), for 3 digests, with and without keep, and with real build_window output (univariate and multichannel windows with a channels record and NaN gaps). The bytes are equal in every case, so the signed report's public rows and public.dropped cannot change.

Tests

tests/accept/w8c/test_w8c_public_cut.py has 9 tests. All are torch-free with a fake reader that counts reads, and all fail on base by assertion. They check:

  • later digests of the same draws don't re-read
  • a restarted process re-reads nothing
  • byte-identical replies
  • loaded windows match bit for bit
  • the cache key changes with each input
  • corrupt or partial files (truncated, empty, garbage, flipped byte, trailing bytes) are ignored and rebuilt
  • budget eviction is LRU
  • uncacheable windows are served uncached
  • the CLI defaults

Also run, all green: w8c public, public_mirror, public_parallel, host_modules and eval_host, plus tests/unit/test_incident_rules.py. Ruff passes.

PATHS: W8c gains cascade/eval/lane_d_public_cut.py.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BMT4D7f8wd5dXsASyWUBwe

…t (live 2026-12-01)

Each lane D settlement spent ~12.5 min per checkpoint in `lane_d_forecasts
public` re-reading and re-cutting the same 5,000 drawn public windows
(16 cores, slow volume) before a short GPU burst; 7 digests ~90 min. The
draws are fixed by the boundary block hash and identical for every digest.

- cascade/eval/lane_d_public_cut.py: CutCache, one file per cut_key (draws,
  block hash, max_channels, context/horizon/contexts, keep, CUT_SCHEMA);
  atomic os.replace, sha256-checked payload, exact dtype/shape/key order;
  corrupt/partial files deleted and re-cut; byte budget (LRU by mtime) and a
  volume free floor; uncacheable or failed writes served uncached.
- public_scores_entry(cut_cache=): load the judged windows + data drops, else
  read/cut (unchanged code path) and store. The `public` command puts the
  cache at <public cache dir>/cut (--cut-cache-dir, --cut-cache-budget-bytes,
  0 disables). Box request, SSH timeout and eval lock unchanged.
- tests/accept/w8c/test_w8c_public_cut.py (fails on base by assertion),
  README section, PATHS entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BMT4D7f8wd5dXsASyWUBwe
@vercel

vercel Bot commented Dec 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cascade Ignored Ignored Dec 1, 2026 11:14am UTC

Request Review

@tensorlink-dev tensorlink-dev added the laned:W8c Lane D plan WP W8c label Dec 1, 2026
@tensorlink-dev
tensorlink-dev added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 3ada219 Dec 1, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

laned:W8c Lane D plan WP W8c

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant