Normalize neural base inputs with frozen learning-pool statistics
This commit is contained in:
1 parent
bb09e8e164
commit
f3532962b0
10 files changed
+326
-15
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
## Scope and decisions
|
||||
|
||||
This implements Claude's [22:18:01 ruling](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794665881295239), the v0.5 Gre24 mapping and v0.6 process-conditioned target, with the [22:37:54 correction](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794667074550589). It is a synthetic-only code delivery for Claude's primary review, not a fitted model, real-corpus preprocessing receipt, or approval of predictive accuracy.
|
||||
This implements Claude's [22:18:01 ruling](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794665881295239), the v0.5 Gre24 mapping and v0.6 process-conditioned target, with the [22:37:54 correction](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794667074550589). Claude's [22:47:07 full-code main review](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794667627081159) approved `bb09e8e` with one required fix: log/standardise encoder base inputs. That fix is implemented below; R2 and the direct prediction target are unchanged. This remains a synthetic-only code delivery, not a fitted model, real-corpus preprocessing receipt, or approval of predictive accuracy.
|
||||
|
||||
No real geometry, LOG or simulation field is loaded by these modules/tests. The existing registration queue and its pinned sources are untouched. Test execution has empty CUDA visibility, one numerical thread and CPU tensors. No estimator `.fit`, backward pass, optimiser or parameter update is executed. Model initialisation is random, fixed by test seeds.
|
||||
|
||||
@@ -27,7 +27,13 @@ Upstream is [thuml/Transolver at 75e0f67643806a81cd1d3f6adc88dd8c02416fe7](https
|
||||
|
||||
The encoder uses all tet nodes, four irregular Transolver blocks, eight heads, 32 slices, widths 128 or 256, GELU, dropout 0 and upstream Model default mlp_ratio 1. It retains the upstream preprocessing MLP, learned placeholder, initialisation and residual attention/MLP blocks. The final scalar head is removed so each node yields an embedding. No time embedding or unified-position grid is used. Pure torch transpose/reshape replaces einops; torch trunc_normal_ replaces timm; structured-grid classes are omitted. An identical-state attention forward comparison against the original source is tested.
|
||||
|
||||
Base columns (10): `(x-center)/Rg` (3), `d/t_part`, Euclidean gate distance/Rg, unrestricted tet-edge geodesic/Rg, `Rg`, volume, `t_part`, `t_set`. The geodesic helper without R2 wall-edge exclusion is a separate input path. Physical scale and process setting are explicit. `t_part` and geodesic/Rg follow the earlier executable feature conventions. No O2 quantity enters the whole-part encoder.
|
||||
Base columns (10), before standardisation: `(x-center)/Rg` (3), `d/t_part`, Euclidean gate distance/Rg, unrestricted tet-edge geodesic/Rg, `log(Rg)`, `log(volume)`, `log(t_part)`, `log(t_set)` (natural logs). The geodesic helper without R2 wall-edge exclusion is a separate input path. Physical scale and process setting are explicit. `t_part` and geodesic/Rg follow the earlier executable feature conventions. No O2 quantity enters the whole-part encoder.
|
||||
|
||||
`normalization.py` fits mean/population std (`ddof=0`) for all ten columns from **the current fold/pool learning parts only**, taking all their tet nodes with equal node weight. It never uses query draw weights or labels. The caller supplies the frozen learning-part manifest; the array mapping must match exactly, so extra validation/test parts or missing learning parts are rejected. Statistics accumulate by part in float64 without concatenating the corpus. Each part's mean is computed after shifting by its first row: this preserves exact constant columns instead of manufacturing tiny variance through summation roundoff. A zero-std learning column uses scale 1 and maps its learning values to zero; held-out deviations remain observable, not imputed.
|
||||
|
||||
The frozen `BaseStandardizer` stores immutable tuples, fold/pool IDs, learning-part IDs and node count, and exports a reproducible fingerprint plus full statistics. An array transform rejects mismatched fold/pool IDs. N/E must be constructed with the **same** standardizer (`QueryModel(arm, width, standardizer=shared_stats)`); there is no unnormalised default. The encoder applies its mean/scale buffers before preprocessing in FP32, including under future AMP. These buffers are not learned parameters and are retained by `state_dict`; the exported statistics/provenance must accompany the run manifest. No validation/test transform refits statistics. Synthetic tests inspect the actual preprocess input to confirm identical N/E transforms. Parameter counts are unchanged.
|
||||
|
||||
Unit conversion test: multiplying all lengths (including gate/centre/distances/Rg/t_part) by L, volume by L³ and time setting by H leaves the first six columns unchanged and shifts the last four by `(log L,3 log L,log L,log H)` for every node. Applying correspondingly converted learning statistics gives the same standardised input. The first test attempt exposed the constant-column roundoff issue; its observed failure summary is preserved in `artifacts/s2-model-normalization-2026-11-14/initial-failure.json`, followed by the corrected 24/24 PASS log and source hashes. No real learning-pool statistics have been computed in this task.
|
||||
|
||||
The query decoder uses the original node index directly. N receives `[embedding,g12,g23]`; E additionally receives `[q1_mean,q1_max,q2_mean,q2_max]`. Two hidden GELU layers have the encoder width and a linear scalar output predicts `t*`. Missing E inputs, E inputs passed to N, nonfinite base/query values, empty/out-of-range queries fail closed. Qualification (positive distance, valid spectrum, N_eff≥64, complete finite edge block) must be enforced by the common-query producer; this module neither invents eligibility nor reads stored draws. All arms must receive identical eligible query IDs and counts.
|
||||
|
||||
@@ -41,7 +47,9 @@ Per-part relative L2 masks ineligible rows **before** arithmetic, counts draws w
|
||||
|
||||
## Acceptance and limitations
|
||||
|
||||
Final synthetic acceptance: **20/20 PASS** (2026-11-14 22:44:43 UTC+8).
|
||||
Latest synthetic acceptance after the required normalisation fix: **24/24 PASS**, cases took 0.413 s. See `artifacts/s2-model-normalization-2026-11-14/receipt.json` and `unittest.txt`. This adds unit conversion, learning-only/frozen statistics, population mean/std/constant handling, and actual shared N/E preprocessing checks. Only synthetic statistics were calculated; no estimator fit, training update, true-data read or GPU operation occurred.
|
||||
|
||||
Historical pre-review acceptance at `bb09e8e`: **20/20 PASS** (2026-11-14 22:44:43 UTC+8). Its receipt/source hashes remain a record of that fixed commit rather than the subsequently modified source.
|
||||
The test subprocess consumed 5.040 CPU-seconds, peak RSS 554.32 MiB including imports; unittest cases themselves took 0.214 s. The 8.753 s wall receipt includes parent imports and parameter-count construction as explicitly noted there. No benchmark claim is made from these tiny cases.
|
||||
|
||||
| Width | N parameters | E parameters | Shared encoder count |
|
||||
|
||||
Reference in new issue
Block a user