Skip to content

fix(lane D): mask NaN and padding in every lane D forecast (owner 2026-12-01) - #1060

Merged
tensorlink-dev merged 5 commits into
mainfrom
laned-nan-mask
Dec 1, 2026
Merged

tensorlink-dev merged 5 commits into
mainfrom
laned-nan-mask

Conversation

@tensorlink-dev

@tensorlink-dev tensorlink-dev commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Owner, 2026-12-01: "it's meant to mask NaN". With this PR, every lane D forecast masks missing history values and padding instead of refusing them or cutting them away. The rule is the same for every entry (king, house and challengers).

Where the mask is built and how it reaches cascade_pyramid

  • Live and public judging, cascade lane-d test, T7, env-qual. All of these go through cascade/eval/lane_d_scorer.py::forecast_quantiles. That function uses only the repo's pyramid_model: it never imports a file from the checkpoint and it never pads. The new observed_rows() applies pad_mask.observed_context, the same GluonTS rule the bench and lanes A/B use. A NaN or inf point becomes 0.0 and is unobserved, and a patch that is more than half missing is unobserved as a whole. _forward concatenates ~observed with the horizon mask, so the mask goes into causal_standardize and into model(z, mask=...). An all-finite input gives the same mask as before, so its output is bit-identical. A window with no finite point in its model input is refused before load with a ValueError. This is the existing rule, like a history shorter than one patch.
  • Public windows (lane_d_public.build_window). Before, the history was cut to the longest all-finite suffix. Now a kept window carries its whole history before the cut, with its NaN left in (leading columns with no finite value are trimmed). The drop decisions are byte-identical: they still read the finite suffix, so public.dropped, the reasons and the judged set that the checker re-derives do not change. The MASE scale is unchanged too, because it is still computed on the finite suffix (scale_history). CUT_SCHEMA moves to lane-d-public-cut/2.
  • Bench sidecar (the gate's rotating gift/boom/time/fev suites and the king's full bench).
    • Before: lane_d_bench_sweep did not pass a method, so the sidecar fell back to its default ($CASCADE_BENCH_METHOD, else observed_mask/3). That default wraps the checkpoint's forecast_wrapper.Wrapper in pad_mask.ObservedMaskWrapper: NaN and left padding become 0.0 and unobserved, and fully padded patches are never attention keys. The wrapper's own refusal of non-finite values and its row[0] edge-pad were therefore bypassed. A host env set to impute/0 would have silently switched this to forward-fill plus edge-pad.
    • Now the pass is pinned with --bench-method observed_mask/3. A report stamped with any other method fails the sweep with sweep_failed (the gate holds).

Canonical wrapper decision

W4 ingest (code_mismatch) already admits only the release's exact model.py / forecast_wrapper.py bytes, and the live scorer loads no checkpoint file. Editing pyramid_wrapper.py would make every existing entry fail ingest. It would also change lane A's pinned checkpoint code. So the wrapper file is not edited, and the mask is applied from outside, as lanes A and B already do. materialise now writes the release's canonical code (canonical_code()) into each bench dir instead of copying the entry's copies, so the rule does not depend on when an entry was admitted.

Why the scorer does not wrap the checkpoint in ObservedMaskWrapper itself

The bench sidecar's observed_mask/3 (observed.py → pad_mask.ObservedMaskWrapper) already masks NaN and leading padding for lane D gate/king-bench checkpoints, so those numbers were already masked; this PR pins it. The live/public scorer uses the SAME rule but not the class: ObservedMaskWrapper needs the checkpoint's forecast_wrapper.py imported (the scorer is repo-code-only by design) and left-pads every history to cfg.context_length (up to 131072 for declared contexts), which breaks the no-pad batch plan and the T7 4k == declared-128k identity. The scorer therefore calls the wrapper's own mask builder (pad_mask.observed_context) and the same _parameters arithmetic (cat(~observed, horizon) into causal_standardize and model(mask=)); with no padding the leading-pad key rule is inert. A CI torch test (test_the_scorer_masks_exactly_as_the_shared_observed_mask_wrapper) pins scorer == ObservedMaskWrapper(pinned Wrapper) on a NaN full-context history.

