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 / om / golden / ollm / README.md
| 1 | # Golden-token merge gate for the own Omega LLM (DRA-52, Core #853) |
| 2 | |
| 3 | A fixed prompt set is decoded greedily on the GB10 by the candidate's own kernels and compared token |
| 4 | by token with a committed reference decoded by an independent path: the same tree's f64 CPU forward |
| 5 | (`model.om`), not the f32 GB10 kernels (`gpu/gk.om`, `gpu/gr.om`, `gpu/gg.om`, `gpu/gb.om`) the gate |
| 6 | checks. The model is the own Omega LLM (aien-train `native/omegallm`). The 35B and every outside model |
| 7 | are retired and are not used here (Linear P-DRA-7, DRA-162). |
| 8 | |
| 9 | Every judgment and every sequencing step is `.om` compiled by a pinned seeded omc: `gate.om` judges, |
| 10 | `drive.om` builds, records and runs the gate. No shell script carries logic; host programs (git, tar, |
| 11 | env, sh and the tools aien-train's own `tests/omegallm/build.sh` calls) are exec'd by absolute path |
| 12 | with an empty environment. |
| 13 | |
| 14 | | File | Role | |
| 15 | |---|---| |
| 16 | | `gdec.om` | Greedy decoders, appended to an aien-train tree's gb10 composition: `gtcpu` (CPU, f64) and `gtgpu` (GB10, f32, all prompts in one batch, one `ggfwd` per step). Prints one `T k s id top1_e9 margin_e9` line per token. | |
| 17 | | `gate.om` | `rec` makes the reference record from a `gtcpu` run; `cmp` judges a `gtgpu` run against it. Hashes the checkpoint, merges and prompt file itself (`om/vendor/sha256.om`). | |
| 18 | | `drive.om` | The driver (omc omega-mv `bf54b19f`, built with `om/golden/build.sh`; run from the repository root). `build OMC TRAIN REV OUT [NEG]` resolves REV to one commit in a private repository `OUT/src.git`, snapshots that commit with `git archive` there (never TRAIN's working tree, replace refs, grafts or info/attributes), builds it with the snapshot's own `tests/omegallm/build.sh` (TARGET=gb10, omc omega-mv `e5b32567`, sha256 `2c824805…`), appends `gdec.om` and prints `BUILD_OK <binary sha256> <path> source_sha256 <sha> commit <sha>`. `record` builds and records a reference; `gate` is the merge gate (REV frozen once; candidate and negative control, `gtgpu`, `gate cmp`); `core` is the Core gate step; `check` runs the host arms. | |
| 19 | | `negctl/softmax-log2e.neg` | The negative control: one GB10 kernel constant (the causal-softmax `log2(e)` immediate in `gpu/gr.om` `grsoftf`, x 5/4). Lines `want N`, `block LINE`, `from LINE`, `to LINE`; the build refuses unless exactly `want` lines change. | |
| 20 | | `ref/` | The committed prompt set and reference record. | |
| 21 | | `aien-train.lock` | The aien-train commit the Core gate step (`tests/gates/run.sh gb10-golden-tokens`) checks. | |
| 22 | | `fixtures/` | Hand-written SYNTHETIC files (not a model, not a decoder run) for `drive check`. | |
| 23 | |
| 24 | ## Decoding contract |
| 25 | |
| 26 | Context of prompt k: token 0, then the prompt's BPE encoding (its bytes when V = 256), exactly as |
| 27 | `ollm sample` builds it. Each step takes the argmax of the logits at the last context position |
| 28 | (lowest index on ties). A generated id 0 ends the prompt. `1 + |prompt| + N <= T`, so the window never |
| 29 | slides and both decoders use positions 0 onward. |
| 30 | |
| 31 | `gtgpu` reads the CE kernel's row output (`gpu/gr.om` id 21: `L <- (e/sum - [c = y]) sc`, with target |
| 32 | y = 0 and `sc = 1/(T B)`), so the decision passes through every forward kernel including the CE |
| 33 | kernel: `p_c = L_c / sc`, `p_0 = L_0 / sc + 1`. `top1` is the kernel's row max of the logits and the |
| 34 | margin is `log(p1/p2)`. `gtcpu` reads the f64 logits directly. |
| 35 | |
| 36 | ## Record `aien-golden-ollm/1` |
| 37 | |
| 38 | ``` |
| 39 | aien-golden-ollm/1 |
| 40 | label REAL|FAKE|SYNTHETIC |
| 41 | ckpt_sha256 <64 hex> merges_sha256 <64 hex> prompts_sha256 <64 hex> (one per line) |
| 42 | prompts K |
| 43 | max_tokens N |
| 44 | margin_floor_e9 F (2^-7 logit = 7812500) |
| 45 | drift_bound_e9 D (2^-9 logit = 1953125) |
| 46 | ref_decoder gtcpu |
| 47 | ref_engine_sha256 <sha256 of the reference decoder binary> |
| 48 | ref_source aien-dev/aien-train@<commit> |
| 49 | host_id <id> |
| 50 | utc <YYYY-MM-DDTHH:MM:SSZ> |
| 51 | P k n id0 .. id(n-1) kept reference ids of prompt k |
| 52 | L k n top1_0 .. top1_(n-1) reference top-1 logits (10^-9 units) |
| 53 | M k n m0 .. m(n-1) reference top-1 margins (10^-9 units) |
| 54 | end |
| 55 | ``` |
| 56 | |
| 57 | `drive record` passes fixed constants to `rec`: N = 48, F = 7812500, D = 1953125 (drive.om texts |
| 58 | `tmx`, `tfl`, `tdr`). The former `MAXTOK`, `FLOOR_E9` and `DRIFT_E9` environment |
| 59 | overrides of record.sh are gone; changing a bound is a source change. `rec` refuses (exit 4) a |
| 60 | decoder run with more than N steps for a prompt, or fewer than N without an end, so `cmp` refuses |
| 61 | exactly what `rec` cannot write. |
| 62 | |
| 63 | `rec` keeps the leading steps of each prompt whose reference top-1 margin is at least F: those are |
| 64 | the steps where a correct f32 forward cannot legitimately pick another token, so any divergence there |
| 65 | is a defect. The first step below F and all later steps are dropped. A prompt that keeps fewer than 4 |
| 66 | steps is refused (exit 5), so the prompt set has to be chosen to decide. |
| 67 | |
| 68 | `cmp` exits 3 (`NOTCOMPARABLE`) when the checkpoint, merges or prompt file does not hash to the record |
| 69 | or the prompt count differs. For each kept step the candidate id must equal the reference id |
| 70 | (`DIVERGE k index=s ref=X cand=Y`, `cand=end` when the candidate stopped) and its top-1 logit must be |
| 71 | within D of the reference's (`DRIFT k index=s ref=.. cand=..`). Exit 0 all match, 1 any DIVERGE or |
| 72 | DRIFT, 4 a malformed record or decoder run. The summary's `maxdrift_e9` is over the matching prompts. |
| 73 | |
| 74 | ## Run |
| 75 | |
| 76 | ```sh |
| 77 | # build the driver once (omc omega-mv bf54b19f) |
| 78 | OMC=<omc bf54b19f> bash om/golden/build.sh /tmp/golden-drive om/golden/ollm/drive.om |
| 79 | # reference (host CPU; once per checkpoint or prompt-set change) |
| 80 | OMC_TRAIN=<omc e5b32567> OMC_GATE=<omc bf54b19f> \ |
| 81 | /tmp/golden-drive record <aien-train> <rev> CK MERGES om/golden/ollm/ref/prompts.txt OUTDIR |
| 82 | # the gate (GB10: inside an exclusive window) |
| 83 | spark-window open golden --lease 20 --gb10 exclusive --quiet none --wait |
| 84 | spark-window run env OMC_TRAIN=... OMC_GATE=... /tmp/golden-drive gate \ |
| 85 | <candidate aien-train> <rev> om/golden/ollm/ref/r10-ck60000.ref CK MERGES om/golden/ollm/ref/prompts.txt OUTDIR |
| 86 | spark-window close |
| 87 | # host arms |
| 88 | OMC_GATE=<omc bf54b19f> OMC_TRAIN=<omc e5b32567> TRAIN=<aien-train> /tmp/golden-drive check |
| 89 | ``` |
| 90 | |
| 91 | `drive gate` prints `GOLDEN-GATE PASS` (exit 0) only when the candidate matches and the negative |
| 92 | control, the candidate with one kernel constant changed, is blocked; `FAIL` (1) blocks the merge; |
| 93 | `NOT_RUN` (3) without a GB10 hold, a pinned compiler or a comparable record; `BROKEN` (4) when a build |
| 94 | fails or the negative control is not blocked, which voids the verdict. The decoder is built from the |
| 95 | commit REV resolves to, so uncommitted, skip-worktree or untracked edits in TRAIN cannot reach it. |
| 96 | REV resolves in a private bare repository `OUT/src.git` (no templates), fetched from TRAIN's HEAD, |
| 97 | heads, tags and remotes through an upload-pack that ignores grafts and replace refs, and `git archive` |
| 98 | runs there; every git child runs with the system and global config, attributes and graft files |
| 99 | disabled and `--no-replace-objects`. TRAIN's `refs/replace`, `info/grafts`, `info/attributes` and |
| 100 | config therefore cannot select the commit or shape the snapshot; the commit's own `.gitattributes` |
| 101 | is part of the commit and does apply. `gate` resolves REV once, pins `OUT/src.git` HEAD to that commit |
| 102 | id, builds candidate and negative control from it, and returns `BROKEN` unless both builds report |
| 103 | that commit, so a branch moved between the two builds cannot split them. |
| 104 | |
| 105 | `cmp` also refuses (exit 4) a record whose header or rows break what `rec` writes: `max_tokens` in |
| 106 | 1..4096, nonzero floor and drift bound up to 10^12, every row RMIN..max_tokens long and every kept |
| 107 | margin at least the floor. |
| 108 | |
| 109 | Checkpoint and merges for the Core gate step are found by content: `$AIEN_GOLDEN_DIR/<sha256>` |
| 110 | (default `$AIEN_MODELS_DIR/omega-llm-golden`, else `$HOME/models/omega-llm-golden`), with the sha256 |
| 111 | taken from the record and checked again by `gate.om`. |
| 112 | |
| 113 | ## Evidence |
| 114 | |
| 115 | First GB10 run, 2026-11-07 (`evidence/dra52-golden-20261107/`, EXERCISED on one GB10): aien-train |
| 116 | main `0518c915` PASS (343/343 kept tokens, max drift 2.49e-5 logit) with its negative control blocked; |
| 117 | a tree whose only change is the RMS-norm epsilon in `gpu/gr.om` (1e-5 -> 1e-4) FAIL (blocked by |
| 118 | DRIFT; it moved no greedy token, so a token-only comparison would have passed it). |
| 119 | |
| 120 | ## Scope and limits |
| 121 | |
| 122 | - Gated paths: the Omega LLM's forward on the GB10 (aien-train `native/omegallm/model.om`, `gpu/`, |
| 123 | including the vendored CUDApp `context.om`, `vector.om`, `launch.om`) and its build composition. |
| 124 | `crates/aien-serve-http` in Core serves no own-model path today (the 35B is retired), so a Core |
| 125 | serving PR is not exercised by this gate; that arm waits for the Omega LLM serving cutover (DRA-125). |
| 126 | `ollm serve` (aien-train `serve.om`) is CPU only and is not exercised by `gtgpu`. |
| 127 | - The reference is recorded on the same Spark host by an independent implementation (CPU f64 vs GB10 |
| 128 | f32). A reference from a second machine is NOT_RUN. |
| 129 | - Making `aien/golden-tokens` a required status check on GitHub is repository administration, not |
| 130 | part of this directory. |