aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / docs / inference / evidence / own30b-wp-gate-20261014T0055Z / NOTES.txt
| 1 | OWN-30B whole-prompt prefill correctness gate: rounding or bug? (W-L1G-C, 2026-10-14). HARDWARE (GB10), real checkpoint |
| 2 | ~/models/qwen3-30b-a3b-instruct-2507-fp8, FP8 weights everywhere, fused decode attention, max context 8192. |
| 3 | Investigation folder (plan with the pre-registered rules, PINS, ground, C golden generator): ~/workspace/investigations/2026-10-14-own30b-wp-w8a8-gate. |
| 4 | sc: own30b/whole-prompt 254e4b0 (gate code; base 4e5cfde). omega: omega-own30b-int 5281feb7 built in a detached worktree with |
| 5 | PHYSICS_DIR=physics-own30b-k (6d7cf0d4); libomega_gpu.a sha256 e059453f... = the SAME bytes the TTFT receipts (own30b-wp-ttft-20261014T0031Z) |
| 6 | were built on (development override, not a qualified build). Binaries: binary.sha256 (run1: gate as committed in 254e4b0 minus the two |
| 7 | metrics below; run2 adds same-route + worst-token index; run3 adds the quantised-input distance; the tool's final form is committed). |
| 8 | |
| 9 | Question: the ON path (whole-prompt: e4m3 per-token per-128 power-of-two activations, QMMA GEMM, bf16 Q/P prefill attention, bf16 |
| 10 | SwiGLU output) differs from OFF (f32 activations) at 512 tokens from token 7 and not at 2048 (32/32). Rounding or bug? |
| 11 | |
| 12 | Method (one variable per run, same prompt as the TTFT receipts, each run from an empty KV): |
| 13 | OFF = the per-token OFF kernels, f32 activations (Qwen3MoeOmegaEngine::control_step, mode Off). Baseline. |
| 14 | CTRL = OFF + the ON quantiser at every GEMM input (host mirror fake_quant.rs, checked bit-exact against the C reference pq_ref / |
| 15 | qm_e4m3_rne_sat on 1536 codes + 12 scales: pq_golden.txt; the chip quantiser is bit-exact to that reference, receipt |
| 16 | OWN30B-L1G-GEMM-f3b18df9). SwiGLU rounded to bf16 then quantised, as the ON epilogue writes bf16. ONE variable: activation rounding. |
| 17 | ON = set_whole_prompt(true) with the recorder (new hook lines; off = no change). |
| 18 | Per layer, all tokens: relerr = ||a-b||_2/||b||_2 on the residual after the experts (x_out); expert-set flips; the ops of layer 0. |
| 19 | Pass rule, fixed before any ON number was looked at (plan.md): B = max_l relerr(CTRL,OFF); PASS iff max_l relerr(ON,CTRL) <= B and at |
| 20 | layer 0 (identical inputs) relerr(ON,CTRL) <= relerr(CTRL,OFF) for qkv, oproj, moe_out. Negative controls (ON + routing mutant, |
| 21 | ON + gate|up scale-block mutant) must fail it. |
| 22 | |
| 23 | RESULTS (run1, --mutants; run2 repeats OFF/CTRL/ON with the same-route metric: all shared numbers identical to run1): |
| 24 | 512: B = 1.280e-1, max_l relerr(ON,CTRL) = 1.180e-1 (0.92 B). Layer 0: qkv ON-CTRL 1.07e-7 (vs 1.15e-2 CTRL-OFF), attention out 9.7e-4 |
| 25 | (bf16 Q/P alone), oproj 2.0e-3 (vs 1.08e-2), moe_out 1.55e-2 (vs 3.04e-2); same-route (505/512 tokens): moe_out 9.1e-3 vs 2.26e-2, |
| 26 | x_out 3.5e-3 vs 1.05e-2. Flips at layer 0: ON-CTRL 7, CTRL-OFF 35, ON-OFF 31. PASS. |
| 27 | Mutants vs CTRL: routing 1.17e0 (9.1 B, 512/512 tokens flipped), gate|up scales 8.66e-1 (6.8 B; layer 0 out 1.59e-1). Both CAUGHT. |
| 28 | 2048: B = 1.749e-1, max_l relerr(ON,CTRL) = 1.719e-1 (0.98 B). Layer 0: qkv 1.06e-7, attn 9.0e-4, oproj 1.9e-3 (vs 1.06e-2), moe_out |
| 29 | 1.30e-2 (vs 2.74e-2); same-route (2012/2048): moe_out 9.2e-3 vs 2.26e-2; x_out 3.4e-3 (2012 tok) vs 1.02e-2 (1912 tok). PASS. Mutants: routing 1.37e0 (7.8 B), scales 8.18e-1 (4.7 B). CAUGHT. |
| 30 | First-step logits cosine vs OFF: 512 ON 0.98889 (= the TTFT receipt), CTRL 0.99616; 2048 ON 0.99353 (= receipt), CTRL 0.99649. Top-1 same in all. |
| 31 | Per layer the three curves lie on top of each other from layer 2 on (e.g. 512 layer 47: ON-OFF 9.30e-2, CTRL-OFF 9.49e-2, ON-CTRL 9.19e-2): |
| 32 | after a few layers any perturbation of e4m3 size is amplified to the same ~1e-1 by routing flips; so the whole-run bound (0.92-0.98 B) is |
| 33 | weak and the sharp evidence is layer 0 (identical inputs) and the mutants. |
| 34 | Layer 1 ON-CTRL (6.9e-2) > CTRL-OFF (4.1e-2) for that one layer: one token (index 116) whose layer-0 top-k is borderline flipped in ON only |
| 35 | (its layer-0 x_out differs 6.6%) and whose norm dominates the layer-1 L2; CTRL-OFF has its own such token (28, 8.0%). Rounding-driven routing |
| 36 | sensitivity of single tokens, not a GEMM effect: with routing held equal (same-route) layer 0 ON-CTRL is 3x below CTRL-OFF. |
| 37 | |
| 38 | VERDICT: the drift is activation rounding (e4m3 activations, with bf16 Q/P attention 20x smaller), not a bug. No bug found, nothing fixed. |
| 39 | The ON GEMM inputs at layer 0 are bit-identical to the control's (qkv 1e-7 = f32 accumulation order only). |
| 40 | Attention-only control: at layer 0 the attention output ON-CTRL = 9.7e-4 with inputs differing 1e-7, so bf16 Q/P contributes ~1e-3, |
| 41 | against 2e-2 for e4m3 rounding of the same output (CTRL-OFF attn 1.99e-2). bf16 Q/P is not suspect; no separate run needed. |
| 42 | |
| 43 | LIMITS: one prompt (the TTFT prompt), two lengths, one run each (deterministic: run1 and run2 numbers identical). OFF here is the per-token |
| 44 | GEMV path, not the chunked GEMM prefill the TTFT OFF used (the sc tests assert row-equality of the two). The whole-run bound is weak (see |
| 45 | above); the gate's teeth are the layer-0 per-op rule and the mutants. Host passes (quantiser mirror) are not chip results. Not pushed. |
| 46 | |
| 47 | run3 (512, quantised-input distance, expectation pre-registered in plan.md: >= 5e-3): the layer-0 gate|up input rows, put through the |
| 48 | quantiser, differ ON vs CTRL by 9.81e-3 (raw rows 2.75e-3), equal to the 9.05e-3 same-route moe_out error: the gate|up + SwiGLU + down |
| 49 | GEMMs add nothing beyond the rounding-decision flips of their slightly shifted input. Attention output quantised 7.04e-3 (raw 9.66e-4) vs |
| 50 | oproj 2.0e-3; x_norm quantised 0 (identical). CTRL-OFF quantised post 2.60e-2 vs moe_out same-route 2.26e-2. Hypothesis confirmed. |
| 51 | Raw: run{1,2,3}.raw/.err/.rc/.start/.end, run{1,2,3}/run.json (every per-layer number), run{1,2,3}/run.txt. zero-cuda gate: ZERO_CUDA PASS. |
| 52 | Host tests at 254e4b0: cargo test --release -p aien-omega-pf -p aien-inference-abi --lib: 151 + 5 pass (native). |