Cached CETT Rows
hprobes.rows
Cached CETT rows artifact for issue #26.
Split probe fitting into extraction (expensive forwards, run once) and
selection+fitting (cheap, run per variant). :class:CETTRows is the
immutable handoff: full unfiltered per-row features plus the Welford
summary stats, so downstream variance pre-selection reproduces the inline
path exactly. Selection (variance top-k, structural priors, clustering)
always stays downstream of the artifact.
CETTRows
dataclass
Full unfiltered CETT extraction output for one sample set.
rows is (n_rows, n_features); labels aligns per row.
welford_* carry the extraction-time summary stats so
variance() matches the inline _welford_M2 / (n - 1) path bit
for bit without recomputing from rows.
Source code in src/hprobes/rows.py
validate()
Raise on any shape/content inconsistency.
Source code in src/hprobes/rows.py
fingerprint_model(model, layers)
Cheap stable fingerprint of model weights for cache keys.
Hashes element counts plus sums of the first, middle and last materialized parameter tensors: catches silent weight swaps without hashing gigabytes. The structural signature (shapes + dtypes of ALL parameters, including offloaded meta placeholders) is always included, so offload never hides model structure. Deterministic for a fixed state dict; meta parameters carry no values and are skipped as data sources only.
Source code in src/hprobes/rows.py
load_rows(base_path)
Reload an artifact written by :func:save_rows (validated).
Source code in src/hprobes/rows.py
rows_key(model_fp, samples, config)
Cache key binding rows to exact extraction inputs.
Any change to weights (via model_fp), samples, or extraction
config (layers, batching, readout, seed, ...) yields a different key,
so stale rows can never be silently reused.
Source code in src/hprobes/rows.py
save_rows(artifact, base_path)
Persist an artifact as <base>.npz (arrays) + <base>.json (rest).
Returns the written paths. Reload with :func:load_rows.