AbstractPhil commited on
Commit
4ef8b0b
·
verified ·
1 Parent(s): 4b7b1b3

loss-manifest companion: article + 155-entry rated registry + sidecar + loss library + gates/battery + campaign beds + raw run ledgers

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LOSS_MANIFEST.md +612 -0
  2. README.md +66 -0
  3. article_loss_manifest.md +612 -0
  4. code/__pycache__/compartment_smoke.cpython-312.pyc +0 -0
  5. code/__pycache__/geolip_vitals.cpython-312.pyc +0 -0
  6. code/ar_differentiation_bed.py +488 -0
  7. code/compartment_smoke.py +641 -0
  8. code/deviant_bed.py +193 -0
  9. code/fac_bed.py +782 -0
  10. code/geobasin_bed.py +258 -0
  11. code/geolip_vitals.py +219 -0
  12. code/loss_forms.py +575 -0
  13. code/loss_view.py +432 -0
  14. loss_manifest.json +0 -0
  15. runs/deviant_runs/anti_curr_s0_t2000.jsonl +1 -0
  16. runs/deviant_runs/anti_curr_s1_t2000.jsonl +1 -0
  17. runs/deviant_runs/anti_curr_s2_t2000.jsonl +1 -0
  18. runs/deviant_runs/conf_penalty_CONTROL_s0_t2000.jsonl +1 -0
  19. runs/deviant_runs/conf_penalty_CONTROL_s1_t2000.jsonl +1 -0
  20. runs/deviant_runs/conf_penalty_CONTROL_s2_t2000.jsonl +1 -0
  21. runs/deviant_runs/fac_cauchy_s0_t2000.jsonl +1 -0
  22. runs/deviant_runs/fac_cauchy_s1_t2000.jsonl +1 -0
  23. runs/deviant_runs/fac_cauchy_s2_t2000.jsonl +1 -0
  24. runs/deviant_runs/fac_tanh_s0_t2000.jsonl +1 -0
  25. runs/deviant_runs/fac_tanh_s1_t2000.jsonl +1 -0
  26. runs/deviant_runs/fac_tanh_s2_t2000.jsonl +1 -0
  27. runs/deviant_runs/focal_s0_t2000.jsonl +1 -0
  28. runs/deviant_runs/focal_s1_t2000.jsonl +1 -0
  29. runs/deviant_runs/focal_s2_t2000.jsonl +1 -0
  30. runs/deviant_runs/geomean_accum_s0_t2000.jsonl +1 -0
  31. runs/deviant_runs/geomean_accum_s1_t2000.jsonl +1 -0
  32. runs/deviant_runs/geomean_accum_s2_t2000.jsonl +1 -0
  33. runs/deviant_runs/label_smooth_s0_t2000.jsonl +1 -0
  34. runs/deviant_runs/label_smooth_s1_t2000.jsonl +1 -0
  35. runs/deviant_runs/label_smooth_s2_t2000.jsonl +1 -0
  36. runs/deviant_runs/p4_sparsemax_s0_t2000.jsonl +1 -0
  37. runs/deviant_runs/p4_sparsemax_s1_t2000.jsonl +1 -0
  38. runs/deviant_runs/p4_sparsemax_s2_t2000.jsonl +1 -0
  39. runs/deviant_runs/softmax_accum_s0_t2000.jsonl +1 -0
  40. runs/deviant_runs/softmax_accum_s1_t2000.jsonl +1 -0
  41. runs/deviant_runs/softmax_accum_s2_t2000.jsonl +1 -0
  42. runs/deviant_runs/sparsemax_s0_t2000.jsonl +1 -0
  43. runs/deviant_runs/sparsemax_s1_t2000.jsonl +1 -0
  44. runs/deviant_runs/sparsemax_s2_t2000.jsonl +1 -0
  45. runs/fac_runs/ce_fixedcode_s0_t2000.jsonl +6 -0
  46. runs/fac_runs/ce_fixedcode_s1_t2000.jsonl +6 -0
  47. runs/fac_runs/ce_fixedcode_s2_t2000.jsonl +6 -0
  48. runs/fac_runs/ce_s0_t2000.jsonl +6 -0
  49. runs/fac_runs/ce_s1_t2000.jsonl +6 -0
  50. runs/fac_runs/ce_s2_t2000.jsonl +6 -0
LOSS_MANIFEST.md ADDED
@@ -0,0 +1,612 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LOSS MANIFEST - every objective this program has back-propagated, rated
2
+ #TAG:loss_manifest #TAG:accumulation #TAG:losses #TAG:rubric
3
+ [CENSUS-VERIFIED 2026-07-25 - three independent censuses: canon+MANIFEST, history+sessions, full code tree]
4
+ Living registry (SCALE_MANIFEST discipline): entries are NEVER deleted - demoted with a
5
+ reason and a date. Rubric v1; every rating below is RECOMPUTABLE from its six sub-score
6
+ digits and the lookup table in THE RUBRIC. Machine-readable sidecar:
7
+ inventory/loss_manifest.json. Views + lint: `python skill/loss_view.py card|ladder|lint`.
8
+ Taxonomy and format laws: canon/loss_accumulation_forms.md.
9
+
10
+ THE RATING ANSWERS: **"how much would I stake on this term in a NEW bed"** - NOT effect
11
+ size. InfoNCE is the most potent term in the census and rates 2.
12
+
13
+ ## THE STRUCTURAL FINDING (read before any row)
14
+
15
+ Only **three primitives ever receive a backward pass** in this program: `F.cross_entropy`,
16
+ squared error, and `F.kl_div` (plus fp64 Cayley-Menger determinants in gauges). No margin,
17
+ triplet, hinge, contrastive-margin, or load-balancing loss has ever existed in the tree.
18
+
19
+ The four objectives that look composed are those same primitives under different
20
+ **accumulation formats**: InfoNCE is CE over an N x N grid; blob-LP-x0 is squared error
21
+ dose-coupled and band-routed; HP/LP band roles are squared error under a cosine crossfade;
22
+ CV is a determinant statistic accumulated in fp64.
23
+
24
+ **So the loss surface is three primitives wide and eleven accumulation formats deep, and
25
+ every loss discovery this program has made lives on the second axis.** Two receipts:
26
+
27
+ - **The addr_head cure changed accumulation only, primitive held fixed.** 5.6650 bpb with
28
+ usage perplexity 1.88/64 (collapsed) -> 2.47 by going slot-parallel. Same `F.cross_entropy`
29
+ on both sides. (L-112 -> L-012)
30
+ - **Chunked CE and plain CE are identical mathematics and a 5x memory law.** 22.8GB
31
+ dedicated + 42.8GB silently spilled to shared memory -> 8.8GB peak at 1.03 s/step. The
32
+ law lives entirely in the reduction schedule. (L-004)
33
+
34
+ A third receipt sits in the forbidden class. `A10` - accumulation that carries state across
35
+ steps (EMA codebooks, commitment counters, k-means centroids) - contains **exactly two
36
+ entries, and both are prohibitions** (L-105 VQ/commitment/EMA, L-134 load-balancing). Not
37
+ one working objective in the program's history has ever used that format. It is precisely
38
+ where a newcomer would naturally write code, and the empirical warrant for not doing so is
39
+ L-083: the codebook stays 125+/128 axes alive at `div_weight = 0`, with no diversity term
40
+ at all.
41
+
42
+ `A9` (raw sum, no denominator) is empty for a duller reason: the scale rides on batch and
43
+ sequence length, so the learning rate stops transferring between beds.
44
+
45
+ ## THE RUBRIC (how every number below was produced)
46
+
47
+ Six sub-scores, summed to `S_raw` (0-13), then a **lookup table** - not arithmetic, so
48
+ anyone can re-derive a rating without trusting a float:
49
+
50
+ | sub-score | 0 | 1 | 2 | 3 |
51
+ |---|---|---|---|---|
52
+ | **R** replication | designed, never run | one seed, one bed | >=2 seeds OR >=2 beds | >=2 seeds AND >=2 beds/substrates |
53
+ | **P** potency vs its own gauge's noise | null / within noise / wrong direction | directional but <1% or below seed spread | 1-10%, or an ordinal win above seed spread | >10%, categorical enable, or 50-200x separation |
54
+ | **D** doctrinal fit | violates a MANIFEST law | permitted but antagonistic | aligned/reconstructive, or a gated exception with a written statute | - |
55
+ | **C** cost | recorded catastrophic-cost event | material but budgeted | free or near-free | - |
56
+ | **I** instrument risk | headline rests on a DISTRUSTED gauge, or the term can silently become zero with no assert | aggregate-only; gauge-blindness plausible | dedicated non-blind gauge AND a silent-zero assert | - |
57
+ | **+L** law bonus | - | encoded as a MANIFEST law **and** enforced in code (assert, refusal, or guard) | - | - |
58
+
59
+ ```
60
+ S_raw: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
61
+ rating: 1 1 2 3 3 4 5 6 7 8 8 9 10 10
62
+ ```
63
+
64
+ **The nine traceability rules** (applied in this order, after the lookup):
65
+
66
+ 1. **UNRUN CEILING** - `R=0` => rating <= 3. A beautiful design does not score on paper.
67
+ 2. **BLIND-GAUGE DEMOTION** - headline from a DISTRUSTED gauge, not re-measured => **-2**.
68
+ 3. **SINGLE-SEED CAP** - `R<=1` => rating <= 6.
69
+ 4. **SUB-1% CAP** - `P<=1` => rating <= 5. Four-for-four directional at 0.05-0.2% cannot
70
+ outrank a measured 5.9%.
71
+ 5. **DOCTRINE-ZERO CEILING** - `D=0` => rating <= 2.
72
+ 6. **RETRACTION FLOOR-BREAKER** - a dated retraction, demotion, or REFUTED verdict anywhere
73
+ in the record => **rating = 1, unconditional.** Sub-scores are still printed so you can
74
+ see why it once looked good. Retracted entries never compete on the ladder.
75
+ 7. **CONTRADICTION** - unreconciled records get a RANGE or a marked sub-claim, never an
76
+ average.
77
+ 8. **PROVENANCE** - every sub-score digit is backed by the row's citations. An uncited digit
78
+ forces the unrun ceiling.
79
+ 9. **SCOPE / GAUGE SPLIT** - a term whose standing differs by scope or by judging instrument
80
+ gets TWO adjacent rows, never one averaged row.
81
+
82
+ ### Calibration - three pairs that prove the rubric works
83
+
84
+ - **L-048 rates 8 and L-123 rates 4. Same objective, same seeds, same data.** The only
85
+ difference is which gauge judged it: the role-aligned in-bed gauge, or aggregate eps-MSE.
86
+ This pair is the concrete price of gauge blindness.
87
+ - **L-047 rates 6 and L-111 rates 1. Same operator - Procrustes.** As a regularizer it
88
+ tightens CV to .19; as a training force it produced R@1 = 0.000 and P_cos stuck at .094
89
+ for thirty epochs. Campaign law 2 restated in loss terms: placement decides
90
+ load-bearingness.
91
+ - **L-113 rates 2 and L-001 rates 10.** The most potent measured objective in the census
92
+ against the plainest one. If that ordering is surprising, the rubric is working: potency
93
+ and standing are different axes.
94
+
95
+ ## THE GRID - PRIMITIVE x ACCUMULATION FORMAT
96
+
97
+ | accumulation | CE | SQ | KL | DET | BREG | - | row |
98
+ |---|---|---|---|---|---|---|---|
99
+ | `A0` uniform-mean | 26 | 27 | 2 | 3 | 4 | 22 | **84** |
100
+ | `A1` chunk-sum-renormalize | 1 | . | . | . | . | . | **1** |
101
+ | `A2` per-sample-then-weighted | 4 | 2 | . | 1 | . | 2 | **9** |
102
+ | `A3` band-crossfade | . | 3 | . | . | . | 6 | **9** |
103
+ | `A4` masked-denominator | 5 | . | 1 | . | . | . | **6** |
104
+ | `A5` dose-coupled | . | 2 | . | . | . | 1 | **3** |
105
+ | `A6` paired-difference | . | . | . | . | . | 3 | **3** |
106
+ | `A7` grid-pairwise | 5 | . | . | . | . | . | **5** |
107
+ | `A8` fp64-accumulate | . | . | . | 3 | . | 4 | **7** |
108
+ | `A9` sum-no-norm | 1 | . | . | . | . | . | **1** |
109
+ | `A10` EMA / external cross-step state | 1 | 1 | . | . | . | . | **2** **PROHIBITIONS ONLY** |
110
+ | `NA` not an accumulation | . | . | . | . | . | 25 | **25** |
111
+
112
+ **Rating distribution** (n=155, mean 5.84): `1`x30 `2`x2 `3`x4 `4`x3 `5`x29 `6`x23 `7`x7 `8`x15 `9`x25 `10`x17
113
+
114
+ Glyphs: `†` retraction floor-breaker | `✖` doctrine ceiling | `⟂` split sibling (scope or gauge) | `⚠` unreconciled contradiction
115
+
116
+ ## THE FORMULA MAP - every entry's mathematics and where it runs
117
+
118
+ Extracted 2026-07-25 (operator directive: the process is the ROSTER). 'NOT RECORDED' is itself information - those formulas were never written down anywhere and their numbers cannot be reproduced without re-derivation. Machine copy in the sidecar.
119
+
120
+ | ID | FORMULA | IMPLEMENTATION |
121
+ |---|---|---|
122
+ | L-001 | `L = mean((dec(z) - x)^2); convergence endpoint = bitwise-exact recon` | geolip_svae (installed pkg) . loss_forms::prim_sq+a0_mean |
123
+ | L-002 | `M_hat = sum_k sinh(u_k)A_k / sum_k cosh(u_k), u = cos(x,A)/tau; L = mean((dec(M_hat)-x)^2); codebook grad ONLY via num@A and cos=M@A^T` | amoe.core.address::m_hat + geolip_svae aleph_model.py . loss_forms::prim_sq |
124
+ | L-003 | `L = mean(-log softmax(W h)[y])` | pod/v35_exp001_placement.py:170 . loss_forms::prim_ce+a0_mean |
125
+ | L-004 | `L = sum_chunks CE_sum(h[i:i+512]) / n_live_tokens (ONE global denominator)` | loss_forms::a1_chunked_ce . pod/v35_exp003_termination.py:128-138 |
126
+ | L-005 | `CE(logits[:,:-1], y[:,1:], ignore_index=-100)` | pod/v35_exp006_math.py:180 . loss_forms::prim_ce+a4_masked |
127
+ | L-006 | `model(**batch, labels=y).loss (masked shift-CE inside HF; vision tower fires)` | pod/v35_exp004_caption.py:175 (chunking unavailable on this path) |
128
+ | L-007 | `same CE; trainable set = per-block dispatch key matrices ONLY` | closeout amoe/train/aligner.py:41-67 |
129
+ | L-008 | `CE(logits, y) on CIFAR-10` | tools/addressed_distillation_v1.py:301 |
130
+ | L-009 | `x_t = sqrt(abar_t)x0 + sqrt(1-abar_t)eps, t~U{0..999}; L = mse(unet(x_t,t,c), eps); CFG drop p=.1` | pod2/dexp006_sd15core_relay.py:132-146 . amoe.diffusion.train.objectives |
131
+ | L-010 | `s = warp(u; shift=2.5); x_t = (1-s)x0 + s*eps; L = mse(pred, eps - x0); x0 = x_t - s*v EXACT/LINEAR` | pod2/dexp001_sd15_relay.py:151-164 . amoe objectives.py:51-58 |
132
+ | L-011 | `M_hard = sign(cos[argmax|cos|])*A[argmax]; forward discrete, backward soft (M_hard + M_soft - sg[M_soft]); CE on head(M_hard)` | tools/ar_differentiation_bed.py (addr_mslh64 arm) |
133
+ | L-012 | `feats = concat_p M_hat^(p)(slots); logits = W feats; CE. P=4/16/32/64 dose` | tools/ar_differentiation_bed.py (addr_msl* arms) |
134
+ | L-013 | `reads at multiple tau; concat -> logits; CE (stroboscope)` | tools/ar_differentiation_bed.py (addr_3tau arm) |
135
+ | L-014 | `logits = head(M_hat) directly (reconstructive read consumed in AR); CE` | tools/ar_differentiation_bed.py (addr_mhat arm) |
136
+ | L-015 | `shift-CE(-100) on stepwise-CoT target sequences vs direct-answer targets` | pod/v35_exp013_experts.py:211 |
137
+ | L-016 | `L = mean_B[ mse_vec + lam*w_HIGH(s01)*blob_lp ]; blob_lp = sum(blob*(LP(x0h)-LP(x0))^2)/(sum(blob)*C); x0h = x_t - s*v_hat` | closeout amoe/diffusion/train/objectives.py:63-69 [REFUSES on eps] |
138
+ | L-017 | `sym CE over sims = za@zb^T/0.07 with in-batch labels` | loss_forms::a7_grid_infonce . tools/qwen_exp011_newanchors.py:445-453 |
139
+ | L-018 | `InfoNCE*1.0 + Procrustes_SVD*0.3 + |CV(bank)-0.20|*0.05` | external (blueprint line; pieces: a7 + procrustes_sq + cv_band_loss) |
140
+ | L-019 | `InfoNCE + MSE + BCE + Procrustes + CV + spread (6-term, never ablated)` | external (Expert Soup, Form 2) |
141
+ | L-020 | `mse(norm(pred), norm(tgt)) + (1 - cos(pred, tgt)) on (B,77,768)` | external (Form 4) . pieces in loss_forms |
142
+ | L-021 | `w = min(SNR,5)/(SNR+1) velocity-adjusted; L = mean(w * mse_vec)` | external (KSimplex trainer) . loss_forms::a2_weighted |
143
+ | L-022 | `L = CE + a*KL(log_softmax(student), mean_k softmax(teacher_k).detach()), a<=0.25, never founders` | tools/exp014_genetic_distillation.py:249-255 . loss_forms::prim_kl+kd_guard |
144
+ | L-023 | `fact rows: KL(teacher) ONLY (CE masked off); clean rows: CE - row-routed channels` | tools/exp019_content_retention.py:158-176 |
145
+ | L-024 | `GPA: mean shape after per-teacher Procrustes to consensus (delta<1e-8); student anchors init from it` | tools/exp014-016 (dif line) |
146
+ | L-025 | `projective ICP: iterate sign-aligned Procrustes on RP; lineage-core overwrite` | tools/exp015_content_inheritance.py (dif line) |
147
+ | L-026 | `prox = exp(-(cv-target)^2/2sig^2); L = (1+boost*prox)*mse + pen*(1-prox)` | geolip_core.core.distinguish (installed pkg) . loss_forms::soft_hand_weights |
148
+ | L-027 | `conv := fold(m_hat(unfold(x))); no plain filter, no ReLU; CE on head` | geolip-aleph-classification (external repo, cls line) |
149
+ | L-028 | `score(v) = logP(x_i=v | x_masked) - logP(x_i=WT | x_masked) (masked marginal)` | external (ryan protein line) |
150
+ | L-029 | `CE; trainable = aleph MslRelay adapters on frozen GPT-2 (<1%)` | tools/exp013_augmentation_bed.py track C |
151
+ | L-030 | `CE on frozen CLIP-L token-AR (matched transforms + shared vocab proj)` | tools/exp013_augmentation_bed.py track A |
152
+ | L-031 | `SOURCE RECOVERED 2026-07-25: attraction (1-s_y)^2 + 0.5*repulsion sum_{c!=y}(s_c^2) + 0.5*margin relu(max_{c!=y}s_c - s_y + .3) + 0.1*range clamp; siblings: prototype (cos-to-learned-prototypes + diversity) and hierarchical (coarse+fine+consistency)` | geofractal.losses.pure_geometric (installed pkg, VERBATIM) . tools/geobasin_bed.py |
153
+ | L-032 | `SOURCE RECOVERED 2026-07-25 (GBC head, geofractal/model/experiment_geometric_basin.py:118): compat = triadic (resonance-weighted cos to class signatures) x self-similarity (level-pair pattern match) x Cantor coherence exp(-(m - proto_c)^2/.1) x hierarchical early/late check - the 4-factor product` | geofractal.model.experiment_geometric_basin::GeometricBasinCompatibility (installed pkg) |
154
+ | L-033 | `mask patches; L = mse(recon_from_antipode_read(masked), x) (law 2 ORIGINAL form)` | built-unrun in geolip-aleph-classification (cls line) |
155
+ | L-034 | `w=.05 entropy-balanced alignment (exact form NOT fully recorded); endpoint M = +/-ref EXACT` | external (SVAE H2 arc) |
156
+ | L-035 | `rectified-flow velocity mse + Min-SNR gamma=5 + CM terms (L-045/L-046)` | external (KSimplex 4.8M prior) |
157
+ | L-036 | `ArcFace cos(th+m) | CosFace cos(th)-m | SphereFace cos(m*th); s=30 m=.30; L1-then-L2 dual-norm` | loss_forms::margin_head (NEW) . external ViT-ZANA |
158
+ | L-037 | `CE on x0 tokens from noise-level-t corrupted tokens, iterative` | q25-e008 bed (pod archive) |
159
+ | L-038 | `L = mse(ea, norm(frozen_h @ fixed_proj)) + mse(eb, ...) (absolute target regression)` | tools/qwen_exp011_newanchors.py:449-453 |
160
+ | L-039 | `standard contrastive; measured as a CV-compression force` | external (cv_band_origin sweep) |
161
+ | L-040 | `V = sqrt(clamp(-det(CM(A[idx5]))/9216)); L += 1e-3 * std(V)/mean(V); fp64, fixed seed-0 subsets, S15 bank ONLY` | tools/exp017_aleph_constellation.py:154-186 . loss_forms::cv_band_loss (NEW, arm-gated) |
162
+ | L-041 | `M = F.normalize(M, dim=-1) (||M||_F^2 = V pins sum sigma^2) - ONE line, not a loss` | structural; everywhere |
163
+ | L-042 | `per tower: g <- g * target/||g|| (equal gradient norms; outputs stay free)` | external (geofractal) |
164
+ | L-043 | `Sp = S * (1 + a*tanh(f)), a <= 0.2, init .024 - modulate never inject` | external (omega line) |
165
+ | L-044 | `p = softmax(-(y-[.5,1.5,2.5])^2/.25); bit_k = p_R + 0.5*p_M; C = sum bit_k 2^-k` | tools/compartment_smoke.py::exact_cantor + soft_cantor_ungated |
166
+ | L-045 | `L_CM = .01 * relu(eps - vol2(CM)) on first k+1 tokens (validity hinge)` | loss_forms::cm_validity_hinge (NEW) . external KSimplex |
167
+ | L-046 | `L_vol = -.005 * std(log|vol^2| across layers) (spread REWARD, anti-collapse)` | loss_forms::cm_volume_spread (NEW) . external KSimplex |
168
+ | L-047 | `L = ||A R* - B||^2, R* = Procrustes(A,B) via SVD - as x0.3 REGULARIZER beside a force` | loss_forms::procrustes_sq (NEW) . external blueprint |
169
+ | L-048 | `low = base + .5*mse(HP3(pred),HP3(tgt)); high = base + .5*mse(LP7,..); composed by band windows [role-aligned gauge]` | closeout amoe/diffusion/train/objectives.py:74-80 |
170
+ | L-049 | `dropout(anchors, p=.3) during alignment` | external (constellation) |
171
+ | L-050 | `clip_grad_norm .5 on cross-attn ONLY; NEVER inside an LBFGS closure` | protocol |
172
+ | L-051 | `Adam(params, lr, weight_decay=0.0) - the ONLY constructor` | closeout amoe/laws.py:26-28 |
173
+ | L-052 | `zeros_(head.weight); zeros_(head.bias); gates = -3.0` | closeout amoe relay.py:49-52 |
174
+ | L-053 | `g_tang pass; g_radial *= (1-.01); g_collapse *= 1.0 (gradient gating)` | external (GM3 Form 12; ALEPH-OMITTED) |
175
+ | L-054 | `q_comp = R (Hamilton) q_expert over 4 FiLM arms` | external (protein line) |
176
+ | L-055 | `Q = (I-A)(I+A)^-1, A skew - det=1 by construction` | external (protein line) |
177
+ | L-056 | `k-step MLP cascade in place of one dimensional jump` | structural, external |
178
+ | L-057 | `w_route = f(phase-0 triangulation distances), softmax-free, geometry-derived` | external (Form 6) |
179
+ | L-058 | `exact softmax within sorted equal-width same-bucket block; codebook grad via address-agreement bias` | design (Tree 3b pending) |
180
+ | L-059 | `M_hard + (M_soft - sg[M_soft]) (STE over an ABSOLUTE reconstructive read)` | amoe.core.address / geolip_svae |
181
+ | L-060 | `n_i_new = min(ceil(norm * n_i^0.5), 8, 1.25*top) (sqrt-damped repeats)` | external (anima bucketing) |
182
+ | L-061 | `assert |question_space| >= 3*draws; train-eval overlap <= .05` | closeout amoe/train/guards.py:19-45 |
183
+ | L-062 | `on starvation strike: sampling_weight[starved] *= 2; 3 strikes abort - DATA, never a loss` | closeout amoe/train/aligner.py:68-84 |
184
+ | L-063 | `with p=.1: cond <- 0 (zeroed, not empty-prompt)` | pod2/dexp006:132-146 |
185
+ | L-064 | `NOT RECORDED (role-weighted pentachoron regularization; rose_w=1e-4, temp .07)` | external (David classifier) |
186
+ | L-065 | `ramp(x)=.5-.5cos(pi*(clamp(x/XF,-1,1)+1)/2); low=1-up1; mid=up1(1-up2); high=up1*up2; edges(.35,.75) XF=.06` | closeout amoe/diffusion/core/multiband.py:23-35 . compartment_smoke::compartment_windows |
187
+ | L-066 | `L = base + lam * w_route * aux, lam~1 (3-pt dose curve)` | loss_forms::a5_dose_coupled |
188
+ | L-067 | `reduce in float64, autocast off (gauges)` | loss_forms::a8_fp64_gauge . geolip_vitals |
189
+ | L-068 | `acc = mean_fp64(res_arm(row,noise,t) - res_ref(row,noise,t)), triples FIXED per row` | loss_forms::a6_paired . dexp001:167-185 |
190
+ | L-069 | `w = f(pi_frozen_ref); L = sum(w*ce_tok)/sum(w)` | loss_forms::pwa_weights+a2_weighted [gate: 0.014-0.083] |
191
+ | L-070 | `v = norm(feats)@R^T/t; L = mean(cosh(clamp(v - c_y*mu, -4, 4)) - 1)` | loss_forms::fac_loss . tools/fac_bed.py |
192
+ | L-071 | `CV = std(V)/mean(V), V = CM 4-volumes over 200 random 5-subsets, fp64 - READOUT` | tools/geolip_vitals.py::pentachoron_cv |
193
+ | L-072 | `drift = arccos(<norm(a), norm(a_init)>); binding_frac = mean(|drift-.29154|<=.05)` | tools/geolip_vitals.py::anchor_drift |
194
+ | L-073 | `bpb = mean CE / ln(2) per byte` | beds (ar_differentiation, fac_bed) |
195
+ | L-074 | `tax = exp(mean CE_512)|adapted - exp(mean CE_512)|frozen on wikitext` | pod beds (v35) |
196
+ | L-075 | `F1 = 2PR/(P+R) over token multisets vs GT captions` | pod v35 judges |
197
+ | L-076 | `precision = |pred inter GT|/|pred|; invented = |pred minus GT_vocab|/|pred|` | pod halluc judge (exp004_caption/halluc) |
198
+ | L-077 | `sep_L = mean_ij inter-register Ham(code_i,code_j) - mean intra (diagonal KEPT, +4% bias, comparability)` | pod2/aleph_diffusion_core.py:257-290 . canon/register_probe_gauge.md |
199
+ | L-078 | `Spearman(Hamming(c_i,c_j), arccos|<a_i,a_j>|) over random pairs` | tools/fac_bed.py (reimpl) . exp015 |
200
+ | L-079 | `HIGH-band foreground-masked LP-x0 error (fp32 judged)` | closeout amoe/diagnostics/diffusion.py::foreground_gauge |
201
+ | L-080 | `assert torch.equal(logits_all_off, logits_base)` | closeout amoe/testing/invariants.py:76-97 |
202
+ | L-081 | `ratio = damage(own band lesion) / damage(cross band lesion) per gauge` | closeout amoe/diagnostics/diffusion.py::lesion_report |
203
+ | L-082 | `excess = metric(real keys) - metric(SAME key repeated); + matched-vs-mismatched delta` | pod2/dexp015_router_v2.py:159-191 |
204
+ | L-083 | `usage = mean oriented-softmax row; ppl = exp(H(usage)); alive = usage > eps/2K` | tools/geolip_vitals.py::axis_aliveness |
205
+ | L-084 | `read ppl = exp(H(mean read weights)); commitment = |cos(read, nearest atom)|` | geolip-aleph-classification gauges (cls line) |
206
+ | L-085 | `ratio = mean|delta|_domain / mean|delta|_neutral; escape <= 1.5; damped >= 3.0` | closeout amoe/diagnostics/__init__.py:58-71 |
207
+ | L-086 | `exact-match on two-step composite prompts vs single-step controls` | pod v35 composite judges |
208
+ | L-087 | `effect = mean|loss_off - loss_on|; report VACUOUS if < eps instead of a ratio` | colab/anima_closeout.ipynb (v14 guard) |
209
+ | L-088 | `orders = log10(max group ||g||) - log10(min); dead = groups with 0` | tools/geolip_vitals.py::grad_norm_spread |
210
+ | L-089 | `CV at step 1000 -> band {<.30 LOW / .35-.50 MID / >.80 HIGH} + stability + freeze-survival` | tools/geolip_vitals.py::CVScreen |
211
+ | L-090 | `ripser H2 on d(a,b)=arccos|<a,b>| (RP metric), thresh 20deg; beta2/axis` | ripser+persim (installed); canon/void_topology.md:27-63 |
212
+ | L-091 | `S0/S_D spectral ratio; erank = exp(-sum p ln p), p = sigma/sum sigma` | external (structural attractors) |
213
+ | L-092 | `var(recon MSE) across patch grids 81..4096 - flatness IS the pass` | external (omega line) |
214
+ | L-093 | `guarded subprocess: restricted builtins, len cap, timeout, no net; exact-match out` | pod v35 exec judge (protocol) |
215
+ | L-094 | `json.parse validity + IoU(xywh) + pair-order + termination-within-window` | pod v35 judges |
216
+ | L-095 | `torch.cuda.max_memory_allocated + s/step at an early step (WDDM spill tell)` | telemetry; pod/run_g6b_rider.py:34-48 |
217
+ | L-096 | `drift_g = arccos(<consensus_g, consensus_prev>); stationarity = no acceleration` | tools (dif line) |
218
+ | L-097 | `held-out byte acc under substitution cipher; variant-format recall` | tools/exp019/exp020 |
219
+ | L-098 | `NN symbol-Hamming between stored and recomputed keys; match@theta=.25` | tools/exp021_persistent_store.py |
220
+ | L-099 | `mean cos(book_epoch, book_init) across the bank sweep` | external (192-bank sweep) |
221
+ | L-100 | `|V_fast - V_geovocab2| / |V| at fp64 == 0 required` | tools/geolip_vitals.py::cv_reference_check |
222
+ | L-101 | `gate_mean = mean sigmoid(g); band [.012,.03] ADVISORY` | tools/geolip_vitals.py::gate_stats |
223
+ | L-102 | `mean mse over all sigma - BLIND to band structure (distrusted for bands)` | prim_sq+a0 (the point is what it hides) |
224
+ | L-103 | `cos(recon, x) - WRONG instrument for addressed systems (address = lookup key)` | distrusted; do not implement as a judge |
225
+ | L-104 | `recall@k under Hamming(code_query, code_bank)` | tools/qwen_exp011 (q25 line) |
226
+ | L-105 | `||sg[z_e] - e||^2 + beta*||z_e - sg[e]||^2 (+ EMA codebook update)` | loss_forms::forbidden_vq_commitment (NEW, force-gated control) |
227
+ | L-106 | `selection event = argmax/softmax-over-roster in the compute path` | prohibited class (the EVENT is the violation, not one formula) |
228
+ | L-107 | `alphabet learned by task gradient (vs fitted-frozen)` | prohibited class (dif line evidence) |
229
+ | L-108 | `direct task-gradient descent on pentachoron vertices` | prohibited (geovocab evidence) |
230
+ | L-109 | `gap = x.mean(dim=spatial) in a geometric encoder` | loss_forms::forbidden_gap (NEW, force-gated control) |
231
+ | L-110 | `CV term injected in backward, or weight > 1e-3` | prohibited placement of L-040 |
232
+ | L-111 | `same as L-047 - AS THE TRAINING FORCE (placement retracted)` | loss_forms::procrustes_sq [placement warning] |
233
+ | L-112 | `logits = W u, u = single-slot coefficients at hard tau (K=32)` | tools/ar_differentiation_bed.py (addr_head) . fac_bed p4 cells |
234
+ | L-113 | `a7_grid_infonce INTO an address path` | loss_forms::a7 [placement ban in docstring] |
235
+ | L-114 | `prim_kl at alpha=1.0 from near-parity teachers in a selection loop` | loss_forms::prim_kl+kd_guard [guard warns] |
236
+ | L-115 | `L-016 with x0h = (x_t - sqrt(1-abar)eps_hat)/sqrt(abar) - divides by vanishing sqrt(abar)` | closeout amoe trainer [REFUSES unless force_blob_on_eps] |
237
+ | L-116 | `keep-or-kill on 1-epoch MSE rank` | retracted protocol; replaced by L-089 |
238
+ | L-117 | `logits = tied(M_hat) with U=M_hat, S=Omega, Vt=I` | dif-e018 bed (tools) |
239
+ | L-118 | `route experts by frozen text keys (raw/pooled/M-hat-slot) vs repeated-key null` | pod2/dexp014/dexp015 beds |
240
+ | L-119 | `a trainable anchor trained to orchestrate others (composite prereg >= +.15)` | pod v35_exp010/exp020 beds (refuted) |
241
+ | L-120 | `solo specialist stack attached always-on` | configuration class (v35 e018 evidence) |
242
+ | L-121 | `frozen solo-trained experts composed under dispatch` | pod v35_exp014 beds (demoted) |
243
+ | L-122 | `transplant proj+codebook onto a fresh trunk` | NA protocol (dif line, demoted) |
244
+ | L-123 | `L-048 judged by aggregate eps-MSE` | same impl; the GAUGE is the difference |
245
+ | L-124 | `append frozen byte-trigram address beside full text cond` | pod2/dexp002 bed |
246
+ | L-125 | `null = shuffle keys across rows (measures diversity, not correctness)` | retracted instrument; use L-082 |
247
+ | L-126 | `CE on generated question sets with space < 3x draws` | retracted claim; guard = L-061 |
248
+ | L-127 | `cross-seed comparison across DIFFERENT instruments` | NA (claim-level error) |
249
+ | L-128 | `bands nested within bands on a Cantor axis` | prohibited configuration |
250
+ | L-129 | `re-enter measure space per layer/step` | prohibited configuration |
251
+ | L-130 | `soft_cantor_ungated(x) used as a band COORDINATE (non-monotone)` | tools/compartment_smoke.py::soft_cantor_ungated (as the regression) |
252
+ | L-131 | `repeat count = ceil(max_bucket / n_i) (alpha=0 equalize-to-largest)` | NA data policy (prohibited) |
253
+ | L-132 | `conv re-weighted by convex sum a_k=1 over a filter bank (hull-bounded mean)` | geolip-aleph-classification (cautionary control, cls line) |
254
+ | L-133 | `argmax decoding in an iterative denoiser` | NA decoding policy |
255
+ | L-134 | `aux = alpha * N * sum_i f_i * P_i (switch-style balance)` | loss_forms::forbidden_load_balancing (NEW, force-gated control) |
256
+ | L-135 | `CE on the big-JSON composite format` | dropped by operator ruling (never built) |
257
+ | L-136 | `learned SVD rotation transform in the dual-penta head` | retracted (convergence failure) |
258
+ | L-137 | `coefficients->logits at ONE hard tau, any dim` | class of L-112; cure = L-012/L-013 |
259
+ | L-138 | `L-070 on the addr_head collapse configuration` | tools/fac_bed.py (p4_addr_head_fac) |
260
+ | L-139 | `sparsemax_loss on addr_head logits (K=32, hard tau) - only the loss differs from the certified collapse cell` | tools/deviant_bed.py (p4_sparsemax) . loss_forms::sparsemax_loss |
261
+ | L-140 | `L = -z_y + 0.5*sum_{j in S}(z_j^2 - tau^2) + 0.5 (sparse support S)` | loss_forms::sparsemax_loss . tools/deviant_bed.py |
262
+ | L-141 | `L = T*logsumexp(ce_tok/T) - T*log(N), T=0.5` | loss_forms::dev_softmax_accum . tools/deviant_bed.py |
263
+ | L-142 | `L = mean(log(ce_tok + 1e-3))` | loss_forms::dev_geomean_accum . tools/deviant_bed.py |
264
+ | L-143 | `CE to (1-eps) smoothed targets == (1-eps)CE + eps*uniform-KL` | F.cross_entropy(label_smoothing=.1) . tools/deviant_bed.py |
265
+ | L-144 | `L = sum((1-p_y)^2 * ce_tok) / sum((1-p_y)^2), p_y detached from the live model` | tools/deviant_bed.py (focal) |
266
+ | L-145 | `L = sum(ce_tok * [pi_ref > .6]) / count, pi_ref from the frozen ce_s0 checkpoint` | tools/deviant_bed.py (anti_curr) |
267
+ | L-146 | `L = mean(1 - tanh(v) * c)` | loss_forms::fac_loss_link(link='tanh') . tools/deviant_bed.py |
268
+ | L-147 | `L = mean(log(1 + (v - c*mu)^2))` | loss_forms::fac_loss_link(link='cauchy') . tools/deviant_bed.py |
269
+ | L-148 | `L = CE - 0.1*H(p)` | tools/deviant_bed.py (conf_penalty_CONTROL) |
270
+ | L-149 | `CE over logits = cos(normalize(feats), normalize(A_c)) * 10` | tools/geobasin_bed.py (geo_ce_scores) |
271
+ | L-150 | `attraction (1-s_y)^2 + 0.5*sum_{c!=y}s_c^2 + 0.5*relu(max_{c!=y}s_c - s_y + .3) + 0.1*range` | geofractal.losses.pure_geometric (VERBATIM) . tools/geobasin_bed.py |
272
+ | L-151 | `same loss; A registered as a frozen buffer` | tools/geobasin_bed.py (geo_pure_frozen) |
273
+ | L-152 | `L = (1 - s_y)^2 + 0.1*(relu(s-1)^2 + relu(-s)^2) - no other-class terms at all` | tools/geobasin_bed.py (geo_pure_norep) |
274
+ | L-153 | `cos(proj(scores), prototypes) pulled/pushed + prototype-diversity term` | geofractal.losses.pure_geometric::GeometricPrototypeLoss (VERBATIM) |
275
+ | L-154 | `coarse (superclass sums to target) + fine + consistency, sigmoid-weighted` | geofractal.losses.pure_geometric::HierarchicalGeometricLoss (VERBATIM, FastHierarchical parity wrapper) |
276
+ | L-155 | `0.5*CE(cos*10) + 0.5*PureGeometricLoss(scores)` | tools/geobasin_bed.py (geo_hybrid) |
277
+
278
+ ## PRIMARY OBJECTIVES
279
+
280
+ Terms that were the training signal, not an addition to one.
281
+
282
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
283
+ |---|---|---|---|---|---|---|
284
+ | L-001 | **10** | 33222+1 | `SQ.A0`/bytes | MSE -> bitwise reconstruction (SVAE H2, 16 noise types) | 16 noise types converge simultaneously; bitwise text recon; the two-year survivor | MANIFEST.md:133-139; MANIFEST.md:144-145 |
285
+ | L-002 | **10** | 33222+1 | `SQ.A0`/codebook | recon gradient through M-hat (the aleph's ONLY codebook pressure) | cos .992-.997 hard-mode, 125-126/128 axes alive, ZERO collapse, div_weight=0 | canon/aleph_core.md:16-18; canon/discovery_catalog.md:40-44 |
286
+ | L-012 | **9** | 33212+0 | `CE.A2`/coefficients | addr_msl slot-parallel read (P parallel D=4 slots, shared K=64) | THE ACCUMULATION CURE: 5.6650 (collapsed) -> 2.47 with the primitive held FIXED | history/timeline.md:124-138; history/timeline.md:1098-1104 |
287
+ | L-015 | **9** | 33212+0 | `CE.A4`/logits | derived-steps expert supervision (stepwise-CoT target vs direct target) | +0.79 vs direct +0.63; held-out ceiling 1.00/1.00; seeds matched to 4 decimals (+0.7917 / +0.7916) | inventory/SCALE_MANIFEST.md:144-154; history/timeline.md:1640 |
288
+ | L-004 | **9** | 23122+1 | `CE.A1`/logits | chunked masked CE (512-token slices, sum-then-renormalize) | 22.8GB dedicated + 42.8GB SILENTLY SHARED -> 8.8GB peak @ 1.03 s/step | MANIFEST.md:50-59; pod/v35_exp003_termination.py:128-138 |
289
+ | L-138 | **9⟂** | 23222+0 | `BREG.A0`/coefficients | FAC on the partition-collapse configuration (the P4 loss-swap cell) | the certified addr_head collapse DECOMPRESSES under a loss swap alone, 3/3 seeds: usage ppl 1.0-2.7 -> 60.6-61.1 of 64; decoded acc 0.05-0.20 -> 0.45-0.47; the win|cos| saturation DISSOLVES (0.9995+ -> 0.13) | tools/fac_runs/p4_addr_head_fac_s0_t2000.jsonl; history/timeline.md:1105-1118 |
290
+ | L-139 | **9** | 23222+0 | `CE.A0`/logits | sparsemax on the collapse configuration (the coupling-axis probe) | THE DOSE-RESPONSE: usage 1.85 (CE, full coupling) -> 23.5 (sparsemax, partial) -> 60.9 (FAC, none); win|cos| .9997 -> .562 -> .132; acc .11 -> .417 -> .456 - MONOTONE on every gauge, 3 seeds/point | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
291
+ | L-152 | **9** | 23222+0 | `SQ.A0`/basin-scores | PureGeometric ABSOLUTE-ONLY (attraction + range; comparative terms dropped) | MORE THAN DOUBLES the full set: acc 0.349 vs 0.157, bpb 3.75 vs 7.52, 3/3 seeds - the comparative terms are the poison | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
292
+ | L-010 | **9** | 32212+1 | `SQ.A0`/x0-linear | flow v-MSE (rectified flow, SHIFT-warped sigma) | x0 = x_t - sigma*v is EXACT and LINEAR at every sigma - asserted, not assumed | pod2/dexp001_sd15_relay.py:151-164; closeout_2026-07-19/amoe/src/amoe/diffusion/train/objectives.py:51-58 |
293
+ | L-003 | **8⚠** | 33121+0 | `CE.A0`/logits | plain full-sequence cross-entropy (packed labels) | the workhorse; also the documented geometry antagonist - CE drove the Oct '25 geometric collapse | pod/v35_exp001_placement.py:170; tools/ar_differentiation_bed.py:423 |
294
+ | L-017 | **8⟂** | 33111+0 | `CE.A7`/similarity-grid | InfoNCE as an alignment force (OFF address paths) | NECESSARY + SUFFICIENT for alignment: swap it in -> R@1 .999 | canon/geometric_memory_blueprint.md:7-8; canon/geometric_memory_blueprint.md:20 |
295
+ | L-005 | **8** | 32121+0 | `CE.A4`/logits | shift-CE with ignore_index=-100 (prefix-masked instruction rows) | the standard instruction-tuning form across the v35 and q25 lines | pod/v35_exp006_math.py:180; pod/v35_exp013_experts.py:211 |
296
+ | L-009 | **8** | 32211+0 | `SQ.A0`/eps | eps-MSE (epsilon prediction, stock schedule) | relay -2.5% over frozen, 2 seeds; relay >= matched LoRA 2-for-2 across substrates | pod2/dexp006_sd15core_relay.py:132-146; history/timeline.md:1337-1350 |
297
+ | L-011 | **8** | 32122+0 | `CE.A0`/logits | sign-code head addr_mslh64 (fully discrete forward, STE backward) | bpb 2.4711 vs soft 2.4685 - parity certified 3 seeds; a ~2.8% gap opens at 4x budget | history/timeline.md:249-283; inventory/SCALE_MANIFEST.md:64-71 |
298
+ | L-149 | **8** | 22222+0 | `CE.A0`/basin-scores | CE on the cosine-anchor basin head (the geobasin control) | the head itself costs +0.13 bpb under CE (2.607 vs 2.477 linear, 3 seeds; acc .498 vs .505) - small, so every geometric-arm deficit is THE LOSS, isolated | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
299
+ | L-028 | **7** | 23111+0 | `CE.A4`/logits | masked-marginal variant scoring (protein VEP) | WT unmasked marginal rho 0.10 -> masked marginal ESSENTIAL; final rho .993 / .309 unseen | canon/ryan_spearman_protein.md:41-42; canon/ryan_spearman_protein.md:6-8 |
300
+ | L-006 | **7** | 32111+0 | `CE.A4`/logits+pixels | HuggingFace out.loss (VLM labels= path, vision tower fires) | required wherever the vision tower must fire - chunking bypasses it | pod/v35_exp004_caption.py:175; pod/v35_exp004_caption.py:17-19 |
301
+ | L-029 | **7** | 22211+0 | `CE.A0`/logits | GPT-2 frozen-trunk relay objective (dif-e013 Track C) | frozen 38.648 -> aleph 26.53 vs param-matched zero-init MLP 27.26; beats matched 2/2 seeds | history/timeline.md:349-363 |
302
+ | L-013 | **6** | 13212+0 | `CE.A2`/coefficients | addr_3tau multi-tau stroboscope | 4.2884 no collapse (usage ppl 7.9, 117/128 alive) against addr_d4's 5.3698 | history/timeline.md:1093-1095 |
303
+ | L-027 | **6** | 13212+0 | `CE.A0`/logits | antipode-conv objective (the address AS the convolution operator) | CIFAR-10 87.23% @ 861,450 params with NO ReLU/GELU anywhere; none -> mag +21.8 | inventory/SCALE_MANIFEST.md:8-30; canon/discovery_catalog.md:49-61 |
304
+ | L-037 | **6** | 13111+0 | `CE.A0`/logits | denoiser objective (tokendiff iterative image-token denoise) | beats identity at every level; t=1.0 gives 0.378 vs 0.002 (189x) | sessions/2026-07-13.md:35-43 |
305
+ | L-018 | **6** | 22111+0 | `CE.A7`/mixed | blueprint composite (InfoNCE 1.0 + Procrustes_SVD 0.3 + |CV-0.20| 0.05) | BERT-8192 m_acc .927 at CV exactly 0.200; CLIP-ctx576 m_acc .945 | canon/geometric_memory_blueprint.md:9-20 |
306
+ | L-014 | **6** | 12212+0 | `CE.A0`/coefficients | addr_mhat reconstructive read consumed in AR | 5.1300 bpb but the HEALTHIEST cultivation on the bed (ppl 11.0, binding_frac .234) | history/timeline.md:1095-1097 |
307
+ | L-035 | **6** | 12211+0 | `SQ.A0`/x0-linear | rectified-flow velocity objective (KSimplex / Form 7 bottleneck) | loss .1749 beat the 268M skip's .1757; the model routed 88% through the 768 dims | canon/ksimplex_diffusion_prior.md:26-28; canon/constellation_forms.md:59-63 |
308
+ | L-038 | **6** | 12211+0 | `SQ.A0`/embeddings | recon_target (absolute MSE to a fixed frozen-trunk projection) | recall@1 0.264 - real (5x frozen) but HALF of InfoNCE's 0.494 at matched budget | sessions/2026-07-13.md:122-126; tools/qwen_exp011_newanchors.py:445-453 |
309
+ | L-019 | **5** | 12111+0 | `CE.A7`/mixed | Expert Soup composite (InfoNCE + MSE + BCE + Procrustes + CV + spread) | mAP .84 (data-limited), 1000/1000 positive volumes, eff-dim 76.9 for COCO-80 | canon/constellation_forms.md:35-39 |
310
+ | L-020 | **5⚠** | 12111+0 | `SQ.A0`/sequence-embeddings | SequenceReconstructor loss: MSE(normed) + (1 - cos) | CLIP-L ep5 m_acc .957 / s_cos .734; Meridian bigG s_cos PLATEAUS at .425 | canon/geometric_memory_blueprint.md:56-63; canon/constellation_forms.md:44-48 |
311
+ | L-146 | **5** | 21222+0 | `BREG.A0`/address-code | FAC tanh-Hamming link (bounded tails) | cosh beats tanh 3/3: 4.349 vs 4.1285 (+0.22) - the bounded link loses within the family | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
312
+ | L-147 | **5** | 21222+0 | `BREG.A0`/address-code | FAC Cauchy link (sub-quadratic tails) | cosh beats Cauchy 3/3: 4.360 vs 4.1285 (+0.23) - robust-statistics tails lose within the family | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
313
+ | L-007 | **5** | 11221+0 | `CE.A0`/logits | dispatch-keys-only CE (aligner; adapters frozen as anchors) | trainable set is ONLY the per-block key matrices; reference-grade, never seed-replicated | closeout_2026-07-19/amoe/src/amoe/train/aligner.py:41-67 |
314
+ | L-030 | **5** | 20211+0 | `CE.A0`/logits | val_ce on a frozen semantic substrate (CLIP-L token-AR) | MLP WINS frozen-substrate token-AR (penult 5.245 best); aleph tax ~ +0.09 | history/timeline.md:335-348 |
315
+ | L-031 | **5** | 20122+0 | `SQ.A0`/geometry | pure geometric-basin loss set (coherence/separation/discretization/geometry) | the program's ONE attempted CE replacement - NOW PROPERLY TESTED: refuted on the byte bed (acc 0.157 vs control 0.498, 3 seeds); the absolute-only variant doubles it (L-152) | canon/cantor_empirics.md:20-22 |
316
+ | L-070 | **5⟂** | 20221+0 | `BREG.A0`/address-code | FAC as a PRIMARY sequential objective (cosh-Bregman, replace CE) | REFUTED AS PREREGISTERED, 3/3 seeds: fac_lsh 4.13 bpb vs ce 2.48; ce_fixedcode 3.81 beats it; fac_none 3.95 beats it | tools/fac_runs/; history/timeline.md 2026-07-25 pass-3 block |
317
+ | L-140 | **5** | 20221+0 | `CE.A0`/logits | sparsemax as a full-bed objective | REFUTED as a general objective: bpb 7.43 / acc 0.331 vs ce 2.4769 / 0.505 (3 seeds) | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
318
+ | L-141 | **5** | 20222+0 | `CE.A9`/logits | soft-max / worst-position accumulation (trained) | REFUTED: bpb 4.24 / acc 0.276, 3 seeds - the 0.911-novelty champion chases irreducible entropy exactly as flagged | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
319
+ | L-142 | **5** | 20222+0 | `CE.A2`/logits | geometric-mean accumulation (trained) | REFUTED decisively: bpb 9.03 - the anti-focal starves hard positions and the distribution never forms (3 seeds) | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
320
+ | L-143 | **5** | 20122+0 | `CE.A0`/logits | label smoothing eps=.1 (trained on the byte bed) | bpb 2.587 vs ce 2.4769 (+0.11, 3 seeds) - payer-class novelty (0.479), mildly WORSE outcome | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
321
+ | L-144 | **5** | 20122+0 | `CE.A2`/logits | focal gamma=2 (trained, live-model weights) | bpb 2.597 (+0.12 vs ce, 3 seeds) - payer-class trained novelty (0.337), mildly worse outcome | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
322
+ | L-145 | **5** | 20222+0 | `CE.A4`/logits | anti-curriculum (train only where the frozen reference is confident) | REFUTED as an objective: bpb 6.74 (3 seeds) - abandoning 72% of the distribution buys nothing on the rest | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
323
+ | L-148 | **5** | 20122+0 | `CE.A0`/logits | confidence penalty (trained as the GATE-VALIDATION CONTROL) | CLOSEST TO CE OF ALL DEVIANTS: bpb 2.520 (+0.043, 3 seeds) - the gate's refusal correctly predicted 'CE plus nothing' | tools/deviant_runs/; history/timeline.md 2026-07-25 deviant-matrix block |
324
+ | L-150 | **5** | 20122+0 | `SQ.A0`/basin-scores | PureGeometricLoss, learned anchors (the Oct '25 arm, properly tested) | REFUTED on this substrate: acc 0.157 vs control 0.498 (-68% relative, 3 seeds) - far below the historical -12% trade | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
325
+ | L-151 | **5** | 20222+0 | `SQ.A0`/basin-scores | PureGeometricLoss, FROZEN anchors (the L-108 cell) | learned BEATS frozen by +8 acc points (0.157 vs 0.076, 3 seeds) - the L-108 falsifier FIRED for cosine anchors | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
326
+ | L-153 | **5** | 20112+0 | `SQ.A0`/basin-scores | GeometricPrototypeLoss (verbatim, own projector) | WORST of the family: bpb 8.12, acc 0.008 (3 seeds) - the extra indirection buys total failure | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
327
+ | L-154 | **5** | 20122+0 | `SQ.A0`/basin-scores | HierarchicalGeometricLoss on the nibble hierarchy (16x16) | CATASTROPHIC: acc 0.0003 - below chance (1/256) - hierarchy-in-class-space destroyed fine structure entirely (3 seeds) | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
328
+ | L-155 | **5** | 20222+0 | `SQ.A0`/basin-scores | CE + PureGeometric hybrid (0.5/0.5) | the geometric set POISONS CE rather than riding it: bpb 4.53 vs control 2.61 (+1.9, 3 seeds) - P4 bar (within 0.15) missed by 12x | tools/geobasin_runs/; history/timeline.md 2026-07-25 geobasin block |
329
+ | L-036 | **4** | 11111+0 | `CE.A0`/logits | margin losses ArcFace / CosFace / SphereFace (RoseFace dual-norm) | the ZANA innovation - and it hit a 60% single-stream ceiling | canon/vit_lineage_beatrix_zana.md:17-28 |
330
+ | L-008 | **4** | 10121+0 | `CE.A0`/logits | image-classification CE (CIFAR-10, aleph-dispatched MoE vs dense) | MoE 58.52% TIES param-matched dense 58.52% exactly; 6x params bought nothing | history/timeline.md:1127-1138; tools/addressed_distillation_v1.py:301 |
331
+ | L-032 | **3** | 00220+0 | `-.NA`/geometry | GBC - 'cross-entropy can be replaced entirely' (roadmap claim) | classification via triadic compatibility, self-similarity, Cantor coherence, hierarchical basin checks | canon/geovocab_chunking.md:21-22 |
332
+ | L-033 | **3** | 00212+0 | `SQ.A0`/pixels | masked-recon / generative arm (campaign law 2 in its ORIGINAL form) | BUILT, NEVER RUN - predicted to be where the SIGNED read finally beats magnitude | inventory/SCALE_MANIFEST.md:19-21; history/open_questions.md:144-145 |
333
+
334
+ ## AUXILIARY TERMS, REGULARIZERS, AND STRUCTURAL SUBSTITUTES
335
+
336
+ Includes the structural devices that REPLACED a loss term - sphere normalization, gradient
337
+ equalization, bounded alpha. Their presence here is the point: this program's strongest
338
+ results come from making geometry structural rather than penalized.
339
+
340
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
341
+ |---|---|---|---|---|---|---|
342
+ | L-052 | **10** | 33221+1 | `-.NA`/adapters | zero-init output heads (WEIGHT and bias) - the inertness contract | makes the toggle law bit-exact (max|dlogit| = 0.0); the bias leak alone is a standing +0.5 ppl offset | MANIFEST.md:171-172; closeout_2026-07-19/amoe/src/amoe/diffusion/core/relay.py:49-52 |
343
+ | L-065 | **10** | 33212+1 | `-.A3`/sigma-axis | band crossfade windows as STRUCTURAL positional gating | own-band damage 50-200x cross-band, 3/3 both seeds - specialists manufactured with NO routing loss | MANIFEST.md:90-96; plans/2026-07-17_multiband_stage_plan.md:18-35 |
344
+ | L-044 | **10** | 23222+1 | `-.NA`/cantor-measure | Devil's Staircase alpha-normalization (bit_k = p[RIGHT] + alpha*p[MIDDLE], alpha=0.5) | WITHOUT the alpha term the measure COLLAPSES to {0, .333, .667} - the FractalDavid bug | MANIFEST.md:30-31; canon/vit_lineage_beatrix_zana.md:40-49 |
345
+ | L-061 | **10** | 23222+1 | `-.NA`/data | question-space guard (training-question space >= 3x draws) | caught TWO memorized experts that had PASSED the answer-diversity guard (spaces 480 and 248 vs 800 draws) | MANIFEST.md:169-170; inventory/SCALE_MANIFEST.md:152-154 |
346
+ | L-051 | **10** | 32222+1 | `-.NA`/optimizer | pure Adam, weight_decay = 0 (the anti-regularizer law) | Adam+gates .731 vs AdamW(3e-4, wd .01) .667 - 'weight decay is uniform damping that destroys the geometric harmonic' | MANIFEST.md:15; canon/discovery_catalog.md:18 |
347
+ | L-068 | **9** | 33212+0 | `-.A6`/any | paired (row, noise, t) triples - the variance-killing accumulation | the noise-pair floor is ~0.988 - without pairing the effects this program measures are invisible | history/timeline.md:1220-1227; pod2/dexp001_sd15_relay.py:167-185 |
348
+ | L-042 | **9** | 23212+1 | `-.NA`/gradients | gradient equalization across heterogeneous geometric towers | without it spreads hit 20 ORDERS of magnitude (fibonacci dead at 2.25e-21 under helix) | MANIFEST.md:43-45; canon/fibonacci_systems.md:14-20 |
349
+ | L-016 | **9** | 32212+1 | `SQ.A5`/x0-linear | blob-LP-x0 structural supervision on FLOW (lambda ~ 1) | -5.9% / -3.7% two seeds on flow vs +0.03% / -1.0% on eps: a ~125-200x effect ratio | MANIFEST.md:65-69; history/timeline.md:1481-1491 |
350
+ | L-041 | **9** | 32222+0 | `-.NA`/activations | sphere normalization (M = F.normalize(M); ||M||_F^2 = V pins sum sigma^2) | zero collapses in 400 epochs; V=1024 went from 48 s/ep crashing to 2.0 s/ep stable | canon/structural_attractors.md:32-37; canon/discovery_catalog.md:8 |
351
+ | L-043 | **9** | 32221+1 | `-.NA`/spectra | bounded multiplicative alpha (S*(1 + alpha*tanh), alpha <= 0.2, init .024) | unbounded alpha POISONS the spectrum; bounded modulation costs 2,272 of 16.9M params (0.013%) | MANIFEST.md:40; canon/omega_tokens_fresnel_johanna.md:5-9 |
352
+ | L-050 | **9** | 22222+1 | `-.NA`/gradients | gradient clipping discipline (0.5 on cross-attn ONLY; NEVER inside an LBFGS closure) | unclipped LBFGS closure DIVERGED to G-MSE 7.4e26; safety is line_search_fn='strong_wolfe' | MANIFEST.md:46-47; canon/tri_band_omega_arc.md:55-57 |
353
+ | L-048 | **8⟂** | 32212+0 | `SQ.A3`/band-routed | HP/LP band-role objectives [judged by the ROLE-ALIGNED gauge] | multiband beats the matched monolith ~10% on HIGH-band foreground, BOTH seeds | history/timeline.md:1465-1479 |
354
+ | L-059 | **8** | 32122+0 | `-.NA`/codebook | straight-through estimator on the aleph HARD read | forward fully DISCRETE oriented code, backward soft: hosted books hold cos .992-.997, 112-122/128 hard axes, zero collapse | canon/aleph_core.md:20-23; MANIFEST.md:135-138 |
355
+ | L-040 | **8** | 22221+0 | `DET.A2`/S15-bank | 1e-3 CV bank loss (arm-gated, S^15 bank ONLY, never the aleph codebook) | holds CV .295-.305 at zero-to-positive task cost where bare CE drifts it to .31-.34 | tools/exp017_aleph_constellation.py:154-186; history/timeline.md:692-696 |
356
+ | L-066 | **8** | 22212+1 | `-.A5`/x0-linear | lambda dose coupling (3-point curve on the blob term) | 0.5 -> -5.9% | 1.0 -> -8.3% (in bound) | 2.0 -> -8.4% (OUT of the 0.5% common-gauge bound) | history/timeline.md:1584-1589; closeout_2026-07-19/amoe/src/amoe/diffusion/laws.py:41 |
357
+ | L-067 | **8** | 22212+1 | `-.A8`/gauges | fp64 gauge accumulation (autocast disabled in the reduction) | fp32 determinants lose up to ~4% on near-degenerate pentachora - 'fp32 det only' now means fp32 MINIMUM | MANIFEST.md:32-39; tools/geolip_vitals.py:60-103 |
358
+ | L-023 | **7** | 23111+0 | `KL.A4`/logits | kd_facts (fact rows supervised ONLY by teacher logits, alpha=1.0 legal here) | recall 0.953 vs direct 0.871; held-out RULE induction 0.264/0.279 >= the teacher itself | history/timeline.md:758-767; history/timeline.md:783-806 |
359
+ | L-024 | **7** | 23111+0 | `SQ.A0`/shape-mean | dual-teacher Procrustes consensus distillation | teachers .699/.649 -> student .761 EXCEEDS BOTH, still accelerating at E30 | canon/geometric_memory_blueprint.md:90-98; canon/gm3_parity/03_teachers_and_distillation.md:7-13 |
360
+ | L-055 | **7** | 22211+0 | `-.NA`/rotations | Cayley orthogonality constraint + Newton-Schulz whitening | Q = (I-A)(I+A)^-1 guarantees pure rotation: det = 1.000 throughout, wins 76/84 unseen assays | canon/ryan_spearman_protein.md:19-23 |
361
+ | L-026 | **6** | 13211+0 | `SQ.A2`/recon | soft-hand loss (proximity REWARD, not penalty) | V256 D24: MSE 0.034 at 400ep - 37% better than the best unconstrained run (.054) | canon/structural_attractors.md:38-56 |
362
+ | L-054 | **6** | 13211+0 | `-.NA`/arms | quaternion composition as a structural regularizer (Hamilton product) | GeoQuat 0.916 -> 0.993 over 100 epochs vs best baseline 0.903 | canon/ryan_spearman_protein.md:12-18; canon/ryan_spearman_protein.md:26-29 |
363
+ | L-056 | **6** | 13221+0 | `-.NA`/architecture | cascade as a regularizer (multi-step MLP instead of a direct dimensional jump) | 9-step 256->64 gives 84.6% vs a direct jump's 29.6%; a 27-step r=.95 cascade EXCEEDS the root | canon/geometric_memory_blueprint.md:38-40 |
364
+ | L-057 | **6** | 13201+0 | `-.A3`/routing | Cantor router (soft weights derived FROM triangulation distances) | cos .9818 at 8 layers vs relay-alone .6533; geometry IMPROVES with more tokens | canon/constellation_forms.md:53-58 |
365
+ | L-022 | **6** | 22111+0 | `KL.A0`/logits | logit-KD at alpha <= 0.25 with founder exemption | mlp_kd lineage 2.4106 -> 2.3707 -> 2.3662 -> 2.3594 monotone ascent; replicates at s1 | history/timeline.md:396-410; history/timeline.md:570-583 |
366
+ | L-034 | **6** | 12221+0 | `SQ.A0`/codebook | entropy-balanced alignment cultivation (w = .05) | produced the emergent basin M = +/- ref EXACTLY - the sign-code convergence endpoint | canon/svae_h2_class.md:23 |
367
+ | L-045 | **6** | 12212+0 | `DET.A0`/simplices | L_CM - Cayley-Menger validity hinge (lambda = .01) | CM validity 100% across the lineage table | canon/ksimplex_diffusion_prior.md:18-23 |
368
+ | L-046 | **6** | 12211+0 | `DET.A0`/simplices | L_vol - volume-spread REWARD (-std(log|vol^2|), lambda = .005) | fragmented anatomy -> coherent composition; base fully preserved (purely additive) | canon/ksimplex_diffusion_prior.md:21-23 |
369
+ | L-047 | **6⟂** | 12211+0 | `SQ.A0`/shape-mean | Procrustes_SVD as a REGULARIZER (x 0.3 alongside a real force) | tightens CV (.19 vs .25) when it rides alongside InfoNCE | canon/geometric_memory_blueprint.md:22-24; canon/constellation_forms.md:26 |
370
+ | L-049 | **6** | 12221+0 | `-.NA`/anchors | anchor dropout (30%) | prevents collapse: 508/512 anchors active | canon/constellation_forms.md:27 |
371
+ | L-060 | **6** | 12221+0 | `-.NA`/data | data-level dampening (sqrt damping alpha=0.5, max_repeats=8, cap 1.25x) | NEVER equalize-to-largest: alpha=0 repeats 5 images ~50x/epoch | canon/subject_bucketing_anima.md:17-19 |
372
+ | L-064 | **6** | 12221+0 | `SQ.A0`/crystals | rose loss (role-weighted pentachoron regularization, rose_w = 1e-4) | 74.87% CIFAR-100 @ 393,216 params vs ~65% zero-shot and ~70-72% linear probe | canon/fibonacci_systems.md:29-33; canon/geovocab_chunking.md:24 |
373
+ | L-039 | **5** | 12111+0 | `CE.A7`/similarity-grid | contrastive dynamics as a CV-compression force | 100 clusters / 200 steps at d=128 -> CV .2451 (in band); 10 clusters -> .94 | canon/cv_band_origin.md:14-17 |
374
+ | L-053 | **5** | 12111+0 | `-.NA`/gradients | geometric autograd / gradient gating (Form 12 tangential-radial split) | gradients split tangential (pass) / radial (attenuate) / collapse-direction (attenuate) | canon/constellation_forms.md:83-86; canon/gm3_parity/02_optimizer_and_cv.md:7-18 |
375
+ | L-025 | **5** | 21212+0 | `SQ.A0`/shape-mean | projective-ICP / GPA consensus operator (lineage-core overwrite) | recovers planted truth |cos|=1.000 in 5 iterations; TASK-NEUTRAL on bpb, 2 seeds | history/timeline.md:417-437; history/timeline.md:570-595 |
376
+ | L-062 | **5** | 21222+1 | `-.A2`/data | usage / starvation reweighting (drives DATA sampling, NEVER a loss term) | the program's ONLY answer to load balancing: x2 upweight the starved anchor's DATA, 3-strike abort | closeout_2026-07-19/amoe/src/amoe/train/aligner.py:68-84; pod/v35_exp007_collective.py:248-262 |
377
+ | L-063 | **5** | 21221+0 | `-.NA`/conditioning | CFG dropout 0.1 (conditioning zeroed, not empty-prompt) | standard in every diffusion bed; never ablated in this program | pod2/dexp006_sd15core_relay.py:132-146 |
378
+ | L-021 | **5** | 11221+0 | `SQ.A2`/eps | Min-SNR gamma=5 weighting + velocity adjustment | part of a working recipe (1 ep, 10k synthetic, ~7 min on an L4); never ablated | canon/ksimplex_diffusion_prior.md:28 |
379
+ | L-058 | **3** | 01211+0 | `-.NA`/codebook | address-agreement bias (BUCKET - making a hard address differentiable) | exact softmax within sorted equal-width blocks masked to the same bucket; argmax alone is gradient-dead | canon/mother_threads.md:35-37; canon/constellation_forms.md:118-120 |
380
+ | L-069 | **3** | 00221+0 | `-.A2`/sequence-axis | predictability-weighted accumulation (PWA) | DESIGNED 2026-07-25: make the PREDICTABILITY PRINCIPLE a loss geometry instead of a discovered side effect | history/timeline.md:1062-1066; inventory/SCALE_MANIFEST.md:144-154 |
381
+
382
+ ## GAUGES - measure only, never in the gradient path
383
+
384
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
385
+ |---|---|---|---|---|---|---|
386
+ | L-071 | **10** | 33212+1 | `DET.A8`/anchors | CV as a READOUT (never a force) | the historical CV 'loss' was GRADIENT-FREE all along - .item() stripped the graph | canon/discovery_catalog.md:9-10; canon/aleph_core.md:40-41 |
387
+ | L-073 | **10** | 33222+0 | `-.A0`/bytes | bpb (bits per byte) - the AR line's verdict currency | certified band 2.469-2.499; addr_msl64 beats the unrestricted head 7/7 across seeds and budgets | inventory/SCALE_MANIFEST.md:53-58; history/timeline.md:139-147 |
388
+ | L-074 | **10** | 33222+0 | `-.A0`/logits | perplexity tax ladder (wikitext ppl delta, one shared gauge) | one always-on stack +9.23/+9.87 | monolith +3.66 | 5-anchor collective +11.0/+12.6 | UNGATED +91.6 | inventory/SCALE_MANIFEST.md:240-248; history/timeline.md:1156-1171 |
389
+ | L-075 | **10** | 33222+0 | `-.A0`/text | token-F1 (caption distribution-match delta) | 0.408 -> 0.706/0.704 (+0.30, |s0-s1| = 0.0019); the hub checkpoint reproduces 0.706 EXACTLY | inventory/SCALE_MANIFEST.md:155-166; history/timeline.md:1656 |
390
+ | L-080 | **10** | 33222+1 | `-.NA`/logits | toggle law - all anchors off is BIT-EXACT to the base model | max|dlogit| = 0.0 exactly at 0.8B on a hybrid DeltaNet/full-attention trunk; library-enforced | MANIFEST.md:171-172; closeout_2026-07-19/amoe/src/amoe/testing/invariants.py:76-97 |
391
+ | L-083 | **10** | 33222+0 | `-.A0`/codebook | usage perplexity / axis aliveness (read-only) | 125+/128 axes alive WITHOUT regularization - the standing refutation of load-balancing auxiliaries | canon/discovery_catalog.md:41-42; tools/geolip_vitals.py:108 |
392
+ | L-085 | **10** | 33222+1 | `-.A0`/anchors | blend-escape ratio (threshold 1.5) and damping ratio (target >= 3x) | specialists damped 5-11x but caption ESCAPES undamped at 0.1004 - the corollary that became the regime law | closeout_2026-07-19/amoe/src/amoe/laws.py:37-39; history/timeline.md:1961-1964 |
393
+ | L-089 | **10** | 33222+0 | `DET.A8`/anchors | CV@1000-batches early screen + the 3-tier filter | CV at 1000 batches PREDICTS the final band; turnaround ~2h -> ~7 min per config | canon/tri_band_omega_arc.md:21-27; canon/discovery_catalog.md:11-13 |
394
+ | L-092 | **10** | 33222+0 | `-.A0`/patches | resolution-invariance flatness (the debugging canary) | 4.5% MSE variance from 81 to 4096 patches; ~1% across a 36-config sweep - ANY shift means an upstream break | canon/discovery_catalog.md:20-22; canon/tri_band_omega_arc.md:67-70 |
395
+ | L-095 | **10** | 23222+1 | `-.NA`/hardware | peak_mem + s/step (the WDDM sysmem-spill tell) | the tell is ~100W/450W at '100% util' with no step prints - 42.8GB observed spilled to shared memory | MANIFEST.md:50-59; pod/run_g6b_rider.py:34-48 |
396
+ | L-077 | **9** | 33221+0 | `-.A0`/codes | register probe (sign-code inter-minus-intra Hamming separation) | THE PREDICTOR of the two-regime law: registers ~0.2-0.3 blend, domains ~0.35-0.5 specialize | canon/register_probe_gauge.md; inventory/SCALE_MANIFEST.md:38-42 |
397
+ | L-081 | **9** | 33212+0 | `-.A3`/bands | band-lesion surgical test (own vs cross damage) | surgical 3/3 both seeds at 50-200x; on a DiT edge bands hit cross-damage EXACTLY 0.0 | MANIFEST.md:70-76; history/timeline.md:1851-1864 |
398
+ | L-091 | **9** | 33212+0 | `-.A8`/spectra | spectral gauges: S0/S_D ratio, effective rank, the universal attractor | critical ratio ~6.5 triggers DISCHARGE; universal attractor S0 ~5.1, erank 15.88 +/- 0.04 across 48+ measurements | canon/structural_attractors.md:24-30; canon/discovery_catalog.md:5-7 |
399
+ | L-094 | **9** | 33221+0 | `-.A0`/structured-text | structured-task validity judges (JSON validity, IoU, pair-order, termination) | bbox 0 -> 0.6875 valid (0.894 IoU); the FORMAT TRAMPLING signature: 9/12 truncated_no_json | inventory/SCALE_MANIFEST.md:253-255; sessions/2026-07-14_pod.md:378-394 |
400
+ | L-076 | **9** | 23222+0 | `-.A0`/text | precision + invented-attribute rate (the hallucination decomposition) | precision 0.356 -> 0.694/0.705 and invented-attribute rate 0.200 -> 0.136/0.101, BOTH seeds | inventory/SCALE_MANIFEST.md:233-238; history/timeline.md:1679 |
401
+ | L-078 | **9** | 23222+0 | `-.A8`/codes | sign_fidelity (Spearman of code-Hamming vs true angular distance) | PROMOTED: separates inheritance from lottery where bpb CANNOT - successors lock at .9555-.9558, spread < .001 | history/timeline.md:476-521; inventory/SCALE_MANIFEST.md:67-69 |
402
+ | L-086 | **9** | 23222+0 | `-.A0`/text | composition score (the controller prereg gauge) | the chaining wall: components >= 0.96 solo, composite 0.0 for EVERY config | inventory/SCALE_MANIFEST.md:261-270; history/timeline.md:1657-1660 |
403
+ | L-088 | **9** | 23222+0 | `-.A0`/gradients | grad_norm_spread (gradient democracy monitor) | reference failure it exists to catch: 20 orders of magnitude across unequalized towers | tools/geolip_vitals.py:160-173; canon/fibonacci_systems.md:14-20 |
404
+ | L-097 | **9** | 23222+0 | `-.A0`/text | held-out byte accuracy (rule induction) and variant-format recall (the format lock) | teachers memorize at 1.000 train but induce at 0.270/0.245 held-out; memorized content is BOUND to surface form | history/timeline.md:783-806; history/timeline.md:794-800 |
405
+ | L-098 | **9** | 23222+0 | `-.A0`/codes | key-durability gauge (nearest-neighbour symbol Hamming + key drift) | sign-code keys disagree on ~91% of symbols; match rate at theta=0.25 is 0.000 EVERYWHERE | history/timeline.md:868-894 |
406
+ | L-099 | **9** | 23222+0 | `-.A0`/codebook | basin mean_cos (BASIN SET AT INIT) | 192-bank sweep: epoch_1 .8632 / best .8635 / final .8615 - delta 0.0017 BELOW the within-phase std | MANIFEST.md:124-127; canon/tri_band_omega_arc.md:71-75 |
407
+ | L-100 | **9** | 22222+1 | `DET.A8`/simplices | cv_reference_check (fp64 parity against the source of truth) | exact parity (relative 0.0) at fp64 against geovocab2, at ~260x the speed | MANIFEST.md:32-39; tools/geolip_vitals.py:78-103 |
408
+ | L-079 | **8** | 23212+0 | `SQ.A3`/band-routed | role-aligned in-bed gauge (HIGH-band foreground-masked LP-x0) | PROMOTED: found a ~10% multiband win that EVERY aggregate comparison hid | history/timeline.md:1465-1479 |
409
+ | L-082 | **8** | 23212+0 | `-.A6`/routing | repeated-key null + matched-vs-mismatched deltas | the instrument that falsified address-as-key: routing excess 2.5e-06 over the null | inventory/SCALE_MANIFEST.md:203-208; history/timeline.md:1611-1629 |
410
+ | L-096 | **8** | 22222+0 | `-.A0`/anchors | consensus drift / stationarity gauge | ROBUST for structured configurations (0.003 drift by g2, both seeds) but SEED-DEPENDENT for a lone flat book | inventory/SCALE_MANIFEST.md:79-86; canon/gm3_parity/01_inherited_object.md:77-85 |
411
+ | L-090 | **7** | 22211+0 | `-.A8`/codebook | void topology beta_2/axis (persistent homology on RP^(D-1)) | within the D=4 cohort every GEOMETRIC signal collapses while VOIDS rise; beta_2 vs recon MSE |rho| = 0.471 | canon/void_topology.md:27-63; canon/discovery_catalog.md:37-38 |
412
+ | L-084 | **6** | 13222+0 | `-.A0`/codebook | read perplexity + |cos to nearest atom| (the quantizer gauge) | read perplexity 14/64 atoms, |cos to nearest atom| 0.964, 64/64 alive - the representation LIES ON the codebook | inventory/SCALE_MANIFEST.md:14-16; canon/discovery_catalog.md:54-58 |
413
+ | L-087 | **6** | 13222+0 | `-.A0`/any | adapter_effect_mean - the VACUOUS guard | returns VACUOUS instead of a false PASS when the stack barely moves the loss | sessions/2026-07-21_comfyui_amoe_packaging.md:363-371 |
414
+ | L-093 | **6** | 12222+0 | `-.NA`/code | exec judge (guarded subprocess: restricted builtins, length cap, hard timeout, no network) | the write-0.0 floor was verified GENUINE off-pod, not a judge artifact | history/timeline.md:1634-1635; plans/2026-07-16_math_night_plan.md:46-51 |
415
+ | L-104 | **6** | 12222+0 | `-.A0`/codes | sign-code Hamming retrieval | 0.359 @1 against the continuous head's 0.494 - ~73% of its power from raw 64-symbol Hamming | sessions/2026-07-13.md:116-121 |
416
+
417
+ ### DISTRUSTED GAUGES - do not rate anything on these alone
418
+
419
+ Each was load-bearing until it was caught. Any entry whose headline rests on one takes the
420
+ -2 blind-gauge demotion (rule 2) until it is re-measured on a promoted gauge.
421
+
422
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
423
+ |---|---|---|---|---|---|---|
424
+ | L-072 | **8** | 32221+0 | `-.A0`/anchors | anchor drift -> 0.29154 rad + binding_fraction | the binding constant recurs across 5 architectures and 3 paradigms - but the drift-based fraction is a STAGE statistic | MANIFEST.md:115-116; history/timeline.md:231-241 |
425
+ | L-101 | **5** | 31221+0 | `-.A0`/gates | gate-mean band 0.012-0.03 (advisory, NOT universal) | held across 6 architectures and 2 optimizers - then MISSED on a 7th at 0.051-0.061 | MANIFEST.md:121; history/open_questions.md:31-33 |
426
+ | L-102 | **5** | 30220+0 | `SQ.A0`/eps | aggregate eps-MSE as a band-behaviour gauge | DISTRUSTED: moved 0.2% against +0.089 grounding effects in image space, and HID a ~10% multiband win | history/timeline.md:1402-1422; history/timeline.md:1465-1479 |
427
+ | L-103 | **2✖** | 20020+0 | `-.A0`/addresses | recon cosine as a judge for ADDRESSED systems | DISTRUSTED: an address is a LOOKUP KEY, not a compressor - judge drift and crushed CV instead | MANIFEST.md:115-116; history/open_questions.md:198-204 |
428
+
429
+ ## RETRACTED / DEMOTED / FORBIDDEN - the doctrine's proof set
430
+
431
+ **Each row below is the EVIDENCE for a standing law. This is not a graveyard and not an
432
+ appendix - these are the controls that turned results into laws. Cite them.**
433
+
434
+ Grouped by the law each row proves, not by entry.
435
+
436
+ ### absolute-beats-relative
437
+
438
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
439
+ |---|---|---|---|---|---|---|
440
+ | L-105 | **1†** | 30012+1 | `SQ.A10`/codebook | VQ / commitment / EMA codebook losses | THE NAMED PROHIBITION - and unnecessary: the codebook stays 125+/128 alive at div_weight = 0 | canon/aleph_core.md:16-18; MANIFEST.md:132-134 |
441
+ | L-106 | **1†** | 30012+1 | `CE.A0`/roster | comparative / relative selectors (argmax anchors, softmax-over-roster, STE one-hots, k-means alphabets) | roster-dependent; the gradient HOMOGENIZES - 14x path collapse, width attenuation, BN-on-padding, same disease | MANIFEST.md:135-138; canon/aleph_core.md:53-58 |
442
+ | L-107 | **1†** | 20011+1 | `CE.A0`/alphabet | gradient-learned alphabets (CAMPAIGN LAW 3) | fitted-frozen alphabets differentiate (1,594 unique paths); gradient-learned alphabets COLLAPSE (116) | MANIFEST.md:157-158; canon/acd_campaign.md:18-20 |
443
+ | L-108 | **1†** | 10011+0 | `SQ.A0`/crystals | direct gradient descent on pentachora | collapses them to zero - as FROZEN anchors the same crystals retain full cohesion and stay backtrackable | canon/geovocab_chunking.md:16-18 |
444
+ | L-118 | **1†** | 30012+1 | `SQ.A0`/routing | comparative routing on diffusion (state+sigma, raw address, M-hat address-as-key) | FALSIFIED THREE WAYS, 2 seeds: routing excess 2.5e-06 over the repeated-key null; match advantage -0.0 | MANIFEST.md:70-76; inventory/SCALE_MANIFEST.md:203-208 |
445
+
446
+ ### regime-law
447
+
448
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
449
+ |---|---|---|---|---|---|---|
450
+ | L-119 | **1†** | 20212+0 | `CE.A0`/logits | the controller hypothesis (a trainable anchor that orchestrates the others) | prereg required >= +0.15; measured -0.417 / -0.167. The passenger role is an ATTRACTOR | inventory/SCALE_MANIFEST.md:261-270; sessions/2026-07-14_pod.md:610-646 |
451
+ | L-120 | **1†** | 30112+1 | `CE.A0`/logits | always-on solo specialist stacks | MUTUALLY DESTRUCTIVE at n=48: the depth stack drives caption F1 to 0.0014 with termination 0.0 | MANIFEST.md:160-166; inventory/SCALE_MANIFEST.md:216-232 |
452
+ | L-121 | **1†** | 20212+0 | `CE.A0`/logits | frozen solo-trained expert collectives under aleph dispatch | no surgical independence (own-drop 0.04/0.00), NO damping (all five blend-regime, 0.86-1.6), composite 0.0 | inventory/SCALE_MANIFEST.md:169-178 |
453
+
454
+ ### instrument-design
455
+
456
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
457
+ |---|---|---|---|---|---|---|
458
+ | L-125 | **1†** | 10222+0 | `-.A6`/routing | shuffled-key null | CONFESSED INSTRUMENT FAILURE: it measures diversity, not correctness - the null scored like the real thing | history/timeline.md:1539-1548 |
459
+ | L-127 | **1†** | 20221+0 | `-.NA`/anchors | the exp021 seed-inversion claim for the trainable anchor | RETRACTED WITHIN HOURS: the claim compared DIFFERENT INSTRUMENTS across seeds | history/timeline.md:1697; hfstage/exp021_s1battery/README.md |
460
+ | L-133 | **1†** | 10222+0 | `-.NA`/sampling | deterministic (greedy) decoding in an iterative denoiser | collapses to the global mode: diversity 0.0, conditional == shuffled EXACTLY | sessions/2026-07-13.md:35-43 |
461
+
462
+ ### coordinate-law
463
+
464
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
465
+ |---|---|---|---|---|---|---|
466
+ | L-128 | **1†** | 10021+1 | `-.A3`/cantor-measure | hierarchical refinement in Cantor space | HARMFUL (-10%); parallel ADJACENT NON-OVERLAPPING bands are +3% | canon/cantor_empirics.md:5-18; MANIFEST.md:122-123 |
467
+ | L-129 | **1†** | 10021+1 | `-.A3`/cantor-measure | repeated boundary crossing in a measure space | KILLS gradients (catastrophic -> random). Enter and exit the measure space ONCE | canon/cantor_empirics.md:5-7; MANIFEST.md:122-123 |
468
+ | L-130 | **1†** | 20022+0 | `-.A3`/cantor-measure | the SOFT devil's staircase used as a BAND COORDINATE | NEW 2026-07-25: measured NON-MONOTONE - min slope -0.13 to -0.49 at EVERY level count on EVERY grid tested | .venv/Lib/site-packages/geofractal/model/positional/staircase.py:49-67; MANIFEST.md:90-96 |
469
+
470
+ ### aggregation-destroys
471
+
472
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
473
+ |---|---|---|---|---|---|---|
474
+ | L-109 | **1†** | 30022+1 | `-.A0`/patches | global average pooling in geometric encoders | 70% -> 29% collapse, REPLICATED independently in the protein line | MANIFEST.md:24; canon/discovery_catalog.md:17 |
475
+ | L-131 | **1†** | 10021+0 | `-.NA`/data | equalize-to-largest data balancing (alpha = 0) | repeats the 5-image bucket ~50x per epoch - 'the textbook way to overfit the long tail you were trying to protect' | canon/subject_bucketing_anima.md:17-21 |
476
+
477
+ ### consumption-law
478
+
479
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
480
+ |---|---|---|---|---|---|---|
481
+ | L-112 | **1†** | 20022+0 | `CE.A0`/coefficients | addr_head - coefficients to logits at a single hard tau | 5.6650 bpb COLLAPSED: usage ppl 1.88/64, TWO unique winners, win|cos| .9992 | history/timeline.md:1105-1118; history/timeline.md:1092-1104 |
482
+ | L-137 | **1†** | 20022+0 | `CE.A0`/coefficients | single hard-tau coefficient heads at ANY dimension | DEMOTED on the standing registry: collapse, and low-D was falsified as the fix | inventory/SCALE_MANIFEST.md:137-139 |
483
+
484
+ ### inheritance
485
+
486
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
487
+ |---|---|---|---|---|---|---|
488
+ | L-114 | **1†** | 20112+0 | `KL.A0`/logits | logit-KD at alpha = 1.0 from near-parity teachers | INVERSE EVOLUTION, compounding downward: 2.4301 -> 2.5046 -> 2.5603 | history/timeline.md:383-395; canon/gm3_parity/03_teachers_and_distillation.md:14-24 |
489
+ | L-122 | **1†** | 20222+0 | `-.NA`/weights | organ-only inheritance (projection + book transplanted onto fresh trunks) | BELOW random init, 2/2 lineages - sixteen random draws beat component inheritance | inventory/SCALE_MANIFEST.md:132-134; history/timeline.md:396-437 |
490
+
491
+ ### regime-transfer
492
+
493
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
494
+ |---|---|---|---|---|---|---|
495
+ | L-117 | **1†** | 20222+0 | `CE.A0`/coefficients | tied M-hat readout (U=M_hat, S=Omega-token, Vt=I) in an AR head | +1.0 bpb BOTH seeds and it STARVES the codebook (drift 0.02, binding 0) | history/timeline.md:715-736; canon/gm3_parity/01_inherited_object.md:77-85 |
496
+ | L-136 | **1†** | 10211+0 | `SQ.A0`/rotations | SVD-rotation transform in the dual-pentachoron head | DROPPED for convergence failure; reduced to scale + shift | canon/cayley_menger_foundations.md:36-38 |
497
+
498
+ ### cv-pressure
499
+
500
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
501
+ |---|---|---|---|---|---|---|
502
+ | L-110 | **1†** | 20011+0 | `DET.A0`/anchors | CV loss as backward injection / above the 1e-3 ceiling | MUST be a forward loss; above ~.001 the CV term dominates CE and trades discrimination for regularity | canon/constellation_forms.md:85-86; canon/geometric_memory_blueprint.md:87 |
503
+
504
+ ### force-vs-regularizer
505
+
506
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
507
+ |---|---|---|---|---|---|---|
508
+ | L-111 | **1†⟂** | 10112+0 | `SQ.A0`/shape-mean | Procrustes as a training FORCE | as a training loss: R@1 = 0.000, P_cos stuck at .094 for THIRTY EPOCHS | canon/geometric_memory_blueprint.md:22-24 |
509
+
510
+ ### infonce-placement
511
+
512
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
513
+ |---|---|---|---|---|---|---|
514
+ | L-113 | **2✖⟂** | 33011+0 | `CE.A7`/similarity-grid | InfoNCE into ADDRESS paths | BANNED despite R@1 .999 - it is the LOUDEST gradient and the bank learns IT instead of the useful signal | MANIFEST.md:135-137; tools/exp013_augmentation_bed.py:18 |
515
+
516
+ ### conditioning-law
517
+
518
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
519
+ |---|---|---|---|---|---|---|
520
+ | L-115 | **1†** | 30012+1 | `SQ.A5`/eps | blob structural supervision on the EPS objective | +0.03% / -1.0%, two seeds - the x0 recovery divides by a vanishing sqrt(alpha_bar) EXACTLY in the supervised band | MANIFEST.md:65-69; history/timeline.md:1465-1500 |
521
+
522
+ ### screening
523
+
524
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
525
+ |---|---|---|---|---|---|---|
526
+ | L-116 | **1†** | 20220+0 | `SQ.A0`/recon | MSE-first single-epoch keep-or-kill screening | DEAD: the lowest-MSE config was a HIGH-band false candidate | canon/tri_band_omega_arc.md:23-27 |
527
+
528
+ ### band-roles
529
+
530
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
531
+ |---|---|---|---|---|---|---|
532
+ | L-123 | **4⟂** | 31210+0 | `SQ.A3`/band-routed | HP/LP band-role objectives [judged by AGGREGATE eps-MSE] | 4/4 directional both seeds at 0.05-0.2% margins - 'nearly collinear with the base objective' | history/timeline.md:1394-1435 |
533
+
534
+ ### redundant-in-context
535
+
536
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
537
+ |---|---|---|---|---|---|---|
538
+ | L-124 | **5** | 21222+0 | `SQ.A0`/conditioning | frozen-address conditioning injected beside full text | real vs deranged -0.0009 beside full text; but ALONE the address steers at +0.0287 | inventory/SCALE_MANIFEST.md:209-210; history/timeline.md:1305-1318 |
539
+
540
+ ### question-space
541
+
542
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
543
+ |---|---|---|---|---|---|---|
544
+ | L-126 | **1†** | 10222+0 | `CE.A0`/logits | the sequences / baseconv expert gains | SELF-RETRACTED: question space 480 and 248 against 800 training draws per tier = MEMORIZED | history/timeline.md:1640 |
545
+
546
+ ### law2-placement
547
+
548
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
549
+ |---|---|---|---|---|---|---|
550
+ | L-132 | **1†** | 10122+0 | `CE.A0`/conv-filters | addr_conv - the decorative address (convex re-weighting of a filter bank) | DECORATIVE: a convex sum a_k = 1 is a hull-bounded perturbation of a MEAN; the 1x1 address is CONSTANT on grayscale (variance 4e-16) | history/timeline.md:1890-1896; sessions/2026-07-24_antipode_conv_decouple.md:24-30 |
551
+
552
+ ### no-balancing
553
+
554
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
555
+ |---|---|---|---|---|---|---|
556
+ | L-134 | **1†** | 30022+1 | `CE.A10`/routing | load-balancing / auxiliary router losses | BANNED and replaced by architectural equality; ZERO instances exist in the tree | history/progression_plan_2026-07-08.md:126-137; closeout_2026-07-19/amoe/src/amoe/core/dispatch.py:1-12 |
557
+
558
+ ### operator-ruling
559
+
560
+ | ID | RATE | RPDCI+L | CELL / SUBSTRATE | NAME | HEADLINE NUMBER | CITE |
561
+ |---|---|---|---|---|---|---|
562
+ | L-135 | **1†** | 00201+0 | `CE.A0`/logits | the big-JSON objective | FORMALLY DROPPED by operator ruling - too costly; 3-5 task adapters deliver more per GPU hour | history/timeline.md:1977-1981; sessions/2026-07-14_pod.md:813-817 |
563
+
564
+ ## MECHANISM NOTES
565
+
566
+ Keyed by ID so `grep L-115` finds both the row and its reasoning. Full notes live in
567
+ `inventory/loss_manifest.json`; `python skill/loss_view.py show L-115` prints one.
568
+
569
+ ## OPEN CONTRADICTIONS (never averaged, per rule 7)
570
+
571
+ 1. **CE vs the CV band.** One record has Form-1 CORE holding CV .2045 under cross-entropy;
572
+ the repo results table shows CV drifting **.238 -> .124 by ep50** against CE at weight
573
+ .01. Bears on L-003's doctrinal standing. **Settled by:** a same-config re-run, or a
574
+ provenance split showing the two runs are not the same configuration.
575
+ 2. **The Meridian s_cos plateau at .425.** Two recorded explanations - a 1280->1024
576
+ dimensional mismatch, or pooled-bank gradient loudness. Bears on L-020. **Settled by:**
577
+ re-running the bank at matched dimension.
578
+ 3. **soft-vs-mag is depth-scoped.** Magnitude leads +10.3 at 3 layers; soft ran AHEAD at 6
579
+ layers with cosine schedule. SCALE_MANIFEST already forbids stating the modulus finding
580
+ as a law. **Settled by:** both arms run to completion at depth.
581
+
582
+ ## CROSS-REFERENCES
583
+
584
+ - `canon/loss_accumulation_forms.md` - the taxonomy, the eleven format laws, the binning
585
+ procedure, the A10 statute.
586
+ - `inventory/SCALE_MANIFEST.md` - answers "what scales". This file answers "what is allowed
587
+ to pull, and on what evidence". A mechanism in both carries the other's ID.
588
+ - `canon/discovery_catalog.md` entry 26 - the three-primitive finding as a program-wide law.
589
+ - `inventory/EXPERIMENT_LINES.md` - resolves the line-qualified IDs used in citations.
590
+
591
+ ## AMENDMENTS (append-only, dated)
592
+
593
+ - **2026-07-25 - created.** Rubric v1, 137 entries, from three independent censuses.
594
+ Two findings NEW to the program are folded in as rows: the soft devil's staircase is
595
+ non-monotone and therefore inadmissible as a band coordinate (L-130), and alpha=0.5 is
596
+ the unique expectation-matching value for the staircase (L-044).
597
+ - **2026-07-25 - A0 AUDIT (the operator: "is A0 correct?").** Partially no, three ways: (1) two
598
+ PRIMARY misbins fixed - L-006 (HF labels= path is masked CE inside) and L-015
599
+ (derived-steps trains shift-CE with ignore_index=-100) both move A0 -> A4 per binning
600
+ rule 4; (2) the fallback bucket had swallowed 25 rows with NO residual-reduction
601
+ semantics (structural devices, optimizer/data disciplines, assertion protocols,
602
+ decoding policies, claims) - a category error, now an explicit **NA** class; (3) what
603
+ remains at A0 (71 of 138) is honestly dominant: plain means ARE the program default,
604
+ and the aleph's only pressure lives there. GAP stays at A0 deliberately - it IS a
605
+ uniform-mean accumulation, the format's cautionary instance.
606
+ - **2026-07-25 - pass 3 measured (same day).** L-070 (FAC) moved from UNRUN to a
607
+ scope-split pair: as a PRIMARY objective it is REFUTED as preregistered, 3/3 seeds
608
+ (loses to ce, to ce_fixedcode, and to fac_none on the bpb-of-record); on the
609
+ partition-collapse configuration (new L-138) a loss swap alone decompresses the
610
+ certified addr_head catastrophe (usage ppl 1.0-2.7 -> 60.6-61.1 of 64, decoded acc 0.05-0.20 -> 0.45-0.47,
611
+ 3/3 SEEDS, spread < 0.5) and dissolves the win|cos| saturation (0.9995+ -> 0.13) -
612
+ amending L-112's recorded geometry attribution. The collapse follows the loss.
README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - loss-functions
5
+ - research-record
6
+ - geometric-deep-learning
7
+ ---
8
+
9
+ # The Loss Manifest — companion repository
10
+
11
+ Companion to the article **"The Loss Manifest: A Field History of Objective
12
+ Functions, and What a Machine Can Actually Be Asked to Compute"**
13
+ (`article_loss_manifest.md` in this repo; also published on the author's blog).
14
+
15
+ 155 objective functions, regularizers, gauges, and prohibitions from a
16
+ multi-year geometric deep learning program — each rated 1-10 under a fixed,
17
+ recomputable rubric, each carrying its mathematics, its implementation home,
18
+ and its verdict with receipts. Failures ship alongside successes: the
19
+ retractions and prohibitions are first-class rows, because each is the
20
+ evidence for a standing law.
21
+
22
+ ## Contents
23
+ - `article_loss_manifest.md` — the article (canonical copy).
24
+ - `LOSS_MANIFEST.md` — the full rated registry, human-readable.
25
+ - `loss_manifest.json` — the machine-readable sidecar; every rating is
26
+ recomputable from its six sub-scores + the lookup table + the nine rules.
27
+ - `code/loss_forms.py` — the composable loss library (4 differencing
28
+ primitives, accumulation formats A0-A8, the campaign candidates, the
29
+ force-gated forbidden controls, self-smoke).
30
+ - `code/compartment_smoke.py` — the 22-test formula-smoke battery, including
31
+ the two calibrated pre-spend gates (conditioning + collinearity).
32
+ - `code/fac_bed.py`, `code/deviant_bed.py`, `code/geobasin_bed.py` — the
33
+ campaign beds (cosh-Bregman/FAC matrix; the deviant roster matrix; the
34
+ recovered CE-replacement geometric arm under full controls).
35
+ - `code/ar_differentiation_bed.py`, `code/geolip_vitals.py`,
36
+ `code/loss_view.py` — the certified byte bed, the shared read-only gauge
37
+ harness, and the registry viewer/linter.
38
+ - `runs/` — the raw run ledgers (JSONL) behind every trained verdict in the
39
+ article's era-six tables.
40
+
41
+ ## Quick start
42
+ ```bash
43
+ pip install torch # cu-enabled build recommended
44
+ python code/loss_forms.py # library self-smoke
45
+ python code/compartment_smoke.py # the 22-test battery + gates
46
+ python code/loss_view.py card --json loss_manifest.json
47
+ ```
48
+ Beds default their data root to `$GEOLIP_DATA` (or `./data`) and download
49
+ wikitext bytes on first use.
50
+
51
+ ## The program's lines (evidence trails)
52
+ [Qwen3.5 adapter line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) ·
53
+ [Qwen2.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen) ·
54
+ [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) ·
55
+ [differentiation line](https://huggingface.co/AbstractPhil/geolip-aleph-differentiation) ·
56
+ [amoe-lora](https://github.com/AbstractEyes/amoe-lora) ·
57
+ [classification line](https://github.com/AbstractEyes/geolip-aleph-classification) ·
58
+ [geolip-svae](https://github.com/AbstractEyes/geolip-svae) ·
59
+ [geofractal](https://github.com/AbstractEyes/geofractal)
60
+
61
+ Field reports: [ft1](https://huggingface.co/blog/AbstractPhil/aleph-autoregressive-differentiation-ft1) ·
62
+ [ft2](https://huggingface.co/AbstractPhil/geolip-aleph-qwen/blob/main/article_ft2.md) ·
63
+ [ft3](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct/blob/main/article_ft3.md)
64
+
65
+ Internal citations in the registry (file:line anchors into the program's
66
+ research record) are preserved verbatim for provenance integrity.
article_loss_manifest.md ADDED
@@ -0,0 +1,612 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The Loss Manifest: A Field History of Objective Functions, and What a Machine Can Actually Be Asked to Compute
2
+
3
+ *One hundred and fifty-five objective functions, regularizers, gauges, and
4
+ prohibitions from a multi-year geometric deep learning program — each rated,
5
+ each with its receipts, failures shipped alongside successes. Read it as a
6
+ blueprint of a long experiment in computable mathematics: years of drilling
7
+ machines to find out which structures gradient descent can cultivate in a
8
+ reasonable amount of time, and which it cannot.*
9
+
10
+ ---
11
+
12
+ ## Why keep a manifest of losses
13
+
14
+ Every result in a deep learning paper is downstream of a decision the paper
15
+ rarely examines: what, exactly, was the machine asked to compute? The loss is
16
+ the entire interface between mathematics and learning. It decides what is
17
+ expressible, what is reachable, and what silently cannot happen no matter how
18
+ long you train.
19
+
20
+ This program has been probing that interface for years, across byte-level
21
+ autoregressive models, CLIP-family alignment systems, diffusion U-Nets and
22
+ DiTs, vision classifiers, and adapter mixtures on frozen language-model
23
+ trunks. The through-line was never any single task. It was a single question
24
+ asked over and over in different geometries: **is this structure computable by
25
+ differential generation — can the gradient path itself cultivate it — or does
26
+ it only look computable on paper?**
27
+
28
+ Mathematics is generous; optimization is not. A structure can be perfectly
29
+ well-defined, provably expressive, and still be unreachable in practice —
30
+ because its gradient homogenizes, because its partition function couples every
31
+ axis to every other, because its measure collapses without a normalization
32
+ term, because its worst case is irreducible noise. If everything well-defined
33
+ were also cheaply computable, this manifest would be short and boring. It is
34
+ neither, because the universe of trainable mathematics is much smaller than
35
+ the universe of mathematics, and finding its boundary is empirical work.
36
+
37
+ So we kept the ledger. All of it: the objectives that carried entire product
38
+ lines, the regularizers that turned out to be gradient-free the whole time,
39
+ the elegant formulations that collapsed on contact, the
40
+ retractions, the prohibitions with their evidence attached. The result is a
41
+ manifest of successes **and failures** for a large family of structures —
42
+ which we would argue is more useful experimental substrate than another
43
+ benchmark table, precisely because the failures are load-bearing: each one
44
+ marks a place where the computability boundary was located by direct contact.
45
+
46
+ Everything below is traceable. The campaign evidence lives in public
47
+ repositories ([the Qwen3.5 adapter line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct),
48
+ [the Qwen2.5 predecessor line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen),
49
+ [the diffusion adapter line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters),
50
+ [the amoe-lora framework](https://github.com/AbstractEyes/amoe-lora),
51
+ [the classification line](https://github.com/AbstractEyes/geolip-aleph-classification),
52
+ [geolip-svae](https://github.com/AbstractEyes/geolip-svae),
53
+ [geofractal](https://github.com/AbstractEyes/geofractal),
54
+ [the differentiation line](https://huggingface.co/AbstractPhil/geolip-aleph-differentiation)), and the story so
55
+ far is told in three prior field reports:
56
+ [part 1](https://huggingface.co/blog/AbstractPhil/aleph-autoregressive-differentiation-ft1),
57
+ [part 2](https://huggingface.co/AbstractPhil/geolip-aleph-qwen/blob/main/article_ft2.md),
58
+ and [part 3](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct/blob/main/article_ft3.md).
59
+
60
+ ---
61
+
62
+ ## The structural finding: three primitives wide, eleven formats deep
63
+
64
+ The manifest began with a census: three independent sweeps over the program's
65
+ record — its canon of verdicts, its history layer, and its full code tree, looking for every term that ever received a backward
66
+ pass. The census found something we did not expect and now consider the
67
+ organizing fact of the whole record:
68
+
69
+ > **Until this week's campaign deliberately built its challengers, only three
70
+ > differencing primitives had ever been back-propagated in this program:
71
+ > cross-entropy, squared error, and KL divergence** (plus float64 determinants
72
+ > on the gauge side, and one arm-gated exception). No margin loss, no triplet,
73
+ > no hinge, no load-balancing auxiliary existed anywhere in the historical
74
+ > tree. Everything that looked like a distinct objective was one of those
75
+ > three primitives under a different **accumulation format**: InfoNCE is
76
+ > cross-entropy accumulated over an N×N similarity grid; structural blob
77
+ > supervision is squared error, dose-coupled and routed to one noise band;
78
+ > frequency-role objectives are squared error under a cosine crossfade. (The
79
+ > campaign then widened the space on purpose — a fourth, Bregman-class
80
+ > primitive and a sparse partition were built precisely to test the boundary,
81
+ > and the margin family was retested under controls. Their verdicts are in
82
+ > era six and in the roster.)
83
+
84
+ So the program's loss surface is **three primitives wide and eleven
85
+ accumulation formats deep**, and nearly every discovery in this manifest lives
86
+ on the second axis. Two receipts make the point sharply:
87
+
88
+ - The worst training collapse in the byte-level line (a coefficients-to-logits
89
+ head at a single hard temperature: 5.67 bits per byte, address usage
90
+ perplexity 1.88 of 64 — two winners starve sixty-two axes) was **cured by
91
+ changing accumulation only**: split the read into parallel slots and the
92
+ same cross-entropy lands at 2.47. Identical primitive, different
93
+ aggregation, night and day.
94
+ - Chunked cross-entropy — sum per chunk, divide once by the global token count
95
+ — is *mathematically identical* to plain cross-entropy and operationally a
96
+ five-fold memory law: on one recorded configuration, 22.8 GB of dedicated
97
+ VRAM plus 42.8 GB silently spilled to shared memory became 8.8 GB at 1.03
98
+ seconds per step. A law of practice that lives entirely in the reduction
99
+ schedule.
100
+
101
+ The eleven formats range from the uniform mean (honestly dominant: 84 of 155
102
+ entries — plain means are the program's default, and its founding objective
103
+ lives there) through chunk-renormalized, per-sample-then-weighted,
104
+ band-crossfaded, masked-denominator, dose-coupled, paired-difference,
105
+ grid-pairwise, and float64-accumulated forms, down to two cells empty of working
106
+ objectives. One (raw sum, no denominator) held nothing for the program's
107
+ entire history — the scale rides on batch and sequence length, so learning
108
+ rates stop transferring — until this campaign trained its first member, a
109
+ worst-position accumulation, and refuted it on schedule. The other holds only
110
+ prohibitions, by statute, and is the single most informative cell in the
111
+ grid: **accumulation that carries state across steps** — EMA codebooks,
112
+ commitment counters, k-means centroids, the entire VQ-VAE bookkeeping family
113
+ ([van den Oord et al., 2017](https://arxiv.org/abs/1711.00937)) — contains
114
+ exactly two entries, and both are prohibitions. Not one working objective in
115
+ the program's history has ever needed it. The empirical warrant: the program's
116
+ learned codebooks stay 125+ of 128 axes alive with the diversity weight set to
117
+ zero. Where the standard literature reaches for a balancing term, this record
118
+ says the geometry, correctly constructed, balances itself.
119
+
120
+ ---
121
+
122
+ ## How the ratings work, and what a 10 means
123
+
124
+ Every entry carries a 1–10 rating, and the rating deliberately does **not**
125
+ answer "how big is the effect." It answers: **how much would we stake on this
126
+ term in a new, unseen experiment?** Six sub-scores (replication across seeds
127
+ and substrates; measured potency against the term's own gauge noise; doctrinal
128
+ fit; cost; instrument risk; and a bonus for findings that are enforced in
129
+ code, not just prose) feed a fixed lookup table, and then nine hard rules
130
+ bind, in order. The ones that do the most work:
131
+
132
+ - anything never run caps at 3 — a beautiful design does not score on paper;
133
+ - a headline resting on an instrument later shown blind takes a penalty until
134
+ re-measured;
135
+ - single-seed evidence caps at 6; sub-1% margins cap at 5;
136
+ - **any formal retraction floors the entry at 1, unconditionally** — retracted
137
+ entries never compete, they testify;
138
+ - contradictory records get a range, never an average; and every sub-score
139
+ digit must carry a citation or the entry caps as if unrun.
140
+
141
+ Three calibration pairs prove the rubric measures what it claims:
142
+
143
+ 1. **The same objective rates 8 and 4 in adjacent rows** — frequency-band role
144
+ objectives judged by a role-aligned gauge versus the same objective judged
145
+ by an aggregate error that was later shown blind to band structure. The
146
+ only difference is the instrument. That pair is the price of gauge
147
+ blindness, made explicit.
148
+ 2. **The same operator rates 6 and 1** — Procrustes alignment as a mild
149
+ regularizer beside a real training force (it tightens geometric regularity)
150
+ versus Procrustes as the training force itself (retrieval 0.000, stuck for
151
+ thirty epochs). Placement decides load-bearingness.
152
+ 3. **The most potent term in the census rates 2.** InfoNCE
153
+ ([van den Oord et al., 2018](https://arxiv.org/abs/1807.03748)) is, by
154
+ measured effect, the strongest alignment force in the record — swap it in
155
+ and retrieval goes to 0.999. It is also the loudest gradient in the
156
+ program: representation banks learn *it* instead of the signal you wanted,
157
+ and it is banned from address pathways outright. Potency and
158
+ trustworthiness are different axes. The plainest entry in the record —
159
+ mean-squared reconstruction driven to bitwise exactness — rates 10.
160
+
161
+ ---
162
+
163
+ ## A short history, told as computability results
164
+
165
+ ### Era one: reconstruction, and the discovery that codes are free
166
+
167
+ The founding result of the program is that **reconstruction pressure alone —
168
+ squared error, uniform mean, nothing else — will cultivate discrete structure
169
+ that most of the literature builds special machinery to obtain.** A small
170
+ spherical autoencoder driven by plain MSE converged sixteen noise types
171
+ simultaneously and ended at bitwise-exact text reconstruction; its learned
172
+ codebook converged to a *sign code* — rows equal to ± reference vectors at
173
+ floating-point precision — with no vector-quantization loss, no commitment
174
+ term, no EMA, no straight-through trick at the objective level. Read the
175
+ signs, not the probabilities.
176
+
177
+ That pair of entries sits at the top of the manifest because everything else
178
+ in the program leans on it: the addressing mechanism at the center of these
179
+ lines (a signed softmax over oriented half-axes, with sinh in the numerator
180
+ and cosh in the denominator) receives its **only** training pressure through
181
+ reconstruction gradients. In computability terms: discrete codes are
182
+ computable by differential generation, cheaply and stably — *if* the pressure
183
+ is absolute (match this target) rather than comparative (beat those rivals).
184
+ That distinction became the program's oldest law, and this week it received
185
+ its sharpest confirmation yet (see era six).
186
+
187
+ ### Era two: geometry as force versus geometry as readout
188
+
189
+ The program spent a long time learning where geometric structure may be
190
+ *pushed* and where it may only be *watched*. The pivotal discovery is almost
191
+ embarrassing and we publish it anyway: the historical "volume-regularity loss"
192
+ — a coefficient-of-variation statistic over Cayley–Menger simplex volumes,
193
+ believed for months to be shaping representations — turned out to be
194
+ **gradient-free the whole time** (a `.item()` call had severed it from the
195
+ graph). The geometry it was credited with had emerged on its own. That
196
+ accident became a law: *geometric statistics are readouts, never forces*, with
197
+ exactly one sanctioned exception — a micro-weighted (1e-3, hard ceiling)
198
+ forward CV term on a specific anchor bank, arm-gated, where bare cross-entropy
199
+ measurably drifts the regularity band and the micro-force holds it at zero
200
+ task cost.
201
+
202
+ The rest of the era's entries chart the same boundary from different sides.
203
+ Sphere normalization — one line of code, no loss term — ended a family of
204
+ spectral collapses outright and is the founding case for "geometry is
205
+ regularization: build it in, don't penalize toward it." Direct gradient
206
+ descent on pentachoron crystals collapses them to zero; the same crystals held
207
+ frozen retain full cohesion — placement by construction beats placement by
208
+ hope. Margin-family heads (SphereFace, CosFace, ArcFace —
209
+ [Liu et al., 2017](https://arxiv.org/abs/1704.08063);
210
+ [Wang et al., 2018](https://arxiv.org/abs/1801.09414);
211
+ [Deng et al., 2019](https://arxiv.org/abs/1801.07698)) were explored in a
212
+ vision-transformer lineage and hit a ceiling attributable to the architecture
213
+ around them rather than the margins themselves. A "soft hand" objective — a
214
+ *reward* that boosts the reconstruction gradient near a geometric target
215
+ rather than penalizing distance from it — produced the best run of its sweep
216
+ and one adverse finding worth more than the win: sustained moderate boost
217
+ teaches the model to optimize for staying in the boost zone. Pressure toward a
218
+ zone is computable; residence in the zone as a goal corrupts.
219
+
220
+ ### Era three: alignment, and the loudest gradient
221
+
222
+ The multi-system alignment era established two placement laws that the rubric
223
+ now encodes as calibration pairs. InfoNCE is *necessary and sufficient* as the
224
+ alignment force — and catastrophic anywhere near an addressing pathway,
225
+ because grid-pairwise accumulation makes every off-diagonal element a
226
+ gradient contributor and the bank learns the loss instead of the sequence
227
+ signal. Procrustes analysis measures alignability and cannot create it.
228
+ Knowledge distillation ([Hinton et al., 2015](https://arxiv.org/abs/1503.02531))
229
+ earned a statute with teeth after a genetic-selection experiment: distilling
230
+ at full weight from near-parity teachers produces *inverse evolution* —
231
+ best-of-round degrading monotonically across three generations — because
232
+ children anchor to teacher level and selection feeds the degradation back.
233
+ Tamed (weight ≤ 0.25, never on founders, never inside a selection loop without
234
+ a quality gap), the same primitive is a clean positive, and in its
235
+ row-routed form it demonstrated genuine dark-knowledge transfer: students
236
+ matching or exceeding teachers on *held-out rule induction* while the teachers
237
+ themselves had merely memorized.
238
+
239
+ ### Era four: diffusion, and the conditioning law
240
+
241
+ The diffusion line contributed the manifest's most transferable single result.
242
+ Identical auxiliary structural supervision — foreground-masked, low-passed
243
+ squared error on the recovered clean image, dose-coupled at λ≈1 — **pays
244
+ −5.9%/−3.7% on a rectified-flow trunk and is inert (+0.03%/−1.0%) on an
245
+ epsilon-prediction trunk, a 125–200× effect ratio at two seeds each.** The
246
+ mechanism is exact: flow recovery of the clean image is linear at every noise
247
+ level, while epsilon recovery divides by a vanishing signal coefficient
248
+ precisely in the supervised band
249
+ (cf. [Liu et al., 2022](https://arxiv.org/abs/2209.03003);
250
+ [Lipman et al., 2022](https://arxiv.org/abs/2210.02747)). Generalized, this is
251
+ the **conditioning law**: *an auxiliary term pays only where the supervised
252
+ quantity is recoverable from the prediction through an exact, well-conditioned
253
+ map* — a computability criterion you can evaluate before spending a GPU-hour,
254
+ and now the first of two pre-spend gates the program runs on every new loss
255
+ design.
256
+
257
+ The same era produced the manifest's best accumulation success and its
258
+ cleanest inertness. Cosine-crossfade band windows over the noise axis — a
259
+ partition of unity entering both the forward pass and the loss — manufacture
260
+ surgically decoupled specialists with **no routing loss at all** (own-band
261
+ lesion damage 50–200× cross-band; on a diffusion transformer the edge bands
262
+ reached cross-damage of exactly 0.0). Meanwhile frequency-reweighted "role"
263
+ objectives moved nothing (0.05–0.2% margins), and the diagnosis became the
264
+ second pre-spend gate: their gradients were 99.2–99.7% collinear with the
265
+ base objective. **A reweighting of the same residual is still the same
266
+ pressure.** The payers differ in supervised *quantity* and *mask*, not in
267
+ weight — measured at 0.715 gradient novelty for the paying term against
268
+ 0.003–0.008 for the inert ones.
269
+
270
+ ### Era five: the adapter campaigns, and what cross-entropy actually teaches
271
+
272
+ Two full adapter campaigns on frozen language-model trunks (a 0.5B and then a
273
+ 0.8B hybrid vision-language model) supplied the workhorse rows: plain,
274
+ shift-masked, and chunked cross-entropy; the HuggingFace labels path; and the
275
+ best-evidenced positive supervision result in the record — **derived-steps
276
+ supervision**, where training targets carry worked derivations instead of bare
277
+ answers. It beat direct-answer supervision on held-out generalization at
278
+ ceiling (1.00/1.00), replicated across seeds to four decimal places, and
279
+ produced the campaign's first positive off-domain spillover. The same
280
+ campaigns minted the laws that guard every later row: the *question-space
281
+ law* (training-question space must exceed draws threefold, or the loss teaches
282
+ memorization — discovered by self-retraction when two "experts" passed an
283
+ answer-diversity guard while memorizing); the *toggle law* (all adapters off
284
+ must be bit-exact to the base model — max logit delta 0.0, enforced in code);
285
+ and the *blend-escape* diagnostics that grew into a two-regime dispatch law.
286
+
287
+ The era also filled the proof set. A "controller" anchor hypothesis was
288
+ refuted at preregistration bars and its failure mechanism classified. Solo
289
+ always-on specialist stacks proved mutually destructive at n=48. And the
290
+ consumption-pattern law localized collapse precisely: it is a property of
291
+ *how coefficients are consumed* — a single hard-temperature softmax starves
292
+ non-winners at any dimensionality — not of the address, and slot-parallel
293
+ accumulation cures it with the primitive untouched.
294
+
295
+ ### Era six: the loss campaign — the boundary, measured directly
296
+
297
+ Everything above set up the question this week finally asked head-on: is
298
+ cross-entropy itself the right thing to ask a machine to compute, and if not
299
+ where, exactly, does it fail? Five results — every trained one preregistered at three seeds on a
300
+ certified byte-level bed:
301
+
302
+ **1. Cross-entropy's failure mode is its partition function, and the failure
303
+ is graded.** The Hessian of CE in logit space has an exact null direction and
304
+ a spectrum that collapses precisely as the model commits — the same shape as
305
+ the conditioning law's vanishing coefficient, now inside the loss itself. We
306
+ built the substrate-native alternative: since CE is the Bregman divergence of
307
+ log-sum-exp ([Bregman, 1967](https://doi.org/10.1016/0041-5553%2867%2990040-7);
308
+ [Banerjee et al., 2005](https://jmlr.org/papers/v6/banerjee05b.html)), and the
309
+ addressing mechanism's own potential is a sum of hyperbolic cosines, the
310
+ matching loss is the Bregman divergence of Σcosh — curvature bounded below by
311
+ one everywhere, no null direction, no partition function, antipodally
312
+ symmetric by construction.
313
+
314
+ **2. In open field, cross-entropy won — as preregistered bars, 3/3 seeds.**
315
+ The cosh-Bregman code loss lost to CE, lost to CE-through-a-frozen-readout,
316
+ and lost even to its own no-geometry control. Where CE is healthy, nothing we
317
+ built beats it, and we publish that plainly.
318
+
319
+ **3. Where CE's coupling is the disease, decoupling is the cure — and it's a
320
+ dose-response.** On the certified collapse configuration, with parameters and
321
+ compute identical and only the loss swapped: full coupling (CE) leaves address
322
+ usage at 1.85 of 64 axes with saturation 0.9997; a *partially* coupled
323
+ partition (sparsemax — [Martins & Astudillo, 2016](https://arxiv.org/abs/1602.02068))
324
+ decompresses to 23.5 of 64; zero coupling (the cosh-Bregman form) reaches 60.9
325
+ of 64, with decoded accuracy climbing 0.11 → 0.417 → 0.456. **Monotone on
326
+ every gauge, three seeds per point.** A two-year-old diagnosis blaming the
327
+ geometry was amended: the collapse follows the loss.
328
+
329
+ **4. The deviant sweep calibrated the instruments as much as the losses.** A
330
+ roster of strange forms — focal ([Lin et al., 2017](https://arxiv.org/abs/1708.02002)),
331
+ label smoothing ([Szegedy et al., 2016](https://arxiv.org/abs/1512.00567);
332
+ [Müller et al., 2019](https://arxiv.org/abs/1906.02629)), a confidence
333
+ penalty ([Pereyra et al., 2017](https://arxiv.org/abs/1701.06548)),
334
+ worst-position and geometric-mean accumulations, an anti-curriculum — was
335
+ gate-measured and then trained without exception. Nothing beat CE. The
336
+ gate-refused confidence penalty landed closest to CE of all arms, validating
337
+ the gate's refusal mode against training reality; the two highest-novelty
338
+ accumulations failed exactly as flagged (one chases irreducible entropy — the
339
+ worst positions of natural text are not computable structure, they are noise;
340
+ the other starves the hard positions and the distribution never forms). The
341
+ protocol finding: **novelty is state-dependent** — commitment-dependent forms
342
+ are invisible to gates run at initialization and must be gated at a trained
343
+ state as well. And novelty is necessary, never sufficient: it screens out
344
+ inertness; only the bed decides benefit.
345
+
346
+ **5. The oldest law held its hardest test.** The program's one previous
347
+ attempt at replacing cross-entropy entirely — a pure geometric basin loss set
348
+ (attraction, repulsion, margin, range) from an earlier classification line —
349
+ was recovered *verbatim* from its original source and retested under full
350
+ controls, including CE run on the identical score head. The full set was
351
+ refuted decisively (−68% relative accuracy — its historical −12% showing was
352
+ flattered by its original substrate). But the arm that dropped the two
353
+ roster-comparative terms and kept only the absolute ones **more than doubled
354
+ the full set** (0.349 vs 0.157 accuracy, 3/3 seeds). *Absolute beats
355
+ relative*, confirmed inside the CE-replacement family itself: the comparative
356
+ terms are the poison. The bed's loss landscape now shows two clean clusters —
357
+ absolute-target objectives at 3.75–4.13 bits per byte, partition-coupled
358
+ cross-entropy at 2.48–2.61 — with the space between them mapped by the coupling
359
+ dial.
360
+
361
+ ---
362
+
363
+ ## What is computable, then?
364
+
365
+ Collapsing the manifest to its computability verdicts:
366
+
367
+ **Computable by differential generation, certified here:** discrete sign codes
368
+ via pure reconstruction; surgical specialist structure via positional
369
+ crossfade windows (no router, no balancing term); structural supervision
370
+ wherever the supervised quantity is linearly recoverable; derived-steps
371
+ reasoning supervision; decoupled per-axis code supervision *at coupling-driven
372
+ collapse sites*; and near-uniform codebook aliveness with no diversity
373
+ pressure at all.
374
+
375
+ **Not computable in reasonable time, located by direct contact:**
376
+ gradient-learned alphabets (they collapse; fitted-frozen ones differentiate);
377
+ pentachora under direct descent; selection events in the compute path
378
+ (comparative selectors homogenize their own gradient); hierarchy imposed in
379
+ class space (below-chance, not merely taxed); worst-position training on
380
+ natural text (the worst positions are irreducible); target-zone residence as
381
+ an objective; and balancing-by-loss of things that balance themselves.
382
+
383
+ **Conditional, with the condition now measurable:** every auxiliary term,
384
+ via the conditioning gate (is the supervised quantity recoverable through a
385
+ well-conditioned map?) and the collinearity gate (is the added pressure a
386
+ genuinely different direction, novelty ≥ 0.3, or a reweighting in costume?).
387
+ Both gates are calibrated against known outcomes (refusal fires below 0.05
388
+ novelty; the payer class begins near 0.3). One refused a design this week
389
+ that training then confirmed was inert; the other reproduces, retroactively
390
+ and exactly, the split that cost the record a wasted arm before the gate
391
+ existed.
392
+
393
+ That is the blueprint this manifest offers: not a leaderboard, but a mapped
394
+ boundary — with instruments for extending it that cost seconds, not
395
+ GPU-days.
396
+
397
+ ## Using the roster
398
+
399
+ The tables below address every entry in the record: what it is
400
+ mathematically, what it was for, what became of it, where it can be run
401
+ today, and why it holds its rank. Ratings answer "how much would we stake on
402
+ this in a new bed." The daggers mark the proof set — retractions and
403
+ prohibitions kept as first-class citizens, because each is the evidence for a
404
+ standing law, and because a manifest of failures with receipts is the part of
405
+ the record you cannot get from papers that publish only what worked.
406
+
407
+ The open cells are marked too, and they are the invitation: the untested
408
+ program-native forms (a hyperbolic-distance objective for a sinh/cosh-native
409
+ substrate; rotor-decode reconstruction; simplex-closure sequence losses), the
410
+ gauge-to-force promotions each pinned to the lesson of the force that was
411
+ never a force, and the coupling dial between the two measured clusters. We
412
+ will be working from this list in the coming days; it is published so that
413
+ anyone can.
414
+
415
+ ---
416
+
417
+ ## THE ROSTER — all 155 entries
418
+
419
+ ### Rated 10 — certified bedrock (17 entries)
420
+
421
+ | ID | R | entry | the mathematics | verdict on record | lives at |
422
+ |---|---|---|---|---|---|
423
+ | L-001 | 10 | MSE -> bitwise reconstruction (SVAE H2, 16 noise types) | `L = mean((dec(z) - x)^2); convergence endpoint = bitwise-exact recon` | 16 noise types converge simultaneously; bitwise text recon; the two-year survivor | [geolip-svae](https://github.com/AbstractEyes/geolip-svae) |
424
+ | L-002 | 10 | recon gradient through M-hat (the aleph's ONLY codebook pressure) | `M_hat = sum_k sinh(u_k)A_k / sum_k cosh(u_k), u = cos(x,A)/tau; L = mean((dec(M_hat)-x)^2); codebook grad ONLY…` | cos .992-.997 hard-mode, 125-126/128 axes alive, ZERO collapse, div_weight=0 | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
425
+ | L-044 | 10 | Devil's Staircase alpha-normalization (bit_k = p[RIGHT] + alpha*p[MIDDLE], alpha=0.5) | `p = softmax(-(y-[.5,1.5,2.5])^2/.25); bit_k = p_R + 0.5*p_M; C = sum bit_k 2^-k` | WITHOUT the alpha term the measure COLLAPSES to {0, .333, .667} - the FractalDavid bug | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
426
+ | L-051 | 10 | pure Adam, weight_decay = 0 (the anti-regularizer law) | `Adam(params, lr, weight_decay=0.0) - the ONLY constructor` | Adam+gates .731 vs AdamW(3e-4, wd .01) .667 - 'weight decay is uniform damping that destroys the geometric harmonic' | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
427
+ | L-052 | 10 | zero-init output heads (WEIGHT and bias) - the inertness contract | `zeros_(head.weight); zeros_(head.bias); gates = -3.0` | makes the toggle law bit-exact (max\|dlogit\| = 0.0); the bias leak alone is a standing +0.5 ppl offset | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
428
+ | L-061 | 10 | question-space guard (training-question space >= 3x draws) | `assert \|question_space\| >= 3*draws; train-eval overlap <= .05` | caught TWO memorized experts that had PASSED the answer-diversity guard (spaces 480 and 248 vs 800 draws) | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
429
+ | L-065 | 10 | band crossfade windows as STRUCTURAL positional gating | `ramp(x)=.5-.5cos(pi*(clamp(x/XF,-1,1)+1)/2); low=1-up1; mid=up1(1-up2); high=up1*up2; edges(.35,.75) XF=.06` | own-band damage 50-200x cross-band, 3/3 both seeds - specialists manufactured with NO routing loss | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
430
+ | L-071 | 10 | CV as a READOUT (never a force) | `CV = std(V)/mean(V), V = CM 4-volumes over 200 random 5-subsets, fp64 - READOUT` | the historical CV 'loss' was GRADIENT-FREE all along - .item() stripped the graph | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
431
+ | L-073 | 10 | bpb (bits per byte) - the AR line's verdict currency | `bpb = mean CE / ln(2) per byte` | certified band 2.469-2.499; addr_msl64 beats the unrestricted head 7/7 across seeds and budgets | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
432
+ | L-074 | 10 | perplexity tax ladder (wikitext ppl delta, one shared gauge) | `tax = exp(mean CE_512)\|adapted - exp(mean CE_512)\|frozen on wikitext` | one always-on stack +9.23/+9.87 · monolith +3.66 · 5-anchor collective +11.0/+12.6 · UNGATED +91.6 | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
433
+ | L-075 | 10 | token-F1 (caption distribution-match delta) | `F1 = 2PR/(P+R) over token multisets vs GT captions` | 0.408 -> 0.706/0.704 (+0.30, \|s0-s1\| = 0.0019); the hub checkpoint reproduces 0.706 EXACTLY | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
434
+ | L-080 | 10 | toggle law - all anchors off is BIT-EXACT to the base model | `assert torch.equal(logits_all_off, logits_base)` | max\|dlogit\| = 0.0 exactly at 0.8B on a hybrid DeltaNet/full-attention trunk; library-enforced | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
435
+ | L-083 | 10 | usage perplexity / axis aliveness (read-only) | `usage = mean oriented-softmax row; ppl = exp(H(usage)); alive = usage > eps/2K` | 125+/128 axes alive WITHOUT regularization - the standing refutation of load-balancing auxiliaries | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
436
+ | L-085 | 10 | blend-escape ratio (threshold 1.5) and damping ratio (target >= 3x) | `ratio = mean\|delta\|_domain / mean\|delta\|_neutral; escape <= 1.5; damped >= 3.0` | specialists damped 5-11x but caption ESCAPES undamped at 0.1004 - the corollary that became the regime law | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
437
+ | L-089 | 10 | CV@1000-batches early screen + the 3-tier filter | `CV at step 1000 -> band {<.30 LOW / .35-.50 MID / >.80 HIGH} + stability + freeze-survival` | CV at 1000 batches PREDICTS the final band; turnaround ~2h -> ~7 min per config | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
438
+ | L-092 | 10 | resolution-invariance flatness (the debugging canary) | `var(recon MSE) across patch grids 81..4096 - flatness IS the pass` | 4.5% MSE variance from 81 to 4096 patches; ~1% across a 36-config sweep - ANY shift means an upstream break | record only |
439
+ | L-095 | 10 | peak_mem + s/step (the WDDM sysmem-spill tell) | `torch.cuda.max_memory_allocated + s/step at an early step (WDDM spill tell)` | the tell is ~100W/450W at '100% util' with no step prints - 42.8GB observed spilled to shared memory | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
440
+
441
+ ### Rated 9 — replicated and load-bearing (25 entries)
442
+
443
+ | ID | R | entry | the mathematics | verdict on record | lives at |
444
+ |---|---|---|---|---|---|
445
+ | L-004 | 9 | chunked masked CE (512-token slices, sum-then-renormalize) | `L = sum_chunks CE_sum(h[i:i+512]) / n_live_tokens (ONE global denominator)` | 22.8GB dedicated + 42.8GB SILENTLY SHARED -> 8.8GB peak @ 1.03 s/step | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
446
+ | L-010 | 9 | flow v-MSE (rectified flow, SHIFT-warped sigma) | `s = warp(u; shift=2.5); x_t = (1-s)x0 + s*eps; L = mse(pred, eps - x0); x0 = x_t - s*v EXACT/LINEAR` | x0 = x_t - sigma*v is EXACT and LINEAR at every sigma - asserted, not assumed | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
447
+ | L-012 | 9 | addr_msl slot-parallel read (P parallel D=4 slots, shared K=64) | `feats = concat_p M_hat^(p)(slots); logits = W feats; CE. P=4/16/32/64 dose` | THE ACCUMULATION CURE: 5.6650 (collapsed) -> 2.47 with the primitive held FIXED | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
448
+ | L-015 | 9 | derived-steps expert supervision (stepwise-CoT target vs direct target) | `shift-CE(-100) on stepwise-CoT target sequences vs direct-answer targets` | +0.79 vs direct +0.63; held-out ceiling 1.00/1.00; seeds matched to 4 decimals (+0.7917 / +0.7916) | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
449
+ | L-016 | 9 | blob-LP-x0 structural supervision on FLOW (lambda ~ 1) | `L = mean_B[ mse_vec + lam*w_HIGH(s01)*blob_lp ]; blob_lp = sum(blob*(LP(x0h)-LP(x0))^2)/(sum(blob)*C); x0h = x…` | -5.9% / -3.7% two seeds on flow vs +0.03% / -1.0% on eps: a ~125-200x effect ratio | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
450
+ | L-041 | 9 | sphere normalization (M = F.normalize(M); \|\|M\|\|_F^2 = V pins sum sigma^2) | `M = F.normalize(M, dim=-1) (\|\|M\|\|_F^2 = V pins sum sigma^2) - ONE line, not a loss` | zero collapses in 400 epochs; V=1024 went from 48 s/ep crashing to 2.0 s/ep stable | record only |
451
+ | L-042 | 9 | gradient equalization across heterogeneous geometric towers | `per tower: g <- g * target/\|\|g\|\| (equal gradient norms; outputs stay free)` | without it spreads hit 20 ORDERS of magnitude (fibonacci dead at 2.25e-21 under helix) | [geofractal](https://github.com/AbstractEyes/geofractal) |
452
+ | L-043 | 9 | bounded multiplicative alpha (S*(1 + alpha*tanh), alpha <= 0.2, init .024) | `Sp = S * (1 + a*tanh(f)), a <= 0.2, init .024 - modulate never inject` | unbounded alpha POISONS the spectrum; bounded modulation costs 2,272 of 16.9M params (0.013%) | record only |
453
+ | L-050 | 9 | gradient clipping discipline (0.5 on cross-attn ONLY; NEVER inside an LBFGS closure) | `clip_grad_norm .5 on cross-attn ONLY; NEVER inside an LBFGS closure` | unclipped LBFGS closure DIVERGED to G-MSE 7.4e26; safety is line_search_fn='strong_wolfe' | record only |
454
+ | L-068 | 9 | paired (row, noise, t) triples - the variance-killing accumulation | `acc = mean_fp64(res_arm(row,noise,t) - res_ref(row,noise,t)), triples FIXED per row` | the noise-pair floor is ~0.988 - without pairing the effects this program measures are invisible | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
455
+ | L-076 | 9 | precision + invented-attribute rate (the hallucination decomposition) | `precision = \|pred inter GT\|/\|pred\|; invented = \|pred minus GT_vocab\|/\|pred\|` | precision 0.356 -> 0.694/0.705 and invented-attribute rate 0.200 -> 0.136/0.101, BOTH seeds | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
456
+ | L-077 | 9 | register probe (sign-code inter-minus-intra Hamming separation) | `sep_L = mean_ij inter-register Ham(code_i,code_j) - mean intra (diagonal KEPT, +4% bias, comparability)` | THE PREDICTOR of the two-regime law: registers ~0.2-0.3 blend, domains ~0.35-0.5 specialize | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
457
+ | L-078 | 9 | sign_fidelity (Spearman of code-Hamming vs true angular distance) | `Spearman(Hamming(c_i,c_j), arccos\|<a_i,a_j>\|) over random pairs` | PROMOTED: separates inheritance from lottery where bpb CANNOT - successors lock at .9555-.9558, spread < .001 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
458
+ | L-081 | 9 | band-lesion surgical test (own vs cross damage) | `ratio = damage(own band lesion) / damage(cross band lesion) per gauge` | surgical 3/3 both seeds at 50-200x; on a DiT edge bands hit cross-damage EXACTLY 0.0 | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
459
+ | L-086 | 9 | composition score (the controller prereg gauge) | `exact-match on two-step composite prompts vs single-step controls` | the chaining wall: components >= 0.96 solo, composite 0.0 for EVERY config | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
460
+ | L-088 | 9 | grad_norm_spread (gradient democracy monitor) | `orders = log10(max group \|\|g\|\|) - log10(min); dead = groups with 0` | reference failure it exists to catch: 20 orders of magnitude across unequalized towers | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
461
+ | L-091 | 9 | spectral gauges: S0/S_D ratio, effective rank, the universal attractor | `S0/S_D spectral ratio; erank = exp(-sum p ln p), p = sigma/sum sigma` | critical ratio ~6.5 triggers DISCHARGE; universal attractor S0 ~5.1, erank 15.88 +/- 0.04 across 48+ measurements | record only |
462
+ | L-094 | 9 | structured-task validity judges (JSON validity, IoU, pair-order, termination) | `json.parse validity + IoU(xywh) + pair-order + termination-within-window` | bbox 0 -> 0.6875 valid (0.894 IoU); the FORMAT TRAMPLING signature: 9/12 truncated_no_json | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
463
+ | L-097 | 9 | held-out byte accuracy (rule induction) and variant-format recall (the format lock) | `held-out byte acc under substitution cipher; variant-format recall` | teachers memorize at 1.000 train but induce at 0.270/0.245 held-out; memorized content is BOUND to surface form | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
464
+ | L-098 | 9 | key-durability gauge (nearest-neighbour symbol Hamming + key drift) | `NN symbol-Hamming between stored and recomputed keys; match@theta=.25` | sign-code keys disagree on ~91% of symbols; match rate at theta=0.25 is 0.000 EVERYWHERE | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
465
+ | L-099 | 9 | basin mean_cos (BASIN SET AT INIT) | `mean cos(book_epoch, book_init) across the bank sweep` | 192-bank sweep: epoch_1 .8632 / best .8635 / final .8615 - delta 0.0017 BELOW the within-phase std | record only |
466
+ | L-100 | 9 | cv_reference_check (fp64 parity against the source of truth) | `\|V_fast - V_geovocab2\| / \|V\| at fp64 == 0 required` | exact parity (relative 0.0) at fp64 against geovocab2, at ~260x the speed | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
467
+ | L-138 | 9⟂ | FAC on the partition-collapse configuration (the P4 loss-swap cell) | `L-070 on the addr_head collapse configuration` | the certified addr_head collapse DECOMPRESSES under a loss swap alone, 3/3 seeds: usage ppl 1.0-2.7 -> 60.6-61.1 of 64; decoded acc 0.05-0.20 -> 0.45-… | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
468
+ | L-139 | 9 | sparsemax on the collapse configuration (the coupling-axis probe) | `sparsemax_loss on addr_head logits (K=32, hard tau) - only the loss differs from the certified collapse cell` | THE DOSE-RESPONSE: usage 1.85 (CE, full coupling) -> 23.5 (sparsemax, partial) -> 60.9 (FAC, none); win\|cos\| .9997 -> .562 -> .132; acc .11 -> .417 … | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
469
+ | L-152 | 9 | PureGeometric ABSOLUTE-ONLY (attraction + range; comparative terms dropped) | `L = (1 - s_y)^2 + 0.1*(relu(s-1)^2 + relu(-s)^2) - no other-class terms at all` | MORE THAN DOUBLES the full set: acc 0.349 vs 0.157, bpb 3.75 vs 7.52, 3/3 seeds - the comparative terms are the poison | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
470
+
471
+ ### Rated 8 — solid, one caveat from bedrock (15 entries)
472
+
473
+ | ID | R | entry | the mathematics | verdict on record | lives at |
474
+ |---|---|---|---|---|---|
475
+ | L-003 | 8⚠ | plain full-sequence cross-entropy (packed labels) | `L = mean(-log softmax(W h)[y])` | the workhorse; also the documented geometry antagonist - CE drove the Oct '25 geometric collapse | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
476
+ | L-005 | 8 | shift-CE with ignore_index=-100 (prefix-masked instruction rows) | `CE(logits[:,:-1], y[:,1:], ignore_index=-100)` | the standard instruction-tuning form across the v35 and q25 lines | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
477
+ | L-009 | 8 | eps-MSE (epsilon prediction, stock schedule) | `x_t = sqrt(abar_t)x0 + sqrt(1-abar_t)eps, t~U{0..999}; L = mse(unet(x_t,t,c), eps); CFG drop p=.1` | relay -2.5% over frozen, 2 seeds; relay >= matched LoRA 2-for-2 across substrates | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
478
+ | L-011 | 8 | sign-code head addr_mslh64 (fully discrete forward, STE backward) | `M_hard = sign(cos[argmax\|cos\|])*A[argmax]; forward discrete, backward soft (M_hard + M_soft - sg[M_soft]); C…` | bpb 2.4711 vs soft 2.4685 - parity certified 3 seeds; a ~2.8% gap opens at 4x budget | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
479
+ | L-017 | 8⟂ | InfoNCE as an alignment force (OFF address paths) | `sym CE over sims = za@zb^T/0.07 with in-batch labels` | NECESSARY + SUFFICIENT for alignment: swap it in -> R@1 .999 | [Qwen2.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen) |
480
+ | L-040 | 8 | 1e-3 CV bank loss (arm-gated, S^15 bank ONLY, never the aleph codebook) | `V = sqrt(clamp(-det(CM(A[idx5]))/9216)); L += 1e-3 * std(V)/mean(V); fp64, fixed seed-0 subsets, S15 bank ONLY` | holds CV .295-.305 at zero-to-positive task cost where bare CE drifts it to .31-.34 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
481
+ | L-048 | 8⟂ | HP/LP band-role objectives [judged by the ROLE-ALIGNED gauge] | `low = base + .5*mse(HP3(pred),HP3(tgt)); high = base + .5*mse(LP7,..); composed by band windows [role-aligned …` | multiband beats the matched monolith ~10% on HIGH-band foreground, BOTH seeds | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
482
+ | L-059 | 8 | straight-through estimator on the aleph HARD read | `M_hard + (M_soft - sg[M_soft]) (STE over an ABSOLUTE reconstructive read)` | forward fully DISCRETE oriented code, backward soft: hosted books hold cos .992-.997, 112-122/128 hard axes, zero collapse | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
483
+ | L-066 | 8 | lambda dose coupling (3-point curve on the blob term) | `L = base + lam * w_route * aux, lam~1 (3-pt dose curve)` | 0.5 -> -5.9% · 1.0 -> -8.3% (in bound) · 2.0 -> -8.4% (OUT of the 0.5% common-gauge bound) | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
484
+ | L-067 | 8 | fp64 gauge accumulation (autocast disabled in the reduction) | `reduce in float64, autocast off (gauges)` | fp32 determinants lose up to ~4% on near-degenerate pentachora - 'fp32 det only' now means fp32 MINIMUM | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
485
+ | L-072 | 8 | anchor drift -> 0.29154 rad + binding_fraction | `drift = arccos(<norm(a), norm(a_init)>); binding_frac = mean(\|drift-.29154\|<=.05)` | the binding constant recurs across 5 architectures and 3 paradigms - but the drift-based fraction is a STAGE statistic | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
486
+ | L-079 | 8 | role-aligned in-bed gauge (HIGH-band foreground-masked LP-x0) | `HIGH-band foreground-masked LP-x0 error (fp32 judged)` | PROMOTED: found a ~10% multiband win that EVERY aggregate comparison hid | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
487
+ | L-082 | 8 | repeated-key null + matched-vs-mismatched deltas | `excess = metric(real keys) - metric(SAME key repeated); + matched-vs-mismatched delta` | the instrument that falsified address-as-key: routing excess 2.5e-06 over the null | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
488
+ | L-096 | 8 | consensus drift / stationarity gauge | `drift_g = arccos(<consensus_g, consensus_prev>); stationarity = no acceleration` | ROBUST for structured configurations (0.003 drift by g2, both seeds) but SEED-DEPENDENT for a lone flat book | record only |
489
+ | L-149 | 8 | CE on the cosine-anchor basin head (the geobasin control) | `CE over logits = cos(normalize(feats), normalize(A_c)) * 10` | the head itself costs +0.13 bpb under CE (2.607 vs 2.477 linear, 3 seeds; acc .498 vs .505) - small, so every geometric-arm deficit is THE LOSS, isola… | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
490
+
491
+ ### Rated 6–7 — measured, capped by replication or instrument (30 entries)
492
+
493
+ | ID | R | entry | the mathematics | verdict on record | lives at |
494
+ |---|---|---|---|---|---|
495
+ | L-006 | 7 | HuggingFace out.loss (VLM labels= path, vision tower fires) | `model(**batch, labels=y).loss (masked shift-CE inside HF; vision tower fires)` | required wherever the vision tower must fire - chunking bypasses it | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
496
+ | L-023 | 7 | kd_facts (fact rows supervised ONLY by teacher logits, alpha=1.0 legal here) | `fact rows: KL(teacher) ONLY (CE masked off); clean rows: CE - row-routed channels` | recall 0.953 vs direct 0.871; held-out RULE induction 0.264/0.279 >= the teacher itself | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
497
+ | L-024 | 7 | dual-teacher Procrustes consensus distillation | `GPA: mean shape after per-teacher Procrustes to consensus (delta<1e-8); student anchors init from it` | teachers .699/.649 -> student .761 EXCEEDS BOTH, still accelerating at E30 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
498
+ | L-028 | 7 | masked-marginal variant scoring (protein VEP) | `score(v) = logP(x_i=v · x_masked) - logP(x_i=WT · x_masked) (masked marginal)` | WT unmasked marginal rho 0.10 -> masked marginal ESSENTIAL; final rho .993 / .309 unseen | collaboration (pending release) |
499
+ | L-029 | 7 | GPT-2 frozen-trunk relay objective (dif-e013 Track C) | `CE; trainable = aleph MslRelay adapters on frozen GPT-2 (<1%)` | frozen 38.648 -> aleph 26.53 vs param-matched zero-init MLP 27.26; beats matched 2/2 seeds | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
500
+ | L-055 | 7 | Cayley orthogonality constraint + Newton-Schulz whitening | `Q = (I-A)(I+A)^-1, A skew - det=1 by construction` | Q = (I-A)(I+A)^-1 guarantees pure rotation: det = 1.000 throughout, wins 76/84 unseen assays | collaboration (pending release) |
501
+ | L-090 | 7 | void topology beta_2/axis (persistent homology on RP^(D-1)) | `ripser H2 on d(a,b)=arccos\|<a,b>\| (RP metric), thresh 20deg; beta2/axis` | within the D=4 cohort every GEOMETRIC signal collapses while VOIDS rise; beta_2 vs recon MSE \|rho\| = 0.471 | record only |
502
+ | L-013 | 6 | addr_3tau multi-tau stroboscope | `reads at multiple tau; concat -> logits; CE (stroboscope)` | 4.2884 no collapse (usage ppl 7.9, 117/128 alive) against addr_d4's 5.3698 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
503
+ | L-014 | 6 | addr_mhat reconstructive read consumed in AR | `logits = head(M_hat) directly (reconstructive read consumed in AR); CE` | 5.1300 bpb but the HEALTHIEST cultivation on the bed (ppl 11.0, binding_frac .234) | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
504
+ | L-018 | 6 | blueprint composite (InfoNCE 1.0 + Procrustes_SVD 0.3 + \|CV-0.20\| 0.05) | `InfoNCE*1.0 + Procrustes_SVD*0.3 + \|CV(bank)-0.20\|*0.05` | BERT-8192 m_acc .927 at CV exactly 0.200; CLIP-ctx576 m_acc .945 | record only |
505
+ | L-022 | 6 | logit-KD at alpha <= 0.25 with founder exemption | `L = CE + a*KL(log_softmax(student), mean_k softmax(teacher_k).detach()), a<=0.25, never founders` | mlp_kd lineage 2.4106 -> 2.3707 -> 2.3662 -> 2.3594 monotone ascent; replicates at s1 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
506
+ | L-026 | 6 | soft-hand loss (proximity REWARD, not penalty) | `prox = exp(-(cv-target)^2/2sig^2); L = (1+boost*prox)*mse + pen*(1-prox)` | V256 D24: MSE 0.034 at 400ep - 37% better than the best unconstrained run (.054) | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
507
+ | L-027 | 6 | antipode-conv objective (the address AS the convolution operator) | `conv := fold(m_hat(unfold(x))); no plain filter, no ReLU; CE on head` | CIFAR-10 87.23% @ 861,450 params with NO ReLU/GELU anywhere; none -> mag +21.8 | [classification line](https://github.com/AbstractEyes/geolip-aleph-classification) |
508
+ | L-034 | 6 | entropy-balanced alignment cultivation (w = .05) | `w=.05 entropy-balanced alignment (exact form NOT fully recorded); endpoint M = +/-ref EXACT` | produced the emergent basin M = +/- ref EXACTLY - the sign-code convergence endpoint | record only |
509
+ | L-035 | 6 | rectified-flow velocity objective (KSimplex / Form 7 bottleneck) | `rectified-flow velocity mse + Min-SNR gamma=5 + CM terms (L-045/L-046)` | loss .1749 beat the 268M skip's .1757; the model routed 88% through the 768 dims | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
510
+ | L-037 | 6 | denoiser objective (tokendiff iterative image-token denoise) | `CE on x0 tokens from noise-level-t corrupted tokens, iterative` | beats identity at every level; t=1.0 gives 0.378 vs 0.002 (189x) | [Qwen2.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen) |
511
+ | L-038 | 6 | recon_target (absolute MSE to a fixed frozen-trunk projection) | `L = mse(ea, norm(frozen_h @ fixed_proj)) + mse(eb, ...) (absolute target regression)` | recall@1 0.264 - real (5x frozen) but HALF of InfoNCE's 0.494 at matched budget | [Qwen2.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen) |
512
+ | L-045 | 6 | L_CM - Cayley-Menger validity hinge (lambda = .01) | `L_CM = .01 * relu(eps - vol2(CM)) on first k+1 tokens (validity hinge)` | CM validity 100% across the lineage table | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
513
+ | L-046 | 6 | L_vol - volume-spread REWARD (-std(log\|vol^2\|), lambda = .005) | `L_vol = -.005 * std(log\|vol^2\| across layers) (spread REWARD, anti-collapse)` | fragmented anatomy -> coherent composition; base fully preserved (purely additive) | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
514
+ | L-047 | 6⟂ | Procrustes_SVD as a REGULARIZER (x 0.3 alongside a real force) | `L = \|\|A R* - B\|\|^2, R* = Procrustes(A,B) via SVD - as x0.3 REGULARIZER beside a force` | tightens CV (.19 vs .25) when it rides alongside InfoNCE | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
515
+ | L-049 | 6 | anchor dropout (30%) | `dropout(anchors, p=.3) during alignment` | prevents collapse: 508/512 anchors active | record only |
516
+ | L-054 | 6 | quaternion composition as a structural regularizer (Hamilton product) | `q_comp = R (Hamilton) q_expert over 4 FiLM arms` | GeoQuat 0.916 -> 0.993 over 100 epochs vs best baseline 0.903 | collaboration (pending release) |
517
+ | L-056 | 6 | cascade as a regularizer (multi-step MLP instead of a direct dimensional jump) | `k-step MLP cascade in place of one dimensional jump` | 9-step 256->64 gives 84.6% vs a direct jump's 29.6%; a 27-step r=.95 cascade EXCEEDS the root | record only |
518
+ | L-057 | 6 | Cantor router (soft weights derived FROM triangulation distances) | `w_route = f(phase-0 triangulation distances), softmax-free, geometry-derived` | cos .9818 at 8 layers vs relay-alone .6533; geometry IMPROVES with more tokens | record only |
519
+ | L-060 | 6 | data-level dampening (sqrt damping alpha=0.5, max_repeats=8, cap 1.25x) | `n_i_new = min(ceil(norm * n_i^0.5), 8, 1.25*top) (sqrt-damped repeats)` | NEVER equalize-to-largest: alpha=0 repeats 5 images ~50x/epoch | record only |
520
+ | L-064 | 6 | rose loss (role-weighted pentachoron regularization, rose_w = 1e-4) | `NOT RECORDED (role-weighted pentachoron regularization; rose_w=1e-4, temp .07)` | 74.87% CIFAR-100 @ 393,216 params vs ~65% zero-shot and ~70-72% linear probe | record only |
521
+ | L-084 | 6 | read perplexity + \|cos to nearest atom\| (the quantizer gauge) | `read ppl = exp(H(mean read weights)); commitment = \|cos(read, nearest atom)\|` | read perplexity 14/64 atoms, \|cos to nearest atom\| 0.964, 64/64 alive - the representation LIES ON the codebook | [classification line](https://github.com/AbstractEyes/geolip-aleph-classification) |
522
+ | L-087 | 6 | adapter_effect_mean - the VACUOUS guard | `effect = mean\|loss_off - loss_on\|; report VACUOUS if < eps instead of a ratio` | returns VACUOUS instead of a false PASS when the stack barely moves the loss | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
523
+ | L-093 | 6 | exec judge (guarded subprocess: restricted builtins, length cap, hard timeout, no network) | `guarded subprocess: restricted builtins, len cap, timeout, no net; exact-match out` | the write-0.0 floor was verified GENUINE off-pod, not a judge artifact | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
524
+ | L-104 | 6 | sign-code Hamming retrieval | `recall@k under Hamming(code_query, code_bank)` | 0.359 @1 against the continuous head's 0.494 - ~73% of its power from raw 64-symbol Hamming | [Qwen2.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen) |
525
+
526
+ ### Rated 2–5 — conditional, refuted-as-candidates, or unrun (38 entries)
527
+
528
+ | ID | R | entry | the mathematics | verdict on record | lives at |
529
+ |---|---|---|---|---|---|
530
+ | L-007 | 5 | dispatch-keys-only CE (aligner; adapters frozen as anchors) | `same CE; trainable set = per-block dispatch key matrices ONLY` | trainable set is ONLY the per-block key matrices; reference-grade, never seed-replicated | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
531
+ | L-019 | 5 | Expert Soup composite (InfoNCE + MSE + BCE + Procrustes + CV + spread) | `InfoNCE + MSE + BCE + Procrustes + CV + spread (6-term, never ablated)` | mAP .84 (data-limited), 1000/1000 positive volumes, eff-dim 76.9 for COCO-80 | record only |
532
+ | L-020 | 5⚠ | SequenceReconstructor loss: MSE(normed) + (1 - cos) | `mse(norm(pred), norm(tgt)) + (1 - cos(pred, tgt)) on (B,77,768)` | CLIP-L ep5 m_acc .957 / s_cos .734; Meridian bigG s_cos PLATEAUS at .425 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
533
+ | L-021 | 5 | Min-SNR gamma=5 weighting + velocity adjustment | `w = min(SNR,5)/(SNR+1) velocity-adjusted; L = mean(w * mse_vec)` | part of a working recipe (1 ep, 10k synthetic, ~7 min on an L4); never ablated | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
534
+ | L-025 | 5 | projective-ICP / GPA consensus operator (lineage-core overwrite) | `projective ICP: iterate sign-aligned Procrustes on RP; lineage-core overwrite` | recovers planted truth \|cos\|=1.000 in 5 iterations; TASK-NEUTRAL on bpb, 2 seeds | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
535
+ | L-030 | 5 | val_ce on a frozen semantic substrate (CLIP-L token-AR) | `CE on frozen CLIP-L token-AR (matched transforms + shared vocab proj)` | MLP WINS frozen-substrate token-AR (penult 5.245 best); aleph tax ~ +0.09 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
536
+ | L-031 | 5 | pure geometric-basin loss set (coherence/separation/discretization/geometry) | `SOURCE RECOVERED 2026-07-25: attraction (1-s_y)^2 + 0.5*repulsion sum_{c!=y}(s_c^2) + 0.5*margin relu(max_{c!=…` | the program's ONE attempted CE replacement - NOW PROPERLY TESTED: refuted on the byte bed (acc 0.157 vs control 0.498, 3 seeds); the absolute-only var… | [geofractal](https://github.com/AbstractEyes/geofractal) |
537
+ | L-039 | 5 | contrastive dynamics as a CV-compression force | `standard contrastive; measured as a CV-compression force` | 100 clusters / 200 steps at d=128 -> CV .2451 (in band); 10 clusters -> .94 | record only |
538
+ | L-053 | 5 | geometric autograd / gradient gating (Form 12 tangential-radial split) | `g_tang pass; g_radial *= (1-.01); g_collapse *= 1.0 (gradient gating)` | gradients split tangential (pass) / radial (attenuate) / collapse-direction (attenuate) | record only |
539
+ | L-062 | 5 | usage / starvation reweighting (drives DATA sampling, NEVER a loss term) | `on starvation strike: sampling_weight[starved] *= 2; 3 strikes abort - DATA, never a loss` | the program's ONLY answer to load balancing: x2 upweight the starved anchor's DATA, 3-strike abort | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
540
+ | L-063 | 5 | CFG dropout 0.1 (conditioning zeroed, not empty-prompt) | `with p=.1: cond <- 0 (zeroed, not empty-prompt)` | standard in every diffusion bed; never ablated in this program | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
541
+ | L-070 | 5⟂ | FAC as a PRIMARY sequential objective (cosh-Bregman, replace CE) | `v = norm(feats)@R^T/t; L = mean(cosh(clamp(v - c_y*mu, -4, 4)) - 1)` | REFUTED AS PREREGISTERED, 3/3 seeds: fac_lsh 4.13 bpb vs ce 2.48; ce_fixedcode 3.81 beats it; fac_none 3.95 beats it | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
542
+ | L-101 | 5 | gate-mean band 0.012-0.03 (advisory, NOT universal) | `gate_mean = mean sigmoid(g); band [.012,.03] ADVISORY` | held across 6 architectures and 2 optimizers - then MISSED on a 7th at 0.051-0.061 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
543
+ | L-102 | 5 | aggregate eps-MSE as a band-behaviour gauge | `mean mse over all sigma - BLIND to band structure (distrusted for bands)` | DISTRUSTED: moved 0.2% against +0.089 grounding effects in image space, and HID a ~10% multiband win | record only |
544
+ | L-124 | 5 | frozen-address conditioning injected beside full text | `append frozen byte-trigram address beside full text cond` | real vs deranged -0.0009 beside full text; but ALONE the address steers at +0.0287 | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
545
+ | L-140 | 5 | sparsemax as a full-bed objective | `L = -z_y + 0.5*sum_{j in S}(z_j^2 - tau^2) + 0.5 (sparse support S)` | REFUTED as a general objective: bpb 7.43 / acc 0.331 vs ce 2.4769 / 0.505 (3 seeds) | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
546
+ | L-141 | 5 | soft-max / worst-position accumulation (trained) | `L = T*logsumexp(ce_tok/T) - T*log(N), T=0.5` | REFUTED: bpb 4.24 / acc 0.276, 3 seeds - the 0.911-novelty champion chases irreducible entropy exactly as flagged | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
547
+ | L-142 | 5 | geometric-mean accumulation (trained) | `L = mean(log(ce_tok + 1e-3))` | REFUTED decisively: bpb 9.03 - the anti-focal starves hard positions and the distribution never forms (3 seeds) | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
548
+ | L-143 | 5 | label smoothing eps=.1 (trained on the byte bed) | `CE to (1-eps) smoothed targets == (1-eps)CE + eps*uniform-KL` | bpb 2.587 vs ce 2.4769 (+0.11, 3 seeds) - payer-class novelty (0.479), mildly WORSE outcome | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
549
+ | L-144 | 5 | focal gamma=2 (trained, live-model weights) | `L = sum((1-p_y)^2 * ce_tok) / sum((1-p_y)^2), p_y detached from the live model` | bpb 2.597 (+0.12 vs ce, 3 seeds) - payer-class trained novelty (0.337), mildly worse outcome | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
550
+ | L-145 | 5 | anti-curriculum (train only where the frozen reference is confident) | `L = sum(ce_tok * [pi_ref > .6]) / count, pi_ref from the frozen ce_s0 checkpoint` | REFUTED as an objective: bpb 6.74 (3 seeds) - abandoning 72% of the distribution buys nothing on the rest | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
551
+ | L-146 | 5 | FAC tanh-Hamming link (bounded tails) | `L = mean(1 - tanh(v) * c)` | cosh beats tanh 3/3: 4.349 vs 4.1285 (+0.22) - the bounded link loses within the family | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
552
+ | L-147 | 5 | FAC Cauchy link (sub-quadratic tails) | `L = mean(log(1 + (v - c*mu)^2))` | cosh beats Cauchy 3/3: 4.360 vs 4.1285 (+0.23) - robust-statistics tails lose within the family | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
553
+ | L-148 | 5 | confidence penalty (trained as the GATE-VALIDATION CONTROL) | `L = CE - 0.1*H(p)` | CLOSEST TO CE OF ALL DEVIANTS: bpb 2.520 (+0.043, 3 seeds) - the gate's refusal correctly predicted 'CE plus nothing' | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
554
+ | L-150 | 5 | PureGeometricLoss, learned anchors (the Oct '25 arm, properly tested) | `attraction (1-s_y)^2 + 0.5*sum_{c!=y}s_c^2 + 0.5*relu(max_{c!=y}s_c - s_y + .3) + 0.1*range` | REFUTED on this substrate: acc 0.157 vs control 0.498 (-68% relative, 3 seeds) - far below the historical -12% trade | [geofractal](https://github.com/AbstractEyes/geofractal) |
555
+ | L-151 | 5 | PureGeometricLoss, FROZEN anchors (the L-108 cell) | `same loss; A registered as a frozen buffer` | learned BEATS frozen by +8 acc points (0.157 vs 0.076, 3 seeds) - the L-108 falsifier FIRED for cosine anchors | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
556
+ | L-153 | 5 | GeometricPrototypeLoss (verbatim, own projector) | `cos(proj(scores), prototypes) pulled/pushed + prototype-diversity term` | WORST of the family: bpb 8.12, acc 0.008 (3 seeds) - the extra indirection buys total failure | [geofractal](https://github.com/AbstractEyes/geofractal) |
557
+ | L-154 | 5 | HierarchicalGeometricLoss on the nibble hierarchy (16x16) | `coarse (superclass sums to target) + fine + consistency, sigmoid-weighted` | CATASTROPHIC: acc 0.0003 - below chance (1/256) - hierarchy-in-class-space destroyed fine structure entirely (3 seeds) | [geofractal](https://github.com/AbstractEyes/geofractal) |
558
+ | L-155 | 5 | CE + PureGeometric hybrid (0.5/0.5) | `0.5*CE(cos*10) + 0.5*PureGeometricLoss(scores)` | the geometric set POISONS CE rather than riding it: bpb 4.53 vs control 2.61 (+1.9, 3 seeds) - P4 bar (within 0.15) missed by 12x | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
559
+ | L-008 | 4 | image-classification CE (CIFAR-10, aleph-dispatched MoE vs dense) | `CE(logits, y) on CIFAR-10` | MoE 58.52% TIES param-matched dense 58.52% exactly; 6x params bought nothing | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
560
+ | L-036 | 4 | margin losses ArcFace / CosFace / SphereFace (RoseFace dual-norm) | `ArcFace cos(th+m) · CosFace cos(th)-m · SphereFace cos(m*th); s=30 m=.30; L1-then-L2 dual-norm` | the ZANA innovation - and it hit a 60% single-stream ceiling | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
561
+ | L-123 | 4⟂ | HP/LP band-role objectives [judged by AGGREGATE eps-MSE] | `L-048 judged by aggregate eps-MSE` | 4/4 directional both seeds at 0.05-0.2% margins - 'nearly collinear with the base objective' | record only |
562
+ | L-032 | 3 | GBC - 'cross-entropy can be replaced entirely' (roadmap claim) | `SOURCE RECOVERED 2026-07-25 (GBC head, geofractal/model/experiment_geometric_basin.py:118): compat = triadic (…` | classification via triadic compatibility, self-similarity, Cantor coherence, hierarchical basin checks | [geofractal](https://github.com/AbstractEyes/geofractal) |
563
+ | L-033 | 3 | masked-recon / generative arm (campaign law 2 in its ORIGINAL form) | `mask patches; L = mse(recon_from_antipode_read(masked), x) (law 2 ORIGINAL form)` | BUILT, NEVER RUN - predicted to be where the SIGNED read finally beats magnitude | [classification line](https://github.com/AbstractEyes/geolip-aleph-classification) |
564
+ | L-058 | 3 | address-agreement bias (BUCKET - making a hard address differentiable) | `exact softmax within sorted equal-width same-bucket block; codebook grad via address-agreement bias` | exact softmax within sorted equal-width blocks masked to the same bucket; argmax alone is gradient-dead | record only |
565
+ | L-069 | 3 | predictability-weighted accumulation (PWA) | `w = f(pi_frozen_ref); L = sum(w*ce_tok)/sum(w)` | DESIGNED 2026-07-25: make the PREDICTABILITY PRINCIPLE a loss geometry instead of a discovered side effect | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
566
+ | L-103 | 2✖ | recon cosine as a judge for ADDRESSED systems | `cos(recon, x) - WRONG instrument for addressed systems (address = lookup key)` | DISTRUSTED: an address is a LOOKUP KEY, not a compressor - judge drift and crushed CV instead | record only |
567
+ | L-113 | 2✖⟂ | InfoNCE into ADDRESS paths | `a7_grid_infonce INTO an address path` | BANNED despite R@1 .999 - it is the LOUDEST gradient and the bank learns IT instead of the useful signal | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
568
+
569
+ ### Rated 1 — the proof set (retractions and prohibitions) (30 entries)
570
+
571
+ | ID | R | entry | the mathematics | verdict on record | lives at |
572
+ |---|---|---|---|---|---|
573
+ | L-105 | 1✖† | VQ / commitment / EMA codebook losses | `\|\|sg[z_e] - e\|\|^2 + beta*\|\|z_e - sg[e]\|\|^2 (+ EMA codebook update)` | THE NAMED PROHIBITION - and unnecessary: the codebook stays 125+/128 alive at div_weight = 0 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
574
+ | L-106 | 1✖† | comparative / relative selectors (argmax anchors, softmax-over-roster, STE one-hots, k-means alphabets) | `selection event = argmax/softmax-over-roster in the compute path` | roster-dependent; the gradient HOMOGENIZES - 14x path collapse, width attenuation, BN-on-padding, same disease | record only |
575
+ | L-107 | 1✖† | gradient-learned alphabets (CAMPAIGN LAW 3) | `alphabet learned by task gradient (vs fitted-frozen)` | fitted-frozen alphabets differentiate (1,594 unique paths); gradient-learned alphabets COLLAPSE (116) | record only |
576
+ | L-108 | 1✖† | direct gradient descent on pentachora | `direct task-gradient descent on pentachoron vertices` | collapses them to zero - as FROZEN anchors the same crystals retain full cohesion and stay backtrackable | record only |
577
+ | L-109 | 1✖† | global average pooling in geometric encoders | `gap = x.mean(dim=spatial) in a geometric encoder` | 70% -> 29% collapse, REPLICATED independently in the protein line | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
578
+ | L-110 | 1✖† | CV loss as backward injection / above the 1e-3 ceiling | `CV term injected in backward, or weight > 1e-3` | MUST be a forward loss; above ~.001 the CV term dominates CE and trades discrimination for regularity | record only |
579
+ | L-111 | 1†⟂ | Procrustes as a training FORCE | `same as L-047 - AS THE TRAINING FORCE (placement retracted)` | as a training loss: R@1 = 0.000, P_cos stuck at .094 for THIRTY EPOCHS | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
580
+ | L-112 | 1✖† | addr_head - coefficients to logits at a single hard tau | `logits = W u, u = single-slot coefficients at hard tau (K=32)` | 5.6650 bpb COLLAPSED: usage ppl 1.88/64, TWO unique winners, win\|cos\| .9992 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
581
+ | L-114 | 1† | logit-KD at alpha = 1.0 from near-parity teachers | `prim_kl at alpha=1.0 from near-parity teachers in a selection loop` | INVERSE EVOLUTION, compounding downward: 2.4301 -> 2.5046 -> 2.5603 | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
582
+ | L-115 | 1✖† | blob structural supervision on the EPS objective | `L-016 with x0h = (x_t - sqrt(1-abar)eps_hat)/sqrt(abar) - divides by vanishing sqrt(abar)` | +0.03% / -1.0%, two seeds - the x0 recovery divides by a vanishing sqrt(alpha_bar) EXACTLY in the supervised band | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
583
+ | L-116 | 1† | MSE-first single-epoch keep-or-kill screening | `keep-or-kill on 1-epoch MSE rank` | DEAD: the lowest-MSE config was a HIGH-band false candidate | record only |
584
+ | L-117 | 1† | tied M-hat readout (U=M_hat, S=Omega-token, Vt=I) in an AR head | `logits = tied(M_hat) with U=M_hat, S=Omega, Vt=I` | +1.0 bpb BOTH seeds and it STARVES the codebook (drift 0.02, binding 0) | record only |
585
+ | L-118 | 1✖† | comparative routing on diffusion (state+sigma, raw address, M-hat address-as-key) | `route experts by frozen text keys (raw/pooled/M-hat-slot) vs repeated-key null` | FALSIFIED THREE WAYS, 2 seeds: routing excess 2.5e-06 over the repeated-key null; match advantage -0.0 | [diffusion line](https://huggingface.co/AbstractPhil/aleph-diffusion-adapters) |
586
+ | L-119 | 1† | the controller hypothesis (a trainable anchor that orchestrates the others) | `a trainable anchor trained to orchestrate others (composite prereg >= +.15)` | prereg required >= +0.15; measured -0.417 / -0.167. The passenger role is an ATTRACTOR | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
587
+ | L-120 | 1† | always-on solo specialist stacks | `solo specialist stack attached always-on` | MUTUALLY DESTRUCTIVE at n=48: the depth stack drives caption F1 to 0.0014 with termination 0.0 | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
588
+ | L-121 | 1† | frozen solo-trained expert collectives under aleph dispatch | `frozen solo-trained experts composed under dispatch` | no surgical independence (own-drop 0.04/0.00), NO damping (all five blend-regime, 0.86-1.6), composite 0.0 | [Qwen3.5 line](https://huggingface.co/AbstractPhil/geolip-aleph-qwen-3.5-0.8b-instruct) |
589
+ | L-122 | 1† | organ-only inheritance (projection + book transplanted onto fresh trunks) | `transplant proj+codebook onto a fresh trunk` | BELOW random init, 2/2 lineages - sixteen random draws beat component inheritance | record only |
590
+ | L-125 | 1† | shuffled-key null | `null = shuffle keys across rows (measures diversity, not correctness)` | CONFESSED INSTRUMENT FAILURE: it measures diversity, not correctness - the null scored like the real thing | record only |
591
+ | L-126 | 1† | the sequences / baseconv expert gains | `CE on generated question sets with space < 3x draws` | SELF-RETRACTED: question space 480 and 248 against 800 training draws per tier = MEMORIZED | record only |
592
+ | L-127 | 1† | the exp021 seed-inversion claim for the trainable anchor | `cross-seed comparison across DIFFERENT instruments` | RETRACTED WITHIN HOURS: the claim compared DIFFERENT INSTRUMENTS across seeds | [campaign loss library](https://huggingface.co/AbstractPhil/loss-manifest) |
593
+ | L-128 | 1✖† | hierarchical refinement in Cantor space | `bands nested within bands on a Cantor axis` | HARMFUL (-10%); parallel ADJACENT NON-OVERLAPPING bands are +3% | record only |
594
+ | L-129 | 1✖† | repeated boundary crossing in a measure space | `re-enter measure space per layer/step` | KILLS gradients (catastrophic -> random). Enter and exit the measure space ONCE | record only |
595
+ | L-130 | 1✖† | the SOFT devil's staircase used as a BAND COORDINATE | `soft_cantor_ungated(x) used as a band COORDINATE (non-monotone)` | NEW 2026-07-25: measured NON-MONOTONE - min slope -0.13 to -0.49 at EVERY level count on EVERY grid tested | [geofractal](https://github.com/AbstractEyes/geofractal) |
596
+ | L-131 | 1✖† | equalize-to-largest data balancing (alpha = 0) | `repeat count = ceil(max_bucket / n_i) (alpha=0 equalize-to-largest)` | repeats the 5-image bucket ~50x per epoch - 'the textbook way to overfit the long tail you were trying to protect' | record only |
597
+ | L-132 | 1† | addr_conv - the decorative address (convex re-weighting of a filter bank) | `conv re-weighted by convex sum a_k=1 over a filter bank (hull-bounded mean)` | DECORATIVE: a convex sum a_k = 1 is a hull-bounded perturbation of a MEAN; the 1x1 address is CONSTANT on grayscale (variance 4e-16) | [classification line](https://github.com/AbstractEyes/geolip-aleph-classification) |
598
+ | L-133 | 1† | deterministic (greedy) decoding in an iterative denoiser | `argmax decoding in an iterative denoiser` | collapses to the global mode: diversity 0.0, conditional == shuffled EXACTLY | record only |
599
+ | L-134 | 1✖† | load-balancing / auxiliary router losses | `aux = alpha * N * sum_i f_i * P_i (switch-style balance)` | BANNED and replaced by architectural equality; ZERO instances exist in the tree | [amoe-lora](https://github.com/AbstractEyes/amoe-lora) |
600
+ | L-135 | 1† | the big-JSON objective | `CE on the big-JSON composite format` | FORMALLY DROPPED by operator ruling - too costly; 3-5 task adapters deliver more per GPU hour | record only |
601
+ | L-136 | 1† | SVD-rotation transform in the dual-pentachoron head | `learned SVD rotation transform in the dual-penta head` | DROPPED for convergence failure; reduced to scale + shift | record only |
602
+ | L-137 | 1✖† | single hard-tau coefficient heads at ANY dimension | `coefficients->logits at ONE hard tau, any dim` | DEMOTED on the standing registry: collapse, and low-D was falsified as the fix | record only |
603
+
604
+ ---
605
+
606
+ *The rated manifest, its machine-readable sidecar, the rubric, the campaign
607
+ code, and the raw run ledgers accompany this article at
608
+ [the companion repository](https://huggingface.co/AbstractPhil/loss-manifest). Evidence trails for every historical claim
609
+ live in the linked line repositories; the three prior field reports carry the
610
+ campaign narratives in full. Written by the program's operator (AbstractPhil)
611
+ with Claude (Anthropic) as the research engineer of record for the loss
612
+ campaign.*
code/__pycache__/compartment_smoke.cpython-312.pyc ADDED
Binary file (49.9 kB). View file
 
code/__pycache__/geolip_vitals.cpython-312.pyc ADDED
Binary file (17.1 kB). View file
 
code/ar_differentiation_bed.py ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ar_differentiation_bed.py — THE FOCUS (2026-07-09 redirect, the operator verbatim):
2
+ "refining the autoregressive techniques for differentiation rather than attempting
3
+ to just mash numbers together."
4
+
5
+ Differentiation is cultivated by PREDICTIVE pressure along the sequence — the
6
+ address parameterizing the next-byte distribution (Law 2: chain-rule advantage pays
7
+ ONLY where the composed address directly parameterizes the predictive distribution).
8
+ This bed puts the aleph in the autoregressive gradient path and measures what
9
+ differentiates. It is the Law-2 construction (codebook-pressure C3) + Tree 3d in
10
+ one harness; the Jun-19 "discuss before building" gate was resolved by the redirect.
11
+
12
+ Byte-level causal LM on wikitext-2-raw (HF parquet, CDN-fast), block 256. ARMS:
13
+ sdpa — standard causal transformer control (matched trunk).
14
+ hub — attention replaced by CAUSAL HUB: linear attention whose feature map
15
+ is the 2K-oriented aleph address, prefix-sum memories (no selection
16
+ event; O(n*K*d)). Differentiation cultivated INSIDE attention.
17
+ addr_head — sdpa trunk, but the OUTPUT HEAD reads ONLY the signed aleph
18
+ coefficient vector w_k = sinh(u_k)/sum_j cosh(u_j) of the final
19
+ hidden state (K -> 256 logits). The address MUST carry every bit of
20
+ next-byte information — the hardest Law-2 bottleneck.
21
+
22
+ JUDGED BY: val bits-per-byte per arm (task) + CULTIVATION VITALS on every aleph
23
+ codebook (readouts, never losses): axis aliveness/hppl, drift-from-init +
24
+ binding fraction @0.29154, winner-|cos| saturation (sign-code emergence), shadow
25
+ path diversity (fixed high-bits hash). Never by recon.
26
+
27
+ Riders: pure Adam wd=0; no BN/Dropout/GAP on geometric paths; orthogonal init;
28
+ Colab-cell-safe (paste-ahead imports, no bare argparse, no __file__ reliance);
29
+ GPU-only for verdict runs; data_root OUTSIDE the mind repo.
30
+
31
+ Terminal: python ar_differentiation_bed.py # shapes/parse smoke
32
+ python ar_differentiation_bed.py --train # verdict run
33
+ Colab: paste geolip_vitals.py cell, then this file (smoke auto-runs),
34
+ then train(steps=2000, data_root="/content/data") in the next cell.
35
+ """
36
+ from __future__ import annotations
37
+ import math
38
+ import torch
39
+ import torch.nn as nn
40
+ import torch.nn.functional as F
41
+
42
+ if "anchor_drift" not in globals():
43
+ try:
44
+ from geolip_vitals import anchor_drift, axis_aliveness, path_diversity
45
+ except ImportError:
46
+ _here = globals().get("__file__")
47
+ if _here is not None:
48
+ import sys, pathlib
49
+ sys.path.insert(0, str(pathlib.Path(_here).parent))
50
+ from geolip_vitals import anchor_drift, axis_aliveness, path_diversity
51
+ else:
52
+ raise ImportError(
53
+ "geolip_vitals not found — paste/run its cell first, or "
54
+ "keep geolip_vitals.py beside this file (ships in this repo).")
55
+
56
+ VOCAB = 256 # bytes
57
+
58
+
59
+ # ------------------------------------------------------------------ aleph address
60
+ def _super_fibonacci_s3(n: int) -> torch.Tensor:
61
+ """Near-uniform unit quaternions (Alexa CVPR'22; constants per canon) —
62
+ starts the codebook INSIDE the RP^3 attractor basin. D=4 only."""
63
+ PHI, PSI = math.sqrt(2.0), 1.533751168755204288118041
64
+ i = torch.arange(n, dtype=torch.float64)
65
+ s = (i + 0.5) / n
66
+ r, R = torch.sqrt(s), torch.sqrt(1.0 - s)
67
+ a, b = 2 * math.pi * i / PHI, 2 * math.pi * i / PSI
68
+ q = torch.stack([r * torch.sin(a), r * torch.cos(a),
69
+ R * torch.sin(b), R * torch.cos(b)], dim=-1)
70
+ return F.normalize(q, dim=-1).float()
71
+
72
+
73
+ class AlephAddress(nn.Module):
74
+ """Closed-form aleph over 2K oriented half-axes (canon/aleph_core.md).
75
+ signed(x): (..., K) w_k = sinh(u_k)/sum_j cosh(u_j) — the Law-2 head feature.
76
+ oriented(x): ((..., K), (..., K)) positive halves of the 2K softmax — HUB map."""
77
+
78
+ def __init__(self, K: int, D: int, tau: float = 0.1, init: str = "random"):
79
+ super().__init__()
80
+ self.K, self.D, self.tau = K, D, tau
81
+ if init == "fibonacci":
82
+ assert D == 4, "fibonacci init lives on S^3 (D=4)"
83
+ A = _super_fibonacci_s3(K)
84
+ else:
85
+ A = F.normalize(torch.randn(K, D), dim=-1)
86
+ self.codebook = nn.Parameter(A)
87
+ self.register_buffer("home", self.codebook.detach().clone())
88
+
89
+ def _u(self, x):
90
+ A = F.normalize(self.codebook, dim=-1)
91
+ return (F.normalize(x, dim=-1) @ A.transpose(-1, -2)) / self.tau
92
+
93
+ def oriented(self, x):
94
+ u = self._u(x)
95
+ m = u.abs().amax(dim=-1, keepdim=True)
96
+ ep, en = torch.exp(u - m), torch.exp(-u - m)
97
+ Z = (ep + en).sum(dim=-1, keepdim=True)
98
+ return ep / Z, en / Z
99
+
100
+ def signed(self, x):
101
+ u = self._u(x)
102
+ m = u.abs().amax(dim=-1, keepdim=True)
103
+ ep, en = torch.exp(u - m), torch.exp(-u - m)
104
+ return (ep - en) / (ep + en).sum(dim=-1, keepdim=True)
105
+
106
+ def signed_at(self, x, taus):
107
+ """Multi-tau stroboscope (rule of 3): signed coefficients at several
108
+ temperatures, concatenated — softer taus keep the vector dense while a
109
+ hard tau supplies the sign-code sharpness. v2 refinement (b)."""
110
+ A = F.normalize(self.codebook, dim=-1)
111
+ cos = F.normalize(x, dim=-1) @ A.transpose(-1, -2)
112
+ outs = []
113
+ for t in taus:
114
+ u = cos / t
115
+ m = u.abs().amax(dim=-1, keepdim=True)
116
+ ep, en = torch.exp(u - m), torch.exp(-u - m)
117
+ outs.append((ep - en) / (ep + en).sum(dim=-1, keepdim=True))
118
+ return torch.cat(outs, dim=-1)
119
+
120
+ def m_hat(self, x):
121
+ """Closed-form soft read (decoders read M_hat, never M). v2 control (c)."""
122
+ u = self._u(x)
123
+ m = u.abs().amax(dim=-1, keepdim=True)
124
+ ep, en = torch.exp(u - m), torch.exp(-u - m)
125
+ A = F.normalize(self.codebook, dim=-1)
126
+ return ((ep - en) @ A) / (ep + en).sum(dim=-1, keepdim=True)
127
+
128
+ def m_hard_ste(self, x):
129
+ """Canon hard mode: M_hard = sign(cos_win) * A[win], straight-through to
130
+ the soft read — forward fully discrete SIGN CODE, backward soft gradient.
131
+ Legal per theme A (reconstructive sign code, not a one-hot roster pick)."""
132
+ u = self._u(x)
133
+ soft = self.m_hat(x)
134
+ win = u.abs().argmax(dim=-1)
135
+ A = F.normalize(self.codebook, dim=-1)
136
+ sign = torch.sign(torch.gather(u, -1, win.unsqueeze(-1))).squeeze(-1)
137
+ hard = sign.unsqueeze(-1) * A[win]
138
+ return hard + soft - soft.detach()
139
+
140
+ @torch.no_grad()
141
+ def vitals(self, x_sample) -> dict:
142
+ u = self._u(x_sample.reshape(-1, x_sample.shape[-1]))
143
+ p, n = self.oriented(x_sample.reshape(-1, x_sample.shape[-1]))
144
+ two_k = torch.cat([p, n], dim=-1)
145
+ win = two_k.argmax(dim=-1)
146
+ cos_win = (u.abs().amax(dim=-1) * self.tau) # winner |cos| — sign-code sat.
147
+ d = anchor_drift(self.codebook, self.home)
148
+ return {"drift": round(d["mean"], 4),
149
+ "binding_frac": round(d["binding_fraction"], 4),
150
+ "aliveness": axis_aliveness(two_k),
151
+ "win_cos_mean": round(cos_win.mean().item(), 4),
152
+ "paths": path_diversity(win)}
153
+
154
+
155
+ # ------------------------------------------------------------------------- blocks
156
+ class CausalSDPA(nn.Module):
157
+ def __init__(self, d: int, heads: int = 4):
158
+ super().__init__()
159
+ self.h = heads
160
+ self.qkv = nn.Linear(d, 3 * d, bias=False)
161
+ self.o = nn.Linear(d, d, bias=False)
162
+ nn.init.orthogonal_(self.qkv.weight); nn.init.orthogonal_(self.o.weight)
163
+
164
+ def forward(self, x):
165
+ B, n, d = x.shape
166
+ q, k, v = self.qkv(x).chunk(3, dim=-1)
167
+ q, k, v = (t.view(B, n, self.h, d // self.h).transpose(1, 2) for t in (q, k, v))
168
+ y = F.scaled_dot_product_attention(q, k, v, is_causal=True)
169
+ return self.o(y.transpose(1, 2).reshape(B, n, d))
170
+
171
+
172
+ class CausalHUB(nn.Module):
173
+ """Causal aleph linear attention: prefix-sum memories over the two K-wide
174
+ halves of the oriented address; 2K never materialized; no selection event."""
175
+
176
+ def __init__(self, d: int, K: int = 32, D: int = 4, tau: float = 0.1):
177
+ super().__init__()
178
+ self.addr = AlephAddress(K, D, tau)
179
+ self.q = nn.Linear(d, D, bias=False)
180
+ self.k = nn.Linear(d, D, bias=False)
181
+ self.v = nn.Linear(d, d, bias=False)
182
+ self.o = nn.Linear(d, d, bias=False)
183
+ for m in (self.q, self.k, self.v, self.o):
184
+ nn.init.orthogonal_(m.weight)
185
+
186
+ def forward(self, x):
187
+ qp, qn = self.addr.oriented(self.q(x)) # (B, n, K)
188
+ kp, kn = self.addr.oriented(self.k(x))
189
+ v = self.v(x) # (B, n, d)
190
+ Sp = torch.cumsum(torch.einsum("bnk,bnd->bnkd", kp, v), dim=1)
191
+ Sn = torch.cumsum(torch.einsum("bnk,bnd->bnkd", kn, v), dim=1)
192
+ zp = torch.cumsum(kp, dim=1)
193
+ zn = torch.cumsum(kn, dim=1)
194
+ num = torch.einsum("bnk,bnkd->bnd", qp, Sp) + torch.einsum("bnk,bnkd->bnd", qn, Sn)
195
+ den = (qp * zp).sum(-1, keepdim=True) + (qn * zn).sum(-1, keepdim=True)
196
+ return self.o(num / den.clamp_min(1e-12))
197
+
198
+
199
+ class MslRelay(nn.Module):
200
+ """Depth-composition unit (chain-rule probe): multi-slot M_hat read entering
201
+ the trunk as a NEAR-ZERO gated residual (gate init -3.0, sigma~0.047 — theme D:
202
+ geometry enters as a nudge and grows only if it earns gradient)."""
203
+
204
+ def __init__(self, d: int, n_slots: int = 16, K: int = 64):
205
+ super().__init__()
206
+ self.n_slots = n_slots
207
+ self.proj = nn.Linear(d, n_slots * 4, bias=False)
208
+ self.out = nn.Linear(n_slots * 4, d, bias=False)
209
+ nn.init.orthogonal_(self.proj.weight)
210
+ nn.init.orthogonal_(self.out.weight)
211
+ self.addr = AlephAddress(K, 4)
212
+ self.gate = nn.Parameter(torch.tensor(-3.0))
213
+
214
+ def forward(self, x):
215
+ B, n, _ = x.shape
216
+ slots = self.proj(x).view(B, n, self.n_slots, 4)
217
+ m = self.addr.m_hat(slots).reshape(B, n, -1)
218
+ return x + self.gate.sigmoid() * self.out(m)
219
+
220
+
221
+ class Block(nn.Module):
222
+ def __init__(self, d: int, attn: nn.Module):
223
+ super().__init__()
224
+ self.n1, self.n2 = nn.LayerNorm(d), nn.LayerNorm(d)
225
+ self.attn = attn
226
+ self.mlp = nn.Sequential(nn.Linear(d, 4 * d), nn.GELU(), nn.Linear(4 * d, d))
227
+
228
+ def forward(self, x):
229
+ x = x + self.attn(self.n1(x))
230
+ return x + self.mlp(self.n2(x))
231
+
232
+
233
+ class ByteLM(nn.Module):
234
+ def __init__(self, arm: str, d: int = 192, layers: int = 4, block: int = 256,
235
+ K: int = 32, D: int = 4):
236
+ super().__init__()
237
+ # "<arm>_tri" suffix = trigram byte embedding (AlephLM byte_emb x3 lineage):
238
+ # token embedding is the sum of embeddings of bytes t, t-1, t-2.
239
+ self.trigram = arm.endswith("_tri")
240
+ if self.trigram:
241
+ arm = arm[:-4]
242
+ # "_fib" = super-Fibonacci S^3 codebook init (basin test: starts INSIDE
243
+ # the RP^3 attractor; primary observable is init->final geodesic drift).
244
+ self.fib = arm.endswith("_fib")
245
+ if self.fib:
246
+ arm = arm[:-4]
247
+ # "relay*" = stacked addresses in depth: MslRelay after every block.
248
+ # relay -> sdpa trunk + standard head; relay_msl64 -> + addressed head.
249
+ self.use_relay = arm.startswith("relay")
250
+ if arm == "relay":
251
+ arm = "sdpa"
252
+ elif arm == "relay_msl64":
253
+ arm = "addr_msl64"
254
+ self.arm, self.block = arm, block
255
+ self.emb = nn.Embedding(VOCAB, d)
256
+ if self.trigram:
257
+ self.emb1 = nn.Embedding(VOCAB, d)
258
+ self.emb2 = nn.Embedding(VOCAB, d)
259
+ self.pos = nn.Parameter(torch.zeros(1, block, d) + 0.01 * torch.randn(1, block, d))
260
+ mk_attn = (lambda: CausalHUB(d, K, D)) if arm == "hub" else (lambda: CausalSDPA(d))
261
+ self.blocks = nn.ModuleList([Block(d, mk_attn()) for _ in range(layers)])
262
+ if self.use_relay:
263
+ self.relays = nn.ModuleList([MslRelay(d) for _ in range(layers)])
264
+ self.nf = nn.LayerNorm(d)
265
+ if arm == "addr_head":
266
+ self.head_addr = AlephAddress(K, d) # v1: codebook in model dim — COLLAPSED
267
+ self.head = nn.Linear(K, VOCAB, bias=True)
268
+ elif arm in ("addr_d4", "addr_3tau", "addr_mhat"):
269
+ # v2 refinements: LOW-D HOME — learned projection to the canon D=4 home
270
+ # before addressing (mirrors the healthy HUB arms), K=64.
271
+ self.head_proj = nn.Linear(d, 4, bias=False)
272
+ nn.init.orthogonal_(self.head_proj.weight)
273
+ self.head_addr = AlephAddress(64, 4)
274
+ if arm == "addr_d4":
275
+ self.head = nn.Linear(64, VOCAB, bias=True) # w alone, D=4 home
276
+ elif arm == "addr_3tau":
277
+ self.taus = (0.05, 0.1, 0.3) # rule-of-3 strobe
278
+ self.head = nn.Linear(64 * 3, VOCAB, bias=True)
279
+ else: # addr_mhat
280
+ self.head = nn.Linear(4, VOCAB, bias=True) # tightest: M_hat
281
+ elif arm.startswith("addr_msl"):
282
+ # v3: MULTI-SLOT heads — the 16s funnel widening: P parallel D=4 slots
283
+ # over a SHARED codebook. addr_msl consumes the reconstructive M_hat per
284
+ # slot (Px4 dims); addr_msl_w consumes signed w per slot (Px64) — tests
285
+ # whether slot-parallel consumption alone rescues the coefficient path.
286
+ # addr_msl<P> = slot-count dose-response. addr_mslh<P> = HARD sign-code
287
+ # consumption (straight-through M_hard per slot).
288
+ self.hard = arm.startswith("addr_mslh")
289
+ if arm in ("addr_msl", "addr_msl_w"):
290
+ self.n_slots = 16
291
+ else:
292
+ self.n_slots = int(arm[len("addr_mslh" if self.hard else "addr_msl"):])
293
+ self.head_proj = nn.Linear(d, self.n_slots * 4, bias=False)
294
+ nn.init.orthogonal_(self.head_proj.weight)
295
+ self.head_addr = AlephAddress(
296
+ 64, 4, init="fibonacci" if self.fib else "random")
297
+ width = self.n_slots * (64 if arm == "addr_msl_w" else 4)
298
+ self.head = nn.Linear(width, VOCAB, bias=True)
299
+ elif arm == "addr_3tau_mhat":
300
+ # v3: combine the two v2 winners — 3-tau stroboscope + reconstructive read.
301
+ self.head_proj = nn.Linear(d, 4, bias=False)
302
+ nn.init.orthogonal_(self.head_proj.weight)
303
+ self.head_addr = AlephAddress(64, 4)
304
+ self.taus = (0.05, 0.1, 0.3)
305
+ self.head = nn.Linear(64 * 3 + 4, VOCAB, bias=True)
306
+ else:
307
+ self.head = nn.Linear(d, VOCAB, bias=True)
308
+ self._last_h = None
309
+
310
+ def forward(self, idx):
311
+ x = self.emb(idx)
312
+ if self.trigram: # past-only shifts — causality preserved
313
+ x = x + self.emb1(F.pad(idx, (1, 0), value=0)[:, :-1]) \
314
+ + self.emb2(F.pad(idx, (2, 0), value=0)[:, :-2])
315
+ x = x + self.pos[:, : idx.shape[1]]
316
+ if self.use_relay:
317
+ for b, r in zip(self.blocks, self.relays):
318
+ x = r(b(x))
319
+ else:
320
+ for b in self.blocks:
321
+ x = b(x)
322
+ h = self.nf(x)
323
+ self._last_h = h.detach()
324
+ if self.arm == "addr_head":
325
+ return self.head(self.head_addr.signed(h))
326
+ if self.arm == "addr_d4":
327
+ return self.head(self.head_addr.signed(self.head_proj(h)))
328
+ if self.arm == "addr_3tau":
329
+ return self.head(self.head_addr.signed_at(self.head_proj(h), self.taus))
330
+ if self.arm == "addr_mhat":
331
+ return self.head(self.head_addr.m_hat(self.head_proj(h)))
332
+ if self.arm.startswith("addr_msl"):
333
+ B, n, _ = h.shape
334
+ slots = self.head_proj(h).view(B, n, self.n_slots, 4)
335
+ if self.arm == "addr_msl_w":
336
+ feats = self.head_addr.signed(slots).reshape(B, n, -1)
337
+ elif getattr(self, "hard", False):
338
+ feats = self.head_addr.m_hard_ste(slots).reshape(B, n, -1)
339
+ else:
340
+ feats = self.head_addr.m_hat(slots).reshape(B, n, -1)
341
+ return self.head(feats)
342
+ if self.arm == "addr_3tau_mhat":
343
+ p = self.head_proj(h)
344
+ feats = torch.cat([self.head_addr.signed_at(p, self.taus),
345
+ self.head_addr.m_hat(p)], dim=-1)
346
+ return self.head(feats)
347
+ return self.head(h)
348
+
349
+ @torch.no_grad()
350
+ def vitals(self) -> dict:
351
+ out = {}
352
+ if self.arm == "hub":
353
+ for i, b in enumerate(self.blocks):
354
+ if self._last_h is not None:
355
+ out[f"L{i}"] = b.attn.addr.vitals(b.attn.q(self._last_h[:2]))
356
+ elif self.arm == "addr_head" and self._last_h is not None:
357
+ out["head"] = self.head_addr.vitals(self._last_h[:2])
358
+ elif self.arm in ("addr_d4", "addr_3tau", "addr_mhat",
359
+ "addr_3tau_mhat") and self._last_h is not None:
360
+ out["head"] = self.head_addr.vitals(self.head_proj(self._last_h[:2]))
361
+ elif self.arm.startswith("addr_msl") and self._last_h is not None:
362
+ slots = self.head_proj(self._last_h[:2])
363
+ out["head"] = self.head_addr.vitals(
364
+ slots.reshape(*slots.shape[:-1], self.n_slots, 4))
365
+ if self.use_relay and self._last_h is not None:
366
+ for i, r in enumerate(self.relays):
367
+ s = r.proj(self._last_h[:2])
368
+ v = r.addr.vitals(s.reshape(*s.shape[:-1], r.n_slots, 4))
369
+ out[f"relay{i}"] = {"gate": round(r.gate.sigmoid().item(), 4),
370
+ "drift": v["drift"],
371
+ "binding_frac": v["binding_frac"],
372
+ "ppl": round(v["aliveness"]["usage_ppl"], 1)}
373
+ return out
374
+
375
+
376
+ # --------------------------------------------------------------------------- data
377
+ def _wikitext_bytes(data_root: str):
378
+ """wikitext-2-raw as flat uint8 tensors via the HF parquet CDN."""
379
+ from huggingface_hub import hf_hub_download
380
+ import pyarrow.parquet as pq
381
+
382
+ def load(split):
383
+ p = hf_hub_download("Salesforce/wikitext",
384
+ f"wikitext-2-raw-v1/{split}-00000-of-00001.parquet",
385
+ repo_type="dataset", local_dir=data_root)
386
+ text = "".join(pq.read_table(p).column("text").to_pylist())
387
+ return torch.frombuffer(bytearray(text.encode("utf-8")), dtype=torch.uint8).clone()
388
+
389
+ return load("train"), load("validation")
390
+
391
+
392
+ def _batch(data: torch.Tensor, batch: int, block: int, device, g: torch.Generator):
393
+ ix = torch.randint(0, data.numel() - block - 1, (batch,), generator=g)
394
+ x = torch.stack([data[i:i + block] for i in ix]).long().to(device)
395
+ y = torch.stack([data[i + 1:i + block + 1] for i in ix]).long().to(device)
396
+ return x, y
397
+
398
+
399
+ # -------------------------------------------------------------------- train/smoke
400
+ def train(arms=("sdpa", "hub", "addr_head"), steps: int = 2000, batch: int = 32,
401
+ block: int = 256, device: str = "cuda", data_root: str = "./data",
402
+ seed: int = 0, eval_every: int = 500, save: bool = True):
403
+ """Verdict run — GPU only. Pure Adam wd=0. Reports val bits-per-byte + vitals.
404
+ save=True writes {data_root}/ar_ckpts/{arm}_s{seed}_t{steps}.pt per arm —
405
+ the cultivated codebooks are SPECIMENS for the projective reading instruments."""
406
+ import os
407
+ if device == "cuda" and not torch.cuda.is_available():
408
+ raise RuntimeError("Verdict runs are GPU-only (never CPU-train for accuracy).")
409
+ ckpt_dir = os.path.join(data_root, "ar_ckpts")
410
+ os.makedirs(ckpt_dir, exist_ok=True)
411
+ tr, va = _wikitext_bytes(data_root)
412
+ print(f"data ready: train {tr.numel():,} bytes, val {va.numel():,} bytes", flush=True)
413
+ results = {}
414
+ for arm in arms:
415
+ torch.manual_seed(seed)
416
+ g = torch.Generator().manual_seed(seed)
417
+ model = ByteLM(arm, block=block).to(device)
418
+ n_params = sum(p.numel() for p in model.parameters())
419
+ opt = torch.optim.Adam(model.parameters(), lr=3e-4, weight_decay=0.0)
420
+ for step in range(1, steps + 1):
421
+ x, y = _batch(tr, batch, block, device, g)
422
+ logits = model(x)
423
+ loss = F.cross_entropy(logits.reshape(-1, VOCAB), y.reshape(-1))
424
+ opt.zero_grad(set_to_none=True)
425
+ loss.backward()
426
+ opt.step()
427
+ if step % eval_every == 0 or step == steps:
428
+ model.eval()
429
+ with torch.no_grad():
430
+ losses = []
431
+ for _ in range(20):
432
+ xv, yv = _batch(va, batch, block, device, g)
433
+ lv = F.cross_entropy(model(xv).reshape(-1, VOCAB),
434
+ yv.reshape(-1))
435
+ losses.append(lv.item())
436
+ bpb = sum(losses) / len(losses) / math.log(2)
437
+ print(f"[{arm}] step {step} val_bpb={bpb:.4f} vitals={model.vitals()}",
438
+ flush=True)
439
+ model.train()
440
+ results[arm] = {"val_bpb": bpb, "params": n_params, "vitals": model.vitals()}
441
+ if save:
442
+ path = os.path.join(ckpt_dir, f"{arm}_s{seed}_t{steps}.pt")
443
+ torch.save({"arm": arm, "seed": seed, "steps": steps, "val_bpb": bpb,
444
+ "state_dict": {k: v.cpu() for k, v in
445
+ model.state_dict().items()}}, path)
446
+ print(f"saved specimen: {path}", flush=True)
447
+ print(results, flush=True)
448
+ return results
449
+
450
+
451
+ def smoke():
452
+ """Shapes/parse only — no accuracy claims."""
453
+ x = torch.randint(0, VOCAB, (2, 64))
454
+ for arm in ("sdpa", "hub", "addr_head"):
455
+ m = ByteLM(arm, d=96, layers=2, block=64, K=16)
456
+ logits = m(x)
457
+ assert logits.shape == (2, 64, VOCAB)
458
+ logits.sum().backward()
459
+ # causality check: future byte must not affect past logits
460
+ with torch.no_grad():
461
+ a = m(x)[0, 10]
462
+ x2 = x.clone(); x2[0, 40] = (x2[0, 40] + 7) % 256
463
+ b = m(x2)[0, 10]
464
+ assert torch.allclose(a, b, atol=1e-4), f"{arm} leaks future context"
465
+ print(f"{arm}: OK params={sum(p.numel() for p in m.parameters()):,} "
466
+ f"vitals={m.vitals()}", flush=True)
467
+ print("OK — AR bed smoke passed (verdict run: train() on GPU)", flush=True)
468
+
469
+
470
+ def _in_notebook() -> bool:
471
+ try:
472
+ get_ipython() # type: ignore[name-defined] # noqa: F821
473
+ return True
474
+ except NameError:
475
+ return False
476
+
477
+
478
+ if __name__ == "__main__":
479
+ if _in_notebook():
480
+ smoke()
481
+ print("Notebook mode: call train(steps=2000) in the next cell (GPU).")
482
+ else:
483
+ import argparse
484
+ ap = argparse.ArgumentParser()
485
+ ap.add_argument("--train", action="store_true")
486
+ ap.add_argument("--steps", type=int, default=2000)
487
+ a, _ = ap.parse_known_args()
488
+ train(steps=a.steps) if a.train else smoke()
code/compartment_smoke.py ADDED
@@ -0,0 +1,641 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """compartment_smoke.py — the loss-campaign formula-smoke battery. #TAG:loss_smoke #TAG:compartments #TAG:conditioning_gate #TAG:collinearity_gate
2
+ Tree: loss campaign pass 2 (plan 2026-07-25). ONE file, Colab-cell-safe, <~60s
3
+ on a 4090. Formula smoke ONLY — shapes, gradients, identities, conditioning,
4
+ memory. NO training, ever (MANIFEST rider). Accuracy verdicts are real runs.
5
+
6
+ Carries the REFERENCE implementations of:
7
+ - compartment_windows(): the certified cosine-crossfade ramp, parameterized
8
+ (parity-asserted bit-exact against amoe.diffusion band_weights at its
9
+ native constants — the "reuse verbatim" proof is a test, not a promise);
10
+ - CompartmentMap / CompartmentDelta: rigid channel->slot partition x smooth
11
+ slot->band crossfade, with the MASKED WRITE-BACK that is the entire
12
+ isolation mechanism on a feature axis;
13
+ - the CONDITIONING GATE (kappa^2 energy ratio; refuses predicted-inert
14
+ auxiliary couplings — calibrated on the eps/flow 125-200x receipt);
15
+ - the COLLINEARITY GATE (novelty = 1-|cos(grad_arm, grad_base)|; refuses
16
+ role objectives that cannot pay — calibrated on dexp009 vs dexp012);
17
+ - the exact fp64 Cantor warp (the ADMISSIBLE band coordinate) and the
18
+ soft-staircase non-monotonicity regression (the INADMISSIBLE one).
19
+
20
+ Run: python tools/compartment_smoke.py (or paste as one Colab cell)
21
+ """
22
+ import inspect
23
+ import math
24
+ import os
25
+ import sys
26
+ import time
27
+ import zlib
28
+
29
+ import torch
30
+ import torch.nn as nn
31
+ import torch.nn.functional as F
32
+
33
+ # ---------------------------------------------------------------- environment
34
+ def _repo_root():
35
+ d = os.path.abspath(os.getcwd())
36
+ while True:
37
+ if os.path.exists(os.path.join(d, "MANIFEST.md")):
38
+ return d
39
+ p = os.path.dirname(d)
40
+ if p == d:
41
+ return os.getcwd()
42
+ d = p
43
+
44
+ ROOT = _repo_root()
45
+ for _p in (os.path.join(ROOT, "tools"),
46
+ os.path.join(ROOT, "closeout_2026-07-19", "amoe", "src")):
47
+ if os.path.isdir(_p) and _p not in sys.path:
48
+ sys.path.insert(0, _p)
49
+
50
+ torch.backends.cuda.matmul.allow_tf32 = False # pin_precision (law)
51
+ torch.backends.cudnn.allow_tf32 = False
52
+ DEV = "cuda" if torch.cuda.is_available() else "cpu"
53
+ if DEV == "cuda":
54
+ torch.cuda.set_per_process_memory_fraction(0.73) # WDDM standing cap
55
+
56
+ def seed_for(name: str) -> int:
57
+ """crc32, never hash() — PYTHONHASHSEED nondeterminism is a recorded law."""
58
+ return zlib.crc32(name.encode("utf-8")) & 0x7FFFFFFF
59
+
60
+ try:
61
+ from geolip_vitals import (_pentachoron_volumes, axis_aliveness,
62
+ pentachoron_cv)
63
+ HAVE_VITALS = True
64
+ except Exception:
65
+ HAVE_VITALS = False
66
+ try:
67
+ from amoe.diffusion.core.multiband import band_weights as amoe_band_weights
68
+ HAVE_AMOE = True
69
+ except Exception:
70
+ HAVE_AMOE = False
71
+
72
+
73
+ # --------------------------------------------------- windows (the smooth layer)
74
+ def compartment_windows(coord: torch.Tensor, edges=(1/3, 2/3),
75
+ xfade: float = 0.06) -> torch.Tensor:
76
+ """The certified cosine-crossfade windows, parameterized. Identical math to
77
+ amoe.diffusion.core.multiband.band_weights (parity test T01b); `coord` is a
78
+ monotone band coordinate in [0,1] — a FUNCTION OF INDEX ONLY on the feature
79
+ axis (T04). Rows sum to 1 everywhere; max step pi/(4*xfade) per unit."""
80
+ def ramp(x):
81
+ t = ((x / xfade).clamp(-1, 1) + 1) / 2
82
+ return 0.5 - 0.5 * torch.cos(t * math.pi)
83
+ e1, e2 = edges
84
+ up1, up2 = ramp(coord - e1), ramp(coord - e2)
85
+ low = 1 - up1
86
+ mid = up1 * (1 - up2)
87
+ high = up1 * up2
88
+ return torch.stack([low, mid, high], dim=-1)
89
+
90
+
91
+ # ------------------------------------------------ Cantor coordinate (the warp)
92
+ def exact_cantor(x: torch.Tensor, L: int = 12) -> torch.Tensor:
93
+ """Exact floor-based Cantor function, fp64, MONOTONE by construction. The
94
+ ADMISSIBLE static warp: built once, frozen, no gradient path — measure
95
+ space is entered exactly once (cantor law)."""
96
+ r = x.double().clone()
97
+ out = torch.zeros_like(r)
98
+ alive = torch.ones_like(r)
99
+ for k in range(1, L + 1):
100
+ d = torch.floor(3.0 * r).clamp(max=2.0) # endpoint: 3*1.0 -> digit 2
101
+ r = 3.0 * r - d
102
+ out = out + alive * (2.0 ** -k) * (d >= 1).double()
103
+ alive = alive * (d != 1).double()
104
+ return out
105
+
106
+ def soft_cantor_ungated(x: torch.Tensor, L: int = 12, tau: float = 0.25,
107
+ alpha: float = 0.5) -> torch.Tensor:
108
+ """The soft alpha-form staircase (centers .5/1.5/2.5, soft trit, no stop
109
+ gate) — reimplemented from the recorded formula for the NON-MONOTONICITY
110
+ REGRESSION (timeline 2026-07-25): it keeps accumulating digits past the
111
+ first 1, so it is INADMISSIBLE as a band coordinate. Feature use is fine."""
112
+ centers = torch.tensor([0.5, 1.5, 2.5], dtype=torch.float64)
113
+ xx = x.double()
114
+ out = torch.zeros_like(xx)
115
+ for k in range(1, L + 1):
116
+ y = (xx * (3.0 ** (k - 1))) % 1.0 * 3.0
117
+ p = torch.softmax(-(y.unsqueeze(-1) - centers) ** 2 / tau, dim=-1)
118
+ out = out + (p[..., 2] + alpha * p[..., 1]) * (2.0 ** -k)
119
+ return out
120
+
121
+ def exact_cantor_ungated(x: torch.Tensor, L: int = 12,
122
+ alpha: float = 0.5) -> torch.Tensor:
123
+ """Exact-arithmetic UNGATED accumulation (digit-2 full bit, digit-1
124
+ alpha-bit, never stops) — the alpha-law regression pair for T06."""
125
+ r = x.double().clone()
126
+ out = torch.zeros_like(r)
127
+ for k in range(1, L + 1):
128
+ d = torch.floor(3.0 * r).clamp(max=2.0)
129
+ r = 3.0 * r - d
130
+ out = out + (2.0 ** -k) * ((d == 2).double() + alpha * (d == 1).double())
131
+ return out
132
+
133
+
134
+ # ------------------------------------------------------- the compartment map
135
+ def build_compartment_map(P: int = 32, Ds: int = 4, d: int = 128, B: int = 3,
136
+ xfade_slots: float = 1.92, warp: str = "identity"):
137
+ """RIGID channel->slot partition (static int64) x SMOOTH slot->band
138
+ crossfade. The coordinate is a function of INDEX ONLY (torch.arange) —
139
+ never of activations; no argmax/topk/softmax selection appears in this
140
+ path (source-inspected by T04). Built ONCE, fp64 warp, frozen buffers."""
141
+ assert d % P == 0, "rigid partition must tile exactly"
142
+ member = torch.arange(d, dtype=torch.int64) // (d // P)
143
+ c = (torch.arange(P, dtype=torch.float64) + 0.5) / P
144
+ if warp == "cantor_exact":
145
+ c = exact_cantor(c)
146
+ c = (c - c.min()) / (c.max() - c.min()).clamp_min(1e-12)
147
+ W_slot = compartment_windows(c, edges=(1/3, 2/3),
148
+ xfade=xfade_slots / P).float()
149
+ W_chan = W_slot[member]
150
+ fp = zlib.crc32(member.numpy().tobytes()
151
+ + W_slot.numpy().tobytes() + W_chan.numpy().tobytes())
152
+ return {"member": member, "coord": c.float(), "W_slot_band": W_slot,
153
+ "W_chan_band": W_chan, "P": P, "Ds": Ds, "B": B, "d": d,
154
+ "fingerprint": fp}
155
+
156
+
157
+ class SquaredReLU(nn.Module):
158
+ def forward(self, x):
159
+ return F.relu(x) ** 2
160
+
161
+
162
+ class MiniAleph(nn.Module):
163
+ """Minimal aleph read: M_hat = sum_k sinh(u_k) A_k / sum_k cosh(u_k),
164
+ stabilized by max-|u| factor-out. Codebook is the only parameter; `home`
165
+ is the frozen init snapshot (drift gauge). No argmax, no roster."""
166
+ def __init__(self, K=64, D=4, tau=0.1, gen=None):
167
+ super().__init__()
168
+ cb = F.normalize(torch.randn(K, D, generator=gen), dim=-1)
169
+ self.codebook = nn.Parameter(cb.clone())
170
+ self.register_buffer("home", cb.clone())
171
+ self.tau = tau
172
+
173
+ def m_hat(self, x): # x: (..., D) rows on the sphere
174
+ A = F.normalize(self.codebook, dim=-1)
175
+ u = (F.normalize(x, dim=-1) @ A.t()) / self.tau
176
+ m = u.abs().amax(dim=-1, keepdim=True)
177
+ ep, en = torch.exp(u - m), torch.exp(-u - m)
178
+ num = (ep - en) @ A
179
+ den = (ep + en).sum(dim=-1, keepdim=True)
180
+ return num / den
181
+
182
+
183
+ class CompartmentDelta(nn.Module):
184
+ """One site: proj -> shared aleph read per slot -> B band consumers with
185
+ WINDOWED READ and MASKED WRITE. The masked write is load-bearing: on a
186
+ feature axis every band is active on every sample, so without masking the
187
+ write-back by the same window, isolation is exactly zero (measured
188
+ own/cross 1.04x). Zero-init heads (weight AND bias) => P-INIT bit-exact;
189
+ enabled=False is a code-path skip => toggle law bit-exact."""
190
+ def __init__(self, cmap, hidden=64, gen=None, head_scale=0.0):
191
+ super().__init__()
192
+ self.cm = cmap
193
+ P, Ds, B, d = cmap["P"], cmap["Ds"], cmap["B"], cmap["d"]
194
+ self.proj = nn.Linear(d, P * Ds, bias=False)
195
+ nn.init.orthogonal_(self.proj.weight, generator=gen)
196
+ self.addr = MiniAleph(K=64, D=Ds, gen=gen)
197
+ self.cons = nn.ModuleList()
198
+ for _ in range(B):
199
+ head = nn.Linear(hidden, d)
200
+ if head_scale == 0.0:
201
+ nn.init.zeros_(head.weight)
202
+ nn.init.zeros_(head.bias) # bias too — the exp006 law
203
+ else:
204
+ with torch.no_grad():
205
+ head.weight.normal_(0, head_scale, generator=gen)
206
+ head.bias.zero_()
207
+ self.cons.append(nn.Sequential(nn.Linear(P * Ds, hidden),
208
+ SquaredReLU(),
209
+ nn.LayerNorm(hidden), head))
210
+ self.gates = nn.Parameter(torch.full((B,), -3.0))
211
+ self.register_buffer("W_slot", cmap["W_slot_band"])
212
+ self.register_buffer("W_chan", cmap["W_chan_band"])
213
+ self.enabled = True
214
+ self.band_enabled = [True] * B
215
+
216
+ def forward(self, x): # x: (B?, T, d)
217
+ if not self.enabled:
218
+ return x
219
+ P, Ds, B = self.cm["P"], self.cm["Ds"], self.cm["B"]
220
+ f = self.addr.m_hat(self.proj(x).view(*x.shape[:-1], P, Ds))
221
+ delta = None
222
+ for b in range(B):
223
+ if not self.band_enabled[b]:
224
+ continue
225
+ f_b = (f * self.W_slot[:, b].view(P, 1)).reshape(*x.shape[:-1], P * Ds)
226
+ piece = torch.sigmoid(self.gates[b]) * (self.W_chan[:, b]
227
+ * self.cons[b](f_b))
228
+ delta = piece if delta is None else delta + piece
229
+ return x if delta is None else x + delta
230
+
231
+
232
+ # ------------------------------------------------------------- the two gates
233
+ def conditioning_gate(w_bands: torch.Tensor, amp: torch.Tensor,
234
+ amp_ref: torch.Tensor, refuse_at: float = 25.0):
235
+ """kappa^2_b = band-weighted ENERGY of the prediction->quantity map's gain,
236
+ relative to a reference map — the conditioning law as a pre-spend check.
237
+ NEVER the pointwise mean ratio (it diverges as the reference gain -> 0).
238
+ kappa^2 >= refuse_at => REFUSE, predicted inert."""
239
+ w = w_bands.double()
240
+ e = (w * amp.double().unsqueeze(-1) ** 2).sum(0) / w.sum(0)
241
+ er = (w * amp_ref.double().unsqueeze(-1) ** 2).sum(0) / w.sum(0)
242
+ k2 = (e / er.clamp_min(1e-30))
243
+ return k2, [bool(v >= refuse_at) for v in k2]
244
+
245
+ def collinearity_gate(loss_arm, loss_base, params, refuse_below: float = 0.05):
246
+ """novelty = 1 - |cos(grad_arm, grad_base)| over shared params. Calibrated:
247
+ HP/LP role arms 0.0026-0.0083 (WAS inert at 0.05-0.2%) vs the blob payer
248
+ 0.715 (~10% win). novelty < refuse_below => REFUSE."""
249
+ def flat_grad(loss):
250
+ gs = torch.autograd.grad(loss, params, retain_graph=True,
251
+ allow_unused=True)
252
+ return torch.cat([g.reshape(-1) for g in gs if g is not None])
253
+ ga, gb = flat_grad(loss_arm), flat_grad(loss_base)
254
+ cos = F.cosine_similarity(ga.unsqueeze(0), gb.unsqueeze(0)).item()
255
+ nov = 1.0 - abs(cos)
256
+ return nov, nov < refuse_below
257
+
258
+
259
+ def half_ulp_bf16(w: float) -> float:
260
+ """Half a bf16 ULP at magnitude |w| (7 explicit mantissa bits). At 3.0 this
261
+ is 0.0078125 — the exp004 sub-ULP freeze constant."""
262
+ if w == 0.0:
263
+ return 2.0 ** -133
264
+ return 2.0 ** (math.floor(math.log2(abs(w))) - 7) / 2.0
265
+
266
+
267
+ # -------------------------------------------------------------------- battery
268
+ RESULTS = []
269
+ def record(tid, name, ok, detail=""):
270
+ RESULTS.append((tid, name, "PASS" if ok else "FAIL", detail))
271
+ return ok
272
+
273
+ def skip(tid, name, why):
274
+ RESULTS.append((tid, name, "SKIP", why))
275
+
276
+
277
+ def run_battery():
278
+ t0 = time.time()
279
+ g = torch.Generator().manual_seed(seed_for("compartment_smoke"))
280
+ cmap = build_compartment_map()
281
+ P, B, d = cmap["P"], cmap["B"], cmap["d"]
282
+ W = cmap["W_slot_band"]
283
+
284
+ # T01 partition of unity (fp32 grid + fp64 dense) + T01b amoe parity
285
+ dense = torch.linspace(0, 1, 4096, dtype=torch.float64)
286
+ Wd = compartment_windows(dense, (1/3, 2/3), 0.06)
287
+ ok = (W.sum(-1) - 1).abs().max().item() <= 1e-6 \
288
+ and (Wd.sum(-1) - 1).abs().max().item() <= 1e-12 \
289
+ and float(W.min()) >= 0 and float(W.max()) <= 1
290
+ record("T01", "window partition-of-unity",
291
+ ok, "fp32 err %.1e fp64 err %.1e" % (
292
+ (W.sum(-1) - 1).abs().max(), (Wd.sum(-1) - 1).abs().max()))
293
+ if HAVE_AMOE:
294
+ s = torch.linspace(0, 1, 2048)
295
+ mine = compartment_windows(s, (0.35, 0.75), 0.06)
296
+ record("T01b", "verbatim parity vs amoe band_weights",
297
+ torch.equal(mine, amoe_band_weights(s)),
298
+ "bit-exact at amoe's native constants")
299
+ else:
300
+ skip("T01b", "verbatim parity vs amoe band_weights", "amoe not importable")
301
+
302
+ # T02 max-step analytic bound (per-slot step; bound pi/(4*m_slots))
303
+ step = (W[1:] - W[:-1]).abs().max().item()
304
+ bound = math.pi / (4 * 1.92)
305
+ record("T02", "max-step analytic bound",
306
+ step <= bound and step >= 0.5 * bound,
307
+ "step %.4f bound %.4f (tight %.2f)" % (step, bound, step / bound))
308
+
309
+ # T03 rigid partition integrity
310
+ bc = torch.bincount(cmap["member"], minlength=P)
311
+ record("T03", "rigid partition integrity",
312
+ bool((bc == d // P).all()) and int(cmap["member"].max()) + 1 == P
313
+ and d % P == 0, "%d channels / %d slots, uniform" % (d, P))
314
+
315
+ # T04 coordinate law — source inspection (the band-coordinate idiom).
316
+ # Scan the CODE only (part after the docstring close) — the docstring
317
+ # names the forbidden ops, which is not the same as using them.
318
+ code = inspect.getsource(build_compartment_map).split('"""')[2]
319
+ ok = ("arange" in code and "argmax" not in code and "topk" not in code
320
+ and "softmax" not in code and ".grad" not in code)
321
+ record("T04", "coordinate is INDEX-ONLY (source-inspected)", ok,
322
+ "no argmax/topk/softmax in the coordinate path")
323
+
324
+ # T05 Cantor admissibility: exact monotone; soft form DETECTED non-monotone
325
+ # (interior grid — the x=1.0 mod-wrap is an endpoint artifact, not the
326
+ # finding; the recorded interior dips are slope -0.13..-0.49 per level)
327
+ xs = torch.linspace(0, 1, 2048, dtype=torch.float64)
328
+ ce_ = exact_cantor(xs)
329
+ mono = float((ce_[1:] - ce_[:-1]).min())
330
+ xin = xs[:-1]
331
+ worst = 0.0
332
+ for L in (3, 5, 12):
333
+ sc = soft_cantor_ungated(xin, L=L)
334
+ worst = min(worst, float(((sc[1:] - sc[:-1]) * (len(xin) - 1)).min()))
335
+ record("T05", "Cantor coordinate admissibility",
336
+ mono >= -1e-12 and worst < -0.05,
337
+ "exact min-diff %.1e; soft interior min-slope %.2f (non-monotone)"
338
+ % (mono, worst))
339
+
340
+ # T06 alpha-law: alpha=0.5 expectation-matches the gated form; alpha=0 collapses
341
+ # alpha=0.5 is the UNIQUE expectation-matching value: a digit-1 contributes
342
+ # 2^-N and stops (gated), while an unstopped continuation contributes
343
+ # alpha*2^-N plus a tail averaging 0.5*2^-N — so alpha=0.5 is unbiased and
344
+ # alpha=0 is systematically biased low. Distinct values must survive.
345
+ cent = (torch.arange(32, dtype=torch.float64) + 0.5) / 32 # slot centroids
346
+ gt5 = ce_ - exact_cantor_ungated(xs, alpha=0.5)
347
+ gt0 = ce_ - exact_cantor_ungated(xs, alpha=0.0)
348
+ slots32 = exact_cantor_ungated(cent, alpha=0.5)
349
+ record("T06", "alpha=0.5 expectation-matching law",
350
+ abs(float(gt5.mean())) < 1e-3 and float(gt5.abs().mean()) > 0.01
351
+ and float(gt0.mean()) > 0.01
352
+ and len(torch.unique(slots32)) == 32,
353
+ "bias a=.5 %.1e (unbiased) vs a=0 %.3f (low); gradation %.3f; "
354
+ "distinct 32/32" % (gt5.mean(), gt0.mean(), gt5.abs().mean()))
355
+
356
+ # T07 map staticity across optimizer steps
357
+ mod = CompartmentDelta(cmap, gen=g).to(DEV)
358
+ opt = torch.optim.Adam(mod.parameters(), lr=1e-3, weight_decay=0.0)
359
+ x = torch.randn(4, 16, d, generator=g).to(DEV)
360
+ for _ in range(3):
361
+ opt.zero_grad(set_to_none=True)
362
+ ((mod(x) - x) ** 2).mean().backward()
363
+ opt.step()
364
+ fp2 = zlib.crc32(mod.cm["member"].numpy().tobytes()
365
+ + mod.cm["W_slot_band"].numpy().tobytes()
366
+ + mod.cm["W_chan_band"].numpy().tobytes())
367
+ record("T07", "map staticity (crc32 across steps)",
368
+ fp2 == cmap["fingerprint"]
369
+ and not mod.W_slot.requires_grad and not mod.W_chan.requires_grad,
370
+ "fingerprint %08x stable" % fp2)
371
+
372
+ # T08 lesion does not renormalize
373
+ Wl = W.clone(); Wl[:, 1] = 0.0
374
+ record("T08", "lesion no-renormalization",
375
+ float(Wl.sum(-1).max()) < 1.0 + 1e-6
376
+ and bool((Wl.sum(-1) < 1 - 1e-6).any())
377
+ and torch.equal(Wl[:, 0], W[:, 0]) and torch.equal(Wl[:, 2], W[:, 2]),
378
+ "lesioned rows sum<1; other columns bit-identical")
379
+
380
+ # T09 toggle / P-INIT bit-exactness
381
+ fresh = CompartmentDelta(cmap, gen=g).to(DEV)
382
+ xb = torch.randn(2, 8, d, generator=g).to(DEV)
383
+ fresh.enabled = False
384
+ off = fresh(xb)
385
+ fresh.enabled = True
386
+ on0 = fresh(xb) # zero-init => inert
387
+ fresh.band_enabled = [False] * B
388
+ les = fresh(xb)
389
+ record("T09", "toggle + P-INIT + full-lesion bit-exact",
390
+ torch.equal(off, xb) and torch.equal(on0, xb)
391
+ and torch.equal(les, xb), "all three torch.equal")
392
+
393
+ # T10/T11 gradient flow to intended / zero to unintended
394
+ live = CompartmentDelta(cmap, gen=g, head_scale=0.02).to(DEV)
395
+ live.band_enabled = [True, True, False] # band 2 disabled
396
+ y = live(xb)
397
+ loss = ((y - xb) ** 2).mean()
398
+ loss.backward()
399
+ flow_ok = all(p.grad is not None and float(p.grad.abs().sum()) > 0
400
+ for p in [live.proj.weight, live.addr.codebook,
401
+ live.gates]
402
+ ) and all(
403
+ any(p.grad is not None and float(p.grad.abs().sum()) > 0
404
+ for p in live.cons[b].parameters()) for b in (0, 1))
405
+ zero_ok = (live.addr.home.grad is None and live.W_slot.grad is None
406
+ and all(p.grad is None or float(p.grad.abs().sum()) == 0
407
+ for p in live.cons[2].parameters()))
408
+ record("T10", "gradient FLOW to every intended parameter", flow_ok,
409
+ "proj+codebook+gates+cons[0,1] all nonzero")
410
+ record("T11", "gradient ZERO to every unintended parameter", zero_ok,
411
+ "buffers + disabled band grad-free")
412
+
413
+ # T12 cross-talk matrix (the isolation mechanism, measured)
414
+ ct = CompartmentDelta(cmap, gen=torch.Generator().manual_seed(
415
+ seed_for("crosstalk")), head_scale=0.02).to(DEV)
416
+ xc = torch.randn(4, 16, d,
417
+ generator=torch.Generator().manual_seed(
418
+ seed_for("crosstalk-x"))).to(DEV)
419
+ M = torch.zeros(B, B)
420
+ for b in range(B):
421
+ for p_ in ct.parameters():
422
+ p_.grad = None
423
+ delta = ct(xc) - xc
424
+ Lb = ((delta * ct.W_chan[:, b]) ** 2).mean()
425
+ Lb.backward()
426
+ for b2 in range(B):
427
+ M[b, b2] = math.sqrt(sum(float((p.grad ** 2).sum())
428
+ for p in ct.cons[b2].parameters()
429
+ if p.grad is not None))
430
+ Mn = M / M.diag().clamp_min(1e-12).unsqueeze(1)
431
+ edge_zero = float(Mn[0, 2]) == 0.0 and float(Mn[2, 0]) == 0.0
432
+ own_cross = min((1.0 / Mn[b][torch.arange(B) != b].max()).item()
433
+ for b in range(B))
434
+ bleed = torch.tensor([[float((W[:, a] * W[:, c]).sum() / W[:, a].sum())
435
+ for c in range(B)] for a in range(B)])
436
+ off_mask = ~torch.eye(B, dtype=torch.bool)
437
+ r = torch.corrcoef(torch.stack([Mn[off_mask], bleed[off_mask]]))[0, 1]
438
+ record("T12", "cross-talk: edges exactly 0, own/cross >= 10x, bleed-correlated",
439
+ edge_zero and own_cross >= 10.0 and float(r) > 0.8,
440
+ "LOW<->HIGH %.1e/%.1e; worst own/cross %.1fx; corr(bleed) %.2f"
441
+ % (Mn[0, 2], Mn[2, 0], own_cross, r))
442
+
443
+ # T13 CONDITIONING GATE — must reproduce the eps/flow calibration
444
+ betas = torch.linspace(0.00085 ** 0.5, 0.012 ** 0.5, 1000,
445
+ dtype=torch.float64) ** 2
446
+ abar = torch.cumprod(1 - betas, dim=0)
447
+ s01 = torch.arange(1000, dtype=torch.float64) / 1000.0 # t/1000 — the LAW
448
+ wb = compartment_windows(s01, (0.35, 0.75), 0.06) # sigma-axis bands
449
+ amp_eps = ((1 - abar).sqrt() / abar.sqrt()).float() # d x0 / d eps_hat
450
+ amp_flow = s01.float() # d x0 / d v_hat
451
+ k2, refuse = conditioning_gate(wb, amp_eps, amp_flow)
452
+ k2f, refuse_f = conditioning_gate(wb, amp_flow, amp_flow)
453
+ record("T13", "conditioning gate reproduces the eps/flow split",
454
+ bool(k2[0] < k2[1] < k2[2]) and refuse[2] and not any(refuse_f)
455
+ and 25.0 <= float(k2[2]) <= 400.0,
456
+ "kappa^2 LOW %.1f MID %.1f HIGH %.1f (refuse@25: HIGH fires; "
457
+ "flow self-ratio clean)" % (k2[0], k2[1], k2[2]))
458
+
459
+ # T14 COLLINEARITY GATE — must reproduce HP/LP-inert vs blob-payer
460
+ gc = torch.Generator().manual_seed(seed_for("collinearity"))
461
+ conv = nn.Conv2d(4, 4, 3, padding=1)
462
+ with torch.no_grad():
463
+ conv.weight.normal_(0, 0.1, generator=gc); conv.bias.zero_()
464
+ conv = conv.to(DEV)
465
+ xt = torch.randn(8, 4, 32, 32, generator=gc).to(DEV)
466
+ tgt = torch.randn(8, 4, 32, 32, generator=gc).to(DEV)
467
+ sig = torch.rand(8, 1, 1, 1, generator=gc).to(DEV) * 0.9 + 0.05
468
+ blob = (torch.rand(8, 1, 32, 32, generator=gc).to(DEV) > 0.7).float()
469
+ def hp(z): return z - F.avg_pool2d(z, 3, stride=1, padding=1)
470
+ def lp(z): return F.avg_pool2d(z, 7, stride=1, padding=3)
471
+ pred = conv(xt)
472
+ base = ((pred - tgt) ** 2).mean()
473
+ lam = 0.5
474
+ arm_low = base + lam * ((hp(pred) - hp(tgt)) ** 2).mean()
475
+ arm_high = base + lam * ((lp(pred) - lp(tgt)) ** 2).mean()
476
+ x0h, x0 = xt - sig * pred, xt - sig * tgt
477
+ den = blob.sum().clamp_min(1.0) * 4
478
+ blob_term = (blob * (lp(x0h) - lp(x0)) ** 2).sum() / den
479
+ ps = [conv.weight, conv.bias]
480
+ # Gate semantics: a COMPOSED role arm (base + filtered residual, exp009's
481
+ # actual objective) is judged whole; an ADDITIVE auxiliary is judged as
482
+ # THE TERM BEING ADDED — that is the new pressure whose direction matters.
483
+ n_low, ref_low = collinearity_gate(arm_low, base, ps)
484
+ n_high, ref_high = collinearity_gate(arm_high, base, ps)
485
+ n_blob, ref_blob = collinearity_gate(lam * blob_term, base, ps)
486
+ record("T14", "collinearity gate reproduces inert-vs-payer",
487
+ ref_low and ref_high and not ref_blob
488
+ and max(n_low, n_high) < 0.02 and n_blob > 0.3,
489
+ "novelty HP %.4f LP %.4f (REFUSED) vs blob %.3f (passes)"
490
+ % (n_low, n_high, n_blob))
491
+
492
+ # T15 fp32-vs-fp64 CM parity + geovocab2 reference
493
+ if HAVE_VITALS:
494
+ gp = torch.Generator().manual_seed(seed_for("cm-parity"))
495
+ pts = F.normalize(torch.randn(200, 5, 4, generator=gp), dim=-1)
496
+ v64 = _pentachoron_volumes(pts)
497
+ d2 = torch.cdist(pts, pts).pow(2) # fp32 clone
498
+ cm32 = torch.ones(200, 6, 6); cm32[:, 0, 0] = 0.0
499
+ cm32[:, 1:, 1:] = d2
500
+ v32 = (-torch.linalg.det(cm32) / 9216.0).clamp_min(0).sqrt()
501
+ rel = ((v32 - v64).abs() / v64.abs().clamp_min(1e-12)).max().item()
502
+ try:
503
+ from geolip_vitals import cv_reference_check
504
+ ref = "geovocab2 parity %.1e" % cv_reference_check()
505
+ except Exception as e:
506
+ ref = "geovocab2 skipped (%s)" % type(e).__name__
507
+ record("T15", "fp64-for-gauges precision law",
508
+ rel < 0.05, "fp32 max rel err %.2e (<4%% recorded); %s"
509
+ % (rel, ref))
510
+ else:
511
+ skip("T15", "fp64-for-gauges precision law", "geolip_vitals not importable")
512
+
513
+ # T16 memory + time: full CE vs chunked CE vs a K=64 code loss @ V=248,320
514
+ if DEV == "cuda":
515
+ V, dd, T = 248_320, 1024, 2048
516
+ E = torch.randn(V, dd, device=DEV) * 0.02
517
+ R = torch.randn(64, dd, device=DEV) / math.sqrt(dd)
518
+ yid = torch.randint(0, V, (1, T), device=DEV)
519
+ code = (torch.randn(V, 64, device=DEV) > 0).float() * 2 - 1
520
+ def one(name, fn):
521
+ h = torch.randn(1, T, dd, device=DEV, requires_grad=True)
522
+ fn(h).backward(); torch.cuda.synchronize() # warm
523
+ torch.cuda.reset_peak_memory_stats()
524
+ h = torch.randn(1, T, dd, device=DEV, requires_grad=True)
525
+ t1 = time.time(); fn(h).backward()
526
+ torch.cuda.synchronize()
527
+ return torch.cuda.max_memory_allocated() / 2**30, time.time() - t1
528
+ def full(h):
529
+ return F.cross_entropy((h @ E.t()).reshape(-1, V), yid.reshape(-1))
530
+ def chunked(h):
531
+ s, n = 0.0, 0
532
+ for i in range(0, T, 512):
533
+ lg = h[:, i:i + 512] @ E.t()
534
+ s = s + F.cross_entropy(lg.reshape(-1, V),
535
+ yid[:, i:i + 512].reshape(-1),
536
+ reduction="sum")
537
+ n += lg.shape[1]
538
+ return s / n
539
+ def fac(h):
540
+ v = (F.normalize(h, dim=-1) @ R.t()) / 0.3
541
+ return (torch.cosh((v - code[yid] * 1.0).clamp(-4, 4)) - 1).mean()
542
+ m_full, s_full = one("full", full)
543
+ m_chunk, s_chunk = one("chunked", chunked)
544
+ m_fac, s_fac = one("fac", fac)
545
+ record("T16", "memory law: candidate <= 1.5x chunked CE",
546
+ m_fac <= 1.5 * m_chunk and m_chunk < m_full,
547
+ "full %.2fGB/%.3fs | chunked-512 %.2fGB/%.3fs | "
548
+ "FAC-K64 %.2fGB/%.3fs (%.0fx less than chunked)"
549
+ % (m_full, s_full, m_chunk, s_chunk, m_fac, s_fac,
550
+ m_chunk / max(m_fac, 1e-9)))
551
+ del E, R, code
552
+ torch.cuda.empty_cache()
553
+ else:
554
+ skip("T16", "memory law vs chunked CE", "no CUDA")
555
+
556
+ # T17 sub-ULP safety
557
+ guard = half_ulp_bf16(3.0)
558
+ record("T17", "sub-ULP freeze guard",
559
+ guard == 0.0078125 and 4.5e-4 < guard # bf16 step FREEZES
560
+ and 4.5e-4 > 2.0 ** (1 - 23) / 2, # fp32 master moves
561
+ "half-ULP(bf16, 3.0)=%.7f; 4.5e-4 step frozen in bf16, live in fp32"
562
+ % guard)
563
+
564
+ # T18 anti-collapse smoke (rich-get-richer detector on the read)
565
+ if HAVE_VITALS:
566
+ ga = torch.Generator().manual_seed(seed_for("aliveness"))
567
+ healthy = torch.softmax(torch.randn(4096, 128, generator=ga) * 0.5, -1)
568
+ logits = torch.randn(4096, 128, generator=ga) * 0.5
569
+ logits[:, :2] += 8.0 # 2-winner collapse
570
+ sick = torch.softmax(logits, -1)
571
+ h, s = axis_aliveness(healthy), axis_aliveness(sick)
572
+ record("T18", "anti-collapse (rich-get-richer signature)",
573
+ (not h["collapsed"]) and s["collapsed"] and s["usage_ppl"] < 6,
574
+ "healthy ppl %.0f/128; collapsed ppl %.1f/128 flagged"
575
+ % (h["usage_ppl"], s["usage_ppl"]))
576
+ else:
577
+ skip("T18", "anti-collapse smoke", "geolip_vitals not importable")
578
+
579
+ # T19 eff-dim readout sanity (the S^15 CV band, zero training)
580
+ if HAVE_VITALS:
581
+ gs = torch.Generator().manual_seed(seed_for("s15"))
582
+ cv = pentachoron_cv(torch.randn(500, 16, generator=gs))
583
+ record("T19", "S^15 CV-band sanity (0.199-0.210 untrained)",
584
+ 0.185 <= cv <= 0.225, "CV %.4f" % cv)
585
+ else:
586
+ skip("T19", "S^15 CV-band sanity", "geolip_vitals not importable")
587
+
588
+ # T20 seed determinism (crc32 path; no hash() in the seeding path)
589
+ ok = seed_for("x") == (zlib.crc32(b"x") & 0x7FFFFFFF)
590
+ try: # scan the SEEDING PATH only, CODE only —
591
+ # docstrings name the forbidden call, which is not using it
592
+ def code_of(fn):
593
+ parts = inspect.getsource(fn).split('"""')
594
+ return parts[0] + "".join(parts[2::2])
595
+ src_all = (code_of(seed_for) + code_of(build_compartment_map)
596
+ + code_of(CompartmentDelta.__init__))
597
+ no_hash = "hash(" not in src_all.replace("crc32", "")
598
+ except Exception:
599
+ no_hash = True
600
+ record("T20", "crc32 seed determinism (never hash())", ok and no_hash,
601
+ "seed_for('x')=%d, source clean" % seed_for("x"))
602
+
603
+ # T21 CE-vs-FAC Hessian conditioning (the sequential-loss smoke)
604
+ Vp = 1000
605
+ gz = torch.Generator().manual_seed(seed_for("hessian"))
606
+ out = []
607
+ for pmax in (0.5, 0.9, 0.999):
608
+ p = torch.full((Vp,), (1 - pmax) / (Vp - 1), dtype=torch.float64)
609
+ p[0] = pmax
610
+ J = torch.diag(p) - torch.outer(p, p)
611
+ ev = torch.linalg.eigvalsh(J)
612
+ out.append((pmax, float(ev[0]), float(ev[-1]),
613
+ float((J @ torch.ones(Vp, dtype=torch.float64)).abs().max())))
614
+ r64 = torch.randn(64, generator=gz, dtype=torch.float64) * 2
615
+ lam_fac = torch.cosh(r64).min().item()
616
+ ce999 = out[2]
617
+ record("T21", "CE-vs-FAC Hessian conditioning",
618
+ abs(ce999[1]) < 1e-9 and ce999[3] < 1e-9 # exact null direction
619
+ and ce999[2] < 1e-2 # spectrum collapsed
620
+ and lam_fac >= 1.0, # cosh(r) >= 1 always
621
+ "CE@p=.999: lam_min %.1e lam_max %.1e null|J1| %.1e; "
622
+ "FAC lam_min %.3f >= 1" % (ce999[1], ce999[2], ce999[3], lam_fac))
623
+
624
+ # ------------------------------------------------------------------ table
625
+ wall = time.time() - t0
626
+ peak = (torch.cuda.max_memory_allocated() / 2**30) if DEV == "cuda" else 0.0
627
+ print("\nCOMPARTMENT / LOSS FORMULA-SMOKE BATTERY (%s, %.1fs, peak %.2f GB)"
628
+ % (DEV, wall, peak))
629
+ print("-" * 100)
630
+ npass = nfail = 0
631
+ for tid, name, st, detail in RESULTS:
632
+ npass += st == "PASS"; nfail += st == "FAIL"
633
+ print("%-5s %-4s %-46s %s" % (tid, st, name[:46], detail[:60]))
634
+ print("-" * 100)
635
+ print("PASS %d FAIL %d SKIP %d" % (npass, nfail,
636
+ len(RESULTS) - npass - nfail))
637
+ return nfail == 0
638
+
639
+
640
+ if __name__ == "__main__":
641
+ sys.exit(0 if run_battery() else 1)
code/deviant_bed.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """deviant_bed.py — trains the DEVIANT ROSTER candidates on the certified byte
2
+ bed. #TAG:deviant_bed #TAG:loss_campaign
3
+ One arm per gate-cleared candidate (inventory/DEVIANT_ROSTER.md) + the
4
+ gate-refused confidence penalty as the DESIGNATED CONTROL (tests whether gate
5
+ refusals predict training reality) + the sparsemax coupling-axis probe on the
6
+ addr_head collapse configuration. Certified operating point throughout:
7
+ wikitext-2 bytes, block 256, batch 32, 2000 steps, pure Adam 3e-4 wd=0,
8
+ fp32/TF32-off, crc32 seeds. Ledgers -> tools/deviant_runs/*.jsonl.
9
+
10
+ Baselines on this exact protocol (this session): ce 2.4769 mean bpb (3 seeds),
11
+ fac_lsh 4.1285, ce_fixedcode 3.8060, fac_none 3.9547.
12
+
13
+ Run: python tools/deviant_bed.py --arm <name> --seed N [--steps 2000]
14
+ python tools/deviant_bed.py --list
15
+ """
16
+ import json
17
+ import math
18
+ import os
19
+ import sys
20
+ import time
21
+ import zlib
22
+
23
+ import torch
24
+ import torch.nn as nn
25
+ import torch.nn.functional as F
26
+
27
+
28
+ def _root():
29
+ d = os.path.abspath(os.getcwd())
30
+ while True:
31
+ if os.path.exists(os.path.join(d, "MANIFEST.md")):
32
+ return d
33
+ p = os.path.dirname(d)
34
+ if p == d:
35
+ return os.getcwd()
36
+ d = p
37
+
38
+ ROOT = _root()
39
+ if os.path.join(ROOT, "tools") not in sys.path:
40
+ sys.path.insert(0, os.path.join(ROOT, "tools"))
41
+
42
+ import ar_differentiation_bed as bed # noqa: E402
43
+ from loss_forms import (dev_geomean_accum, dev_softmax_accum, fac_loss_link,
44
+ prim_ce, pwa_weights, sparsemax_loss) # noqa: E402
45
+
46
+ torch.backends.cuda.matmul.allow_tf32 = False
47
+ torch.backends.cudnn.allow_tf32 = False
48
+ DEV = "cuda" if torch.cuda.is_available() else "cpu"
49
+ if DEV == "cuda":
50
+ torch.cuda.set_per_process_memory_fraction(0.73)
51
+
52
+ DATA_ROOT = os.environ.get("GEOLIP_DATA", "./data")
53
+ RUNS = os.path.join(ROOT, "tools", "deviant_runs")
54
+ REF_CKPT = os.path.join(DATA_ROOT, "fac_ckpts", "ce_s0_t2000.pt")
55
+
56
+ def seed_for(name):
57
+ return zlib.crc32(name.encode()) & 0x7FFFFFFF
58
+
59
+ ARMS = ("softmax_accum", "geomean_accum", "label_smooth", "focal",
60
+ "sparsemax", "anti_curr", "fac_tanh", "fac_cauchy",
61
+ "conf_penalty_CONTROL", "p4_sparsemax")
62
+ FAC_ARMS = ("fac_tanh", "fac_cauchy")
63
+
64
+
65
+ def build(arm, seed):
66
+ torch.manual_seed(seed_for(f"deviant:{arm}:{seed}"))
67
+ model_arm = "addr_head" if arm == "p4_sparsemax" else "addr_msl64"
68
+ lm = bed.ByteLM(model_arm).to(DEV)
69
+ ctx = {}
70
+ if arm in FAC_ARMS:
71
+ lm.head = nn.Identity() # forward returns feats
72
+ gp = torch.Generator().manual_seed(seed_for("deviant-fac-frame"))
73
+ ctx["R"] = torch.linalg.qr(
74
+ torch.randn(256, 256, generator=gp))[0][:64].to(DEV)
75
+ gsm = torch.randn(258, 64, generator=gp) # lsh: box-3 smoothed
76
+ sm = (gsm[:-2] + gsm[1:-1] + gsm[2:]) / 3.0
77
+ ctx["code"] = ((sm > 0).float() * 2 - 1).to(DEV)
78
+ if arm == "anti_curr":
79
+ ref = bed.ByteLM("addr_msl64").to(DEV)
80
+ sd = torch.load(REF_CKPT, map_location="cpu", weights_only=True)
81
+ ref.load_state_dict(sd["state_dict"], strict=True)
82
+ ref.eval()
83
+ for p_ in ref.parameters():
84
+ p_.requires_grad_(False)
85
+ ctx["ref"] = ref
86
+ return lm, ctx
87
+
88
+
89
+ def loss_of(arm, lm, ctx, x, y):
90
+ out = lm(x)
91
+ if arm in FAC_ARMS:
92
+ link = "tanh" if arm == "fac_tanh" else "cauchy"
93
+ return fac_loss_link(out, ctx["R"], ctx["code"][y], link=link).mean()
94
+ if arm == "sparsemax" or arm == "p4_sparsemax":
95
+ return sparsemax_loss(out.reshape(-1, 256), y.reshape(-1)).mean()
96
+ ce_tok = prim_ce(out, y)
97
+ if arm == "softmax_accum":
98
+ return dev_softmax_accum(ce_tok, T=0.5)
99
+ if arm == "geomean_accum":
100
+ return dev_geomean_accum(ce_tok)
101
+ if arm == "label_smooth":
102
+ return F.cross_entropy(out.reshape(-1, 256), y.reshape(-1),
103
+ label_smoothing=0.1)
104
+ if arm == "focal":
105
+ w = (1 - F.softmax(out, -1).gather(-1, y.unsqueeze(-1))
106
+ .squeeze(-1).detach()) ** 2
107
+ return (w * ce_tok).sum() / w.sum().clamp_min(1e-9)
108
+ if arm == "anti_curr":
109
+ with torch.no_grad():
110
+ pi = F.softmax(ctx["ref"](x), -1).gather(
111
+ -1, y.unsqueeze(-1)).squeeze(-1)
112
+ m = (pi > 0.6).float()
113
+ return (ce_tok * m).sum() / m.sum().clamp_min(1.0)
114
+ if arm == "conf_penalty_CONTROL":
115
+ p = F.softmax(out, -1)
116
+ ent = -(p * p.clamp_min(1e-12).log()).sum(-1).mean()
117
+ return ce_tok.mean() - 0.1 * ent
118
+ raise ValueError(arm)
119
+
120
+
121
+ @torch.no_grad()
122
+ def evaluate(arm, lm, ctx, va, g):
123
+ """bpb-of-record (softmax over available scores), decoded acc, vitals."""
124
+ lm.eval()
125
+ tot_ce, tot_ok, n = 0.0, 0, 0
126
+ for _ in range(8):
127
+ x, y = bed._batch(va, 32, 256, DEV, g)
128
+ out = lm(x)
129
+ if arm in FAC_ARMS:
130
+ s = F.normalize(out, dim=-1) @ ctx["R"].t()
131
+ scores = s @ ctx["code"].t()
132
+ else:
133
+ scores = out
134
+ lp = F.log_softmax(scores, -1)
135
+ tot_ce += float(-lp.gather(-1, y.unsqueeze(-1)).sum())
136
+ tot_ok += int((scores.argmax(-1) == y).sum())
137
+ n += y.numel()
138
+ x, _ = bed._batch(va, 8, 256, DEV, g)
139
+ _ = lm(x)
140
+ v = lm.head_addr.vitals(lm.head_proj(lm._last_h).view(
141
+ *lm._last_h.shape[:-1], lm.n_slots, 4)) \
142
+ if getattr(lm, "n_slots", 0) else lm.head_addr.vitals(lm._last_h)
143
+ lm.train()
144
+ return (tot_ce / n) / math.log(2), tot_ok / n, v
145
+
146
+
147
+ def train_arm(arm, seed, steps=2000):
148
+ assert arm in ARMS, f"unknown arm {arm} (see --list)"
149
+ os.makedirs(RUNS, exist_ok=True)
150
+ tr, va = bed._wikitext_bytes(DATA_ROOT)
151
+ lm, ctx = build(arm, seed)
152
+ g = torch.Generator().manual_seed(seed_for(f"deviant-data:{arm}:{seed}"))
153
+ ge = torch.Generator().manual_seed(seed_for("deviant-eval"))
154
+ opt = torch.optim.Adam((p_ for p_ in lm.parameters() if p_.requires_grad),
155
+ lr=3e-4, weight_decay=0.0)
156
+ t0 = time.time()
157
+ for step in range(steps):
158
+ x, y = bed._batch(tr, 32, 256, DEV, g)
159
+ opt.zero_grad(set_to_none=True)
160
+ L = loss_of(arm, lm, ctx, x, y)
161
+ L.backward()
162
+ opt.step()
163
+ if step == 10 and DEV == "cuda":
164
+ print(f"[{arm} s{seed}] step10 loss {float(L.detach()):.4f} "
165
+ f"peak {torch.cuda.max_memory_allocated()/2**30:.2f}GB",
166
+ flush=True)
167
+ bpb, acc, vit = evaluate(arm, lm, ctx, va, ge)
168
+ rec = {"arm": arm, "seed": seed, "steps": steps, "bpb": round(bpb, 4),
169
+ "decoded_acc": round(acc, 4), "vitals": vit,
170
+ "wall_s": round(time.time() - t0, 1),
171
+ "peak_gb": round(torch.cuda.max_memory_allocated() / 2**30, 2)
172
+ if DEV == "cuda" else 0.0}
173
+ out = os.path.join(RUNS, f"{arm}_s{seed}_t{steps}.jsonl")
174
+ with open(out, "a", encoding="utf-8") as f:
175
+ f.write(json.dumps(rec) + "\n")
176
+ print(f"[DONE {arm} s{seed}] bpb {bpb:.4f} acc {acc:.4f} "
177
+ f"usage_ppl {vit['aliveness']['usage_ppl']:.1f} "
178
+ f"win|cos| {vit['win_cos_mean']:.3f} ({rec['wall_s']}s)", flush=True)
179
+ return rec
180
+
181
+
182
+ if __name__ == "__main__":
183
+ import argparse
184
+ ap = argparse.ArgumentParser()
185
+ ap.add_argument("--arm", default=None)
186
+ ap.add_argument("--seed", type=int, default=0)
187
+ ap.add_argument("--steps", type=int, default=2000)
188
+ ap.add_argument("--list", action="store_true")
189
+ a, _ = ap.parse_known_args()
190
+ if a.list or not a.arm:
191
+ print("arms:", " ".join(ARMS))
192
+ sys.exit(0)
193
+ train_arm(a.arm, a.seed, a.steps)
code/fac_bed.py ADDED
@@ -0,0 +1,782 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """fac_bed.py — FAC (factorized absolute code) experiment bed. #TAG:fac #TAG:loss_campaign #TAG:autoregressive #TAG:sign_code
2
+
3
+ THE QUESTION: can a cosh-Bregman pull onto a FROZEN +/-1 code table replace the
4
+ trained CE readout on the certified byte-LM operating point — and does swapping
5
+ only-the-loss revive the certified addr_head collapse (the P4 cell)?
6
+
7
+ Built ON TOP of tools/ar_differentiation_bed.py (as-run certified reference —
8
+ imported, never modified, never copied). The certified operating point:
9
+ wikitext-2-raw bytes, block 256, batch 32, d=192, 4 layers, 2000 steps, pure
10
+ Adam lr 3e-4 wd=0. Incumbent control: addr_msl64 (3-seed certified mean bpb
11
+ 2.4685; timeline 2026-07-09 W6).
12
+
13
+ THE FAC CONSTRUCTION
14
+ feats = the certified addr_msl64 pre-readout read: P=64 parallel D=4 slots
15
+ through the shared K=64 aleph codebook, concat M_hat -> 256 dims.
16
+ (The spec sketch guessed P=16/64-dim; the BED CODE is authoritative:
17
+ ByteLM 'addr_msl<P>' parses P from the name -> addr_msl64 is 64
18
+ slots x D=4 = 256 dims. Recorded as smoke S0.)
19
+ R = FIXED frame (64 x 256), orthonormal ROWS, torch.linalg.qr on a
20
+ crc32-seeded gaussian; registered buffer, NEVER trained. Gauge-fixed
21
+ by construction — a learnable frame reproduces either the tied-M_hat
22
+ starvation or the L-PS1 moving-target failure.
23
+ s = F.normalize(feats, dim=-1) @ R.T (B, T, 64); |s_k| <= 1
24
+ v = s / t_loss (t_loss 0.3; sweep .1/.3/1)
25
+ C = FROZEN code table in {-1,+1}^{256 x 64}. Two constructions:
26
+ fac_ecc — sign of an iid crc32-seeded gaussian (injective w.h.p.);
27
+ fac_lsh — sign of the same gaussian box-filtered (width 3) along
28
+ the byte-value axis, so numerically adjacent bytes share more bits
29
+ (a semantic-adjacency proxy for the byte alphabet; bytes carry no
30
+ pretrained embedding here, so a fixed random frame IS the SimHash).
31
+ LOSS L = mean( cosh( clamp(v - C[y]*mu, -4, 4) ) - 1 ), mu = 1.0 (S4).
32
+ This is the residual-form cosh-Bregman D_Phi(v - C[y]*mu, 0) with
33
+ Phi = sum cosh: D_Phi(r,0) = cosh(r) - cosh(0) - sinh(0)*r
34
+ = cosh(r) - 1 exactly (smoke S2; the target-anchored D_Phi(v, v*)
35
+ is a DIFFERENT function — coincides only at v* = 0 — S2 reports the
36
+ gap so the naming is honest).
37
+ EVAL score(y') = s @ C[y'].T; bpb-of-record = log_softmax over the 256
38
+ scores (raw scores as logits — softmax temperature NOT calibrated;
39
+ caveat recorded in every ledger line). Decoded-token accuracy and
40
+ code-collision rate (Hamming <= 2 over distinct byte pairs) ride
41
+ along. Decode argmax is a READOUT only — no selection event in any
42
+ gradient path (aleph rider).
43
+
44
+ ARMS (--arm)
45
+ ce certified addr_msl64 incumbent — bed's own model + CE.
46
+ ce_fixedcode SAME init (same seed, same RNG draw order), readout replaced
47
+ by the frozen C: logits = s @ C.T, trained with CE. Zero
48
+ trainable readout params — THE param-matched control.
49
+ fac_lsh/fac_ecc the FAC loss with each code table.
50
+ fac_none FAC loss, s from a plain Linear(d,64) on the trunk hidden
51
+ state; the aleph head is present but UNREAD (gradient-dead).
52
+ Isolates the geometry.
53
+ p4_addr_head_ce the certified COLLAPSE configuration, verbatim: ByteLM
54
+ 'addr_head' (raw hidden -> single-slot address, K=32,
55
+ tau=0.1, coefficients->logits) + CE. Expected: bpb ~5.66,
56
+ usage_ppl ~1.88/64.
57
+ p4_addr_head_fac the SAME model (identical params; the coeff->logit head is
58
+ computed but gradient-dead) with the FAC loss on the signed
59
+ coefficient vector, embedded isometrically by a 64x32
60
+ orthonormal-column frame. ONLY THE LOSS DIFFERS.
61
+ Prediction: usage_ppl >= 8/64 while win|cos| stays > 0.99.
62
+
63
+ LEDGER JSON lines, one file per run: tools/fac_runs/{arm}_s{seed}_t{steps}.jsonl
64
+ bpb (partitioned), decoded_acc, train-curve summary, collision_rate,
65
+ sign_fidelity (exp015 gauge, L-078), anchor_drift mean + binding_fraction +
66
+ usage_ppl + win|cos| (via the bed's own vitals -> geolip_vitals), gate stats
67
+ (none of these arms carry gates — recorded as null), wall, peak_mem, params
68
+ (+ delta vs ce — the S9 honesty line), seeds from crc32(arm:seed).
69
+
70
+ RIDERS pure Adam wd=0 ONLY; fp32, TF32 off; cuda memory fraction 0.73;
71
+ crc32 seeds never hash(); GPU-only verdict runs; data_root OUTSIDE the repo;
72
+ Colab-cell-safe (paste-ahead imports, parse_known_args, no __file__ logic).
73
+
74
+ Terminal: python tools/fac_bed.py # smoke battery (default)
75
+ python tools/fac_bed.py --smoke # same
76
+ python tools/fac_bed.py --bench # ~20-step throughput probe
77
+ python tools/fac_bed.py --arm fac_lsh --seed 0 # verdict run
78
+ Colab: paste geolip_vitals.py, ar_differentiation_bed.py, then this file
79
+ (smokes auto-run); train_arm("fac_lsh", seed=0) in the next cell.
80
+ """
81
+ from __future__ import annotations
82
+ import json
83
+ import math
84
+ import os
85
+ import sys
86
+ import time
87
+ import types
88
+ import zlib
89
+
90
+ import torch
91
+ import torch.nn as nn
92
+ import torch.nn.functional as F
93
+
94
+ # ---------------------------------------------------------------- environment
95
+ def _repo_root():
96
+ d = os.path.abspath(os.getcwd())
97
+ while True:
98
+ if os.path.exists(os.path.join(d, "MANIFEST.md")):
99
+ return d
100
+ p = os.path.dirname(d)
101
+ if p == d:
102
+ return os.getcwd()
103
+ d = p
104
+
105
+ ROOT = _repo_root()
106
+ _TOOLS = os.path.join(ROOT, "tools")
107
+ if os.path.isdir(_TOOLS) and _TOOLS not in sys.path:
108
+ sys.path.insert(0, _TOOLS)
109
+
110
+ if "ByteLM" in globals() and "AlephAddress" in globals(): # Colab paste-ahead
111
+ bed = types.SimpleNamespace(
112
+ ByteLM=globals()["ByteLM"], AlephAddress=globals()["AlephAddress"],
113
+ _wikitext_bytes=globals()["_wikitext_bytes"],
114
+ _batch=globals()["_batch"], VOCAB=globals()["VOCAB"])
115
+ else:
116
+ import ar_differentiation_bed as bed # certified, read-only
117
+
118
+ torch.backends.cuda.matmul.allow_tf32 = False # pin_precision law
119
+ torch.backends.cudnn.allow_tf32 = False
120
+ DEV = "cuda" if torch.cuda.is_available() else "cpu"
121
+ if DEV == "cuda":
122
+ torch.cuda.set_per_process_memory_fraction(0.73) # WDDM standing cap
123
+
124
+ DATA_ROOT = os.environ.get("GEOLIP_DATA", "./data")
125
+ RUNS_DIR = (os.path.join(_TOOLS, "fac_runs") if os.path.isdir(_TOOLS)
126
+ else os.path.abspath("./fac_runs"))
127
+
128
+ CODE_BITS = 64 # width of the absolute code (matches the K=64 aleph book)
129
+ T_LOSS = 0.3 # loss temperature (knob; sweep {0.1, 0.3, 1.0})
130
+ MU = 1.0 # target margin in v-units (S4 decision: KEPT at 1.0)
131
+ CLAMP = 4.0 # residual clamp — cosh(4) ~ 27.3, fp32-safe by construction
132
+
133
+
134
+ def seed_for(name: str) -> int:
135
+ """crc32, never hash() — PYTHONHASHSEED nondeterminism is a recorded law."""
136
+ return zlib.crc32(name.encode("utf-8")) & 0x7FFFFFFF
137
+
138
+
139
+ # ------------------------------------------------------------- frozen buffers
140
+ def orthonormal_frame(out_dim: int, in_dim: int, seed: int) -> torch.Tensor:
141
+ """(out_dim, in_dim) fixed frame, QR on a crc32-seeded gaussian, fp64 then
142
+ fp32, canonical sign fix. NEVER trained (registered as a buffer).
143
+ in_dim >= out_dim: orthonormal ROWS (R R^T = I) -> |s_k| <= 1 for unit feats
144
+ in_dim < out_dim: orthonormal COLS (R^T R = I) -> isometric embed,
145
+ ||s|| = ||feats_hat||, |s_k| <= ||row_k|| <= 1."""
146
+ g = torch.Generator().manual_seed(seed)
147
+ n, m = max(out_dim, in_dim), min(out_dim, in_dim)
148
+ G = torch.randn(n, m, generator=g, dtype=torch.float64)
149
+ Q, Rq = torch.linalg.qr(G)
150
+ sgn = torch.where(torch.diagonal(Rq) >= 0, 1.0, -1.0)
151
+ Q = Q * sgn.unsqueeze(0)
152
+ R = Q.T if in_dim >= out_dim else Q
153
+ return R.float().contiguous()
154
+
155
+
156
+ def build_code(kind: str) -> torch.Tensor:
157
+ """FROZEN code table C in {-1,+1}^(256 x 64), crc32-seeded, buffer-only.
158
+ ecc — sign of iid gaussian rows: injective w.h.p., no byte structure.
159
+ lsh — sign of the gaussian box-filtered (width 3, replicate-padded) along
160
+ the byte-value axis: adjacent byte values share ~73% of bits
161
+ (corr 2/3 -> sign agreement 1 - arccos(2/3)/pi) — the
162
+ semantic-adjacency proxy for the byte alphabet."""
163
+ g = torch.Generator().manual_seed(seed_for(f"fac:C:{kind}"))
164
+ G = torch.randn(bed.VOCAB, CODE_BITS, generator=g, dtype=torch.float64)
165
+ if kind == "lsh":
166
+ Gp = torch.cat([G[:1], G, G[-1:]], dim=0) # replicate pad
167
+ G = (Gp[:-2] + Gp[1:-1] + Gp[2:]) / 3.0 # width-3 box filter
168
+ elif kind != "ecc":
169
+ raise ValueError(f"unknown code table '{kind}' (ecc|lsh)")
170
+ return torch.where(G >= 0, 1.0, -1.0).float().contiguous()
171
+
172
+
173
+ @torch.no_grad()
174
+ def code_collision_rate(C: torch.Tensor, thresh: int = 2) -> float:
175
+ """Fraction of distinct byte pairs whose codes are within Hamming <= thresh."""
176
+ ham = (C.shape[1] - C @ C.t()) / 2
177
+ iu = torch.triu_indices(C.shape[0], C.shape[0], offset=1)
178
+ return float((ham[iu[0], iu[1]] <= thresh).float().mean())
179
+
180
+
181
+ @torch.no_grad()
182
+ def sign_fidelity(book: torch.Tensor, n: int = 3000, seed: int = 0) -> float:
183
+ """Spearman(sign-code Hamming, true angle) over random pairs on S^(D-1),
184
+ using the book as the LSH frame — the exp015 content gauge (L-078),
185
+ reimplemented verbatim-in-spirit (importing exp015 drags its module state)."""
186
+ A = F.normalize(book.detach().float().cpu(), dim=-1)
187
+ g = torch.Generator().manual_seed(seed)
188
+ D = A.shape[1]
189
+ x = F.normalize(torch.randn(n, D, generator=g), dim=-1)
190
+ y = F.normalize(torch.randn(n, D, generator=g), dim=-1)
191
+ ang = torch.arccos((x * y).sum(-1).clamp(-1, 1))
192
+ ham = (torch.sign(x @ A.T) != torch.sign(y @ A.T)).float().mean(-1)
193
+ ra = ang.argsort().argsort().float()
194
+ rb = ham.argsort().argsort().float()
195
+ ra = (ra - ra.mean()) / ra.std()
196
+ rb = (rb - rb.mean()) / rb.std()
197
+ return round(float((ra * rb).mean()), 4)
198
+
199
+
200
+ def margin_audit(R: torch.Tensor, t_loss: float, mu: float) -> dict:
201
+ """The S4 reachability chain, as data: per-axis max |s_k| = ||row_k|| <= 1;
202
+ v = s/t_loss so per-axis reachable |v_k| = ||row_k||/t_loss; mu must sit
203
+ strictly inside. (The JOINT target ||C[y]*mu|| = mu*8 exceeds the reachable
204
+ ||v|| <= 1/t_loss ball — by design the loss is a per-axis margin pull, not
205
+ an attainable minimum; recorded, not a failure.)"""
206
+ rn = R.norm(dim=-1)
207
+ lo, hi = float(rn.min()), float(rn.max())
208
+ return {"row_norm_min": round(lo, 4), "row_norm_max": round(hi, 4),
209
+ "v_reach_min": round(lo / t_loss, 4),
210
+ "v_reach_max": round(hi / t_loss, 4), "t_loss": t_loss, "mu": mu,
211
+ "per_axis_reachable": bool(mu < lo / t_loss)}
212
+
213
+
214
+ # --------------------------------------------------------------------- model
215
+ class FacModel(nn.Module):
216
+ """Wraps the CERTIFIED bed ByteLM — subclass-free reuse, zero copied math.
217
+ mode:
218
+ 'addr' — lm = ByteLM('addr_msl64'); lm.head := Identity, so the certified
219
+ forward RETURNS the pre-readout feats itself (64 slots x D4 =
220
+ 256). Same seed => bit-identical init to the ce arm everywhere
221
+ except the (removed) readout.
222
+ 'none' — lm = ByteLM('addr_msl64') kept whole (aleph present, UNREAD,
223
+ gradient-dead); trunk walked via lm's own submodules; feats =
224
+ plain Linear(d, 64) on the hidden state (orthogonal init,
225
+ bias-free — the bed's head_proj idiom).
226
+ 'p4' — lm = ByteLM('addr_head') UNMODIFIED (the certified collapse
227
+ configuration: K=32, tau=0.1, coefficients->logits). The signed
228
+ coefficient vector is captured by a forward PRE-HOOK on lm.head,
229
+ so the two P4 cells have IDENTICAL parameters and identical
230
+ forward compute — only the loss differs (the coeff->logit head
231
+ is trainable-but-gradient-dead under FAC).
232
+ The FAC read: s = normalize(feats) @ R.T (fixed frame), scores = s @ C.T."""
233
+
234
+ def __init__(self, mode: str, code: str = "ecc", d: int = 192,
235
+ layers: int = 4, block: int = 256, t_loss: float = T_LOSS,
236
+ mu: float = MU):
237
+ super().__init__()
238
+ self.mode, self.code_kind = mode, code
239
+ self.t_loss, self.mu = t_loss, mu
240
+ if mode == "addr":
241
+ self.lm = bed.ByteLM("addr_msl64", d=d, layers=layers, block=block)
242
+ in_dim = self.lm.n_slots * 4 # 256, read off the arm
243
+ self.lm.head = nn.Identity() # readout removed
244
+ elif mode == "none":
245
+ self.lm = bed.ByteLM("addr_msl64", d=d, layers=layers, block=block)
246
+ assert not self.lm.trigram and not self.lm.use_relay
247
+ self.proj_none = nn.Linear(d, CODE_BITS, bias=False)
248
+ nn.init.orthogonal_(self.proj_none.weight)
249
+ in_dim = CODE_BITS
250
+ elif mode == "p4":
251
+ self.lm = bed.ByteLM("addr_head", d=d, layers=layers, block=block)
252
+ in_dim = self.lm.head_addr.K # 32
253
+ self._w = None
254
+ self.lm.head.register_forward_pre_hook(self._grab)
255
+ else:
256
+ raise ValueError(f"unknown mode '{mode}'")
257
+ self.in_dim = in_dim
258
+ self.register_buffer("R", orthonormal_frame(
259
+ CODE_BITS, in_dim, seed_for(f"fac:R:{in_dim}")))
260
+ self.register_buffer("C", build_code(code))
261
+
262
+ def _grab(self, module, inputs): # p4 pre-hook
263
+ self._w = inputs[0]
264
+
265
+ def _trunk(self, idx):
266
+ """The bed's trunk, walked via the wrapped submodules (mode 'none' only
267
+ — the certified forward would read the aleph, which this arm forbids)."""
268
+ lm = self.lm
269
+ x = lm.emb(idx) + lm.pos[:, : idx.shape[1]]
270
+ for b in lm.blocks:
271
+ x = b(x)
272
+ h = lm.nf(x)
273
+ lm._last_h = h.detach() # vitals hookup
274
+ return h
275
+
276
+ def feats(self, idx):
277
+ if self.mode == "addr":
278
+ return self.lm(idx) # head=Identity -> feats
279
+ if self.mode == "none":
280
+ return self.proj_none(self._trunk(idx))
281
+ _ = self.lm(idx) # head computed, unused
282
+ return self._w
283
+
284
+ def address(self, idx):
285
+ return F.normalize(self.feats(idx), dim=-1) @ self.R.t()
286
+
287
+ def forward(self, idx):
288
+ return self.address(idx)
289
+
290
+ @torch.no_grad()
291
+ def vitals(self) -> dict:
292
+ return self.lm.vitals() # the bed's own readouts
293
+
294
+
295
+ # ---------------------------------------------------------------- loss + eval
296
+ def fac_loss(s, y, C, t_loss: float = T_LOSS, mu: float = MU):
297
+ """The FAC objective: residual-form cosh-Bregman pull onto the frozen code.
298
+ L = mean(cosh(clamp(s/t_loss - C[y]*mu, -4, 4)) - 1) — S2/S3/S5/S6."""
299
+ v = s / t_loss
300
+ r = (v - C[y] * mu).clamp(-CLAMP, CLAMP)
301
+ return (torch.cosh(r) - 1.0).mean()
302
+
303
+
304
+ def eval_scores(kind: str, model, x):
305
+ """Per-token scores on the shared 256-way scale. ce -> the model's own
306
+ logits; fixed-code kinds -> s @ C.T (raw scores as logits; softmax
307
+ temperature NOT calibrated — the recorded caveat)."""
308
+ if kind == "ce":
309
+ return model(x)
310
+ s = model.address(x)
311
+ return s @ model.C.t()
312
+
313
+
314
+ def compute_loss(kind: str, model, x, y):
315
+ """THE single loss site of this bed (mirrors the bed's one F.cross_entropy)."""
316
+ if kind in ("ce", "ce_fixedcode"):
317
+ logits = eval_scores(kind, model, x)
318
+ return F.cross_entropy(logits.reshape(-1, bed.VOCAB), y.reshape(-1))
319
+ s = model.address(x)
320
+ return fac_loss(s, y, model.C, model.t_loss, model.mu)
321
+
322
+
323
+ @torch.no_grad()
324
+ def evaluate(kind: str, model, va, batch, block, device, g, n_batches=20):
325
+ model.eval()
326
+ nll = acc = 0.0
327
+ for _ in range(n_batches):
328
+ xv, yv = bed._batch(va, batch, block, device, g)
329
+ sc = eval_scores(kind, model, xv)
330
+ nll += float(F.cross_entropy(sc.reshape(-1, bed.VOCAB), yv.reshape(-1)))
331
+ acc += float((sc.argmax(-1) == yv).float().mean())
332
+ model.train()
333
+ return nll / n_batches / math.log(2), acc / n_batches
334
+
335
+
336
+ # ---------------------------------------------------------------------- arms
337
+ ARMS = {
338
+ "ce": dict(kind="ce", mode=None,
339
+ note="certified addr_msl64 incumbent (3-seed 2.4685)"),
340
+ "ce_fixedcode": dict(kind="ce_fixedcode", mode="addr",
341
+ note="frozen-C readout, CE — THE param-matched control"),
342
+ "fac_lsh": dict(kind="fac", mode="addr", code="lsh"),
343
+ "fac_ecc": dict(kind="fac", mode="addr", code="ecc"),
344
+ "fac_none": dict(kind="fac", mode="none",
345
+ note="aleph UNREAD (gradient-dead) — geometry isolation"),
346
+ "p4_addr_head_ce": dict(kind="ce", mode="p4ce",
347
+ note="certified collapse config + CE (expect ~5.66 bpb, ppl ~1.88/64)"),
348
+ "p4_addr_head_fac": dict(kind="fac", mode="p4",
349
+ note="same params, FAC loss (predict ppl >= 8/64, win|cos| > .99)"),
350
+ }
351
+
352
+
353
+ def build_model(arm: str, code: str = "ecc", d: int = 192, layers: int = 4,
354
+ block: int = 256, t_loss: float = T_LOSS, mu: float = MU):
355
+ spec = ARMS[arm]
356
+ if arm == "ce":
357
+ return bed.ByteLM("addr_msl64", d=d, layers=layers, block=block)
358
+ if arm == "p4_addr_head_ce":
359
+ return bed.ByteLM("addr_head", d=d, layers=layers, block=block)
360
+ return FacModel(spec["mode"], code=spec.get("code", code), d=d,
361
+ layers=layers, block=block, t_loss=t_loss, mu=mu)
362
+
363
+
364
+ def _trainable(model) -> int:
365
+ return sum(p.numel() for p in model.parameters() if p.requires_grad)
366
+
367
+
368
+ @torch.no_grad()
369
+ def model_vitals(model) -> dict:
370
+ lm = model.lm if isinstance(model, FacModel) else model
371
+ return {"vitals": model.vitals(),
372
+ "sign_fidelity": sign_fidelity(lm.head_addr.codebook),
373
+ "gates": None} # no gates in any FAC arm
374
+
375
+
376
+ # ---------------------------------------------------------------------- train
377
+ def train_arm(arm: str, seed: int = 0, steps: int = 2000, batch: int = 32,
378
+ block: int = 256, d: int = 192, layers: int = 4,
379
+ device: str = "cuda", data_root: str | None = None,
380
+ t_loss: float = T_LOSS, mu: float = MU, code: str | None = None,
381
+ eval_every: int = 500, save: bool = True, lr: float = 3e-4):
382
+ """Verdict run — GPU only, pure Adam wd=0, ledger JSONL under tools/fac_runs."""
383
+ if device == "cuda" and not torch.cuda.is_available():
384
+ raise RuntimeError("Verdict runs are GPU-only (never CPU-train for accuracy).")
385
+ spec = ARMS[arm]
386
+ code = code or spec.get("code", "ecc")
387
+ data_root = data_root or DATA_ROOT
388
+ base = seed_for(f"{arm}:{seed}") # crc32(arm + seed index)
389
+ torch.manual_seed(base)
390
+ g = torch.Generator().manual_seed(base)
391
+ tr, va = bed._wikitext_bytes(data_root)
392
+ print(f"data ready: train {tr.numel():,} bytes, val {va.numel():,} bytes",
393
+ flush=True)
394
+ model = build_model(arm, code=code, d=d, layers=layers, block=block,
395
+ t_loss=t_loss, mu=mu).to(device)
396
+ with torch.random.fork_rng(): # S9 honesty line, same init seed
397
+ torch.manual_seed(base)
398
+ ce_ref = bed.ByteLM("addr_msl64", d=d, layers=layers, block=block)
399
+ ce_trainable = _trainable(ce_ref)
400
+ del ce_ref
401
+ n_train = _trainable(model)
402
+ audit = (margin_audit(model.R, t_loss, mu)
403
+ if isinstance(model, FacModel) else None)
404
+ if audit is not None and not audit["per_axis_reachable"]:
405
+ print(f"WARNING: mu={mu} not per-axis reachable at t_loss={t_loss} "
406
+ f"({audit}) — the margin never engages; consider mu<="
407
+ f"{0.8 * audit['v_reach_min']:.2f}", flush=True)
408
+ os.makedirs(RUNS_DIR, exist_ok=True)
409
+ led = os.path.join(RUNS_DIR, f"{arm}_s{seed}_t{steps}.jsonl")
410
+ def emit(obj, first=False):
411
+ with open(led, "w" if first else "a", encoding="utf-8") as f:
412
+ f.write(json.dumps(obj) + "\n")
413
+ emit({"event": "config", "arm": arm, "seed": seed, "base_seed": base,
414
+ "steps": steps, "batch": batch, "block": block, "d": d,
415
+ "layers": layers, "lr": lr, "t_loss": t_loss, "mu": mu,
416
+ "code": (code if isinstance(model, FacModel) else None),
417
+ "margin_audit": audit, "params_trainable": n_train,
418
+ "params_trainable_ce_ref": ce_trainable,
419
+ "param_delta_vs_ce": ce_trainable - n_train,
420
+ "readout_note": {
421
+ "ce": "trained Linear(256,256) readout",
422
+ "ce_fixedcode": "frozen C readout — ZERO trainable readout params",
423
+ "fac_lsh": "frozen C readout — ZERO trainable readout params",
424
+ "fac_ecc": "frozen C readout — ZERO trainable readout params",
425
+ "fac_none": "frozen C readout; aleph head params present but UNREAD",
426
+ "p4_addr_head_ce": "trained Linear(32,256) coeff->logit head",
427
+ "p4_addr_head_fac": "identical params to the ce cell; coeff->logit "
428
+ "head computed but gradient-dead under FAC",
429
+ }[arm], "partition_note": "bpb uses raw s@C.T scores as logits "
430
+ "(log_softmax); softmax temperature NOT calibrated — caveat",
431
+ "torch": torch.__version__, "device": device,
432
+ "note": spec.get("note", "")}, first=True)
433
+ if device == "cuda":
434
+ torch.cuda.reset_peak_memory_stats()
435
+ opt = torch.optim.Adam(model.parameters(), lr=lr, weight_decay=0.0)
436
+ kind, curve, t0, bpb, acc = spec["kind"], [], time.time(), None, None
437
+ for step in range(1, steps + 1):
438
+ x, y = bed._batch(tr, batch, block, device, g)
439
+ loss = compute_loss(kind, model, x, y)
440
+ opt.zero_grad(set_to_none=True)
441
+ loss.backward()
442
+ opt.step()
443
+ if step == 1 or step % 100 == 0:
444
+ curve.append([step, round(float(loss), 5)])
445
+ if step % eval_every == 0 or step == steps:
446
+ bpb, acc = evaluate(kind, model, va, batch, block, device, g)
447
+ vit = model_vitals(model)
448
+ emit({"event": "eval", "step": step, "bpb": round(bpb, 4),
449
+ "decoded_acc": round(acc, 4), **vit})
450
+ print(f"[{arm} s{seed}] step {step} bpb={bpb:.4f} acc={acc:.4f} "
451
+ f"vitals={vit['vitals']}", flush=True)
452
+ losses = [c[1] for c in curve]
453
+ final = {"event": "final", "arm": arm, "seed": seed, "steps": steps,
454
+ "t_loss": t_loss, "mu": mu,
455
+ "code": (code if isinstance(model, FacModel) else None),
456
+ "bpb": round(bpb, 4), "decoded_acc": round(acc, 4),
457
+ "collision_rate": (code_collision_rate(model.C.cpu())
458
+ if isinstance(model, FacModel) else None),
459
+ "train_curve": {"first": losses[0], "final": losses[-1],
460
+ "min": min(losses), "every100": curve},
461
+ **model_vitals(model),
462
+ "wall_s": round(time.time() - t0, 1),
463
+ "peak_mem_gb": (round(torch.cuda.max_memory_allocated() / 2**30, 3)
464
+ if device == "cuda" else 0.0),
465
+ "params_trainable": n_train,
466
+ "param_delta_vs_ce": ce_trainable - n_train,
467
+ "mu_note": "mu in v-units; per-axis reachability audited at config; "
468
+ "joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss — "
469
+ "per-axis margin pull by design"}
470
+ emit(final)
471
+ print(json.dumps(final), flush=True)
472
+ if save:
473
+ ck = os.path.join(data_root, "fac_ckpts")
474
+ os.makedirs(ck, exist_ok=True)
475
+ path = os.path.join(ck, f"{arm}_s{seed}_t{steps}.pt")
476
+ torch.save({"arm": arm, "seed": seed, "steps": steps, "bpb": bpb,
477
+ "state_dict": {k: v.cpu() for k, v in
478
+ model.state_dict().items()}}, path)
479
+ print(f"saved specimen: {path}", flush=True)
480
+ return final
481
+
482
+
483
+ # ---------------------------------------------------------------------- bench
484
+ def bench(arm: str = "fac_lsh", steps: int = 20, warmup: int = 5,
485
+ batch: int = 32, block: int = 256, device: str = "cuda",
486
+ data_root: str | None = None):
487
+ """~20-step throughput probe at the full operating point -> min/2000 steps.
488
+ Falls back to synthetic random bytes if the parquet cache is unreachable
489
+ (identical compute — the batch path indexes a flat uint8 tensor either way)."""
490
+ if device == "cuda" and not torch.cuda.is_available():
491
+ raise RuntimeError("bench is a GPU probe")
492
+ try:
493
+ tr, _ = bed._wikitext_bytes(data_root or DATA_ROOT)
494
+ src = "wikitext-2-raw"
495
+ except Exception as e:
496
+ g0 = torch.Generator().manual_seed(seed_for("fac:bench:data"))
497
+ tr = torch.randint(0, 256, (2_000_000,), generator=g0,
498
+ dtype=torch.uint8)
499
+ src = f"synthetic ({type(e).__name__})"
500
+ torch.manual_seed(seed_for(f"{arm}:bench"))
501
+ g = torch.Generator().manual_seed(seed_for(f"{arm}:bench"))
502
+ model = build_model(arm).to(device)
503
+ kind = ARMS[arm]["kind"]
504
+ opt = torch.optim.Adam(model.parameters(), lr=3e-4, weight_decay=0.0)
505
+ if device == "cuda":
506
+ torch.cuda.reset_peak_memory_stats()
507
+ for _ in range(warmup):
508
+ x, y = bed._batch(tr, batch, block, device, g)
509
+ loss = compute_loss(kind, model, x, y)
510
+ opt.zero_grad(set_to_none=True); loss.backward(); opt.step()
511
+ if device == "cuda":
512
+ torch.cuda.synchronize()
513
+ t0 = time.time()
514
+ for _ in range(steps):
515
+ x, y = bed._batch(tr, batch, block, device, g)
516
+ loss = compute_loss(kind, model, x, y)
517
+ opt.zero_grad(set_to_none=True); loss.backward(); opt.step()
518
+ if device == "cuda":
519
+ torch.cuda.synchronize()
520
+ sec = (time.time() - t0) / steps
521
+ peak = (torch.cuda.max_memory_allocated() / 2**30) if device == "cuda" else 0.0
522
+ print(f"BENCH [{arm}] data={src} {sec*1000:.1f} ms/step -> "
523
+ f"{sec*2000/60:.1f} min / 2000 steps (+~{20*sec:.0f}s eval overhead); "
524
+ f"peak {peak:.2f} GB", flush=True)
525
+ return {"arm": arm, "ms_per_step": sec * 1000,
526
+ "min_per_2000": sec * 2000 / 60, "peak_gb": peak, "data": src}
527
+
528
+
529
+ # ------------------------------------------------------------- smoke battery
530
+ RESULTS = []
531
+ def record(tid, name, ok, detail=""):
532
+ RESULTS.append((tid, name, "PASS" if ok else "FAIL", detail))
533
+ return ok
534
+
535
+
536
+ def run_smokes() -> bool:
537
+ """FORMULA smokes only — shapes, gradients, identities, fp32 safety,
538
+ causality, param honesty. NO training, ever (MANIFEST rider); the S3
539
+ minimizer probe optimizes one free 64-vector, not a model."""
540
+ del RESULTS[:]
541
+ t0 = time.time()
542
+ sd, sl, sb = 96, 2, 64 # small config
543
+
544
+ # S0 — feats-dim truth: the certified addr_msl64 read is 64 slots x D4.
545
+ torch.manual_seed(seed_for("fac:s0"))
546
+ m_addr = FacModel("addr", "lsh", d=sd, layers=sl, block=sb).to(DEV)
547
+ record("S0", "feats match the certified addr_msl64 read",
548
+ m_addr.in_dim == 256 and m_addr.lm.n_slots == 64,
549
+ "64 slots x D=4 = 256-dim feats (bed code authoritative; spec's "
550
+ "'P=16' guess corrected) -> R is 64x256 orthonormal-rows")
551
+
552
+ # S1 — gradient flow: FAC backward reaches the aleph codebook AND the slot
553
+ # projection (the tied-M_hat failure would show a near-zero codebook grad).
554
+ g1 = torch.Generator().manual_seed(seed_for("fac:s1"))
555
+ seq = torch.randint(0, 256, (2, sb + 1), generator=g1)
556
+ x, y = seq[:, :-1].to(DEV), seq[:, 1:].to(DEV)
557
+ loss = fac_loss(m_addr.address(x), y, m_addr.C)
558
+ loss.backward()
559
+ g_cb = float(m_addr.lm.head_addr.codebook.grad.norm())
560
+ g_pj = float(m_addr.lm.head_proj.weight.grad.norm())
561
+ g_em = float(m_addr.lm.emb.weight.grad.norm())
562
+ record("S1", "FAC gradient flow (codebook + slot proj + trunk)",
563
+ g_cb > 0 and g_pj > 0 and g_em > 0
564
+ and all(map(math.isfinite, (g_cb, g_pj, g_em))),
565
+ "|g| codebook %.2e, head_proj %.2e, emb %.2e — all nonzero/finite"
566
+ % (g_cb, g_pj, g_em))
567
+
568
+ # S2 — Bregman identity. Phi = sum cosh. The implemented loss is the
569
+ # RESIDUAL-form divergence D_Phi(r, 0) = cosh(r) - cosh(0) - sinh(0)*r
570
+ # = cosh(r) - 1 ("up to the constant" = cosh(0)). The target-anchored
571
+ # D_Phi(v, v*) is a different function (equal only at v* = 0) — its gap is
572
+ # reported so the 'cosh-Bregman' name stays honest.
573
+ g2 = torch.Generator().manual_seed(seed_for("fac:s2"))
574
+ r = torch.empty(4096, dtype=torch.float64).uniform_(-3.9, 3.9, generator=g2)
575
+ d_res = float((torch.cosh(r) - math.cosh(0.0) - math.sinh(0.0) * r
576
+ - (torch.cosh(r) - 1.0)).abs().max())
577
+ vs = torch.where(torch.rand(4096, generator=g2) > 0.5, 1.0, -1.0).double()
578
+ v = r + vs
579
+ d_anchor = float((torch.cosh(v) - torch.cosh(vs) - torch.sinh(vs) * (v - vs)
580
+ - (torch.cosh(v - vs) - 1.0)).abs().max())
581
+ record("S2", "Bregman identity (residual form, up to cosh(0))",
582
+ d_res <= 1e-6,
583
+ "residual-form dev %.1e; target-anchored D_Phi(v,c*mu) differs by "
584
+ "up to %.2f — loss is D_Phi(v - C[y]mu, 0), coincides at v*=0"
585
+ % (d_res, d_anchor))
586
+
587
+ # S3 — minimizer identity: 200 Adam steps on a free 64-vector -> the code.
588
+ C_ecc = build_code("ecc")
589
+ g3 = torch.Generator().manual_seed(seed_for("fac:s3"))
590
+ y0 = int(torch.randint(0, 256, (1,), generator=g3))
591
+ target = C_ecc[y0] * MU
592
+ vfree = nn.Parameter(torch.zeros(CODE_BITS))
593
+ # pure Adam wd=0; beta2=0.9 so the second-moment memory (1000-step at the
594
+ # default 0.999) cannot suppress late updates inside a 200-step anneal —
595
+ # measured: default betas freeze the error at ~3e-3.
596
+ opt3 = torch.optim.Adam([vfree], lr=1.0, betas=(0.9, 0.9), weight_decay=0.0)
597
+ for _ in range(200):
598
+ l3 = (torch.cosh((vfree - target).clamp(-CLAMP, CLAMP)) - 1.0).mean()
599
+ opt3.zero_grad(set_to_none=True)
600
+ l3.backward()
601
+ opt3.step()
602
+ for pg in opt3.param_groups:
603
+ pg["lr"] *= 0.93 # anneal; Adam alone orbits at lr
604
+ err3 = float((vfree.detach() - target).abs().max())
605
+ record("S3", "minimizer identity (free v -> C[y]*mu)",
606
+ err3 < 1e-4, "||v - C[y]mu||_inf = %.1e after 200 Adam steps" % err3)
607
+
608
+ # S4 — margin reachability chain. |s_k| <= ||R row_k|| <= 1 (R construction);
609
+ # v = s/t_loss -> per-axis reachable |v_k| = ||row_k||/0.3 (=3.33 for the
610
+ # orthonormal-row frames); mu = 1.0 sits strictly inside for ALL frames,
611
+ # and a perfectly-aligned s pulls strictly toward the target on every axis.
612
+ # DECISION: mu stays 1.0 (in v-units; the s-unit boundary worry dissolves
613
+ # because the margin lives in v-space).
614
+ frames = {n: orthonormal_frame(CODE_BITS, i, seed_for(f"fac:R:{i}"))
615
+ for n, i in (("addr", 256), ("none", 64), ("p4", 32))}
616
+ audits = {n: margin_audit(Rf, T_LOSS, MU) for n, Rf in frames.items()}
617
+ ortho_dev = max(
618
+ float((frames["addr"] @ frames["addr"].t()
619
+ - torch.eye(CODE_BITS)).abs().max()),
620
+ float((frames["none"] @ frames["none"].t()
621
+ - torch.eye(CODE_BITS)).abs().max()),
622
+ float((frames["p4"].t() @ frames["p4"]
623
+ - torch.eye(32)).abs().max()))
624
+ s_align = C_ecc[y0] / math.sqrt(CODE_BITS) # unit, code-aligned
625
+ pull = -torch.sinh((s_align / T_LOSS - C_ecc[y0] * MU).clamp(-CLAMP, CLAMP)
626
+ ) * C_ecc[y0]
627
+ ok4 = (all(a["per_axis_reachable"] for a in audits.values())
628
+ and all(a["row_norm_max"] <= 1.0 + 1e-5 for a in audits.values())
629
+ and ortho_dev < 1e-5 and bool((pull > 0).all()))
630
+ record("S4", "margin reachability (mu=1.0 KEPT, v-units)", ok4,
631
+ "v-reach addr/none/p4 = %.2f/%.2f/%.2f > mu=1; ortho dev %.0e; "
632
+ "aligned-s pull > 0 on 64/64 axes"
633
+ % (audits["addr"]["v_reach_min"], audits["none"]["v_reach_min"],
634
+ audits["p4"]["v_reach_min"], ortho_dev))
635
+
636
+ # S5 — antipodal invariance: L(v, c) == L(-v, -c) bit-exact.
637
+ g5 = torch.Generator().manual_seed(seed_for("fac:s5"))
638
+ s5 = (torch.randn(4, 32, CODE_BITS, generator=g5) * 0.4).to(DEV)
639
+ y5 = torch.randint(0, 256, (4, 32), generator=g5).to(DEV)
640
+ C5 = C_ecc.to(DEV)
641
+ la, lb = fac_loss(s5, y5, C5), fac_loss(-s5, y5, -C5)
642
+ record("S5", "antipodal invariance L(v,c)==L(-v,-c)",
643
+ bool(torch.equal(la, lb)),
644
+ "bit-exact on %s: %.6f == %.6f" % (DEV, float(la), float(lb)))
645
+
646
+ # S6 — fp32 overflow: finite loss AND gradient over the full reachable |v|
647
+ # range (t_loss down to 0.1 -> |v| <= 10, swept to 12) with the clamp; the
648
+ # zero-feats normalize edge is finite too.
649
+ v6 = torch.linspace(-12.0, 12.0, 100001).requires_grad_(True)
650
+ l6 = (torch.cosh((v6 - 1.0).clamp(-CLAMP, CLAMP)) - 1.0).sum()
651
+ l6.backward()
652
+ z = F.normalize(torch.zeros(3, CODE_BITS), dim=-1) @ frames["none"].t()
653
+ ok6 = (bool(torch.isfinite(l6)) and bool(torch.isfinite(v6.grad).all())
654
+ and bool(torch.isfinite(z).all()))
655
+ record("S6", "fp32 safety across the reachable v-range",
656
+ ok6, "cosh capped at cosh(4)=%.1f; grad finite on [-12,12]; "
657
+ "zero-feats normalize edge finite" % math.cosh(CLAMP))
658
+
659
+ # S7 — decode consistency: planted s = C[y]*t_loss*mu -> argmax score == y,
660
+ # 1000 draws under fac_ecc (assert); lsh failure rate reported, not gated.
661
+ g7 = torch.Generator().manual_seed(seed_for("fac:s7"))
662
+ y7 = torch.randint(0, 256, (1000,), generator=g7)
663
+ acc_ecc = float(((C_ecc[y7] * T_LOSS * MU) @ C_ecc.t()
664
+ ).argmax(-1).eq(y7).float().mean())
665
+ C_lsh = build_code("lsh")
666
+ acc_lsh = float(((C_lsh[y7] * T_LOSS * MU) @ C_lsh.t()
667
+ ).argmax(-1).eq(y7).float().mean())
668
+ adj = float((C_lsh[:-1] == C_lsh[1:]).float().mean())
669
+ record("S7", "decode consistency (planted code -> argmax)",
670
+ acc_ecc == 1.0,
671
+ "ecc 1000/1000; lsh fail rate %.4f (report-only); collisions@H<=2 "
672
+ "ecc %.1e lsh %.1e; lsh adjacent-byte bit-share %.3f"
673
+ % (1.0 - acc_lsh, code_collision_rate(C_ecc),
674
+ code_collision_rate(C_lsh), adj))
675
+
676
+ # S8 — causality: the bed's future-leak check, replicated on every FAC
677
+ # read path (addr / none / p4): a future byte must not move past scores.
678
+ leaks = {}
679
+ for mode in ("addr", "none", "p4"):
680
+ torch.manual_seed(seed_for(f"fac:s8:{mode}"))
681
+ m8 = FacModel(mode, "ecc", d=sd, layers=sl, block=sb).to(DEV).eval()
682
+ g8 = torch.Generator().manual_seed(seed_for("fac:s8:x"))
683
+ x8 = torch.randint(0, 256, (2, sb), generator=g8).to(DEV)
684
+ with torch.no_grad():
685
+ a = (m8.address(x8) @ m8.C.t())[0, 10]
686
+ x8b = x8.clone()
687
+ x8b[0, 40] = (x8b[0, 40] + 7) % 256
688
+ b = (m8.address(x8b) @ m8.C.t())[0, 10]
689
+ leaks[mode] = float((a - b).abs().max())
690
+ record("S8", "causality (no future leak, all FAC read paths)",
691
+ all(v <= 1e-4 for v in leaks.values()),
692
+ "max |dscore@t=10| after t=40 edit: " +
693
+ ", ".join(f"{k} {v:.1e}" for k, v in leaks.items()))
694
+
695
+ # S9 — toggle/param-match honesty at the full operating point (d=192, L=4):
696
+ # ce_fixedcode == ce minus EXACTLY the readout table; zero trainable
697
+ # readout params; the two P4 cells are parameter-IDENTICAL.
698
+ with torch.random.fork_rng():
699
+ torch.manual_seed(seed_for("fac:s9"))
700
+ ce_ref = bed.ByteLM("addr_msl64")
701
+ torch.manual_seed(seed_for("fac:s9"))
702
+ fc = FacModel("addr", "ecc")
703
+ torch.manual_seed(seed_for("fac:s9"))
704
+ p4c = bed.ByteLM("addr_head")
705
+ torch.manual_seed(seed_for("fac:s9"))
706
+ p4f = FacModel("p4", "ecc")
707
+ head_n = ce_ref.head.weight.numel() + ce_ref.head.bias.numel()
708
+ tr_ce, tr_fc = _trainable(ce_ref), _trainable(fc)
709
+ fc_readout = 0 if isinstance(fc.lm.head, nn.Identity) else -1
710
+ record("S9", "param match (readout delta exact; P4 cells identical)",
711
+ tr_ce - tr_fc == head_n == 65792 and fc_readout == 0
712
+ and _trainable(p4c) == _trainable(p4f),
713
+ "ce %s vs ce_fixedcode %s (delta %s == readout %s; fixed-code "
714
+ "readout trainable=0); p4 pair %s == %s"
715
+ % (f"{tr_ce:,}", f"{tr_fc:,}", f"{tr_ce - tr_fc:,}",
716
+ f"{head_n:,}", f"{_trainable(p4c):,}", f"{_trainable(p4f):,}"))
717
+
718
+ # ------------------------------------------------------------------ table
719
+ wall = time.time() - t0
720
+ peak = (torch.cuda.max_memory_allocated() / 2**30) if DEV == "cuda" else 0.0
721
+ print("\nFAC FORMULA-SMOKE BATTERY (%s, %.1fs, peak %.2f GB)"
722
+ % (DEV, wall, peak))
723
+ print("-" * 100)
724
+ npass = nfail = 0
725
+ for tid, name, st, detail in RESULTS:
726
+ npass += st == "PASS"
727
+ nfail += st == "FAIL"
728
+ print("%-5s %-4s %-46s %s" % (tid, st, name[:46], detail))
729
+ print("-" * 100)
730
+ print("PASS %d FAIL %d SKIP %d" % (npass, nfail,
731
+ len(RESULTS) - npass - nfail))
732
+ return nfail == 0
733
+
734
+
735
+ def print_launch_matrix(steps: int = 2000):
736
+ print("\nARM MATRIX (verdict runs — NOT launched by this bed; P4 cells first):")
737
+ py = ".venv/Scripts/python.exe"
738
+ for arm in ("p4_addr_head_ce", "p4_addr_head_fac"):
739
+ print(f" {py} tools/fac_bed.py --arm {arm} --seed 0")
740
+ for arm in ("ce", "ce_fixedcode", "fac_lsh", "fac_ecc", "fac_none"):
741
+ for seed in (0, 1, 2):
742
+ print(f" {py} tools/fac_bed.py --arm {arm} --seed {seed}")
743
+ print(" # knobs: --steps N | --t_loss {0.1,0.3,1.0} | --mu M | --code {ecc,lsh}")
744
+
745
+
746
+ def _in_notebook() -> bool:
747
+ try:
748
+ get_ipython() # type: ignore[name-defined] # noqa: F821
749
+ return True
750
+ except NameError:
751
+ return False
752
+
753
+
754
+ if __name__ == "__main__":
755
+ if _in_notebook():
756
+ _ok = run_smokes()
757
+ print_launch_matrix()
758
+ print("Notebook mode: train_arm('fac_lsh', seed=0) in the next cell (GPU).")
759
+ else:
760
+ import argparse
761
+ ap = argparse.ArgumentParser()
762
+ ap.add_argument("--arm", type=str, default=None, choices=sorted(ARMS))
763
+ ap.add_argument("--seed", type=int, default=0)
764
+ ap.add_argument("--steps", type=int, default=2000)
765
+ ap.add_argument("--smoke", action="store_true")
766
+ ap.add_argument("--bench", action="store_true")
767
+ ap.add_argument("--t_loss", type=float, default=T_LOSS)
768
+ ap.add_argument("--mu", type=float, default=MU)
769
+ ap.add_argument("--code", type=str, default=None, choices=("ecc", "lsh"))
770
+ ap.add_argument("--data_root", type=str, default=None)
771
+ ap.add_argument("--device", type=str, default="cuda")
772
+ a, _ = ap.parse_known_args()
773
+ if a.bench:
774
+ bench(steps=20, device=a.device, data_root=a.data_root)
775
+ elif a.arm and not a.smoke:
776
+ train_arm(a.arm, seed=a.seed, steps=a.steps, device=a.device,
777
+ data_root=a.data_root, t_loss=a.t_loss, mu=a.mu,
778
+ code=a.code)
779
+ else:
780
+ ok = run_smokes()
781
+ print_launch_matrix(a.steps)
782
+ sys.exit(0 if ok else 1)
code/geobasin_bed.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """geobasin_bed.py — the CE-replacement geometric arm, reconstructed and
2
+ properly tested. #TAG:geobasin #TAG:ce_replacement #TAG:loss_campaign
3
+
4
+ RECONSTRUCTION PROVENANCE (2026-07-25): the Oct '25 arm survives VERBATIM in
5
+ the installed package — geofractal.losses.pure_geometric (PureGeometricLoss:
6
+ attraction (1-s_y)^2 + repulsion sum(s_c^2) + margin hinge + range clamp;
7
+ GeometricPrototypeLoss; HierarchicalGeometricLoss) and the GBC 4-factor
8
+ compatibility head in geofractal/model/experiment_geometric_basin.py.
9
+ L-031's "term forms NOT recorded" and L-032's "unbuilt" are both CLOSED.
10
+ Losses are IMPORTED from the package, never rewritten (reuse law).
11
+
12
+ THE TEST (the ce_fixedcode lesson: isolate the LOSS by holding the head
13
+ identical): all arms share one cosine-anchor score head on the certified
14
+ addr_msl64 read — s = normalize(feats); scores_c = (cos(s, A_c)+1)/2,
15
+ A: (256 classes x 256), ~param-matched to the ce head (65,536 vs 65,792).
16
+ CE arms consume cos*10 as logits (fixed scale, disclosed).
17
+
18
+ ARMS: geo_ce_scores (CE on the SAME head - the decisive control) | geo_pure
19
+ (verbatim, learned anchors) | geo_pure_frozen (L-108 cell) | geo_pure_norep
20
+ (attraction+range ONLY - the absolute-only, doctrine-clean variant; repulsion
21
+ +margin are roster-comparative terms) | geo_proto (verbatim, own projector -
22
+ extra params disclosed) | geo_hier (nibble hierarchy 16x16 - bytes' natural
23
+ coarse structure) | geo_hybrid (0.5 CE + 0.5 PureGeometric).
24
+
25
+ PREREG (3 seeds; baselines ce 2.4769/acc .505): P1 the Oct'25 trade was -12%
26
+ relative accuracy - geo_pure within -12% of geo_ce_scores matches history,
27
+ parity overturns it, acc<0.30 refutes viability. P2 (L-108): learned anchors
28
+ show a collapse signature vs frozen; falsifier: learned > frozen by >2 pts.
29
+ P3 (absolute-beats-relative): norep >= pure - noise; falsifier: pure beats
30
+ norep by >2 pts (the comparative terms would be load-bearing - a scope
31
+ amendment to the law). P4: hybrid bpb within 0.15 of geo_ce_scores.
32
+
33
+ Run: python tools/geobasin_bed.py --arm <name> --seed N | --list
34
+ """
35
+ import json
36
+ import math
37
+ import os
38
+ import sys
39
+ import time
40
+ import zlib
41
+
42
+ import torch
43
+ import torch.nn as nn
44
+ import torch.nn.functional as F
45
+
46
+
47
+ def _root():
48
+ d = os.path.abspath(os.getcwd())
49
+ while True:
50
+ if os.path.exists(os.path.join(d, "MANIFEST.md")):
51
+ return d
52
+ p = os.path.dirname(d)
53
+ if p == d:
54
+ return os.getcwd()
55
+ d = p
56
+
57
+ ROOT = _root()
58
+ if os.path.join(ROOT, "tools") not in sys.path:
59
+ sys.path.insert(0, os.path.join(ROOT, "tools"))
60
+
61
+ import ar_differentiation_bed as bed # noqa: E402
62
+ from geofractal.losses.pure_geometric import ( # noqa: E402
63
+ GeometricPrototypeLoss, HierarchicalGeometricLoss, PureGeometricLoss)
64
+ from loss_forms import prim_ce # noqa: E402
65
+
66
+ torch.backends.cuda.matmul.allow_tf32 = False
67
+ torch.backends.cudnn.allow_tf32 = False
68
+ DEV = "cuda" if torch.cuda.is_available() else "cpu"
69
+ if DEV == "cuda":
70
+ torch.cuda.set_per_process_memory_fraction(0.73)
71
+
72
+ DATA_ROOT = os.environ.get("GEOLIP_DATA", "./data")
73
+ RUNS = os.path.join(ROOT, "tools", "geobasin_runs")
74
+ CE_SCALE = 10.0
75
+
76
+ def seed_for(name):
77
+ return zlib.crc32(name.encode()) & 0x7FFFFFFF
78
+
79
+ ARMS = ("geo_ce_scores", "geo_pure", "geo_pure_frozen", "geo_pure_norep",
80
+ "geo_proto", "geo_hier", "geo_hybrid")
81
+
82
+
83
+ class FastHierarchical(HierarchicalGeometricLoss):
84
+ """Vectorizes ONLY the per-sample fine_mask loop (a 60x Python-loop
85
+ slowdown at B*T=8192); every formula identical — parity-asserted against
86
+ the verbatim original at build time."""
87
+ def forward(self, compatibility_scores, labels, mixed_labels=None,
88
+ lam=None):
89
+ if mixed_labels is not None:
90
+ return super().forward(compatibility_scores, labels,
91
+ mixed_labels, lam)
92
+ B = compatibility_scores.shape[0]
93
+ dev = compatibility_scores.device
94
+ sl = labels // self.subclasses_per_super
95
+ scores_r = compatibility_scores.view(B, self.num_superclasses,
96
+ self.subclasses_per_super)
97
+ ss = scores_r.sum(dim=2)
98
+ coarse_correct = ss[torch.arange(B, device=dev), sl]
99
+ ct = float(self.subclasses_per_super)
100
+ coarse_loss = ((coarse_correct - ct) / ct).pow(2).mean()
101
+ cmask = torch.ones_like(ss)
102
+ cmask[torch.arange(B, device=dev), sl] = 0
103
+ coarse_rep = (ss * cmask).pow(2).sum(dim=1).mean()
104
+ fine_correct = compatibility_scores[torch.arange(B, device=dev), labels]
105
+ fine_loss = (1.0 - fine_correct).pow(2).mean()
106
+ # vectorized fine_mask: ones on the label's superclass block, zero at
107
+ # the label column (identical to the original's per-sample loop)
108
+ cols = (sl * self.subclasses_per_super).unsqueeze(1) + \
109
+ torch.arange(self.subclasses_per_super, device=dev).unsqueeze(0)
110
+ fmask = torch.zeros_like(compatibility_scores)
111
+ fmask.scatter_(1, cols, 1.0)
112
+ fmask[torch.arange(B, device=dev), labels] = 0
113
+ fine_rep = (compatibility_scores * fmask).pow(2).sum(dim=1).mean()
114
+ consistency = F.relu(fine_correct * 2 - coarse_correct).mean()
115
+ w_c = torch.sigmoid(self.coarse_weight)
116
+ w_f = torch.sigmoid(self.fine_weight)
117
+ return (w_c * (coarse_loss + 0.3 * coarse_rep)
118
+ + w_f * (fine_loss + 0.3 * fine_rep) + 0.2 * consistency)
119
+
120
+
121
+ class ScoreHead(nn.Module):
122
+ """The shared cosine-anchor basin head. scores in [0,1] per class."""
123
+ def __init__(self, dim=256, classes=256, frozen=False, gen=None):
124
+ super().__init__()
125
+ A = torch.randn(classes, dim, generator=gen)
126
+ if frozen:
127
+ self.register_buffer("A", F.normalize(A, dim=-1))
128
+ else:
129
+ self.A = nn.Parameter(A)
130
+
131
+ def cos(self, feats):
132
+ return F.normalize(feats, dim=-1) @ F.normalize(self.A, dim=-1).t()
133
+
134
+ def forward(self, feats):
135
+ return (self.cos(feats) + 1) / 2
136
+
137
+
138
+ def build(arm, seed):
139
+ torch.manual_seed(seed_for(f"geobasin:{arm}:{seed}"))
140
+ lm = bed.ByteLM("addr_msl64").to(DEV)
141
+ lm.head = nn.Identity() # forward -> 256-d msl feats
142
+ gh = torch.Generator().manual_seed(seed_for(f"geobasin-head:{seed}"))
143
+ head = ScoreHead(frozen=(arm == "geo_pure_frozen"), gen=gh).to(DEV)
144
+ aux = None
145
+ if arm == "geo_proto":
146
+ aux = GeometricPrototypeLoss(num_classes=256, prototype_dim=64).to(DEV)
147
+ elif arm == "geo_hier":
148
+ aux = FastHierarchical(num_classes=256, num_superclasses=16).to(DEV)
149
+ # parity vs the VERBATIM original on a random batch (reference-check
150
+ # pattern): the vectorization must be mathematics-identical
151
+ ref = HierarchicalGeometricLoss(num_classes=256,
152
+ num_superclasses=16).to(DEV)
153
+ ref.load_state_dict(aux.state_dict())
154
+ gpar = torch.Generator().manual_seed(seed_for("hier-parity"))
155
+ sc = torch.rand(16, 256, generator=gpar).to(DEV)
156
+ yy = torch.randint(0, 256, (16,), generator=gpar).to(DEV)
157
+ assert torch.allclose(aux(sc, yy), ref(sc, yy), atol=1e-6), \
158
+ "FastHierarchical diverged from the verbatim original"
159
+ elif arm != "geo_ce_scores":
160
+ aux = PureGeometricLoss() # stateless
161
+ params = list(lm.parameters()) + list(head.parameters())
162
+ if aux is not None:
163
+ params += list(aux.parameters())
164
+ return lm, head, aux, [p for p in params if p.requires_grad]
165
+
166
+
167
+ def loss_of(arm, head, aux, feats, y):
168
+ scores = head(feats).reshape(-1, 256)
169
+ yy = y.reshape(-1)
170
+ if arm == "geo_ce_scores":
171
+ return prim_ce((scores * 2 - 1).reshape(*y.shape, 256) * CE_SCALE, y).mean()
172
+ if arm == "geo_hybrid":
173
+ ce = prim_ce((scores * 2 - 1).reshape(*y.shape, 256) * CE_SCALE, y).mean()
174
+ return 0.5 * ce + 0.5 * PureGeometricLoss()(scores, yy)
175
+ if arm == "geo_pure_norep":
176
+ B = scores.shape[0]
177
+ correct = scores[torch.arange(B, device=scores.device), yy]
178
+ attraction = (1.0 - correct).pow(2).mean() # verbatim term 1
179
+ rng = F.relu(scores - 1.0).pow(2).mean() \
180
+ + F.relu(-scores).pow(2).mean() # verbatim term 4
181
+ return attraction + 0.1 * rng # comparative terms DROPPED
182
+ return aux(scores, yy) # verbatim package losses
183
+
184
+
185
+ @torch.no_grad()
186
+ def evaluate(head, lm, va, g):
187
+ lm.eval()
188
+ tot_ce, tot_ok, n = 0.0, 0, 0
189
+ for _ in range(8):
190
+ x, y = bed._batch(va, 32, 256, DEV, g)
191
+ cos = head.cos(lm(x))
192
+ lp = F.log_softmax(cos * CE_SCALE, -1)
193
+ tot_ce += float(-lp.gather(-1, y.unsqueeze(-1)).sum())
194
+ tot_ok += int((cos.argmax(-1) == y).sum())
195
+ n += y.numel()
196
+ x, _ = bed._batch(va, 8, 256, DEV, g)
197
+ _ = lm(x)
198
+ v = lm.head_addr.vitals(lm.head_proj(lm._last_h).view(
199
+ *lm._last_h.shape[:-1], lm.n_slots, 4))
200
+ lm.train()
201
+ return (tot_ce / n) / math.log(2), tot_ok / n, v
202
+
203
+
204
+ def train_arm(arm, seed, steps=2000):
205
+ assert arm in ARMS, f"unknown arm {arm}"
206
+ os.makedirs(RUNS, exist_ok=True)
207
+ tr, va = bed._wikitext_bytes(DATA_ROOT)
208
+ lm, head, aux, params = build(arm, seed)
209
+ g = torch.Generator().manual_seed(seed_for(f"geobasin-data:{arm}:{seed}"))
210
+ ge = torch.Generator().manual_seed(seed_for("geobasin-eval"))
211
+ opt = torch.optim.Adam(params, lr=3e-4, weight_decay=0.0)
212
+ t0 = time.time()
213
+ # anchor-collapse gauge: pairwise |cos| spread of A at start vs end
214
+ def anchor_spread():
215
+ An = F.normalize(head.A.detach(), dim=-1)
216
+ pc = (An @ An.t()).abs()
217
+ off = pc[~torch.eye(256, dtype=torch.bool, device=pc.device)]
218
+ return float(off.mean())
219
+ sp0 = anchor_spread()
220
+ for step in range(steps):
221
+ x, y = bed._batch(tr, 32, 256, DEV, g)
222
+ opt.zero_grad(set_to_none=True)
223
+ L = loss_of(arm, head, aux, lm(x), y)
224
+ L.backward()
225
+ opt.step()
226
+ if step == 10 and DEV == "cuda":
227
+ print(f"[{arm} s{seed}] step10 loss {float(L.detach()):.4f} "
228
+ f"peak {torch.cuda.max_memory_allocated()/2**30:.2f}GB",
229
+ flush=True)
230
+ bpb, acc, vit = evaluate(head, lm, va, ge)
231
+ rec = {"arm": arm, "seed": seed, "steps": steps, "bpb": round(bpb, 4),
232
+ "decoded_acc": round(acc, 4),
233
+ "anchor_abs_cos_mean_init": round(sp0, 4),
234
+ "anchor_abs_cos_mean_final": round(anchor_spread(), 4),
235
+ "vitals": vit, "wall_s": round(time.time() - t0, 1),
236
+ "n_params_extra": sum(p.numel() for p in aux.parameters())
237
+ if aux is not None and any(True for _ in aux.parameters()) else 0}
238
+ out = os.path.join(RUNS, f"{arm}_s{seed}_t{steps}.jsonl")
239
+ with open(out, "a", encoding="utf-8") as f:
240
+ f.write(json.dumps(rec) + "\n")
241
+ print(f"[DONE {arm} s{seed}] bpb {bpb:.4f} acc {acc:.4f} "
242
+ f"anchors |cos| {sp0:.3f}->{rec['anchor_abs_cos_mean_final']:.3f} "
243
+ f"({rec['wall_s']}s)", flush=True)
244
+ return rec
245
+
246
+
247
+ if __name__ == "__main__":
248
+ import argparse
249
+ ap = argparse.ArgumentParser()
250
+ ap.add_argument("--arm", default=None)
251
+ ap.add_argument("--seed", type=int, default=0)
252
+ ap.add_argument("--steps", type=int, default=2000)
253
+ ap.add_argument("--list", action="store_true")
254
+ a, _ = ap.parse_known_args()
255
+ if a.list or not a.arm:
256
+ print("arms:", " ".join(ARMS))
257
+ sys.exit(0)
258
+ train_arm(a.arm, a.seed, a.steps)
code/geolip_vitals.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """geolip_vitals.py — the shared diagnostic harness (progression plan Tree 7a).
2
+ One implementation, every tree imports it. ALL functions are READOUTS: no gradients,
3
+ no losses. CV is a readout, never a force (discovery_catalog #3). Judge addressing by
4
+ drift->0.29154 and CV->0.20, never recon cosine (MANIFEST).
5
+
6
+ Vitals provided:
7
+ anchor_drift — geodesic drift of anchors from init; binding fraction @0.29154
8
+ pentachoron_cv — CM 4-volume CV over random 5-row subsets (geovocab2 import)
9
+ axis_aliveness — oriented-address usage: axes alive, hppl, collapse flag
10
+ gate_stats — gate means vs the 0.012-0.03 band
11
+ path_diversity — unique-path counting, FIXED high-bits hash (low-16 bug is the
12
+ retracted artifact — never use the low bits)
13
+ grad_norm_spread — gradient democracy monitor (orders-of-magnitude spread)
14
+ CVScreen — CV@1000-batch early band screen (<0.30 LOW / .35-.50 MID / >.80 HIGH)
15
+
16
+ Smoke on a torch-capable env: python geolip_vitals.py
17
+ """
18
+ from __future__ import annotations
19
+ import math
20
+ import torch
21
+
22
+ BINDING = 0.29154 # radians; the binding/separation constant (MANIFEST)
23
+ CV_BAND = (0.13, 0.30) # CM CV band (discovery_catalog #4)
24
+ GATE_BAND = (0.012, 0.03) # live invariant candidate (acd_campaign)
25
+ KNUTH32 = 2654435761
26
+
27
+
28
+ # ----------------------------------------------------------------------------- drift
29
+ @torch.no_grad()
30
+ def anchor_drift(current: torch.Tensor, init: torch.Tensor, tol: float = 0.05) -> dict:
31
+ """Geodesic drift (radians) of each row of `current` from its row in `init`,
32
+ both row-normalized. Returns mean/std/per-row drift and the fraction of rows
33
+ within +/-tol of BINDING (the GLFM '46%' readout)."""
34
+ a = torch.nn.functional.normalize(current.float(), dim=-1)
35
+ b = torch.nn.functional.normalize(init.float(), dim=-1)
36
+ cos = (a * b).sum(-1).clamp(-1.0, 1.0)
37
+ drift = torch.arccos(cos)
38
+ frac = ((drift - BINDING).abs() <= tol).float().mean()
39
+ return {"mean": drift.mean().item(), "std": drift.std().item(),
40
+ "per_row": drift, "binding_fraction": frac.item()}
41
+
42
+
43
+ # -------------------------------------------------------------------------------- cv
44
+ @torch.no_grad()
45
+ def _pentachoron_volumes(pts: torch.Tensor) -> torch.Tensor:
46
+ """Batched Cayley-Menger 4-simplex volumes. pts: (B, 5, D) -> (B,) volumes.
47
+ One float64 det over all samples (vol^2 = -det(CM)/9216 for n=4). Built-in
48
+ per the 2026-07-11 rider amendment (the operator: the installed geovocab2 path is a
49
+ per-sample class call — too slow for a vitals loop); geovocab2 stays the
50
+ reference implementation, parity-checked via cv_reference_check()."""
51
+ B = pts.shape[0]
52
+ d2 = torch.cdist(pts.double(), pts.double()).pow(2) # (B,5,5)
53
+ cm = torch.ones(B, 6, 6, dtype=torch.float64, device=pts.device)
54
+ cm[:, 0, 0] = 0.0
55
+ cm[:, 1:, 1:] = d2
56
+ det = torch.linalg.det(cm)
57
+ return (-det / 9216.0).clamp_min(0.0).sqrt().float()
58
+
59
+
60
+ @torch.no_grad()
61
+ def pentachoron_cv(rows: torch.Tensor, n_samples: int = 200,
62
+ generator: torch.Generator | None = None) -> float:
63
+ """CV (std/mean) of Cayley-Menger 4-simplex volumes over n_samples random
64
+ 5-row subsets. Rows are row-normalized before measurement. Uses the built-in
65
+ batched CM (float64 det); validate against geovocab2 with
66
+ cv_reference_check() after any change to the volume math."""
67
+ x = torch.nn.functional.normalize(rows.float(), dim=-1)
68
+ n = x.shape[0]
69
+ if n < 5:
70
+ raise ValueError(f"pentachoron_cv needs >=5 rows, got {n}")
71
+ g = generator or torch.Generator(device="cpu").manual_seed(0)
72
+ idx = torch.stack([torch.randperm(n, generator=g)[:5]
73
+ for _ in range(n_samples)]) # (B,5)
74
+ v = _pentachoron_volumes(x[idx].cpu())
75
+ return (v.std() / v.mean().clamp_min(1e-12)).item()
76
+
77
+
78
+ @torch.no_grad()
79
+ def cv_reference_check(n_trials: int = 50, tol: float = 1e-5) -> float:
80
+ """Parity check of the built-in batched CM against geovocab2's reference
81
+ implementation (the formula's source of truth). Returns max |rel diff|;
82
+ raises if geovocab2 is absent or parity fails. Run after touching
83
+ _pentachoron_volumes."""
84
+ try:
85
+ from geovocab2.shapes.formula.symbolic.cayley_menger import (
86
+ CayleyMengerFromSimplex)
87
+ except Exception as e: # pragma: no cover
88
+ raise ImportError(
89
+ "cv_reference_check requires geovocab2 (install via the geolip-svae "
90
+ "umbrella: pip install git+https://github.com/AbstractEyes/"
91
+ "geolip-svae).") from e
92
+ ref = CayleyMengerFromSimplex()
93
+ g = torch.Generator().manual_seed(0)
94
+ pts = torch.nn.functional.normalize(
95
+ torch.randn(n_trials, 5, 4, generator=g), dim=-1)
96
+ mine = _pentachoron_volumes(pts)
97
+ # compare at float64: the reference computes in the INPUT dtype, and fp32
98
+ # dets lose up to ~4% on near-degenerate pentachora (measured 2026-07-11)
99
+ tsuccessors = torch.stack([ref.forward(p.double())["volume"].float() for p in pts])
100
+ rel = ((mine - tsuccessors).abs() / tsuccessors.abs().clamp_min(1e-12)).max().item()
101
+ if rel > tol:
102
+ raise AssertionError(f"CM parity vs geovocab2 failed: max rel {rel}")
103
+ return rel
104
+
105
+
106
+ # ------------------------------------------------------------------------- aliveness
107
+ @torch.no_grad()
108
+ def axis_aliveness(oriented_weights: torch.Tensor, alive_thresh: float = 1e-3) -> dict:
109
+ """`oriented_weights`: (..., 2K) nonnegative oriented-softmax address rows
110
+ (sum to 1 on the last dim). Returns axes-alive count, mean-usage perplexity
111
+ (hppl analogue; healthy hosted reference 125-126/128), and a collapse flag.
112
+ Reference behavior: near-uniform aliveness at div_weight=0 (discovery #22)."""
113
+ w = oriented_weights.reshape(-1, oriented_weights.shape[-1]).float()
114
+ usage = w.mean(0)
115
+ usage = usage / usage.sum().clamp_min(1e-12)
116
+ # an axis is alive if its mean usage exceeds alive_thresh x the uniform share
117
+ alive = int((usage > alive_thresh * (1.0 / usage.numel())).sum())
118
+ ent = -(usage.clamp_min(1e-12) * usage.clamp_min(1e-12).log()).sum()
119
+ ppl = float(ent.exp())
120
+ return {"axes_total": usage.numel(), "axes_alive": alive, "usage_ppl": ppl,
121
+ "collapsed": ppl < 0.05 * usage.numel()}
122
+
123
+
124
+ # ------------------------------------------------------------------------------ gates
125
+ @torch.no_grad()
126
+ def gate_stats(gates: torch.Tensor) -> dict:
127
+ """Gate values (post-sigmoid/clamp). Reports mean and whether it sits in the
128
+ 0.012-0.03 band (read-only — the band is a candidate invariant, never a target)."""
129
+ g = gates.float().flatten()
130
+ m = g.mean().item()
131
+ return {"mean": m, "std": g.std().item(),
132
+ "in_band": GATE_BAND[0] <= m <= GATE_BAND[1]}
133
+
134
+
135
+ # ------------------------------------------------------------------------------ paths
136
+ @torch.no_grad()
137
+ def path_diversity(ids: torch.Tensor) -> dict:
138
+ """Unique-path counting with the FIXED multiplicative hash:
139
+ ((ids * 2654435761) % 2^32) >> 16 — Knuth needs the HIGH bits; the low-16
140
+ variant produced the retracted ~1,500 path ceiling (sessions/2026-07-07).
141
+ `ids`: integer tensor, one composed path id per row (any shape)."""
142
+ x = ids.reshape(-1).to(torch.int64)
143
+ hashed = ((x * KNUTH32) % (1 << 32)) >> 16
144
+ return {"n": int(x.numel()),
145
+ "unique_raw": int(torch.unique(x).numel()),
146
+ "unique_hashed": int(torch.unique(hashed).numel())}
147
+
148
+
149
+ @torch.no_grad()
150
+ def compose_path_ids(stage_indices: list[torch.Tensor], radix: int) -> torch.Tensor:
151
+ """Compose per-stage discrete indices (each (...,) int in [0, radix)) into a
152
+ single path id, positional base-`radix` — construction, not hashing."""
153
+ out = torch.zeros_like(stage_indices[0], dtype=torch.int64)
154
+ for s in stage_indices:
155
+ out = out * radix + s.to(torch.int64)
156
+ return out
157
+
158
+
159
+ # --------------------------------------------------------------------- grad democracy
160
+ @torch.no_grad()
161
+ def grad_norm_spread(groups: dict[str, list[torch.nn.Parameter]]) -> dict:
162
+ """Gradient-democracy monitor. `groups`: name -> params of one parallel member
163
+ (tower/expert). Reports per-group grad norms and the orders-of-magnitude spread.
164
+ Reference: unequalized heterogeneous towers spread ~20 orders (fibonacci dead at
165
+ 2.25e-21 under helix); equalized ~0.0 (canon/fibonacci_systems.md)."""
166
+ norms = {}
167
+ for name, params in groups.items():
168
+ gs = [p.grad for p in params if p.grad is not None]
169
+ norms[name] = float(torch.sqrt(sum((g.float() ** 2).sum() for g in gs)).item()) \
170
+ if gs else 0.0
171
+ vals = [v for v in norms.values() if v > 0]
172
+ spread = (math.log10(max(vals)) - math.log10(min(vals))) if len(vals) >= 2 else 0.0
173
+ return {"norms": norms, "spread_orders": spread, "dead": [k for k, v in norms.items() if v == 0.0]}
174
+
175
+
176
+ # ----------------------------------------------------------------------------- screen
177
+ class CVScreen:
178
+ """CV@N early band screen (tri-band ft1): record pentachoron CV at `step_mark`
179
+ batches; classify <0.30 LOW / 0.35-0.50 MID / >0.80 HIGH. Turns ~2h/config
180
+ into ~7min. Readout only."""
181
+ def __init__(self, step_mark: int = 1000):
182
+ self.step_mark = step_mark
183
+ self.recorded: float | None = None
184
+
185
+ def maybe_record(self, step: int, rows: torch.Tensor) -> float | None:
186
+ if self.recorded is None and step >= self.step_mark:
187
+ self.recorded = pentachoron_cv(rows)
188
+ return self.recorded
189
+
190
+ @property
191
+ def band(self) -> str | None:
192
+ c = self.recorded
193
+ if c is None:
194
+ return None
195
+ if c < 0.30:
196
+ return "LOW"
197
+ if 0.35 <= c <= 0.50:
198
+ return "MID"
199
+ if c > 0.80:
200
+ return "HIGH"
201
+ return "BETWEEN"
202
+
203
+
204
+ # ------------------------------------------------------------------------------ smoke
205
+ if __name__ == "__main__": # shapes/parse smoke ONLY — no training, ever.
206
+ g = torch.Generator().manual_seed(0)
207
+ K, D = 64, 4
208
+ init = torch.nn.functional.normalize(torch.randn(K, D, generator=g), dim=-1)
209
+ cur = torch.nn.functional.normalize(init + 0.29 * torch.randn(K, D, generator=g), dim=-1)
210
+ print("drift:", {k: v for k, v in anchor_drift(cur, init).items() if k != "per_row"})
211
+ w = torch.softmax(torch.randn(32, 2 * K, generator=g), dim=-1)
212
+ print("aliveness:", axis_aliveness(w))
213
+ print("gates:", gate_stats(torch.full((8,), 0.024)))
214
+ ids = compose_path_ids([torch.randint(0, 16, (4096,), generator=g) for _ in range(4)], 16)
215
+ print("paths:", path_diversity(ids))
216
+ lin = torch.nn.Linear(8, 8)
217
+ lin(torch.randn(4, 8)).sum().backward()
218
+ print("democracy:", grad_norm_spread({"a": list(lin.parameters())}))
219
+ print("OK — vitals smoke passed (pentachoron_cv needs geovocab2; run on GPU env)")
code/loss_forms.py ADDED
@@ -0,0 +1,575 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """loss_forms.py — the composable loss library of the loss campaign. #TAG:loss_forms #TAG:accumulation
2
+ Every RUNNABLE loss form in one place: the four differencing primitives, the
3
+ accumulation formats A0-A8 as composable functions, the candidate losses
4
+ (FAC, PWA weights, compartment roles, latent-chain), and a self-smoke.
5
+
6
+ Deliberately ABSENT, by statute (inventory/LOSS_MANIFEST.md):
7
+ A9 sum-no-norm — scale rides on batch/seq; lr stops transferring.
8
+ A10 EMA/cross-step — the VQ/commitment/load-balancing failure class.
9
+ InfoNCE into address paths — legal only as a readout head (L-113 / L-017).
10
+
11
+ House laws honored throughout: pure Adam wd=0 (constructor not included here —
12
+ use amoe.laws.make_optimizer); fp32/TF32-off; crc32 seeds never hash(); CV is a
13
+ readout never a force; masking never renormalizes; gauges fp64.
14
+
15
+ Colab-cell-safe: no argparse side effects, no __file__ logic.
16
+ Smoke: python tools/loss_forms.py
17
+ """
18
+ import math
19
+ import os
20
+ import sys
21
+ import zlib
22
+
23
+ import torch
24
+ import torch.nn.functional as F
25
+
26
+
27
+ def _root():
28
+ d = os.path.abspath(os.getcwd())
29
+ while True:
30
+ if os.path.exists(os.path.join(d, "MANIFEST.md")):
31
+ return d
32
+ p = os.path.dirname(d)
33
+ if p == d:
34
+ return os.getcwd()
35
+ d = p
36
+
37
+ for _p in (os.path.join(_root(), "tools"),):
38
+ if os.path.isdir(_p) and _p not in sys.path:
39
+ sys.path.insert(0, _p)
40
+
41
+ def seed_for(name: str) -> int:
42
+ return zlib.crc32(name.encode("utf-8")) & 0x7FFFFFFF
43
+
44
+
45
+ # ============================================================= PRIMITIVES
46
+ # Each returns PER-ELEMENT residuals (unreduced) so accumulation composes.
47
+
48
+ def prim_ce(logits, target):
49
+ """CE — the coupled primitive: log-sum-exp partition over the last dim.
50
+ Hessian diag(p)-pp^T: exact null direction; spectrum collapses as
51
+ p_max->1 (measured T21). Returns (...,) per-position nats."""
52
+ return F.cross_entropy(logits.reshape(-1, logits.shape[-1]),
53
+ target.reshape(-1), reduction="none"
54
+ ).reshape(target.shape)
55
+
56
+ def prim_sq(pred, target):
57
+ """Squared error — the aleph's only sanctioned codebook pressure rides
58
+ this (recon through M-hat). Returns per-element squares."""
59
+ return (pred - target) ** 2
60
+
61
+ def prim_kl(logits, teacher_probs):
62
+ """KL to detached teacher probs. LAW: alpha <= 0.25, NEVER on founders,
63
+ never in a selection loop without a quality gap (L-114/L-022)."""
64
+ return F.kl_div(F.log_softmax(logits, -1), teacher_probs.detach(),
65
+ reduction="none").sum(-1)
66
+
67
+ def prim_cosh_bregman(v, code, mu=1.0, clamp=4.0):
68
+ """BREG — the Bregman divergence of the aleph's own potential sum-cosh:
69
+ D_Phi(v - c*mu, 0) = cosh(r) - 1. Uncoupled per axis, curvature >= 1,
70
+ antipodally invariant L(v,c)==L(-v,-c). VERDICT ON RECORD (L-070/L-138):
71
+ loses to CE wherever CE is healthy, 3/3; DECOMPRESSES the coupled-
72
+ partition collapse 3/3 (usage 1-2.7 -> ~61/64). Use it where the
73
+ partition coupling is the disease, not as a general replacement."""
74
+ r = (v - code * mu).clamp(-clamp, clamp)
75
+ return torch.cosh(r) - 1.0
76
+
77
+
78
+ # ====================================================== ACCUMULATION FORMATS
79
+ # Each takes per-element residuals -> a scalar (or a weighted scalar).
80
+
81
+ def a0_mean(res):
82
+ """A0 uniform-mean. The default; honestly dominant (71/138)."""
83
+ return res.mean()
84
+
85
+ def a1_chunked_ce(logits_fn, hidden, target, chunk=512, ignore_index=-100):
86
+ """A1 chunk-sum-renormalize for CE: never materialize seq x vocab.
87
+ Mathematically identical to A0; a 5x memory law (L-004). `logits_fn`
88
+ maps a hidden slice -> logits (the lm head)."""
89
+ s, n = None, 0
90
+ T = hidden.shape[1]
91
+ for i in range(0, T, chunk):
92
+ lg = logits_fn(hidden[:, i:i + chunk])
93
+ tgt = target[:, i:i + chunk]
94
+ term = F.cross_entropy(lg.reshape(-1, lg.shape[-1]), tgt.reshape(-1),
95
+ ignore_index=ignore_index, reduction="sum")
96
+ s = term if s is None else s + term
97
+ n += int((tgt != ignore_index).sum())
98
+ return s / max(n, 1)
99
+
100
+ def a2_weighted(res, w, dims=None):
101
+ """A2 per-sample(or per-element)-then-weighted. Reduce res over `dims`
102
+ FIRST if given, then weight and renormalize by w.sum() — a mean taken
103
+ too early silently erases the weight."""
104
+ if dims is not None:
105
+ res = res.mean(dim=dims)
106
+ return (res * w).sum() / w.sum().clamp_min(1e-12)
107
+
108
+ def a3_band_composed(res_per_band, w_bands):
109
+ """A3 band-crossfade composition: (B, N_BANDS) losses x (B, N_BANDS)
110
+ windows -> scalar. Windows must be a partition of unity on the TRAINING
111
+ coordinate (band coordinate law); isolation is quadratic in the window."""
112
+ return (res_per_band * w_bands).sum(-1).mean()
113
+
114
+ def a4_masked(res, mask):
115
+ """A4 masked-denominator — THE SILENT-ZERO CLASS. Asserts the mask fired:
116
+ a term that never fires is indistinguishable from a null term."""
117
+ m = mask.float()
118
+ live = m.sum()
119
+ assert float(live) > 0, "A4 silent zero: mask never fired (assert the count upstream)"
120
+ return (res * m).sum() / live
121
+
122
+ def a5_dose_coupled(base_scalar, aux_res, w_route, lam=1.0):
123
+ """A5 dose-coupled auxiliary: base + lam * routed aux. lam~1 is the
124
+ measured operating point on the flow substrate; run the CONDITIONING
125
+ GATE on the aux's recovery map before spending (L-016 vs L-115)."""
126
+ return base_scalar + lam * a2_weighted(aux_res, w_route)
127
+
128
+ def a6_paired(res_a, res_b):
129
+ """A6 paired-difference: identical (row, noise, t) triples per arm,
130
+ per-sample reduction, fp64 accumulation. Without pairing, sub-1%
131
+ effects are invisible (the ~0.988 unpaired floor)."""
132
+ return (res_a.double() - res_b.double()).mean()
133
+
134
+ def a7_grid_infonce(za, zb, temp=0.07):
135
+ """A7 grid-pairwise (InfoNCE), symmetric. THE LOUDEST GRADIENT — legal
136
+ ONLY as a readout objective on a head outside the compute path; NEVER
137
+ into address paths (L-113). You are responsible for that placement."""
138
+ sims = za @ zb.t() / temp
139
+ lbl = torch.arange(za.shape[0], device=za.device)
140
+ return (F.cross_entropy(sims, lbl) + F.cross_entropy(sims.t(), lbl)) / 2
141
+
142
+ def a8_fp64_gauge(fn, *args):
143
+ """A8 fp64-accumulate for GAUGES (no_grad, autocast off). fp32 CM dets
144
+ lose ~4% on near-degenerate pentachora."""
145
+ with torch.no_grad():
146
+ return fn(*(a.double() if torch.is_tensor(a) else a for a in args))
147
+
148
+
149
+ # ========================================================== CANDIDATE LOSSES
150
+
151
+ def fac_loss(feats, R, code_rows, mu=1.0, t_loss=0.3):
152
+ """FAC: normalize(feats) @ R^T / t_loss -> cosh-Bregman to the target
153
+ code. R is a FROZEN orthonormal frame (gauge-fixed by construction);
154
+ code_rows in {-1,+1}^K frozen. See prim_cosh_bregman's verdict note."""
155
+ v = (F.normalize(feats, dim=-1) @ R.t()) / t_loss
156
+ return prim_cosh_bregman(v, code_rows, mu=mu)
157
+
158
+ def pwa_weights(pi, form="inverse", w_min=0.1, band=(0.10, 0.60), eps=0.02):
159
+ """PWA weight builders over a FROZEN reference's true-token prob pi.
160
+ GATE RECORD (2026-07-25, trained-ce reference): band-kernel novelty
161
+ 0.0145 REFUSED; window 0.0562 marginal; inverse 0.0832 weak-pass —
162
+ all far below the 0.715 payer class. CONDITIONAL: do not spend an arm
163
+ matrix on these; revival bar is a form with novelty >= 0.3."""
164
+ if form == "band-kernel":
165
+ return w_min + (1 - w_min) * 4 * pi * (1 - pi)
166
+ if form == "window":
167
+ lo, hi = band
168
+ return (torch.sigmoid((pi - lo) / eps)
169
+ * torch.sigmoid((hi - pi) / eps)).clamp_min(w_min)
170
+ if form == "inverse":
171
+ return (1 - pi).clamp_min(w_min)
172
+ raise ValueError(form)
173
+
174
+
175
+ # Compartment ROLE losses (rank 1 of the series). Each supervises a DIFFERENT
176
+ # QUANTITY through the band's channel window — the 0.715-class design contract
177
+ # (a reweighting of the base residual would be gate-refused; these are not).
178
+ # `cmap` is compartment_smoke.build_compartment_map(...); h is the trunk
179
+ # hidden (B, T, d). Fixed probes are frozen buffers (placement by
180
+ # construction); trainable role heads replace them in a real bed.
181
+
182
+ def role_low_recon(h, W_chan, emb_target, probe):
183
+ """LOW = absolute/reconstructive: rebuild the token's own input embedding
184
+ from the LOW channels alone. The aleph's proven pressure class."""
185
+ hw = h * W_chan[:, 0]
186
+ return prim_sq(hw @ probe, emb_target.detach()).mean(-1)
187
+
188
+ def role_mid_continuity(h, W_chan, probe):
189
+ """MID = relational: geodesic continuity of adjacent-position MID-channel
190
+ states (1 - cos on a fixed projection). A different quantity (the
191
+ trajectory), not a reweighting of the next-token residual."""
192
+ z = F.normalize((h * W_chan[:, 1]) @ probe, dim=-1)
193
+ return 1.0 - (z[:, :-1] * z[:, 1:]).sum(-1)
194
+
195
+ def role_high_span(h, W_chan, span_target, probe, span=32):
196
+ """HIGH = structural: predict the span's byte-histogram signature from
197
+ the HIGH channels. Span pooling over TIME toward an explicit span-level
198
+ TARGET (not GAP-in-an-encoder: the pooled object IS the supervised
199
+ quantity, flagged per the GAP law regardless)."""
200
+ B, T, d = h.shape
201
+ n = T // span
202
+ hw = (h * W_chan[:, 2])[:, :n * span].reshape(B, n, span, d).mean(2)
203
+ return prim_sq(hw @ probe, span_target.detach()).mean(-1)
204
+
205
+
206
+ def latent_chain_terms(feats_answer, feats_register, R, code_y, code_z,
207
+ mu=1.0, t_loss=0.3, lam=1.0):
208
+ """LATENT-CHAIN: FAC on the answer position + FAC on a LATENT register
209
+ position targeting the intermediate value's code — supervision of a
210
+ quantity NOT in the output string (the thing CE structurally cannot
211
+ express). Mandatory control in any bed: latent_chain_shuffled (c_z
212
+ drawn from a shuffled intermediate). Prereg: direct composite
213
+ 0.0 -> >= 0.50, REFUTED < 0.10."""
214
+ la = fac_loss(feats_answer, R, code_y, mu, t_loss)
215
+ lz = fac_loss(feats_register, R, code_z, mu, t_loss)
216
+ return la.mean() + lam * lz.mean()
217
+
218
+
219
+ # ================================================= LEGACY ROSTER (extracted)
220
+ # Every historical form with a recorded formula and no living local impl,
221
+ # made runnable. Verdicts travel in the docstrings; the manifest row is the
222
+ # authority (inventory/LOSS_MANIFEST.md).
223
+
224
+ def margin_head(feats, weight, target, kind="arcface", s=30.0, m=0.30):
225
+ """L-036 RoseFace margin family. cos(th+m) (arc) | cos(th)-m (cos) |
226
+ cos(m*th) (sphere), scale s. Historical ceiling: 60% single-stream
227
+ (diagnosed as frozen pentachora + erosion, not the margin)."""
228
+ z = F.normalize(feats, dim=-1) @ F.normalize(weight, dim=-1).t()
229
+ th = torch.arccos(z.clamp(-1 + 1e-7, 1 - 1e-7))
230
+ if kind == "arcface":
231
+ zt = torch.cos(th + m)
232
+ elif kind == "cosface":
233
+ zt = z - m
234
+ elif kind == "sphereface":
235
+ zt = torch.cos(m * th)
236
+ else:
237
+ raise ValueError(kind)
238
+ logits = z.clone()
239
+ logits.scatter_(-1, target.unsqueeze(-1), zt.gather(-1, target.unsqueeze(-1)))
240
+ return prim_ce(s * logits, target)
241
+
242
+ def cv_band_loss(anchors, cv_target=0.20, weight=1e-3, n_sets=64, seed=0):
243
+ """L-040 — THE ONE SANCTIONED CV FORCE. Arm-gated by statute: weight
244
+ HARD CEILING 1e-3; S^15-class BANKS only, NEVER the aleph codebook;
245
+ forward loss; fp64 determinant; fixed-seed subset draw (deterministic
246
+ across steps). Port of tools/exp017_aleph_constellation.py:154-186."""
247
+ assert weight <= 1e-3, "CV force above 1e-3 is prohibited (L-110)"
248
+ A = F.normalize(anchors, dim=-1)
249
+ n = A.shape[0]
250
+ assert n >= 5, "pentachoron CV needs >= 5 anchors"
251
+ g = torch.Generator(device="cpu").manual_seed(seed)
252
+ idx = torch.stack([torch.randperm(n, generator=g)[:5] for _ in range(n_sets)])
253
+ pts = A[idx]
254
+ d2 = torch.cdist(pts.double(), pts.double()).pow(2)
255
+ cm = torch.ones(n_sets, 6, 6, dtype=torch.float64, device=A.device)
256
+ cm[:, 0, 0] = 0.0
257
+ cm[:, 1:, 1:] = d2
258
+ v = (-torch.linalg.det(cm) / 9216.0).clamp_min(1e-24).sqrt()
259
+ cv = (v.std() / v.mean().clamp_min(1e-12)).float()
260
+ return weight * (cv - cv_target).abs()
261
+
262
+ def cm_validity_hinge(pts, lam=0.01, eps=1e-6):
263
+ """L-045 KSimplex validity hinge: penalize non-positive CM volume^2 on
264
+ the simplex. Requires d/k >= 8 or the det is numerically unstable."""
265
+ B = pts.shape[0]
266
+ d2 = torch.cdist(pts, pts).pow(2)
267
+ k1 = pts.shape[1]
268
+ cm = torch.ones(B, k1 + 1, k1 + 1, dtype=pts.dtype, device=pts.device)
269
+ cm[:, 0, 0] = 0.0
270
+ cm[:, 1:, 1:] = d2
271
+ sign = -1.0 if (k1 % 2 == 0) else 1.0
272
+ vol2 = sign * torch.linalg.det(cm)
273
+ return lam * F.relu(eps - vol2).mean()
274
+
275
+ def cm_volume_spread(vol2_per_layer, lam=0.005):
276
+ """L-046 volume-spread REWARD: -std(log|vol^2|) across layers — an
277
+ anti-collapse diversity reward, note the SIGN."""
278
+ return -lam * torch.log(vol2_per_layer.abs().clamp_min(1e-24)).std()
279
+
280
+ def procrustes_sq(A, B):
281
+ """L-047/L-111 Procrustes residual ||A R* - B||^2 (R* via SVD).
282
+ PLACEMENT VERDICT: as a x0.3 regularizer beside a real force it
283
+ tightens CV (rating 6); as THE training force R@1 = 0.000 (rating 1).
284
+ It measures alignability; it cannot create it."""
285
+ U, _, Vt = torch.linalg.svd(A.t() @ B)
286
+ R = U @ Vt
287
+ return ((A @ R - B) ** 2).mean()
288
+
289
+ def soft_hand_weights(cv, target, sigma=0.15, boost=1.5, penalty=1.0):
290
+ """L-026 soft hand — reward, not penalty: near the CV target the recon
291
+ gradient is BOOSTED (1..1+boost); far, a restoring force. Adverse
292
+ finding on record: SUSTAINED moderate boost hurts (the model optimizes
293
+ for staying in the boost zone). Returns (recon_weight, cv_penalty)."""
294
+ prox = torch.exp(-((cv - target) ** 2) / (2 * sigma ** 2))
295
+ return 1.0 + boost * prox, penalty * (1.0 - prox)
296
+
297
+ def kd_guard(alpha, is_founder=False, in_selection_loop=False,
298
+ teacher_gap=None):
299
+ """L-022/L-114 KD statute: alpha <= 0.25, never on founders, never in a
300
+ selection loop without a quality gap. Raises on the L-114 configuration
301
+ (inverse evolution, 2.4301 -> 2.5603)."""
302
+ if is_founder:
303
+ raise ValueError("KD on a founder is prohibited (L-114)")
304
+ if alpha > 0.25 and in_selection_loop and not teacher_gap:
305
+ raise ValueError("KD alpha > 0.25 in a selection loop without a "
306
+ "quality gap reproduces inverse evolution (L-114)")
307
+ return min(alpha, 1.0)
308
+
309
+
310
+ # ============================================= DEVIANT ROSTER (gate-cleared)
311
+ # inventory/DEVIANT_ROSTER.md candidates. Novelty numbers travel with them;
312
+ # trained verdicts graduate them to LOSS_MANIFEST rows.
313
+
314
+ def dev_softmax_accum(res, T=0.5):
315
+ """Worst-position accumulation: T*logsumexp(res/T) - T*log(N). Gradient ==
316
+ softmax(res/T) weighting (self-paced weighting IS this loss). Gate 0.911
317
+ at trained state - the highest ever. FLAG: on natural text the worst
318
+ positions are largely irreducible entropy; prereg carries a held-out bar."""
319
+ flat = res.reshape(-1)
320
+ return T * torch.logsumexp(flat / T, 0) - T * math.log(flat.numel())
321
+
322
+ def dev_geomean_accum(res, eps=1e-3):
323
+ """Geometric-mean accumulation: mean(log(res+eps)) - the anti-focal
324
+ (gradient 1/res polishes the nearly-solved). Gate 0.486 trained."""
325
+ return torch.log(res + eps).mean()
326
+
327
+ def sparsemax_loss(z, y):
328
+ """Sparsemax loss (Martins & Astudillo 2016): a PARTIAL partition -
329
+ sparse support - between CE (full coupling) and FAC (zero coupling).
330
+ The coupling-axis probe for the L-138 mechanism. Gate 0.253 (state-
331
+ independent form). z: (N,V) logits, y: (N,) targets -> (N,) losses."""
332
+ zs, _ = torch.sort(z.detach(), dim=-1, descending=True)
333
+ cs = zs.cumsum(-1)
334
+ k = torch.arange(1, z.shape[-1] + 1, device=z.device, dtype=z.dtype)
335
+ ksup = ((1 + k * zs) > cs).to(z.dtype).sum(-1, keepdim=True)
336
+ tau = (cs.gather(-1, ksup.long() - 1) - 1) / ksup
337
+ psp = (z - tau).clamp_min(0) # sparsemax probs (grad ok)
338
+ zy = z.gather(-1, y.unsqueeze(-1)).squeeze(-1)
339
+ zsq = torch.where(psp > 0, z ** 2 - tau ** 2, torch.zeros_like(z)).sum(-1)
340
+ return -zy + 0.5 * zsq + 0.5
341
+
342
+ def fac_loss_link(feats, R, code_rows, link="cosh", mu=1.0, t_loss=0.3):
343
+ """The FAC link dial: cosh (exponential tails, the measured verdict) |
344
+ tanh-Hamming (bounded) | cauchy log(1+r^2) (sub-quadratic). Links are
345
+ ~90% collinear at init (direction dominates early; tails matter late)."""
346
+ v = (F.normalize(feats, dim=-1) @ R.t()) / t_loss
347
+ if link == "cosh":
348
+ return prim_cosh_bregman(v, code_rows, mu=mu)
349
+ if link == "tanh":
350
+ return 1.0 - torch.tanh(v) * code_rows
351
+ if link == "cauchy":
352
+ return torch.log1p((v - code_rows * mu) ** 2)
353
+ raise ValueError(link)
354
+
355
+
356
+ # ================================================ FORBIDDEN CONTROLS [FORCE]
357
+ # Runnable ONLY as explicitly-forced control arms (the blob-on-eps pattern:
358
+ # the library refuses the design and permits the falsification). Each cites
359
+ # its manifest row and warns loudly.
360
+
361
+ def _force_gate(force, row, evidence):
362
+ if not force:
363
+ raise ValueError(
364
+ f"{row} is a FORBIDDEN class ({evidence}). This implementation "
365
+ f"exists ONLY as a control arm - pass force=True to reproduce "
366
+ f"the failure on purpose.")
367
+ import warnings
368
+ warnings.warn(f"{row} forced: you are reproducing a documented failure "
369
+ f"class as a CONTROL, not training a design.")
370
+
371
+ def forbidden_vq_commitment(z_e, codebook, beta=0.25, force=False):
372
+ """L-105 VQ codebook + commitment loss (EMA variant NOT provided — the
373
+ cross-step state is A10 and stays absent even here). Evidence: the
374
+ aleph codebook holds 125+/128 axes alive at div_weight=0 without it."""
375
+ _force_gate(force, "L-105 VQ/commitment", "14x path collapse class")
376
+ d = torch.cdist(z_e.reshape(-1, z_e.shape[-1]), codebook)
377
+ e = codebook[d.argmin(-1)].reshape(z_e.shape)
378
+ return (prim_sq(z_e.detach(), e).mean()
379
+ + beta * prim_sq(z_e, e.detach()).mean())
380
+
381
+ def forbidden_load_balancing(router_probs, expert_mask, alpha=0.01,
382
+ force=False):
383
+ """L-134 switch-style balance aux: alpha * N * sum_i f_i * P_i.
384
+ Evidence: banned and never needed — usage stays near-uniform read-only."""
385
+ _force_gate(force, "L-134 load-balancing aux", "no-balancing statute")
386
+ N = router_probs.shape[-1]
387
+ f = expert_mask.float().mean(dim=tuple(range(expert_mask.ndim - 1)))
388
+ P = router_probs.mean(dim=tuple(range(router_probs.ndim - 1)))
389
+ return alpha * N * (f * P).sum()
390
+
391
+ def forbidden_gap(x, spatial_dims, force=False):
392
+ """L-109 global average pooling in a geometric encoder. Evidence:
393
+ 70% -> 29% collapse, replicated twice. Patch aggregation defaults to
394
+ MEAN over tokens at the READOUT, never pooling inside the encoder."""
395
+ _force_gate(force, "L-109 GAP", "70->29 collapse, replicated")
396
+ return x.mean(dim=spatial_dims)
397
+
398
+
399
+ # ================================================================ THE GATES
400
+ def collinearity_novelty(loss_arm, loss_base, params):
401
+ """novelty = 1 - |cos(grad_arm, grad_base)|. Composed role arms are
402
+ judged whole; additive auxiliaries are judged as THE TERM BEING ADDED.
403
+ Calibration: HP/LP 0.0026-0.0083 (inert) vs blob 0.715 (payer).
404
+ REFUSE below 0.05; the payer class starts ~0.3."""
405
+ ga = torch.autograd.grad(loss_arm, params, retain_graph=True,
406
+ allow_unused=True)
407
+ gb = torch.autograd.grad(loss_base, params, retain_graph=True,
408
+ allow_unused=True)
409
+ # zero-fill on the SHARED parameter support: a param an arm does not
410
+ # touch contributes the zero vector to its direction (dropping it would
411
+ # misalign the two flattened gradients)
412
+ fa = torch.cat([(g if g is not None else torch.zeros_like(p)).reshape(-1)
413
+ for g, p in zip(ga, params)])
414
+ fb = torch.cat([(g if g is not None else torch.zeros_like(p)).reshape(-1)
415
+ for g, p in zip(gb, params)])
416
+ return 1.0 - abs(F.cosine_similarity(fa.unsqueeze(0),
417
+ fb.unsqueeze(0)).item())
418
+
419
+
420
+ # ================================================================ SELF-SMOKE
421
+ def _smoke():
422
+ torch.backends.cuda.matmul.allow_tf32 = False
423
+ torch.backends.cudnn.allow_tf32 = False
424
+ dev = "cuda" if torch.cuda.is_available() else "cpu"
425
+ if dev == "cuda":
426
+ torch.cuda.set_per_process_memory_fraction(0.73)
427
+ g = torch.Generator().manual_seed(seed_for("loss_forms"))
428
+ ok = []
429
+
430
+ B, T, V, d, K = 4, 64, 256, 192, 64
431
+ logits = torch.randn(B, T, V, generator=g, requires_grad=True)
432
+ y = torch.randint(0, V, (B, T), generator=g)
433
+ ce = prim_ce(logits, y)
434
+ ok.append(("prim_ce shape+grad", bool(ce.shape == (B, T)
435
+ and torch.autograd.grad(ce.mean(), logits)[0].abs().sum() > 0)))
436
+
437
+ # A1 == A0 identity (the 5x memory law is math-free)
438
+ h = torch.randn(B, T, d, generator=g)
439
+ W = torch.randn(V, d, generator=g) * 0.02
440
+ fn = lambda hh: hh @ W.t()
441
+ full = F.cross_entropy(fn(h).reshape(-1, V), y.reshape(-1))
442
+ ok.append(("A1 == A0 exactly",
443
+ torch.allclose(a1_chunked_ce(fn, h, y, chunk=17), full,
444
+ atol=1e-6)))
445
+
446
+ # A2 early-mean hazard: weighting after full mean == unweighted
447
+ res = torch.randn(B, T, generator=g).abs()
448
+ w = torch.rand(B, generator=g) + 0.1
449
+ good = a2_weighted(res, w, dims=(1,))
450
+ bad = res.mean() * (w / w).mean()
451
+ ok.append(("A2 weight not erased", abs(good - res.mean()) > 1e-6
452
+ and torch.allclose(bad, res.mean())))
453
+
454
+ # A4 silent-zero assert fires
455
+ try:
456
+ a4_masked(res, torch.zeros_like(res))
457
+ ok.append(("A4 silent-zero assert", False))
458
+ except AssertionError:
459
+ ok.append(("A4 silent-zero assert", True))
460
+
461
+ # A6 fp64; A7 symmetric
462
+ ok.append(("A6 fp64", a6_paired(res, res).dtype == torch.float64
463
+ and float(a6_paired(res, res)) == 0.0))
464
+ za = F.normalize(torch.randn(8, 32, generator=g), dim=-1)
465
+ zb = F.normalize(torch.randn(8, 32, generator=g), dim=-1)
466
+ ok.append(("A7 symmetric", torch.allclose(a7_grid_infonce(za, zb),
467
+ a7_grid_infonce(zb, za),
468
+ atol=1e-6)))
469
+
470
+ # FAC: antipodal invariance + gradient flow through feats
471
+ feats = torch.randn(B, T, 256, generator=g, requires_grad=True)
472
+ R = torch.linalg.qr(torch.randn(256, 256, generator=g))[0][:K]
473
+ code = ((torch.randn(V, K, generator=g) > 0).float() * 2 - 1)[y]
474
+ L = fac_loss(feats, R, code).mean()
475
+ v = (F.normalize(feats, dim=-1) @ R.t()) / 0.3
476
+ ok.append(("FAC antipodal + grad",
477
+ bool(torch.allclose(prim_cosh_bregman(v, code),
478
+ prim_cosh_bregman(-v, -code))
479
+ and torch.autograd.grad(L, feats)[0].abs().sum() > 0)))
480
+
481
+ # PWA weights bounded + floored
482
+ pi = torch.rand(B, T, generator=g)
483
+ for f in ("band-kernel", "window", "inverse"):
484
+ wf = pwa_weights(pi, f)
485
+ ok.append((f"PWA {f} in [w_min,1]",
486
+ float(wf.min()) >= 0.1 - 1e-6 and float(wf.max()) <= 1.0 + 1e-6))
487
+
488
+ # Compartment roles: shapes + grad + zero-grad outside their window
489
+ try:
490
+ from compartment_smoke import build_compartment_map
491
+ cmap = build_compartment_map(P=32, Ds=4, d=d)
492
+ Wc = cmap["W_chan_band"]
493
+ hh = torch.randn(B, T, d, generator=g, requires_grad=True)
494
+ pl = torch.randn(d, 48, generator=g) / math.sqrt(d)
495
+ emb_t = torch.randn(B, T, 48, generator=g)
496
+ lo = role_low_recon(hh, Wc, emb_t, pl).mean()
497
+ gl = torch.autograd.grad(lo, hh)[0]
498
+ dead = (Wc[:, 0] == 0)
499
+ ok.append(("role LOW grad confined to LOW channels",
500
+ bool(float(gl[..., dead].abs().sum()) == 0.0
501
+ and float(gl.abs().sum()) > 0)))
502
+ mid = role_mid_continuity(hh, Wc, pl).mean()
503
+ sp_t = torch.randn(B, T // 32, 48, generator=g)
504
+ hi = role_high_span(hh, Wc, sp_t, pl).mean()
505
+ ok.append(("roles MID/HIGH finite+grad",
506
+ bool(torch.isfinite(mid) and torch.isfinite(hi)
507
+ and torch.autograd.grad(mid + hi, hh)[0].abs().sum() > 0)))
508
+ except ImportError:
509
+ ok.append(("compartment roles (map import)", None))
510
+
511
+ # legacy roster
512
+ W2 = torch.randn(10, 64, generator=g)
513
+ f2 = torch.randn(6, 64, generator=g, requires_grad=True)
514
+ y2 = torch.randint(0, 10, (6,), generator=g)
515
+ mh = margin_head(f2, W2, y2, "arcface").mean()
516
+ ok.append(("margin_head grad + finite",
517
+ bool(torch.isfinite(mh)
518
+ and torch.autograd.grad(mh, f2)[0].abs().sum() > 0)))
519
+ bank = torch.randn(96, 16, generator=g, requires_grad=True)
520
+ cvl = cv_band_loss(bank)
521
+ ok.append(("cv_band_loss forward+grad, ceiling enforced",
522
+ bool(torch.isfinite(cvl)
523
+ and torch.autograd.grad(cvl, bank)[0].abs().sum() > 0)))
524
+ try:
525
+ cv_band_loss(bank.detach(), weight=1e-2)
526
+ ok.append(("cv_band_loss ceiling assert", False))
527
+ except AssertionError:
528
+ ok.append(("cv_band_loss ceiling assert", True))
529
+ pts5 = torch.randn(8, 5, 32, generator=g, requires_grad=True)
530
+ hinge = cm_validity_hinge(pts5)
531
+ ok.append(("cm_validity_hinge finite", bool(torch.isfinite(hinge))))
532
+ ok.append(("cm_volume_spread sign is a reward",
533
+ bool(cm_volume_spread(torch.rand(6, generator=g) + 0.1) <= 0)))
534
+ A2m = torch.randn(32, 8, generator=g); B2m = torch.randn(32, 8, generator=g)
535
+ ok.append(("procrustes_sq beats unaligned",
536
+ bool(procrustes_sq(A2m, B2m) <= ((A2m - B2m) ** 2).mean() + 1e-5)))
537
+ rw, cp = soft_hand_weights(torch.tensor(0.20), 0.20)
538
+ ok.append(("soft_hand at target: boost on, penalty ~0",
539
+ bool(rw > 2.4 and cp < 1e-6)))
540
+ try:
541
+ kd_guard(0.5, is_founder=True)
542
+ ok.append(("kd_guard founder refusal", False))
543
+ except ValueError:
544
+ ok.append(("kd_guard founder refusal", True))
545
+ # forbidden controls refuse without force, run with it
546
+ ze = torch.randn(4, 7, 16, generator=g); cb = torch.randn(32, 16, generator=g)
547
+ import warnings
548
+ refuse = 0
549
+ for fn, args in ((forbidden_vq_commitment, (ze, cb)),
550
+ (forbidden_load_balancing,
551
+ (torch.softmax(torch.randn(64, 8, generator=g), -1),
552
+ F.one_hot(torch.randint(0, 8, (64,), generator=g), 8))),
553
+ (forbidden_gap, (torch.randn(2, 3, 8, 8, generator=g), (2, 3)))):
554
+ try:
555
+ fn(*args)
556
+ except ValueError:
557
+ refuse += 1
558
+ with warnings.catch_warnings():
559
+ warnings.simplefilter("ignore")
560
+ out = fn(*args, force=True)
561
+ refuse += int(bool(torch.isfinite(out if out.dim() == 0 else out.sum())))
562
+ ok.append(("forbidden controls: refuse w/o force, run with it", refuse == 6))
563
+
564
+ npass = sum(1 for _, v in ok if v is True)
565
+ nfail = sum(1 for _, v in ok if v is False)
566
+ print("LOSS_FORMS SELF-SMOKE")
567
+ for name, v in ok:
568
+ print(" %-38s %s" % (name, "PASS" if v is True
569
+ else ("SKIP" if v is None else "FAIL")))
570
+ print("PASS %d FAIL %d SKIP %d" % (npass, nfail, len(ok) - npass - nfail))
571
+ return nfail == 0
572
+
573
+
574
+ if __name__ == "__main__":
575
+ sys.exit(0 if _smoke() else 1)
code/loss_view.py ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """loss_view.py - render + lint the rated loss-manifest registry. #TAG:loss_view
3
+ Usage: python loss_view.py card|ladder|role|cell|show|recheck-gauge|lint|html [ARG]
4
+ [--json PATH] [--min N] [--max N] (verb defaults to 'card')
5
+ Reads inventory/loss_manifest.json. Stdlib only, no import-time side effects."""
6
+ import argparse, collections, html, json, os, sys, zlib
7
+
8
+ FALLBACK_ROOT = "."
9
+ ROLES = ("PRIMARY", "AUX", "GAUGE", "GAUGE-DISTRUSTED", "RETRACTED", "FORBIDDEN")
10
+ # BREG (Bregman divergence of a substrate potential) is the FOURTH differencing
11
+ # primitive, introduced 2026-07-25 by the FAC design - a genuine schema widening,
12
+ # not a mis-binning: it is neither CE, squared error, nor KL.
13
+ PRIMS = ("CE", "SQ", "KL", "DET", "BREG", "NONE")
14
+ COLS = (("CE", "CE"), ("SQ", "SQ"), ("KL", "KL"), ("DET", "DET"),
15
+ ("BREG", "BREG"), ("NONE", "-"))
16
+ ACCUMS = tuple("A%d" % i for i in range(11)) + ("NA",) # NA minted 2026-07-25 (A0 audit)
17
+ # key, display name, lo, hi (names overridable by an optional top-level "sub_names" map)
18
+ SUB = (("R", "replication", 0, 3), ("P", "potency", 0, 3), ("D", "durability", 0, 2),
19
+ ("C", "coverage", 0, 2), ("I", "independence", 0, 2), ("L", "lineage", 0, 1))
20
+ ABBR = {"PRIMARY": "PRIM", "AUX": "AUX", "GAUGE": "GAUG", "GAUGE-DISTRUSTED": "GDIS",
21
+ "RETRACTED": "RETR", "FORBIDDEN": "FORB"}
22
+ # the only four non-ASCII glyphs this tool emits: dagger, heavy-x, perpendicular, warning
23
+ MARK = (("retraction=1", "\u2020"), ("doctrine<=2", "\u2716"),
24
+ ("split", "\u27c2"), ("contra", "\u26a0"))
25
+ LEGEND = ("\u2020 retraction floor-breaker | \u2716 doctrine ceiling | "
26
+ "\u27c2 split sibling | \u26a0 unreconciled contradiction")
27
+ BANNER_LAW = "Each row is the EVIDENCE for a standing law. Not a graveyard - cite them."
28
+
29
+ def repo_root():
30
+ d = os.path.abspath(os.getcwd())
31
+ while True:
32
+ if os.path.exists(os.path.join(d, "MANIFEST.md")):
33
+ return d
34
+ p = os.path.dirname(d)
35
+ if p == d:
36
+ return FALLBACK_ROOT
37
+ d = p
38
+
39
+ def load(path):
40
+ p = path or os.path.join(repo_root(), "inventory", "loss_manifest.json")
41
+ if not os.path.isfile(p):
42
+ print("ERROR: loss manifest not found at %s (pass --json PATH)" % p)
43
+ sys.exit(2)
44
+ with open(p, encoding="utf-8") as f:
45
+ return json.load(f)
46
+
47
+ def cut(s, n):
48
+ s = "" if s is None else str(s)
49
+ return s if len(s) <= n else s[:max(1, n - 3)] + "..."
50
+
51
+ def pad(s, n):
52
+ return "%-*s" % (n, cut(s, n))
53
+
54
+ def wrap(s, n, ind):
55
+ out, cur = [], ind
56
+ for w in str(s).split():
57
+ if cur.strip() and len(cur) + len(w) > n:
58
+ out.append(cur.rstrip())
59
+ cur = ind
60
+ cur += w + " "
61
+ out.append(cur.rstrip())
62
+ return "\n".join(out)
63
+
64
+ def banner(d):
65
+ print("LOSS MANIFEST - census %s - %d entries - rubric v%s"
66
+ % (d.get("census_date", "?"), len(d.get("entries") or []),
67
+ d.get("rubric_version", "?")))
68
+
69
+ def prim_lbl(e):
70
+ return "-" if e.get("primitive") == "NONE" else str(e.get("primitive"))
71
+
72
+ def cell_lbl(e):
73
+ return "%s.%s/%s" % (prim_lbl(e), e.get("accum"), e.get("substrate", "?"))
74
+
75
+ def rate_lbl(e):
76
+ hi = e.get("rating_hi")
77
+ return "%s-%s" % (e.get("rating"), hi) if hi is not None else "%s" % e.get("rating")
78
+
79
+ def marks(e):
80
+ r = e.get("rules_fired") or []
81
+ return "".join(g for t, g in MARK if t in r)
82
+
83
+ def rate_col(e):
84
+ return rate_lbl(e) + marks(e)
85
+
86
+ def rpdcil(e):
87
+ s = e.get("sub") or {}
88
+ return "".join(str(s.get(k, "?")) for k, _, _, _ in SUB[:5]) + "+" + str(s.get("L", "?"))
89
+
90
+ def sub_named(d):
91
+ ov = d.get("sub_names") or {}
92
+ return [(k, ov.get(k, nm), lo, hi) for k, nm, lo, hi in SUB]
93
+
94
+ def sortkey(e):
95
+ s = e.get("sub") or {}
96
+ return (-(e.get("rating") or 0), -(s.get("P") or 0), -(s.get("R") or 0), str(e.get("id")))
97
+
98
+ def expect(d, e):
99
+ """rubric-derived rating: lookup[s_raw], minus blind-2, then every '<=N' cap, then retraction."""
100
+ lut = d.get("lookup") or []
101
+ s = e.get("s_raw")
102
+ if not isinstance(s, int) or not 0 <= s < len(lut):
103
+ return None
104
+ base = lut[s]
105
+ rules = e.get("rules_fired") or []
106
+ if "blind-2" in rules:
107
+ base -= 2
108
+ for t in rules: # canonical order is unrun/single-seed/sub1pct/doctrine; min-caps commute
109
+ if "<=" in t:
110
+ try:
111
+ base = min(base, int(t.split("<=")[1]))
112
+ except ValueError:
113
+ pass
114
+ if "retraction=1" in rules:
115
+ return 1
116
+ return max(1, base)
117
+
118
+ def card(d, arg, a):
119
+ es = d.get("entries") or []
120
+ banner(d)
121
+ print("")
122
+ c = collections.Counter((x.get("primitive"), x.get("accum")) for x in es)
123
+ print("GRID " + "".join("%5s" % l for _, l in COLS) + "%6s" % "row")
124
+ tot = {}
125
+ for acc in ACCUMS:
126
+ v = [c[(p, acc)] for p, _ in COLS]
127
+ tot[acc] = sum(v)
128
+ print("%-5s" % acc + "".join("%5s" % (x if x else "-") for x in v) + "%6d" % tot[acc])
129
+ emp = [k for k in ACCUMS if not tot[k] and k != "A10"]
130
+ line = "empty: " + (" ".join(emp) if emp else "(none)")
131
+ if not tot["A10"]:
132
+ line += " | A10 EMPTY BY STATUTE"
133
+ print(line)
134
+ print("")
135
+ h = collections.Counter(x.get("rating") for x in es)
136
+ mx = max([h[r] for r in range(1, 11)] + [1])
137
+ print("RATINGS")
138
+ for r in range(1, 11):
139
+ n = h.get(r, 0)
140
+ bar = "#" * max(1, round(22 * n / mx)) if n else ""
141
+ print("%2d |%-22s %d" % (r, bar, n))
142
+ rr = sorted((x.get("rating") or 0) for x in es)
143
+ mean = sum(rr) / len(rr) if rr else 0.0
144
+ med = 0.0 if not rr else (rr[len(rr) // 2] if len(rr) % 2
145
+ else (rr[len(rr) // 2 - 1] + rr[len(rr) // 2]) / 2)
146
+ print("mean %.2f median %.1f (ranges counted at their low end)" % (mean, med))
147
+ print("")
148
+ print("TOP")
149
+ for x in sorted(es, key=sortkey)[:3]:
150
+ print(" %s %s %s %s" % (pad(x.get("id"), 6), pad(rate_col(x), 6),
151
+ pad(x.get("name"), 32), cut(x.get("headline"), 34)))
152
+ print("")
153
+ print("BOTTOM %d entries at rating 1" % sum(1 for x in es if x.get("rating") == 1))
154
+ print(" these are the DOCTRINE'S PROOF SET, not an appendix - see `role RETRACTED`")
155
+ print("")
156
+ print("FLAGS contradictions %d | gauge-distrusted %d | unrun-flagged %d"
157
+ % (sum(1 for x in es if x.get("rating_hi") is not None
158
+ or "contra" in (x.get("rules_fired") or [])),
159
+ sum(1 for x in es if x.get("role") == "GAUGE-DISTRUSTED"),
160
+ sum(1 for x in es if "UNRUN" in (x.get("flags") or []))))
161
+ print("")
162
+ print(LEGEND)
163
+
164
+ def ladder(d, arg, a):
165
+ banner(d)
166
+ print("")
167
+ es = [x for x in (d.get("entries") or []) if a.min <= (x.get("rating") or 0) <= a.max]
168
+ print("%-6s %-8s %-7s %-4s %-16s %-24s %s"
169
+ % ("ID", "RATE", "RPDCIL", "ROLE", "CELL", "NAME", "HEADLINE"))
170
+ for x in sorted(es, key=sortkey):
171
+ print("%s %s %-7s %-4s %s %s %s"
172
+ % (pad(x.get("id"), 6), pad(rate_col(x), 8), rpdcil(x),
173
+ ABBR.get(x.get("role"), "?"), pad(cell_lbl(x), 16),
174
+ pad(x.get("name"), 24), cut(x.get("headline"), 24)))
175
+ print("")
176
+ print("%d rows (rating %d..%d)" % (len(es), a.min, a.max))
177
+ print(LEGEND)
178
+
179
+ def role(d, arg, a):
180
+ banner(d)
181
+ print("")
182
+ want = (arg or "").upper()
183
+ if want not in ROLES:
184
+ print("unknown role '%s' - one of: %s" % (arg, " ".join(ROLES)))
185
+ return
186
+ es = [x for x in (d.get("entries") or []) if x.get("role") == want]
187
+ print("ROLE %s - %d entries" % (want, len(es)))
188
+ print("")
189
+ if want not in ("RETRACTED", "FORBIDDEN"):
190
+ for x in sorted(es, key=sortkey):
191
+ print("%s %s %s %s %s" % (pad(x.get("id"), 6), pad(rate_col(x), 8),
192
+ pad(cell_lbl(x), 16), pad(x.get("name"), 28),
193
+ cut(x.get("headline"), 34)))
194
+ return
195
+ print(BANNER_LAW)
196
+ print("")
197
+ fam = collections.defaultdict(list)
198
+ for x in es:
199
+ fam[x.get("family") or "(unfiled)"].append(x)
200
+ for k, v in sorted(fam.items(), key=lambda kv: (-len(kv[1]), kv[0])):
201
+ print("[%s] %d" % (k, len(v)))
202
+ for x in sorted(v, key=sortkey):
203
+ print(" %s %s %s %s" % (pad(x.get("id"), 6), pad(rate_col(x), 6),
204
+ pad(x.get("name"), 34), cut(x.get("headline"), 38)))
205
+ print("")
206
+
207
+ def cell(d, arg, a):
208
+ banner(d)
209
+ print("")
210
+ p, _, acc = (arg or "").partition(".")
211
+ p, acc = p.strip().upper(), acc.strip().upper()
212
+ if p == "-":
213
+ p = "NONE"
214
+ if p not in PRIMS or acc not in ACCUMS:
215
+ print("usage: cell <PRIM>.<ACCUM>, PRIM in %s, ACCUM in A0..A10" % "/".join(PRIMS))
216
+ return
217
+ meta = (d.get("accum") or {}).get(acc) or {}
218
+ print("CELL %s.%s" % ("-" if p == "NONE" else p, acc))
219
+ print(" %s: %s" % (acc, meta.get("name", "(no name in accum map)")))
220
+ print(wrap("law: %s" % meta.get("law", "(no law text)"), 96, " "))
221
+ print("")
222
+ es = [x for x in (d.get("entries") or [])
223
+ if x.get("primitive") == p and x.get("accum") == acc]
224
+ if not es:
225
+ print("(no entries occupy this cell)")
226
+ return
227
+ for x in sorted(es, key=sortkey):
228
+ print("%s %s %-7s %-4s %s %s" % (pad(x.get("id"), 6), pad(rate_col(x), 8), rpdcil(x),
229
+ ABBR.get(x.get("role"), "?"), pad(x.get("name"), 30),
230
+ cut(x.get("headline"), 30)))
231
+ print("")
232
+ print("%d entries" % len(es))
233
+
234
+ def show(d, arg, a):
235
+ banner(d)
236
+ print("")
237
+ e = next((x for x in (d.get("entries") or []) if str(x.get("id")) == str(arg)), None)
238
+ if e is None:
239
+ print("no entry with id '%s'" % arg)
240
+ return
241
+ known = ("id", "name", "role", "primitive", "accum", "substrate", "family", "flags",
242
+ "s_raw", "rating", "rating_hi", "sub", "rules_fired", "gauge", "headline",
243
+ "cite", "note")
244
+ print("id %s" % e.get("id"))
245
+ print("name %s" % e.get("name"))
246
+ print("role %s" % e.get("role"))
247
+ print("primitive %s" % prim_lbl(e))
248
+ print("accum %s (%s)" % (e.get("accum"),
249
+ ((d.get("accum") or {}).get(e.get("accum")) or {})
250
+ .get("name", "?")))
251
+ print("substrate %s" % e.get("substrate"))
252
+ print("cell %s" % cell_lbl(e))
253
+ print("family %s" % e.get("family"))
254
+ print("flags %s" % (", ".join(e.get("flags") or []) or "(none)"))
255
+ print("rating %s%s" % (rate_lbl(e), (" " + marks(e)) if marks(e) else ""))
256
+ print("rating_hi %s" % ("(none)" if e.get("rating_hi") is None else e.get("rating_hi")))
257
+ print("s_raw %s (rubric-derived rating: %s)" % (e.get("s_raw"), expect(d, e)))
258
+ s = e.get("sub") or {}
259
+ for k, nm, lo, hi in sub_named(d):
260
+ print(" %s %-13s %s [%d..%d]" % (k, nm, s.get(k, "?"), lo, hi))
261
+ print("rules_fired %s" % (", ".join(e.get("rules_fired") or []) or "(none)"))
262
+ print("gauge %s" % e.get("gauge"))
263
+ print("headline %s" % e.get("headline"))
264
+ print("cite %s" % (("\n ".join(str(c) for c in (e.get("cite") or [])))
265
+ or "(EMPTY - lint violation)"))
266
+ print("note %s" % (e.get("note") or "(none)"))
267
+ for k in sorted(k for k in e if k not in known):
268
+ print("%-11s %s" % (k, e[k]))
269
+
270
+ def recheck_gauge(d, arg, a):
271
+ banner(d)
272
+ print("")
273
+ q = (arg or "").lower()
274
+ if not q:
275
+ print("usage: recheck-gauge <substring> (matched against gauge and every cite)")
276
+ return
277
+ print("GAUGE BLINDNESS SWEEP - all rows below must be re-rated in the same session.")
278
+ print("")
279
+ hits = [x for x in (d.get("entries") or [])
280
+ if q in str(x.get("gauge") or "").lower()
281
+ or any(q in str(c).lower() for c in (x.get("cite") or []))]
282
+ for x in sorted(hits, key=sortkey):
283
+ print("[ ] %s %s %s gauge=%s" % (pad(x.get("id"), 6), pad(rate_col(x), 8),
284
+ pad(x.get("name"), 30), cut(x.get("gauge"), 16)))
285
+ print(wrap("cite: %s" % (", ".join(str(c) for c in (x.get("cite") or [])) or "(none)"),
286
+ 96, " "))
287
+ print("")
288
+ print("%d rows matched '%s'" % (len(hits), arg))
289
+
290
+ def lint(d, arg, a):
291
+ banner(d)
292
+ print("")
293
+ es = d.get("entries") or []
294
+ v = []
295
+ for k, n in sorted(collections.Counter(str(x.get("id")) for x in es).items()):
296
+ if n > 1:
297
+ v.append("%s: duplicate id (%d entries share it)" % (k, n))
298
+ splits = collections.Counter(str(x.get("family")) for x in es
299
+ if "split" in (x.get("rules_fired") or []))
300
+ for x in es:
301
+ i, r, s = x.get("id"), x.get("rules_fired") or [], x.get("sub") or {}
302
+ if not (x.get("cite") or []):
303
+ v.append("%s: empty cite" % i)
304
+ for fld in ("formula", "impl"): # roster law 2026-07-25
305
+ if not x.get(fld):
306
+ v.append("%s: missing %s (every entry carries its math + its home)" % (i, fld))
307
+ if x.get("role") not in ROLES:
308
+ v.append("%s: role '%s' outside allowed set" % (i, x.get("role")))
309
+ if x.get("primitive") not in PRIMS:
310
+ v.append("%s: primitive '%s' outside allowed set" % (i, x.get("primitive")))
311
+ if x.get("accum") not in ACCUMS:
312
+ v.append("%s: accum '%s' outside A0..A10" % (i, x.get("accum")))
313
+ tot, ok = 0, True
314
+ for k, nm, lo, hi in sub_named(d):
315
+ dv = s.get(k)
316
+ if not isinstance(dv, int) or isinstance(dv, bool) or not lo <= dv <= hi:
317
+ v.append("%s: sub.%s (%s) = %r outside %d..%d" % (i, k, nm, dv, lo, hi))
318
+ ok = False
319
+ else:
320
+ tot += dv
321
+ if ok and x.get("s_raw") != tot:
322
+ v.append("%s: s_raw %s != R+P+D+C+I+L = %d" % (i, x.get("s_raw"), tot))
323
+ exp = expect(d, x)
324
+ if exp is None:
325
+ v.append("%s: s_raw %r outside lookup table (len %d)"
326
+ % (i, x.get("s_raw"), len(d.get("lookup") or [])))
327
+ elif exp != x.get("rating"):
328
+ v.append("%s: rating %s != rubric-derived %d" % (i, x.get("rating"), exp))
329
+ if x.get("accum") == "A10" and x.get("role") not in ("FORBIDDEN", "RETRACTED"):
330
+ v.append("%s: accum A10 with role %s (A10 is FORBIDDEN/RETRACTED only)"
331
+ % (i, x.get("role")))
332
+ if "split" in r and splits[str(x.get("family"))] < 2:
333
+ v.append("%s: split with no split sibling in family '%s'" % (i, x.get("family")))
334
+ hi = x.get("rating_hi")
335
+ if hi is not None:
336
+ if not isinstance(hi, int) or hi <= (x.get("rating") or 0):
337
+ v.append("%s: rating_hi %r not greater than rating %s" % (i, hi, x.get("rating")))
338
+ if "contra" not in r:
339
+ v.append("%s: rating_hi set but 'contra' missing from rules_fired" % i)
340
+ for line in v:
341
+ print(line)
342
+ if v:
343
+ print("LINT: %d violations" % len(v))
344
+ sys.exit(1)
345
+ print("LINT: clean")
346
+ sys.exit(0)
347
+
348
+ def _shade(t):
349
+ t = 0.0 if t < 0 else (1.0 if t > 1 else t)
350
+ return int(238 - 214 * t), int(243 - 196 * t), int(250 - 140 * t)
351
+
352
+ def _td(bg, fg, body, extra=""):
353
+ return ("<td style=\"background:rgb(%d,%d,%d);color:%s;border:1px solid #9aa;"
354
+ "padding:5px 8px;%s\">%s</td>" % (bg[0], bg[1], bg[2], fg, extra, body))
355
+
356
+ def write_html(d, arg, a):
357
+ banner(d)
358
+ out = os.path.abspath(arg or "loss_manifest.html")
359
+ es = d.get("entries") or []
360
+ esc, buckets = html.escape, collections.defaultdict(list)
361
+ for x in es:
362
+ buckets[(x.get("primitive"), x.get("accum"))].append(x.get("rating") or 0)
363
+ b = ["<!doctype html><html><head><meta charset=\"utf-8\">",
364
+ "<title>loss manifest %s</title></head>" % esc(str(d.get("census_date"))),
365
+ "<body style=\"background:#ffffff;color:#111111;margin:20px;"
366
+ "font:13px/1.5 Consolas,monospace\">",
367
+ "<h2 style=\"color:#111111\">LOSS MANIFEST - census %s - %d entries - rubric v%s</h2>"
368
+ % (esc(str(d.get("census_date"))), len(es), esc(str(d.get("rubric_version")))),
369
+ "<p style=\"color:#333333\">cell shade = mean rating (light low, dark high); "
370
+ "cell text = count / mean.</p>",
371
+ "<table style=\"border-collapse:collapse\"><tr>",
372
+ _td((225, 228, 232), "#111111", "<b>accum</b>")]
373
+ for p, l in COLS:
374
+ b.append(_td((225, 228, 232), "#111111", "<b>%s</b>" % esc(l)))
375
+ b.append(_td((225, 228, 232), "#111111", "<b>row</b>") + "</tr>")
376
+ for acc in ACCUMS:
377
+ meta = (d.get("accum") or {}).get(acc) or {}
378
+ b.append("<tr>" + _td((238, 240, 243), "#111111",
379
+ "<b>%s</b> %s" % (acc, esc(str(meta.get("name", ""))))))
380
+ n_row = 0
381
+ for p, _l in COLS:
382
+ rs = buckets.get((p, acc)) or []
383
+ n_row += len(rs)
384
+ if not rs:
385
+ b.append(_td((232, 232, 232), "#777777", "-", "text-align:center"))
386
+ continue
387
+ m = sum(rs) / len(rs)
388
+ bg = _shade((m - 1) / 9.0)
389
+ fg = "#ffffff" if (299 * bg[0] + 587 * bg[1] + 114 * bg[2]) / 1000 < 140 else "#111111"
390
+ b.append(_td(bg, fg, "%d<br>%.1f" % (len(rs), m), "text-align:center"))
391
+ b.append(_td((238, 240, 243), "#111111", "<b>%d</b>" % n_row, "text-align:center")
392
+ + "</tr>")
393
+ b.append("</table><h3 style=\"color:#111111\">entries</h3>")
394
+ b.append("<table style=\"border-collapse:collapse\"><tr>")
395
+ heads = ("ID", "RATE", "RPDCIL", "ROLE", "CELL", "FAMILY", "NAME", "HEADLINE",
396
+ "RULES", "CITE")
397
+ for hcol in heads:
398
+ b.append(_td((225, 228, 232), "#111111", "<b>%s</b>" % hcol))
399
+ b.append("</tr>")
400
+ for i, x in enumerate(sorted(es, key=sortkey)):
401
+ bg = (255, 255, 255) if i % 2 else (246, 247, 249)
402
+ vals = (x.get("id"), rate_col(x), rpdcil(x), x.get("role"), cell_lbl(x),
403
+ x.get("family"), x.get("name"), x.get("headline"),
404
+ " ".join(x.get("rules_fired") or []), "; ".join(str(c) for c in
405
+ (x.get("cite") or [])))
406
+ b.append("<tr>" + "".join(_td(bg, "#111111", esc(str(t if t is not None else "")))
407
+ for t in vals) + "</tr>")
408
+ crc = zlib.crc32(json.dumps(d, sort_keys=True).encode("utf-8"))
409
+ b.append("</table><p style=\"color:#555555\">%s<br>manifest crc32 0x%08x</p>"
410
+ % (esc(LEGEND), crc))
411
+ b.append("</body></html>")
412
+ with open(out, "w", encoding="utf-8") as f:
413
+ f.write("\n".join(b))
414
+ print("wrote %s" % out)
415
+
416
+ if __name__ == "__main__":
417
+ try:
418
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
419
+ except Exception:
420
+ pass
421
+ VERBS = {"card": card, "ladder": ladder, "role": role, "cell": cell, "show": show,
422
+ "recheck-gauge": recheck_gauge, "lint": lint, "html": write_html}
423
+ ap = argparse.ArgumentParser()
424
+ ap.add_argument("cmd", nargs="?", default="card", choices=sorted(VERBS))
425
+ ap.add_argument("arg", nargs="?", default="")
426
+ ap.add_argument("--json", dest="path", default="")
427
+ ap.add_argument("--min", type=int, default=1)
428
+ ap.add_argument("--max", type=int, default=10)
429
+ a, rest = ap.parse_known_args()
430
+ if not a.arg and rest:
431
+ a.arg = rest[0] # argparse rejects a leading '-', e.g. `cell -.A0`; recover it here
432
+ VERBS[a.cmd](load(a.path), a.arg, a)
loss_manifest.json ADDED
The diff for this file is too large to render. See raw diff
 
runs/deviant_runs/anti_curr_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "anti_curr", "seed": 0, "steps": 2000, "bpb": 6.8464, "decoded_acc": 0.3963, "vitals": {"drift": 0.2118, "binding_frac": 0.2812, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.27613830566406, "collapsed": false}, "win_cos_mean": 0.9436, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 72.5, "peak_gb": 1.65}
runs/deviant_runs/anti_curr_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "anti_curr", "seed": 1, "steps": 2000, "bpb": 6.7238, "decoded_acc": 0.3938, "vitals": {"drift": 0.2027, "binding_frac": 0.2812, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 126.86341857910156, "collapsed": false}, "win_cos_mean": 0.943, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 71.9, "peak_gb": 1.65}
runs/deviant_runs/anti_curr_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "anti_curr", "seed": 2, "steps": 2000, "bpb": 6.6606, "decoded_acc": 0.3962, "vitals": {"drift": 0.2263, "binding_frac": 0.2812, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 123.7918701171875, "collapsed": false}, "win_cos_mean": 0.9469, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 72.4, "peak_gb": 1.65}
runs/deviant_runs/conf_penalty_CONTROL_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "conf_penalty_CONTROL", "seed": 0, "steps": 2000, "bpb": 2.5268, "decoded_acc": 0.5002, "vitals": {"drift": 0.2298, "binding_frac": 0.2656, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 123.009033203125, "collapsed": false}, "win_cos_mean": 0.9329, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 40.5, "peak_gb": 1.45}
runs/deviant_runs/conf_penalty_CONTROL_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "conf_penalty_CONTROL", "seed": 1, "steps": 2000, "bpb": 2.4856, "decoded_acc": 0.5099, "vitals": {"drift": 0.2344, "binding_frac": 0.3281, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.69622039794922, "collapsed": false}, "win_cos_mean": 0.9326, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 40.3, "peak_gb": 1.45}
runs/deviant_runs/conf_penalty_CONTROL_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "conf_penalty_CONTROL", "seed": 2, "steps": 2000, "bpb": 2.5473, "decoded_acc": 0.4974, "vitals": {"drift": 0.2474, "binding_frac": 0.25, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.56529998779297, "collapsed": false}, "win_cos_mean": 0.9251, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 41.7, "peak_gb": 1.45}
runs/deviant_runs/fac_cauchy_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "fac_cauchy", "seed": 0, "steps": 2000, "bpb": 4.4321, "decoded_acc": 0.4122, "vitals": {"drift": 0.2935, "binding_frac": 0.4062, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 119.41014862060547, "collapsed": false}, "win_cos_mean": 0.9284, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 38.9, "peak_gb": 1.45}
runs/deviant_runs/fac_cauchy_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "fac_cauchy", "seed": 1, "steps": 2000, "bpb": 4.2942, "decoded_acc": 0.439, "vitals": {"drift": 0.2929, "binding_frac": 0.3906, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 122.3031005859375, "collapsed": false}, "win_cos_mean": 0.9402, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 37.0, "peak_gb": 1.45}
runs/deviant_runs/fac_cauchy_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "fac_cauchy", "seed": 2, "steps": 2000, "bpb": 4.3528, "decoded_acc": 0.4243, "vitals": {"drift": 0.2935, "binding_frac": 0.4375, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 119.4802017211914, "collapsed": false}, "win_cos_mean": 0.9272, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 40.1, "peak_gb": 1.45}
runs/deviant_runs/fac_tanh_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "fac_tanh", "seed": 0, "steps": 2000, "bpb": 4.307, "decoded_acc": 0.4366, "vitals": {"drift": 0.3013, "binding_frac": 0.375, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 120.96920776367188, "collapsed": false}, "win_cos_mean": 0.9367, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 50.5, "peak_gb": 1.45}
runs/deviant_runs/fac_tanh_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "fac_tanh", "seed": 1, "steps": 2000, "bpb": 4.3696, "decoded_acc": 0.4257, "vitals": {"drift": 0.3009, "binding_frac": 0.3906, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 106.07247924804688, "collapsed": false}, "win_cos_mean": 0.8899, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 40.7, "peak_gb": 1.45}
runs/deviant_runs/fac_tanh_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "fac_tanh", "seed": 2, "steps": 2000, "bpb": 4.3693, "decoded_acc": 0.4267, "vitals": {"drift": 0.3, "binding_frac": 0.375, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 118.07414245605469, "collapsed": false}, "win_cos_mean": 0.9274, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 40.1, "peak_gb": 1.45}
runs/deviant_runs/focal_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "focal", "seed": 0, "steps": 2000, "bpb": 2.5778, "decoded_acc": 0.5005, "vitals": {"drift": 0.2213, "binding_frac": 0.3594, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.10615539550781, "collapsed": false}, "win_cos_mean": 0.9347, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 55.1, "peak_gb": 1.45}
runs/deviant_runs/focal_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "focal", "seed": 1, "steps": 2000, "bpb": 2.6302, "decoded_acc": 0.4881, "vitals": {"drift": 0.2285, "binding_frac": 0.2656, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.11713409423828, "collapsed": false}, "win_cos_mean": 0.9366, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 56.3, "peak_gb": 1.45}
runs/deviant_runs/focal_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "focal", "seed": 2, "steps": 2000, "bpb": 2.5824, "decoded_acc": 0.4979, "vitals": {"drift": 0.241, "binding_frac": 0.3125, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.72762298583984, "collapsed": false}, "win_cos_mean": 0.9303, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 55.8, "peak_gb": 1.45}
runs/deviant_runs/geomean_accum_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "geomean_accum", "seed": 0, "steps": 2000, "bpb": 9.0408, "decoded_acc": 0.3024, "vitals": {"drift": 0.2533, "binding_frac": 0.3281, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 123.65676879882812, "collapsed": false}, "win_cos_mean": 0.9664, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 52.6, "peak_gb": 1.45}
runs/deviant_runs/geomean_accum_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "geomean_accum", "seed": 1, "steps": 2000, "bpb": 9.1156, "decoded_acc": 0.3032, "vitals": {"drift": 0.2681, "binding_frac": 0.4531, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 123.70748138427734, "collapsed": false}, "win_cos_mean": 0.9624, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 52.3, "peak_gb": 1.45}
runs/deviant_runs/geomean_accum_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "geomean_accum", "seed": 2, "steps": 2000, "bpb": 8.9412, "decoded_acc": 0.2996, "vitals": {"drift": 0.2708, "binding_frac": 0.375, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 123.42230987548828, "collapsed": false}, "win_cos_mean": 0.9647, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 52.3, "peak_gb": 1.45}
runs/deviant_runs/label_smooth_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "label_smooth", "seed": 0, "steps": 2000, "bpb": 2.6275, "decoded_acc": 0.4985, "vitals": {"drift": 0.2397, "binding_frac": 0.2344, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 126.72000885009766, "collapsed": false}, "win_cos_mean": 0.9321, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 50.1, "peak_gb": 1.45}
runs/deviant_runs/label_smooth_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "label_smooth", "seed": 1, "steps": 2000, "bpb": 2.5332, "decoded_acc": 0.5175, "vitals": {"drift": 0.209, "binding_frac": 0.2188, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.94983673095703, "collapsed": false}, "win_cos_mean": 0.9304, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 53.4, "peak_gb": 1.45}
runs/deviant_runs/label_smooth_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "label_smooth", "seed": 2, "steps": 2000, "bpb": 2.5992, "decoded_acc": 0.5061, "vitals": {"drift": 0.2307, "binding_frac": 0.4219, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.7259521484375, "collapsed": false}, "win_cos_mean": 0.9292, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 54.1, "peak_gb": 1.45}
runs/deviant_runs/p4_sparsemax_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "p4_sparsemax", "seed": 0, "steps": 2000, "bpb": 7.5717, "decoded_acc": 0.3957, "vitals": {"drift": 0.4523, "binding_frac": 0.125, "aliveness": {"axes_total": 64, "axes_alive": 64, "usage_ppl": 22.355093002319336, "collapsed": false}, "win_cos_mean": 0.5746, "paths": {"n": 2048, "unique_raw": 24, "unique_hashed": 24}}, "wall_s": 28.5, "peak_gb": 0.52}
runs/deviant_runs/p4_sparsemax_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "p4_sparsemax", "seed": 1, "steps": 2000, "bpb": 7.5365, "decoded_acc": 0.4221, "vitals": {"drift": 0.4517, "binding_frac": 0.0625, "aliveness": {"axes_total": 64, "axes_alive": 64, "usage_ppl": 23.987043380737305, "collapsed": false}, "win_cos_mean": 0.5543, "paths": {"n": 2048, "unique_raw": 28, "unique_hashed": 28}}, "wall_s": 29.0, "peak_gb": 0.52}
runs/deviant_runs/p4_sparsemax_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "p4_sparsemax", "seed": 2, "steps": 2000, "bpb": 7.5236, "decoded_acc": 0.432, "vitals": {"drift": 0.4311, "binding_frac": 0.1875, "aliveness": {"axes_total": 64, "axes_alive": 64, "usage_ppl": 24.11216926574707, "collapsed": false}, "win_cos_mean": 0.5576, "paths": {"n": 2048, "unique_raw": 24, "unique_hashed": 24}}, "wall_s": 28.1, "peak_gb": 0.52}
runs/deviant_runs/softmax_accum_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "softmax_accum", "seed": 0, "steps": 2000, "bpb": 4.2063, "decoded_acc": 0.2758, "vitals": {"drift": 0.05, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 122.14643859863281, "collapsed": false}, "win_cos_mean": 0.9602, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 52.3, "peak_gb": 1.45}
runs/deviant_runs/softmax_accum_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "softmax_accum", "seed": 1, "steps": 2000, "bpb": 4.2258, "decoded_acc": 0.2873, "vitals": {"drift": 0.051, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 122.0751724243164, "collapsed": false}, "win_cos_mean": 0.9616, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 53.0, "peak_gb": 1.45}
runs/deviant_runs/softmax_accum_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "softmax_accum", "seed": 2, "steps": 2000, "bpb": 4.2981, "decoded_acc": 0.2652, "vitals": {"drift": 0.0617, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.55496215820312, "collapsed": false}, "win_cos_mean": 0.9578, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 53.2, "peak_gb": 1.45}
runs/deviant_runs/sparsemax_s0_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "sparsemax", "seed": 0, "steps": 2000, "bpb": 7.45, "decoded_acc": 0.3197, "vitals": {"drift": 0.0192, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 113.26224517822266, "collapsed": false}, "win_cos_mean": 0.9613, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 54.3, "peak_gb": 1.45}
runs/deviant_runs/sparsemax_s1_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "sparsemax", "seed": 1, "steps": 2000, "bpb": 7.4272, "decoded_acc": 0.3355, "vitals": {"drift": 0.0203, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 116.71968078613281, "collapsed": false}, "win_cos_mean": 0.9589, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 54.5, "peak_gb": 1.45}
runs/deviant_runs/sparsemax_s2_t2000.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arm": "sparsemax", "seed": 2, "steps": 2000, "bpb": 7.4041, "decoded_acc": 0.3383, "vitals": {"drift": 0.0214, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 122.58434295654297, "collapsed": false}, "win_cos_mean": 0.9637, "paths": {"n": 131072, "unique_raw": 128, "unique_hashed": 128}}, "wall_s": 53.5, "peak_gb": 1.45}
runs/fac_runs/ce_fixedcode_s0_t2000.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"event": "config", "arm": "ce_fixedcode", "seed": 0, "base_seed": 688173314, "steps": 2000, "batch": 32, "block": 256, "d": 192, "layers": 4, "lr": 0.0003, "t_loss": 0.3, "mu": 1.0, "code": "ecc", "margin_audit": {"row_norm_min": 1.0, "row_norm_max": 1.0, "v_reach_min": 3.3333, "v_reach_max": 3.3333, "t_loss": 0.3, "mu": 1.0, "per_axis_reachable": true}, "params_trainable": 1924480, "params_trainable_ce_ref": 1990272, "param_delta_vs_ce": 65792, "readout_note": "frozen C readout \u2014 ZERO trainable readout params", "partition_note": "bpb uses raw s@C.T scores as logits (log_softmax); softmax temperature NOT calibrated \u2014 caveat", "torch": "2.11.0+cu128", "device": "cuda", "note": "frozen-C readout, CE \u2014 THE param-matched control"}
2
+ {"event": "eval", "step": 500, "bpb": 5.0285, "decoded_acc": 0.2923, "vitals": {"head": {"drift": 0.0917, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 117.58717346191406, "collapsed": false}, "win_cos_mean": 0.9369, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9448, "gates": null}
3
+ {"event": "eval", "step": 1000, "bpb": 4.8592, "decoded_acc": 0.3163, "vitals": {"head": {"drift": 0.1451, "binding_frac": 0.1094, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 117.78475952148438, "collapsed": false}, "win_cos_mean": 0.9354, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9389, "gates": null}
4
+ {"event": "eval", "step": 1500, "bpb": 4.1847, "decoded_acc": 0.4244, "vitals": {"head": {"drift": 0.1673, "binding_frac": 0.1562, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 117.19036102294922, "collapsed": false}, "win_cos_mean": 0.9489, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9429, "gates": null}
5
+ {"event": "eval", "step": 2000, "bpb": 3.7216, "decoded_acc": 0.4999, "vitals": {"head": {"drift": 0.1897, "binding_frac": 0.2188, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 118.49891662597656, "collapsed": false}, "win_cos_mean": 0.9554, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9514, "gates": null}
6
+ {"event": "final", "arm": "ce_fixedcode", "seed": 0, "steps": 2000, "t_loss": 0.3, "mu": 1.0, "code": "ecc", "bpb": 3.7216, "decoded_acc": 0.4999, "collision_rate": 0.0, "train_curve": {"first": 5.55613, "final": 2.57454, "min": 2.57454, "every100": [[1, 5.55613], [100, 3.58998], [200, 3.53227], [300, 3.55078], [400, 3.4759], [500, 3.49183], [600, 3.46486], [700, 3.46173], [800, 3.42661], [900, 3.39767], [1000, 3.37912], [1100, 3.30872], [1200, 3.17737], [1300, 3.02575], [1400, 3.01104], [1500, 2.96913], [1600, 2.82452], [1700, 2.88912], [1800, 2.64376], [1900, 2.65145], [2000, 2.57454]]}, "vitals": {"head": {"drift": 0.1897, "binding_frac": 0.2188, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 118.49891662597656, "collapsed": false}, "win_cos_mean": 0.9554, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9514, "gates": null, "wall_s": 54.7, "peak_mem_gb": 1.45, "params_trainable": 1924480, "param_delta_vs_ce": 65792, "mu_note": "mu in v-units; per-axis reachability audited at config; joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss \u2014 per-axis margin pull by design"}
runs/fac_runs/ce_fixedcode_s1_t2000.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"event": "config", "arm": "ce_fixedcode", "seed": 1, "base_seed": 1577288084, "steps": 2000, "batch": 32, "block": 256, "d": 192, "layers": 4, "lr": 0.0003, "t_loss": 0.3, "mu": 1.0, "code": "ecc", "margin_audit": {"row_norm_min": 1.0, "row_norm_max": 1.0, "v_reach_min": 3.3333, "v_reach_max": 3.3333, "t_loss": 0.3, "mu": 1.0, "per_axis_reachable": true}, "params_trainable": 1924480, "params_trainable_ce_ref": 1990272, "param_delta_vs_ce": 65792, "readout_note": "frozen C readout \u2014 ZERO trainable readout params", "partition_note": "bpb uses raw s@C.T scores as logits (log_softmax); softmax temperature NOT calibrated \u2014 caveat", "torch": "2.11.0+cu128", "device": "cuda", "note": "frozen-C readout, CE \u2014 THE param-matched control"}
2
+ {"event": "eval", "step": 500, "bpb": 5.0409, "decoded_acc": 0.2966, "vitals": {"head": {"drift": 0.088, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 118.2909927368164, "collapsed": false}, "win_cos_mean": 0.9312, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9554, "gates": null}
3
+ {"event": "eval", "step": 1000, "bpb": 4.8935, "decoded_acc": 0.3147, "vitals": {"head": {"drift": 0.1622, "binding_frac": 0.0938, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 118.28981018066406, "collapsed": false}, "win_cos_mean": 0.9338, "paths": {"n": 32768, "unique_raw": 127, "unique_hashed": 127}}}, "sign_fidelity": 0.9527, "gates": null}
4
+ {"event": "eval", "step": 1500, "bpb": 4.2945, "decoded_acc": 0.4082, "vitals": {"head": {"drift": 0.2092, "binding_frac": 0.1562, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 120.295166015625, "collapsed": false}, "win_cos_mean": 0.9494, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9554, "gates": null}
5
+ {"event": "eval", "step": 2000, "bpb": 3.8588, "decoded_acc": 0.4768, "vitals": {"head": {"drift": 0.2356, "binding_frac": 0.3125, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 121.67655944824219, "collapsed": false}, "win_cos_mean": 0.9569, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9634, "gates": null}
6
+ {"event": "final", "arm": "ce_fixedcode", "seed": 1, "steps": 2000, "t_loss": 0.3, "mu": 1.0, "code": "ecc", "bpb": 3.8588, "decoded_acc": 0.4768, "collision_rate": 0.0, "train_curve": {"first": 5.64217, "final": 2.69746, "min": 2.69746, "every100": [[1, 5.64217], [100, 3.55487], [200, 3.57277], [300, 3.53763], [400, 3.5044], [500, 3.47673], [600, 3.44289], [700, 3.45891], [800, 3.45679], [900, 3.45943], [1000, 3.41101], [1100, 3.36025], [1200, 3.28415], [1300, 3.17502], [1400, 3.07122], [1500, 2.96849], [1600, 2.91717], [1700, 2.83006], [1800, 2.79579], [1900, 2.77939], [2000, 2.69746]]}, "vitals": {"head": {"drift": 0.2356, "binding_frac": 0.3125, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 121.67655944824219, "collapsed": false}, "win_cos_mean": 0.9569, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9634, "gates": null, "wall_s": 53.9, "peak_mem_gb": 1.45, "params_trainable": 1924480, "param_delta_vs_ce": 65792, "mu_note": "mu in v-units; per-axis reachability audited at config; joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss \u2014 per-axis margin pull by design"}
runs/fac_runs/ce_fixedcode_s2_t2000.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"event": "config", "arm": "ce_fixedcode", "seed": 2, "base_seed": 1191890990, "steps": 2000, "batch": 32, "block": 256, "d": 192, "layers": 4, "lr": 0.0003, "t_loss": 0.3, "mu": 1.0, "code": "ecc", "margin_audit": {"row_norm_min": 1.0, "row_norm_max": 1.0, "v_reach_min": 3.3333, "v_reach_max": 3.3333, "t_loss": 0.3, "mu": 1.0, "per_axis_reachable": true}, "params_trainable": 1924480, "params_trainable_ce_ref": 1990272, "param_delta_vs_ce": 65792, "readout_note": "frozen C readout \u2014 ZERO trainable readout params", "partition_note": "bpb uses raw s@C.T scores as logits (log_softmax); softmax temperature NOT calibrated \u2014 caveat", "torch": "2.11.0+cu128", "device": "cuda", "note": "frozen-C readout, CE \u2014 THE param-matched control"}
2
+ {"event": "eval", "step": 500, "bpb": 5.0144, "decoded_acc": 0.2975, "vitals": {"head": {"drift": 0.0914, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 118.8255615234375, "collapsed": false}, "win_cos_mean": 0.9339, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9559, "gates": null}
3
+ {"event": "eval", "step": 1000, "bpb": 4.896, "decoded_acc": 0.3172, "vitals": {"head": {"drift": 0.1561, "binding_frac": 0.0312, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 119.43121337890625, "collapsed": false}, "win_cos_mean": 0.9312, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9523, "gates": null}
4
+ {"event": "eval", "step": 1500, "bpb": 4.3166, "decoded_acc": 0.4073, "vitals": {"head": {"drift": 0.1889, "binding_frac": 0.1875, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 120.79203033447266, "collapsed": false}, "win_cos_mean": 0.9455, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.951, "gates": null}
5
+ {"event": "eval", "step": 2000, "bpb": 3.8377, "decoded_acc": 0.4833, "vitals": {"head": {"drift": 0.205, "binding_frac": 0.2344, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 121.07920837402344, "collapsed": false}, "win_cos_mean": 0.9553, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9577, "gates": null}
6
+ {"event": "final", "arm": "ce_fixedcode", "seed": 2, "steps": 2000, "t_loss": 0.3, "mu": 1.0, "code": "ecc", "bpb": 3.8377, "decoded_acc": 0.4833, "collision_rate": 0.0, "train_curve": {"first": 5.70817, "final": 2.72652, "min": 2.72652, "every100": [[1, 5.70817], [100, 3.56968], [200, 3.51576], [300, 3.54142], [400, 3.47476], [500, 3.48407], [600, 3.44005], [700, 3.51847], [800, 3.40848], [900, 3.43823], [1000, 3.34821], [1100, 3.35495], [1200, 3.28955], [1300, 3.15745], [1400, 3.14624], [1500, 2.96627], [1600, 2.91325], [1700, 2.87134], [1800, 2.81051], [1900, 2.76078], [2000, 2.72652]]}, "vitals": {"head": {"drift": 0.205, "binding_frac": 0.2344, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 121.07920837402344, "collapsed": false}, "win_cos_mean": 0.9553, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9577, "gates": null, "wall_s": 53.6, "peak_mem_gb": 1.45, "params_trainable": 1924480, "param_delta_vs_ce": 65792, "mu_note": "mu in v-units; per-axis reachability audited at config; joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss \u2014 per-axis margin pull by design"}
runs/fac_runs/ce_s0_t2000.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"event": "config", "arm": "ce", "seed": 0, "base_seed": 1169907951, "steps": 2000, "batch": 32, "block": 256, "d": 192, "layers": 4, "lr": 0.0003, "t_loss": 0.3, "mu": 1.0, "code": null, "margin_audit": null, "params_trainable": 1990272, "params_trainable_ce_ref": 1990272, "param_delta_vs_ce": 0, "readout_note": "trained Linear(256,256) readout", "partition_note": "bpb uses raw s@C.T scores as logits (log_softmax); softmax temperature NOT calibrated \u2014 caveat", "torch": "2.11.0+cu128", "device": "cuda", "note": "certified addr_msl64 incumbent (3-seed 2.4685)"}
2
+ {"event": "eval", "step": 500, "bpb": 3.5222, "decoded_acc": 0.3009, "vitals": {"head": {"drift": 0.099, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.31436157226562, "collapsed": false}, "win_cos_mean": 0.9695, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9525, "gates": null}
3
+ {"event": "eval", "step": 1000, "bpb": 3.3639, "decoded_acc": 0.325, "vitals": {"head": {"drift": 0.1297, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.59706115722656, "collapsed": false}, "win_cos_mean": 0.9587, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9507, "gates": null}
4
+ {"event": "eval", "step": 1500, "bpb": 2.7599, "decoded_acc": 0.4466, "vitals": {"head": {"drift": 0.1884, "binding_frac": 0.1719, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.66361999511719, "collapsed": false}, "win_cos_mean": 0.9454, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9361, "gates": null}
5
+ {"event": "eval", "step": 2000, "bpb": 2.5004, "decoded_acc": 0.5001, "vitals": {"head": {"drift": 0.2545, "binding_frac": 0.3281, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 126.27082061767578, "collapsed": false}, "win_cos_mean": 0.93, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9146, "gates": null}
6
+ {"event": "final", "arm": "ce", "seed": 0, "steps": 2000, "t_loss": 0.3, "mu": 1.0, "code": null, "bpb": 2.5004, "decoded_acc": 0.5001, "collision_rate": null, "train_curve": {"first": 5.55115, "final": 1.71296, "min": 1.71296, "every100": [[1, 5.55115], [100, 2.80654], [200, 2.59162], [300, 2.48218], [400, 2.55176], [500, 2.51223], [600, 2.42308], [700, 2.38143], [800, 2.37819], [900, 2.35726], [1000, 2.31292], [1100, 2.20838], [1200, 2.15096], [1300, 2.03818], [1400, 2.03527], [1500, 1.93894], [1600, 1.87538], [1700, 1.83741], [1800, 1.84276], [1900, 1.81583], [2000, 1.71296]]}, "vitals": {"head": {"drift": 0.2545, "binding_frac": 0.3281, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 126.27082061767578, "collapsed": false}, "win_cos_mean": 0.93, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9146, "gates": null, "wall_s": 44.5, "peak_mem_gb": 1.451, "params_trainable": 1990272, "param_delta_vs_ce": 0, "mu_note": "mu in v-units; per-axis reachability audited at config; joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss \u2014 per-axis margin pull by design"}
runs/fac_runs/ce_s1_t2000.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"event": "config", "arm": "ce", "seed": 1, "base_seed": 851202169, "steps": 2000, "batch": 32, "block": 256, "d": 192, "layers": 4, "lr": 0.0003, "t_loss": 0.3, "mu": 1.0, "code": null, "margin_audit": null, "params_trainable": 1990272, "params_trainable_ce_ref": 1990272, "param_delta_vs_ce": 0, "readout_note": "trained Linear(256,256) readout", "partition_note": "bpb uses raw s@C.T scores as logits (log_softmax); softmax temperature NOT calibrated \u2014 caveat", "torch": "2.11.0+cu128", "device": "cuda", "note": "certified addr_msl64 incumbent (3-seed 2.4685)"}
2
+ {"event": "eval", "step": 500, "bpb": 3.5379, "decoded_acc": 0.3013, "vitals": {"head": {"drift": 0.0861, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 122.89728546142578, "collapsed": false}, "win_cos_mean": 0.9698, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9509, "gates": null}
3
+ {"event": "eval", "step": 1000, "bpb": 3.265, "decoded_acc": 0.3488, "vitals": {"head": {"drift": 0.1174, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 123.8575210571289, "collapsed": false}, "win_cos_mean": 0.959, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9483, "gates": null}
4
+ {"event": "eval", "step": 1500, "bpb": 2.7288, "decoded_acc": 0.4558, "vitals": {"head": {"drift": 0.1812, "binding_frac": 0.1406, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.866455078125, "collapsed": false}, "win_cos_mean": 0.9459, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9383, "gates": null}
5
+ {"event": "eval", "step": 2000, "bpb": 2.4768, "decoded_acc": 0.5058, "vitals": {"head": {"drift": 0.2364, "binding_frac": 0.3438, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.47602844238281, "collapsed": false}, "win_cos_mean": 0.9344, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9238, "gates": null}
6
+ {"event": "final", "arm": "ce", "seed": 1, "steps": 2000, "t_loss": 0.3, "mu": 1.0, "code": null, "bpb": 2.4768, "decoded_acc": 0.5058, "collision_rate": null, "train_curve": {"first": 5.55206, "final": 1.76768, "min": 1.73487, "every100": [[1, 5.55206], [100, 2.76865], [200, 2.56418], [300, 2.50292], [400, 2.45994], [500, 2.46286], [600, 2.42948], [700, 2.40484], [800, 2.37874], [900, 2.33296], [1000, 2.29799], [1100, 2.15992], [1200, 2.04953], [1300, 1.95414], [1400, 1.95962], [1500, 1.87639], [1600, 1.8719], [1700, 1.80011], [1800, 1.79421], [1900, 1.73487], [2000, 1.76768]]}, "vitals": {"head": {"drift": 0.2364, "binding_frac": 0.3438, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.47602844238281, "collapsed": false}, "win_cos_mean": 0.9344, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9238, "gates": null, "wall_s": 45.6, "peak_mem_gb": 1.451, "params_trainable": 1990272, "param_delta_vs_ce": 0, "mu_note": "mu in v-units; per-axis reachability audited at config; joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss \u2014 per-axis margin pull by design"}
runs/fac_runs/ce_s2_t2000.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"event": "config", "arm": "ce", "seed": 2, "base_seed": 733282755, "steps": 2000, "batch": 32, "block": 256, "d": 192, "layers": 4, "lr": 0.0003, "t_loss": 0.3, "mu": 1.0, "code": null, "margin_audit": null, "params_trainable": 1990272, "params_trainable_ce_ref": 1990272, "param_delta_vs_ce": 0, "readout_note": "trained Linear(256,256) readout", "partition_note": "bpb uses raw s@C.T scores as logits (log_softmax); softmax temperature NOT calibrated \u2014 caveat", "torch": "2.11.0+cu128", "device": "cuda", "note": "certified addr_msl64 incumbent (3-seed 2.4685)"}
2
+ {"event": "eval", "step": 500, "bpb": 3.5371, "decoded_acc": 0.2967, "vitals": {"head": {"drift": 0.0892, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 122.30438232421875, "collapsed": false}, "win_cos_mean": 0.9688, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9473, "gates": null}
3
+ {"event": "eval", "step": 1000, "bpb": 3.1838, "decoded_acc": 0.3643, "vitals": {"head": {"drift": 0.1183, "binding_frac": 0.0, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.03565979003906, "collapsed": false}, "win_cos_mean": 0.9525, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9448, "gates": null}
4
+ {"event": "eval", "step": 1500, "bpb": 2.6783, "decoded_acc": 0.4639, "vitals": {"head": {"drift": 0.1782, "binding_frac": 0.1406, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 124.962890625, "collapsed": false}, "win_cos_mean": 0.9396, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9299, "gates": null}
5
+ {"event": "eval", "step": 2000, "bpb": 2.4536, "decoded_acc": 0.5104, "vitals": {"head": {"drift": 0.2274, "binding_frac": 0.2656, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.4764404296875, "collapsed": false}, "win_cos_mean": 0.9296, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9165, "gates": null}
6
+ {"event": "final", "arm": "ce", "seed": 2, "steps": 2000, "t_loss": 0.3, "mu": 1.0, "code": null, "bpb": 2.4536, "decoded_acc": 0.5104, "collision_rate": null, "train_curve": {"first": 5.59072, "final": 1.68083, "min": 1.68083, "every100": [[1, 5.59072], [100, 2.80129], [200, 2.56276], [300, 2.49087], [400, 2.4736], [500, 2.44614], [600, 2.40425], [700, 2.39409], [800, 2.36525], [900, 2.2793], [1000, 2.20186], [1100, 2.11937], [1200, 2.02742], [1300, 1.95192], [1400, 1.90608], [1500, 1.9137], [1600, 1.85935], [1700, 1.80106], [1800, 1.76603], [1900, 1.7115], [2000, 1.68083]]}, "vitals": {"head": {"drift": 0.2274, "binding_frac": 0.2656, "aliveness": {"axes_total": 128, "axes_alive": 128, "usage_ppl": 125.4764404296875, "collapsed": false}, "win_cos_mean": 0.9296, "paths": {"n": 32768, "unique_raw": 128, "unique_hashed": 128}}}, "sign_fidelity": 0.9165, "gates": null, "wall_s": 45.5, "peak_mem_gb": 1.451, "params_trainable": 1990272, "param_delta_vs_ce": 0, "mu_note": "mu in v-units; per-axis reachability audited at config; joint target ||C[y]*mu||=8 exceeds ||v||<=1/t_loss \u2014 per-axis margin pull by design"}