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 / evidence / hum-exact-head / README.md
| 1 | # HUM lever L314: exact two-pass lm_head on Qwen3.6-35B-A3B |
| 2 | |
| 3 | ## Verdict for Drake (plain English) |
| 4 | |
| 5 | **What changed.** Every word the 35B writes ends with one big step that scores all 248,320 words in the |
| 6 | vocabulary and picks the best one. That step reads 1.017 GB from memory every word, more than a quarter of all |
| 7 | the reading. Now it runs in two passes. First, a rough copy of the scoring table at half the size (8-bit numbers) |
| 8 | scores every word quickly. With each rough score comes a proven worst-case error, so the rough pass can rule |
| 9 | out almost every word for certain. Second, the exact original table rescores only the few words still in the |
| 10 | running (31 on average, 761 at most, out of 248,320). |
| 11 | |
| 12 | **The number.** The head step drops from 1.017 GB to 0.520 GB read per word (calc:e42a986f, calc:4694a43d). |
| 13 | That raises the 35B's memory-speed ceiling from 58.5 to 67.0 words per second to 68.1 to 78.0 |
| 14 | (calc:c66bca93, calc:c52efc2d, calc:9016f1ef; measured memory speed 207 to 237 GB/s). |
| 15 | |
| 16 | **Identical words, by construction.** The rough pass may only rule out a word when even its best possible |
| 17 | true score is below the winner's worst possible score, so the word the exact table would pick is always |
| 18 | recomputed exactly and still wins. Checked on 1,010 real positions of the 35B: 0 differences in every variant. |
| 19 | A deliberately broken version (error bounds shrunk) does change words, so the check can fail. |
| 20 | |
| 21 | **What did not work.** A 4-bit rough copy (a quarter of the size) is too rough: the proven bound then leaves |
| 22 | 20,000 to 218,000 words to recheck. The worst-case bound is about 50 times wider than the typical error, and |
| 23 | at 4 bits that swamps the gap between the best words. |
| 24 | |
| 25 | **Served (2026-10-21, Drake 02:25Z "just turn it on").** The served 35B uses it for every greedy request. The words are |
| 26 | identical to the golden and to the lever switched off (5 of 5 extra requests), and a broken build fails. One request at |
| 27 | a time, the chip spent 21.8 ms per word instead of 24.0 (`serve-combined/README.md`). Sampled requests still use the |
| 28 | full head. See "Serving" below. |
| 29 | |
| 30 | Chip receipt: 1010 of 1010 tokens identical on the chip, and the head step takes 2.04x less time (4.77 to 2.34 ms), now at the memory-speed limit. See "Chip" below. |
| 31 | |
| 32 | ## Method |
| 33 | |
| 34 | `logit_i = w_i . h`. Screen `s_i = w~_i . h` with `w~` = e4m3 codes times one bf16 scale per 128 x 128 block (the |
| 35 | layout omega's FP8 GEMV reads, so the chip reuses that kernel). Bound (Row): `|L_i - s_i| <= |w_i - w~_i| |h| + |
| 36 | gamma(|w_i| + |w~_i|) |h|`, gamma covering any f32 summation order (Higham 3.1; 2048 on the host, 2100 on the chip |
| 37 | for the block partial sums). Candidates `C = { i : s_i + B_i >= tau }`, `tau = max_j (s_j - B_j)`. The full argmax |
| 38 | `i*` (first on ties) has `L_i* >= s_j - B_j` for every j, so `s_i* + B_i* >= L_i* >= tau`: `i*` is in C. The recheck |
| 39 | computes the same `L_i` bits as today's head and takes the first maximum, so it returns `i*`. Proof and rounding |
| 40 | margins: `crates/aien-inference-abi/src/exact_head.rs` header; chip margins: omega `XBOUND` in |
| 41 | `src/omega_blackwell_codegen_dec.h`. |
| 42 | |
| 43 | ## Files |
| 44 | |
| 45 | | file | what | |
| 46 | |---|---| |
| 47 | | `hidden.sh`, `hidden-resume.sh`, `hidden.txt` | 1010 final hidden states from the 35B host reference: the 5 goldens replayed token by token (full argmax == golden at every step) + 400 teacher-forced positions each of two passages | |
| 48 | | `analyze.sh`, `analyze-v1-w4-fp8row.json`, `analyze-v1.txt` | W4 and per-row-scale FP8 screens, 4 bounds each | |
| 49 | | `analyze.json`, `analyze-v2.txt` | v1 plus the fp8b screen the chip runs (per-record |C|, bytes/token, mutant sweep, top-20 sampling check) | |
| 50 | | `chain.sh`, `gate-fp8b-row-x*.json/.txt` | identity gate: greedy decode with the two-pass head choosing every token on the 5 goldens, at the proven bound (x1) and the mutants x0.5, x0.02, x0 | |
| 51 | | `chip.sh`, `chip-receipt.json`, `chip.txt`, `chip-mutant1.*` | omega `gpu_exact_head_test --chip`: full head vs two-pass head on the chip per record | |
| 52 | |
| 53 | ## Host results (1010 records, |C| = rows rechecked exactly) |
| 54 | |
| 55 | | screen | bound | |C| mean | |C| max | exact-tau mean | wrong | largest mutant scale that loses a token | |
| 56 | |---|---|---|---|---|---|---| |
| 57 | | W4 (128-col groups) | Group | 107013 | 248320 | 20227 | 0 | 0.02 | |
| 58 | | FP8 per-row 128-col scales | Row | 27.1 | 725 | 4.2 | 0 | 0.02 | |
| 59 | | FP8 per-row 128-col scales | Group | 24.6 | 652 | 4.0 | 0 | 0.02 | |
| 60 | | **fp8b (128x128 blocks, chip layout)** | **Row** | **31.0** | **761** | 4.4 | 0 | 0.05 | |
| 61 | | fp8b | Group | 28.1 | 686 | 4.2 | 0 | 0.05 | |
| 62 | |
| 63 | The halved bound (x0.5) loses no token: the proven bound has 20x to 50x slack on these states. The mutant |
| 64 | that does fail is x0.05 / x0.02, and x0 (no bound) always fails; that is the red control. |
| 65 | |
| 66 | ## Sampling |
| 67 | |
| 68 | The 35B's generation config is temperature 1.0, top_k 20, top_p 0.95, and the door masks to the top 20 before |
| 69 | softmax and top-p. Candidates that certify the exact top 20 (`candidates_topk`: tau = 20th largest `s - B`) make |
| 70 | the draw a function of exact logits only: bit-identical draws, no fallback needed. Checked with the Group bound |
| 71 | (`Min` rows of `analyze.json`, which equal Group here): 8080 draws (1010 records x 8 seeds), 0 differ. Not yet |
| 72 | checked with the Row bound the chip uses. Certifying 20 rows costs more rechecks than greedy: fp8b Row |C| mean |
| 73 | 712.8, max 13452 rows (about 2.92 MB mean calc:a9bb7f70, 55.1 MB worst calc:55b06ae3, still far below the 1.017 GB head); fp8b Group mean 667.0, |
| 74 | max 12617. The chip pipeline here is greedy only; the top-20 chip path is the next step. A request with top_k = 0 |
| 75 | and temperature > 0 needs every logit: the full head runs, always. |
| 76 | |
| 77 | ## Bytes per token (chip pipeline, mean) |
| 78 | |
| 79 | screen codes 508,559,360 + scales 62,080 + 9 passes of n f32 (s, coef, lo, hi, y) 8,939,520 + two padded |
| 80 | ARGMAX reads 1,998,848 + 31 bf16 rows 126,976 = 519,686,784 B (calc:e42a986f) vs 1,017,118,720 B (calc:4694a43d). |
| 81 | |
| 82 | ## Chip |
| 83 | |
| 84 | `chip/` (2026-10-21 12:3xZ, omega hum/exact-head-stroke 41269bd8 at physics.lock 6d7cf0d4, `chip-run.sh`, inputs and |
| 85 | hashes in `chip/inputs.txt`). omega `gpu_exact_head_test --chip` runs the full bf16 head list and the two-pass list on |
| 86 | the chip for each of the 1010 hidden records (the same records as the host analysis), under `quiet-measure` and the |
| 87 | chip lock. |
| 88 | |
| 89 | | check | result | |
| 90 | |---|---| |
| 91 | | two-pass token == full head token | 1010 / 1010 (`chip/chip-receipt.json`) | |
| 92 | | candidate logits bit-identical to the full head's | 0 differ, full argmax never outside the candidates | |
| 93 | | candidate set size | mean 31.2, p99 496, max 769 rows of 248,320 | |
| 94 | | red control `--mutant 1` (XBOUND without the bound) | loses 4 of 200 tokens, as required (`chip/chip-mutant1.json`) | |
| 95 | | head list time, p50 (p99) | full 4774.1 us (4987.4), two-pass 2340.5 us (2648.8) | |
| 96 | |
| 97 | The two-pass head takes 2.040x less time (calc:91a93d74), 2433.6 us less per token (calc:6e461e53). Both lists run at |
| 98 | the memory-speed limit: full head 1,017,118,720 B in 4774.1 us = 213.0 GB/s (calc:27f0a0a0), two-pass 519,686,784 B |
| 99 | in 2340.5 us = 222.0 GB/s (calc:85b9bfd9), inside the measured 207 to 237 GB/s. So the head is now as fast as the |
| 100 | bytes it reads allow; going further means reading fewer bytes. The served per-token saving (24.0 to 21.8 ms) matches. |
| 101 | |
| 102 | `chip/attempt1-hung/`: the first chip run (11:39Z) waited on itself for 28 min while holding the chip lock: the test made |
| 103 | its command lists while holding the session lock, and `omega_gpu_cmdlist_create` takes that lock too. Fixed in |
| 104 | 41269bd8; runs are now capped at 300 s. |
| 105 | ## Serving |
| 106 | |
| 107 | - `serve/`: bin-e1f02b29, the exact head alone. `serve-combined/`: bin-409c8ffa, with the L356 levers (the swap request). |
| 108 | - Engine: `qwen38_omega/moe.rs` builds `exact_head::chip_screen` at load (7 to 9 s) and `qwen38_engine.rs` turns it on per |
| 109 | request when temperature <= 0.001. |
| 110 | - Graph: omega `omega_gpu_q36_graph_set_exact_head`, 5 extra launches per token: XBOUND SCALE, FP8 screen, XBOUND, |
| 111 | ARGMAX x2, then the bf16 MASK GEMV in place of the plain one. |
| 112 | - The omega lib must be built against physics at `physics.lock`. A build with `PHYSICS_LOCK_CHECK=0` against a stale |
| 113 | checkout cannot load on the GB10 (`serve/attempt1-stale-physics/`). |