[Global-PGM S5] S=1000 memory: streaming targets + float32-preserving collapse (#235, resolves C-212) - #255
Merged
Merged
Conversation
…12, #235) Registers C-212 (tier 2): the S=1000 global goal is blocked twice over — all-targets-at-once loading (~28 GB) and, larger, the collapse path's float64 detour (float64 copy + masked copy + float32 cast ≈ 5x source per call, ~46 GB for one global S=1000 target). The subprocess RSS probe measures 3.8x today; the guard demands <3.5x (float32-preserving path measures ~1-2x). Fails at this commit by design. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… (C-212, #235) The S=1000 global goal is unblocked, measured: Collapse: the float64 detour is gone — calculate_map/hdi/exceedance work on the frame's float32 directly, skip the boolean-mask copy on the all-finite norm, and the ephemeral tower wrap is zero-copy. Numerically identical (the tower always computed in float32; 49 value-pinning tests green). Subprocess RSS probe, 194k rows x S=1000, all four layers: collapse delta over the resident source ~0.00 GB (was ~3.8x); CI guard pins < 3.5x. Loading: iter_predictions streams (target, frame) pairs one at a time (laziness test-pinned: the second target's files stay untouched until the consumer asks); the template releases each target's samples + layers before the next loads. load_predictions keeps its dict API. Extrapolated full global S=1000: ~9.3 GB/target streamed, peak ~12 GB on the 31 GB machine; all-four-layer collapse wall ~12 min/target. mmap_mode evaluated and NOT adopted: 4x re-read I/O for a peak already ~1x source. Register: C-212 registered (RED commit) and resolved here with the numbers. 401 tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #235. Part of epic #230 (tracker #237).
The finding that grew the story
The issue scoped the loader (~28 GB all-targets-at-once). Implementation found the larger term: every collapse call forced a float64 copy of the whole sample array, boolean-masked it again, then cast back to float32 for the tower — ~5× the source at peak, ≈46 GB for ONE global S=1000 target, repeated per layer. Both mechanisms are now registered as C-212 and resolved in this PR.
What (RED→GREEN)
iter_predictionsstreams(target, frame)one at a time — laziness is test-pinned (second target's files untouched until the consumer pulls); the template releases each target's samples + layers before the next loads.load_predictionsdict API unchanged.Measured
Quarter-scale probe (194k rows × S=1000, all four layers, subprocess RSS): collapse delta ≈ 0.00 GB over the resident source, 61 s. Extrapolated full global S=1000: ~9.3 GB/target streamed → peak ≈ 12 GB on the 31 GB machine; ~12 min collapse wall per target.
mmap_modeevaluated and NOT adopted (4× re-read I/O for a peak already ~1× source; rationale documented in the loader).Ritual
Register C-212 added (RED) and resolved (GREEN) with numbers; docs validator green; ruff clean; 401 passed (2 skipped, 1 xfailed).
🤖 Generated with Claude Code