Live pool

pool_d linearly interpolates history gaps at build time (_cut / _extend_back, max 20% missing). Live histories therefore reach the scorer finite, and the mask is a no-op for them. Changing that would change the snapshot bytes that auditors re-derive, so it is left as an owner decision.

Consensus

Satellites and cascade/audit/lane_d.py (checked on 86b3dba and 890fe6d) replay the signed rows. They never re-forecast and never rebuild windows: forecast_quantiles, build_window and _finite_suffix are not referenced. For public data drops, the checker reads them as given and re-derives only the keep set. The signed report format is unchanged. From the deploy settlement on, scores shift for every entry alike: this affects public windows that have gaps, and bench items whose series hold NaN or are short. The PR applies cleanly onto validator-release-laned-1201c (86b3dba); merge-tree reports no conflicts.

Tests

Every new test fails on base by assertion. The torch tests are marked torch and run in CI only.

  • w5d/test_w5d_nan_mask.py: mask construction; NaN masked, not refused; all-NaN refused; [torch] the mask reaches the model call; [torch] NaN and inf give the same forecast and a masked point differs from an observed 0.0.
  • w5k: a kept window holds its whole history; drops and MASE are unchanged. The old test expecting the suffix-only history is corrected.
  • w8c: cut schema /2; NaN histories round-trip.
  • w3b6a/test_w3b6a_masked_bench.py: canonical code is materialised; the masked method is pinned even when env says impute/0; a foreign-method report fails the sweep.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BMT4D7f8wd5dXsASyWUBwe

…6-12-01)

Owner: "it's meant to mask NaN". Lane D now masks missing history values
instead of refusing or cutting them, the same for every entry:

- lane_d_scorer (live + public judging, `cascade lane-d test`, T7,
  env-qual): a non-finite history point is filled with 0.0 and marked
  unobserved in the point mask the pyramid already takes for the horizon
  (scaler + model mask), via observed_rows -> pad_mask.observed_context
  (the bench / lane A / lane B rule). All-finite inputs are bit-identical.
  A window with nothing observed is refused before load.
- lane_d_public.build_window: a kept window carries its whole history
  (NaN included) instead of its finite suffix. The drop decisions and the
  MASE scale still read the finite suffix (public.dropped and the judged
  set are unchanged). Cut cache schema -> lane-d-public-cut/2.
- lane_d_bench_sweep: materialised dirs get the release's canonical
  model.py / forecast_wrapper.py; the sidecar pass pins
  --bench-method observed_mask/3 (ObservedMaskWrapper); a report of
  another method fails the sweep.

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 Preview Dec 1, 2026 11:37pm UTC

Request Review

@tensorlink-dev tensorlink-dev added laned:W5d laned:W5k Lane D WP W5k (rev6.18 F3 public draw) laned:W8c Lane D plan WP W8c laned:W3b6a Lane D WP W3b6a laned:tests-correction labels Dec 1, 2026
tensorlink-dev and others added 4 commits December 1, 2026 22:12
A torch (CI-only) test pins that the lane D scorer's NaN masking is the
pad_mask.py observed-mask rule, not a new one: on a full-context history
with NaN (nothing to pad) its forecast equals ObservedMaskWrapper around
the byte-pinned wrapper (the sidecar's observed_mask/3 path).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BMT4D7f8wd5dXsASyWUBwe
…seam first (fail on base by assertion)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BMT4D7f8wd5dXsASyWUBwe
…irst (fails on base by assertion)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BMT4D7f8wd5dXsASyWUBwe
@tensorlink-dev
tensorlink-dev added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 0816b86 Dec 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

laned:tests-correction laned:W3b6a Lane D WP W3b6a laned:W5d laned:W5k Lane D WP W5k (rev6.18 F3 public draw) laned:W8c Lane D plan WP W8c

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant