omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / train / omega-llm / docs / README.md
| 1 | # Omega LLM v0 (aien-train#52) |
| 2 | |
| 3 | Omega LLM v0 is a proof of concept. It is a byte-level, decoder-only transformer with 119,104 |
| 4 | parameters: |
| 5 | |
| 6 | - V 256, T 64, D 64, H 4, F 256, L 2, B 16. |
| 7 | - It is trained from random initialization entirely in seeded `.om` (omc, omega-mv e5b32567). |
| 8 | - Training runs single-threaded on the DGX Spark Grace CPU, with no GPU. |
| 9 | |
| 10 | The normative spec is [CONTRACT.md](CONTRACT.md). The receipts are under |
| 11 | `evidence/OMEGALLM/core/` (the `.om` lane) and `evidence/OMEGALLM/oracle/` (the Python-stdlib referee). |
| 12 | |
| 13 | ## v1 (aien-train#54) |
| 14 | |
| 15 | v1 adds a byte-pair tokenizer in `.om` (`bpe.om`, concatenated between `ckpt.om` and `cli.om`), |
| 16 | shapes up to V 4096, T 256, D 256, L 8, B 64, gradient blocks G and K worker processes with |
| 17 | byte-identical results for every valid K, and the `OLLMCK02` checkpoint. The spec is |
| 18 | [CONTRACT-V1.md](CONTRACT-V1.md); v0 commands and files keep their bytes. |
| 19 | |
| 20 | ```sh |
| 21 | ollm bpefit TEXT MERGES V [MAXBYTES] # fit merges: M V types chunks fitbytes |
| 22 | ollm bpeenc MERGES V TEXT TOKS # encode to u16 tokens: K bytes tokens |
| 23 | ollm bpedec MERGES TOKS OUT # decode: D tokens bytes |
| 24 | ollm init CK V T D H F L B SEED TOTAL LRMICRO [G [LP LC NP]] # LP LC NP: a looped core, see LOOP.md |
| 25 | ollm train CK TOKS UNTIL EVERY [K] # K worker processes, G mod K = 0 (Linux only) |
| 26 | ollm eval CK HELD W MERGES # MERGES required when V > 256 |
| 27 | ollm sample CK SEED N TEMPMILLI PROMPT MERGES |
| 28 | ollm tune CK OUT TOTAL LRMICRO # fine-tune: keep weights, step 0, new TOTAL and lr, Adam m = v = 0 |
| 29 | ``` |
| 30 | |
| 31 | | What | Status | Receipt | |
| 32 | |---|---|---| |
| 33 | | rung 3: config b (V4096 T128 D192 H6 F768 L4 B40, G = K = 20, P 2,582,208), 9000 steps | EXERCISED, 2026-11-02, 41,814 s on the Grace CPU; held-out `E 9000 4486 1823975 680427` (0.680427 bpb over 0.99988 of `held.tok`) | `evidence/OMEGALLM/v1/` | |
| 34 | | v0 receipt suite on the v1 binary b9b4e02d, aarch64 | EXERCISED, 48/48 PASS (2026-11-04) | `evidence/OMEGALLM/v1/checks/core-aarch64/` | |
| 35 | | v1 referee checks, mutants d and e, K = 1/2/4 and config-a K = 1/4 identity | EXERCISED (2026-11-04) | `evidence/OMEGALLM/v1/checks/reruns.txt` | |
| 36 | |
| 37 | v0's 1.463036 bpb scores 4096 × 64 bytes, 0.11803 of the same held text; v1's 0.680427 scores |
| 38 | nearly all of it, so the two are not measured on the same positions. |
| 39 | |
| 40 | ## Depth growth |
| 41 | |
| 42 | `ollm grow INPUT OUTPUT LAYERS TOTAL LRMICRO` adds trainable layers while |
| 43 | keeping learned tensors. See [growth behavior and verification](GROW.md). |
| 44 | Growth increases capacity; it is not a measured quality improvement. |
| 45 | |
| 46 | ## Looped core |
| 47 | |
| 48 | `ollm init ... G LP LC NP` makes the LC layers from layer LP a core that runs NP times with the |
| 49 | same weights, so depth no longer costs parameters. It trains and runs on the CPU and on the GB10. |
| 50 | See [the loop, its checks and the first trained comparison](LOOP.md): at equal parameters the looped |
| 51 | model's held-out loss was within 0.4% of the unlooped model's, at 1.84 times the step time. |
| 52 | |
| 53 | ## Status |
| 54 | |
| 55 | Evidence for every row is in `evidence/OMEGALLM/core/summary.tsv` (48/48 as expected). Every receipt |
| 56 | names the binary and source sha256 it ran; `core-receipts.sh` builds all six binaries first |
| 57 | (`build.txt`): |
| 58 | |
| 59 | - `ollm` b729cc35faa6b3543ff1893c64e8a6feafc224feba7b99f7f13353e1d2179f22, source 47c27b0b; |
| 60 | - mutants: a 69825ec6, b c7ddea4c, c 41c85250; gcheck step variants: h5 0ba9e2c6, h7 2c1e9b3b. |
| 61 | |
| 62 | | What | Status | Receipt (`evidence/OMEGALLM/core/`) | |
| 63 | |---|---|---| |
| 64 | | `prep` on TinyStoriesV2-GPT4-valid.txt | EXERCISED | `prep.txt`: `P 27630 24867 2763 19883834 2220914` | |
| 65 | | `base` unigram/bigram bpb | EXERCISED | `base.txt`: `B 4415645 3295113` (4.415645 / 3.295113 bpb) | |
| 66 | | `init` v0 | EXERCISED | `init-v0.txt`: `I 119104` | |
| 67 | | `train`, 50 v0 steps | EXERCISED | `train-v0-50.txt`: loss 5.429638 at step 5 to 3.110411 at step 50 nats; ln 256 = 5.545177 | |
| 68 | | resume is bit-identical | EXERCISED | `resume-cmp.txt`: steps 0→40 in one run and 0→20→40 in two runs give the same checkpoint; `cmp` rc 0 | |
| 69 | | checkpoint refusal | EXERCISED | `refuse-truncated.txt` (rc 10), `refuse-flip-magic.txt` (rc 11), `refuse-shape.txt` (D = 0, rc 12), `refuse-count.txt` (P byte changed, rc 13), `refuse-flip-payload.txt` (rc 14), `refuse-long.txt` (one byte appended, rc 15) | |
| 70 | | largest shape | EXERCISED | `init-max.txt`: `I 217664`, a 5224048-byte checkpoint; `eval-max.txt` (W 2): `E 0 2 5566611 8030922` | |
| 71 | | overflow refusals | EXERCISED | `refuse-eval-hugew.txt`: W = 2^58 → rc 23; `refuse-grad-hugeoff.txt`: 16 offsets of 2^64 − 1 → rc 22 | |
| 72 | | `eval` | EXERCISED | `eval-v0.txt`: `E 50 256 3049318 4399237` | |
| 73 | | `sample` | EXERCISED (runs; output is not cross-checked) | `sample-v0-argmax.txt`, `sample-v0-t800.txt` | |
| 74 | | gradient self-check (smoke; the gate is the oracle's `xgrad`) | EXERCISED | `gcheck.txt` (small shape) maxrel 3.08146e-4; `gcheck-v0-init.txt` (v0, seed 1) 1.05146e-4; `gcheck-v0-step50.txt` (v0, 50 steps) 5.15267e-4; 76 indices each, 0 retries | |
| 75 | | gcheck step size | EXERCISED | `var-h5-*` (h = 1e-5) and `var-h7-*` (h = 1e-7) fail with rc 40 on both v0 checkpoints; see "Self-check constants" | |
| 76 | | Adam self-check (smoke; the gate is the oracle's `xstep`) | EXERCISED | `adamck.txt`: `A 5 3cd046ce38e38e38 0` | |
| 77 | | exp/log against Wolfram | EXERCISED | `mathck.txt`: exp at most 1 ulp, log at most 2 ulp | |
| 78 | | mutants a (dK sign), c (no bias correction) | EXERCISED, killed | `mut-a-gcheck.txt` and `mut-a-gcheck-v0.txt` (rc 40, maxrel 2.0), `mut-c-adamck.txt` (rc 41, maxrel 0.639088) | |
| 79 | | mutant b (targets shifted) | killed by the oracle only | `mut-b-gcheck.txt` passes the self-check, as expected; the kill is in `evidence/OMEGALLM/oracle/` | |
| 80 | | cross-check against the referee | EXERCISED by the oracle lane, on b729cc35 and the three mutants | `evidence/OMEGALLM/oracle/` and `tests/omegallm/ORACLE.md` | |
| 81 | | the v0 run, 20000 steps (`tests/omegallm/v0-run.sh`) | EXERCISED: 2026-11-01T15:24:54Z to 19:23:57Z on core 9, binary a9b5f3ec, unit `Result=success`; held-out 1.463036 bpb at W=4096 | `evidence/OMEGALLM/v0/run/` (see "v0 result") | |
| 82 | | a9b5f3ec and b729cc35 compute the same v0 run | EXERCISED | `evidence/OMEGALLM/v0/equiv-a9b5f3ec-b729cc35.txt`: same `E 2000` line from the run's step-2000 checkpoint, byte-identical checkpoint after 10 more steps; control `equiv-control-mut-b.txt` differs | |
| 83 | | `ollm` as an x86-64 Linux program (`TARGET=x86linux`, omega-mv main `ba5559d9`) | EXERCISED, EMULATED (qemu-x86_64 8.2.2 user mode) | `evidence/OMEGALLM/x86/`: the whole receipt suite, 48/48 PASS, every receipt equal to the AArch64 one apart from hashes, paths and wall time; the v0 checkpoint's final eval `E 20000 4096 1014099 1463036` reproduced | |
| 84 | | `ollm` as a UEFI application (`TARGET=x86efi`, compiler from omega-mv #1015, merged as main `d3d1b1bc`) | EXERCISED, EMULATED (QEMU 8.2.2 TCG + OVMF) | `evidence/OMEGALLM/efi/`: the 11 commands of `tests/omegallm/efi-job.txt` read from `\OLLM\JOB.TXT`; the OUT.TXT body matches the AArch64 reference after efi-check.sh strips the banner, J (timing) and DONE lines; TR.BIN, HE.BIN and S.CK written on the FAT volume identical; mutant b differs at byte 375; corrupted checkpoint, 65535- and 65536-byte job controls pass | |
| 85 | | the same image on one physical machine (names iMac18,3 and Core i5-7500 are from earlier aienux evidence; this run does not record them) | EXERCISED on physical hardware (one machine) | `evidence/OMEGALLM/imac/`: the OUT.TXT body matches the AArch64 reference after efi-check.sh strips the banner, J (timing) and DONE lines; TR.BIN, HE.BIN and S.CK identical, `OLLM DONE 11 186521`; negative controls in `check.txt` DIFFERENT; FAT clean after the firmware's writes | |
| 86 | | `ollm` as an AArch64 UEFI application (`TARGET=a64efi`, omega-mv `target a64efi`, docs/A64-EFI.md there) | EXERCISED, virtualized (QEMU virt + EDK2, KVM on a GB10 core) | `evidence/OMEGALLM/a64efi/`: `tests/omegallm/a64efi-receipts.sh`: the 11 commands of `efi-job.txt`; the OUT.TXT body matches the AArch64 Linux reference; TR.BIN, HE.BIN and S.CK identical; `fsck.vfat -n` clean; mutant b differs | |
| 87 | | an a64efi image on one physical machine, a DGX Spark, with no operating system, so no NVIDIA operating-system driver (nvidia.ko) loaded (the machine's own UEFI firmware, its display support included, starts the image and stays beneath it: console, keyboard, files, key-poll waits; the clock is the processor's own counter) | EXERCISED on physical hardware (one machine, one boot, 2026-11-12) | `evidence/OMEGALLM/a64efi/dgx-spark/`: started by the machine's firmware from its EFI system partition; `OLLM DONE 11 13594`; the OUT.TXT body matches the reference; TR.BIN, HE.BIN and S.CK identical. The image is not build.sh's: it is this directory's sources at `bb19fba9` plus a unit that read the GPU's identity registers through the firmware. `evidence/OMEGALLM/a64efi/dgx-spark/BUILD.txt` records its sha256, the sha256 and composition of its source, the compiler that built it and the committed compiler that rebuilds the same bytes. The 15.8M-parameter checkpoint on that machine without an operating system is NOT_RUN: its file is larger than the machine's EFI system partition (sizes measured in `evidence/OMEGALLM/a64efi/dgx-spark/SIZES.txt`) | |
| 88 | | typed conversation (`ask`) on that DGX Spark's own keyboard and screen, no operating system (keyboard and screen through the machine's firmware) | EXERCISED on physical hardware (one machine, one session, 2026-11-12, the v0 checkpoint) | `evidence/OMEGALLM/a64efi/dgx-spark-ask/RESULT.txt`: build.sh's a64efi image; two typed lines; each answer equals the AArch64 Linux build's `sample` for the same line and seed; `OLLM DONE 1 679444`; the machine restarted itself. The transcript holds the operator's words and is not published (its sha256 is) | |
| 89 | |
| 90 | b729cc35 differs from a9b5f3ec only in bounds handling. The source diff shows it: the concatenated |
| 91 | source goes from `cb80250d…` (a9b5f3ec, recorded in commit da910097's `init-v0.txt`) to `47c27b0b…` |
| 92 | (`build.txt`), and the only code changes are `OCKCAP` in `native/omegallm/ckpt.om` and the two range |
| 93 | checks in `native/omegallm/cli.om` (`ooffrow`, `cmdeval`); the rest are note lines. |
| 94 | `evidence/OMEGALLM/v0/bounds-ab.txt` (core 7, 20 s timeout) shows the behaviour. On a valid |
| 95 | largest-shape `init`, a9b5f3ec exits 103 (bounds trap). On `eval` with W = 2^58, where `W·T + 1` |
| 96 | wraps, it was still running at 20 s and the timeout killed it (rc 124). On a huge `grad` offset it |
| 97 | exits 103. b729cc35 sizes the checkpoint buffer for the largest shape (`I 217664`, rc 0) and refuses |
| 98 | the other two with 23 and 22; `eval-edge-w3`/`refuse-eval-edge-w4` and |
| 99 | `grad-edge-o128`/`refuse-grad-edge-o129` pin the exact boundaries. On in-range inputs the two give |
| 100 | identical output (the equivalence receipt). `evidence/OMEGALLM/v0/provenance.txt` ties the running |
| 101 | unit to the compared files: the sha256 of the run directory's `ollm`, `run.sh` and `ck-2000.bin` |
| 102 | against `frozen/ollm` and the copied checkpoint, and the unit's start time and command line. |
| 103 | |
| 104 | ## Build |
| 105 | |
| 106 | ```sh |
| 107 | sh tests/omegallm/build.sh # -> ../build/ollm (AArch64 Linux) |
| 108 | sh tests/omegallm/build.sh --mutant a # also b, c: -> ../build/ollm-mut-X |
| 109 | sh tests/omegallm/build.sh --variant h5 # also h7: -> ../build/ollm-var-hX |
| 110 | sh tests/omegallm/build.sh --variant bx # small bank-A capacities (CONTRACT-V3 check 3): -> ../build/ollm-var-bx |
| 111 | sh tests/omegallm/build.sh --mutant y # bx plus the wrong bank-B layer (four lines): -> ../build/ollm-mut-y |
| 112 | TARGET=x86linux sh tests/omegallm/build.sh # x86-64 Linux ELF |
| 113 | TARGET=x86efi sh tests/omegallm/build.sh # -> ../build/ollm.efi, a UEFI x86-64 application |
| 114 | TARGET=a64efi sh tests/omegallm/build.sh # -> ../build/ollm-aa64.efi, a UEFI AArch64 application |
| 115 | TARGET=gb10 sh tests/omegallm/build.sh # -> ../build/ollm-gb10, CPU ollm plus the GB10 GPU commands |
| 116 | TARGET=gb10 sh tests/omegallm/build.sh --mutant g # also h, m, f, k, s, p, t, r, x, q, w: -> ../build/ollm-mut-X-gb10 |
| 117 | TARGET=gb10 sh tests/omegallm/build.sh --variant r0 # GEMM FFMAs without reuse: -> ../build/ollm-var-r0-gb10 |
| 118 | ``` |
| 119 | |
| 120 | The build script does four things: |
| 121 | |
| 122 | 1. It checks the sha256 of the target's omc (`OMC`, defaulting to a sibling checkout): |
| 123 | - aarch64: `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f` |
| 124 | (omega-mv `e5b32567`, `../omega-mv`); |
| 125 | - x86linux: `be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a` |
| 126 | (omega-mv main `ba5559d9`, `../omega-mv-x86`); |
| 127 | - x86efi: `3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194` |
| 128 | (omega-mv PR #1022 commit `cf9fbda1`: main `d3d1b1bc`, where #1015's x86efi backend merged |
| 129 | on 2026-11-04, plus efi 14, `../omega-efi`); the receipts in `evidence/OMEGALLM/efi` and `imac` |
| 130 | were built earlier with omc `b4f45121` from #1015's commit `5ce9ecaa`; |
| 131 | - a64efi: `17657be4842e08d2ccb3b5c6f65b5f7209e584ad73274518cbdf0263d1fcb182` (omega-mv with |
| 132 | `target a64efi`, `../omega-mv-a64efi`); `seed/a64efi/efirt.om` of that checkout (sha256 |
| 133 | `04dcb32a82cd2817125a4d76a9fade4f70c1de102c60b14aca4cb3583da5f5b0`, also checked) is placed |
| 134 | after the first line. |
| 135 | 2. It concatenates `math.om data.om`, the pool unit (`lpool.om` on Linux, `epool.om` on UEFI; |
| 136 | CONTRACT-V3 §2), `model.om adam.om ckpt.om bpe.om cli.om` and the platform unit |
| 137 | (`lio.om` for Linux, `eio.om` for UEFI; CONTRACT §9). The x86 targets put the line |
| 138 | `target x86linux` or `target x86efi` first, a64efi `target a64efi`. |
| 139 | 3. For a mutant, it changes exactly one line of the concatenated copy (`OMUTA`, `OMUTB`, `OMUTC`; |
| 140 | mutant y changes four: bx's three capacities and `OMUTY`). A variant sets both gcheck steps `GCH` |
| 141 | and `GCH2` to 1e-5 (h5) or 1e-7 (h7) and must change exactly those two lines (bx: the three |
| 142 | bank-A capacities); any other count stops the build with exit 4. |
| 143 | 4. It compiles under `taskset -c $CORE nice -n 19` and prints |
| 144 | `BUILD_OK <bin sha256> <path> source_sha256 <sha>`. |
| 145 | |
| 146 | ## Run |
| 147 | |
| 148 | ```sh |
| 149 | B=../build/ollm; R="taskset -c 6 nice -n 19" |
| 150 | $R $B prep TinyStoriesV2-GPT4-valid.txt train.bin held.bin |
| 151 | $R $B base train.bin held.bin |
| 152 | $R $B init v0.ck 256 64 64 4 256 2 16 SEED TOTAL LRMICRO |
| 153 | $R $B train v0.ck train.bin UNTIL EVERY |
| 154 | $R $B eval v0.ck held.bin 256 |
| 155 | $R $B sample v0.ck SEED 200 800 "Once upon a time" |
| 156 | ``` |
| 157 | |
| 158 | Never commit the data or the `.bin` and `.ck` files. Every receipt in the table can be reproduced |
| 159 | with `sh tests/omegallm/core-receipts.sh`; set `CORE`, `BUILD`, `DATA` or `WORK` to override the |
| 160 | defaults. The exit codes are listed in CONTRACT §7. |
| 161 | |
| 162 | ## Serve (DRA-119) |
| 163 | |
| 164 | ```sh |
| 165 | ollm serve PORT CK MERGES [MAXCONN] [tplmax=N] [test=1] # AArch64 Linux; prints "MODEL id", then "PORT n" once listening |
| 166 | ollm-gb10 gserve PORT CK MERGES [MAXCONN] [tplmax=N] [test=1] # the same server, logits from the GB10 |
| 167 | ollm-gb10 gserveb PORT CK MERGES [MAXCONN] [tplmax=N] [test=1] # mixed BF16, see CONTRACT-BF16.md |
| 168 | ``` |
| 169 | |
| 170 | The server has no connection limit. MAXCONN, when given, makes it leave after that many |
| 171 | connections; the checks use it to end a server. |
| 172 | |
| 173 | `serve.om` (aarch64 and gb10 builds; the x86 targets get `noserve.om`, which exits 2) answers |
| 174 | OpenAI-style chat requests on 127.0.0.1:PORT with omega-mv's `seed/net/http.om` and |
| 175 | `seed/json/{json,jsonw}.om`, vendored byte for byte from omega-mv `e5b32567` into |
| 176 | `native/omegallm/net/`. `build.sh` checks their sha256 (`NET_PIN_MISMATCH`, exit 3) and puts `om2` |
| 177 | first. One request at a time and one request per connection (`Connection: close`), so a pooled |
| 178 | idle client cannot hold the listener. A connection is served only once its first bytes arrive: |
| 179 | one that sends nothing within 20 ms of its accept waits in one of 8 pending slots (polled with |
| 180 | the listener; when all 8 are taken, new connections wait in the listen backlog) and is closed |
| 181 | unanswered 10 s after its accept. Once bytes arrive the head must complete within 10 s and the |
| 182 | body within 60 s, so a client that starts a request and stalls holds an idle server up to that |
| 183 | bound. `tplmax=N` (256 to 983040, default 65536) caps the chat template in bytes. `test=1` |
| 184 | enables the test-only members `ollm_test_output` (a string whose encoding replaces the drawn |
| 185 | tokens, then token 0) and `ollm_test_delay_ms` (0 to 10000, how long the server waits for |
| 186 | connections before each token); without it they are 400. |
| 187 | |
| 188 | - `GET /health` → `{"status":"ok","in_flight":0,"busy":false}`; `GET /v1/models` → one model, whose id is read |
| 189 | from the loaded checkpoint's header: `ollm-ck0M-vV-tT-dD-hH-lL-stepS-fnvX` (checkpoint format M, |
| 190 | shapes, step field and the payload FNV-1a 64 that the load has just verified). The rung-10 |
| 191 | ck60000 checkpoint (sha256 `a53ced7265818c8f6197449315e9ca4082721665022fec4f81d4538e8d6c2d0f`) |
| 192 | is `ollm-ck02-v4096-t256-d384-h12-l8-step60000-fnv0a3ae8e8c031f163`. Every completion and chunk |
| 193 | carries the same id in `model`. |
| 194 | `in_flight` is the number of chat completions generating, 0 or 1 (one slot), and `busy` is |
| 195 | `in_flight == 1`; connections waiting in pending slots or the backlog are not counted. |
| 196 | - One generation slot. Between tokens the listener and the pending connections are served: |
| 197 | `GET /health` answers `{"status":"ok","in_flight":1,"busy":true}`, `GET /v1/models` the list, |
| 198 | and every other request 503 `server_busy` with `Retry-After: 1`. These side requests get a |
| 199 | 250 ms head and 1 s body deadline, so one that starts and stalls costs the generation at most |
| 200 | about 1.3 s; a silent connection costs it 20 ms once. |
| 201 | - Between tokens the generating request's socket is peeked (`MSG_PEEK | MSG_DONTWAIT`). End of |
| 202 | stream or a socket error means the client left: generation stops, nothing more is sent, the |
| 203 | slot frees and the log line has status 499 and finish 4. A client that half-closes its |
| 204 | sending side after the request counts as gone. A stream also ends when a chunk cannot be sent. |
| 205 | - `POST /v1/chat/completions`: `messages` (content a string, null, or an array of |
| 206 | `{"type":"text","text":...}` parts joined with no separator; other part types are 400), |
| 207 | `max_tokens` or `max_completion_tokens` (1 to 999999), `temperature` (0 to 2, no exponent; 0 is |
| 208 | argmax), `seed` (when absent or null each request draws from a fresh seed, so repeating a request |
| 209 | gives a different answer; only a request with its own `seed` is reproducible), `top_k` (-1 to |
| 210 | 999999; -1, 0 and K ≥ V are off), `top_p` (0 to 1, no |
| 211 | exponent, resolution 0.000001; 0 keeps only the most probable token, 1 is off), `stop` (a |
| 212 | string or an array of at most 8 strings of 1 to 128 bytes), `tools`, `tool_choice` (`none` or |
| 213 | `auto`; `required` and an object are 400, because the server cannot force a call), `stream`, |
| 214 | `stream_options.include_usage`, `n` = 1. Members that would change the answer and are not |
| 215 | implemented are 400 unless they carry their default: `response_format` other than |
| 216 | `{"type":"text"}`, a non-empty `logit_bias`, `logprobs` true, `top_logprobs`, |
| 217 | `frequency_penalty` or `presence_penalty` other than 0, `parallel_tool_calls` false, `functions` |
| 218 | and `function_call`. Other members are ignored (`model`, `user`). JSON or SSE |
| 219 | (`data:` chunks: role, content, tool calls, finish, optional usage, `[DONE]`). |
| 220 | - Interim template, until DRA-123 fixes a shared one: when `tools` is non-empty, `tools: ` and |
| 221 | the tools JSON exactly as sent, then `\n`; then `role: content\n` per message, an assistant's |
| 222 | `tool_calls` appended to its content as `<tool_call>{"name":NAME,"arguments":ARGS}</tool_call>` |
| 223 | (ARGS the decoded string or the object's JSON text as sent); then `assistant: `. At most |
| 224 | `tplmax` bytes. The context is token 0 plus the template's encoding; when that reaches T the |
| 225 | answer is 400 `context_length_exceeded`, stating the prompt's tokens and T (the 14,364-byte |
| 226 | allen-chat system prompt gets this against a T = 256 checkpoint). Output is at most |
| 227 | min(max_tokens, T − prompt tokens) tokens drawn with `sample`'s step (`osstep`), so the same |
| 228 | SEED and TEMPMILLI give `sample`'s bytes; with `top_k`/`top_p` on, the kept tokens are the most |
| 229 | probable (ties to the lower id), up to K and until their mass reaches `top_p`, drawn by the same |
| 230 | uniform scaled to the kept mass. Token 0 ends with `stop`, the limit with `length`, the earliest |
| 231 | stop string with `stop` (content cut before it; a stream never sends bytes a stop could still |
| 232 | claim). Bytes are sent as UTF-8; an ill-formed sequence becomes U+FFFD. |
| 233 | - Tool calls (tools non-empty, `tool_choice` not `none`): when the content from the first |
| 234 | `<tool_call>` on is 1 to 8 blocks `<tool_call>{"name":N,"arguments":A}</tool_call>` with only |
| 235 | whitespace between and after, each N a declared tool, the answer carries `tool_calls` (ids |
| 236 | `call_<request>_<i>`, `arguments` the object's JSON text or the string) with `finish_reason` |
| 237 | `tool_calls` and content the text before (null when empty); otherwise the text is plain content. |
| 238 | A stream holds back a possible marker and sends the calls in one delta chunk. Role `tool` |
| 239 | messages are rendered like any other role. Whether the model emits such blocks is a model |
| 240 | matter; the checks script the output with `ollm_test_output`. |
| 241 | - `POST /v1/completions` (raw prompt, for the Omega Node edit→verify→review workflow): `prompt` |
| 242 | (a non-empty string) is the whole template: the context is token 0 plus the prompt's encoding, |
| 243 | with no role lines and no `assistant: ` prefix, so the same SEED and TEMPMILLI give |
| 244 | `ollm sample CK SEED N TEMPMILLI PROMPT MERGES`'s bytes. The scalar members are chat's |
| 245 | (`max_tokens`, `temperature`, `seed`, `top_k`, `top_p`, `stop`, `n` = 1). JSON only: |
| 246 | `{"id":"cmpl-ollm-N","object":"text_completion","created":..,"model":ID,"choices":[{"index":0,"text":..,"finish_reason":"stop"|"length"}],"usage":{..}}`. |
| 247 | 400 `invalid_request` for `stream` true, for `messages`, `tools` or `tool_choice` present, and |
| 248 | for a missing, non-string or empty `prompt`; `tplmax` and `context_length_exceeded` apply as on |
| 249 | chat. Busy 503, client-left 499 and the log line are shared with chat. |
| 250 | - Refusals are JSON `{"error":{...}}`: 400 (`invalid_json`, `invalid_request`, |
| 251 | `context_length_exceeded`), 404, 405, 503 `server_busy`, and 413 `request_too_large` for a body |
| 252 | over 983040 bytes (refused at the head) or over 65532 JSON tokens (the JSON parser's tape). |
| 253 | - stdout gets one line per response: `C status prompt_tokens completion_tokens finish ms` |
| 254 | (finish 0 none, 1 stop, 2 length, 3 tool_calls, 4 client left). |
| 255 | |
| 256 | `tests/omegallm/serve-check.sh` starts two servers under taskset/nice/bwrap (defaults on PORT, |
| 257 | `tplmax=4000 test=1` on TPORT), referees them with `serve-check.py` (the content oracle |
| 258 | is the same binary's `sample`, decoded with Python's `errors="replace"`; the 499 log lines are read |
| 259 | from `server-test.log` via `SERVE_TLOG`; `cmpl_*`/`t_cmpl_*` cover `/v1/completions`) and stops the PIDs it started. The checks added since |
| 260 | DRA-119's first 27 come with control checks (`*_control`, `*_is_sample`, |
| 261 | `sample_differs_from_greedy`, `t_ctl_*`, `t_forced_plain`): the same request with one input |
| 262 | changed, expecting the other outcome. A refusal (`refuse_*`) is controlled by the accepted |
| 263 | request it varies. |
| 264 | Four `parity_` checks compare the sha256 of the served text with the sha256 of `sample`'s raw |
| 265 | stdout for the same prompt, seed, temperature and token count and keep both files in `OUT/parity`; |
| 266 | the model id oracle reads the checkpoint header itself, and the gate also requires the first |
| 267 | server's `MODEL` line to equal that id and both servers to listen on 127.0.0.1 alone. |
| 268 | `tests/omegallm/serve-mutants.sh` is the negative control: it builds the seven serve mutants of |
| 269 | `build.sh` (smeth, spath, sbig, sjson, sloop, sseed, smid: the 405, 404, 413 and malformed-JSON |
| 270 | refusals removed, a 0.0.0.0 bind, a shifted seed, the old fixed id) and requires serve-check.sh to |
| 271 | fail each one on the check written for it, each run inside a private network namespace. Receipts: |
| 272 | `evidence/OMEGALLM/serve/`. |
| 273 | |
| 274 | ## iMac |
| 275 | |
| 276 | `tests/omegallm/efi-receipts.sh` leaves the boot image at `$WORK/ollm.img` (`scratch-efi/ollm.img`; |
| 277 | the image of the receipted run is sha256 `2b9a420a93486a4d37ed78141a45861427090535502243ecbb67fa4008b6c162`). |
| 278 | It is a GPT disk with one EFI system partition, FAT label ALLEN, holding: |
| 279 | |
| 280 | - `EFI/BOOT/BOOTX64.EFI`, the `ollm.efi` application; |
| 281 | - `OLLM/JOB.TXT` (a copy of `tests/omegallm/efi-job.txt`), `OLLM/CK.BIN` (the v0 checkpoint), |
| 282 | `OLLM/STORIES.TXT` (TinyStoriesV2-GPT4-valid.txt) and `OLLM/MATHREF.TXT`. |
| 283 | |
| 284 | Write it whole to a USB stick and start the Intel iMac from the stick (hold Option at the chime and |
| 285 | pick "EFI Boot"). `ollm` runs the 11 jobs, shows each job's output on the console and appends it to |
| 286 | `\OLLM\OUT.TXT`. After the last job the console shows `OLLM DONE 11 <ms>`, and `ollm` waits up to |
| 287 | 300 s for a key before returning to the firmware. A refusal ends the application at once; OUT.TXT |
| 288 | then ends with that job's output. Copy `OLLM/OUT.TXT` (and `TR.BIN`, `HE.BIN`, `S.CK`) off the stick |
| 289 | and check them against the Linux reference. `678` is the byte size of `tests/omegallm/efi-job.txt`, |
| 290 | which the banner must equal: |
| 291 | |
| 292 | ```sh |
| 293 | sh tests/omegallm/efi-check.sh OUT.TXT evidence/OMEGALLM/efi/ref.out 11 678 |
| 294 | (cd <copied files> && sha256sum TR.BIN HE.BIN S.CK) | diff - evidence/OMEGALLM/efi/ref-files.txt |
| 295 | ``` |
| 296 | |
| 297 | Status: EXERCISED on physical hardware (one machine) (`evidence/OMEGALLM/imac/`, run 2026-11-01). Apple's |
| 298 | firmware ran all 11 jobs and its FAT driver accepted the writes: the OUT.TXT body matches the AArch64 |
| 299 | reference after efi-check.sh strips the banner, J (timing) and DONE lines, the three written files match |
| 300 | `ref-files.txt`, and `fsck.vfat -n` finds the volume clean. The firmware clock gave 186521 ms in total, |
| 301 | against 1004245 ms under TCG on one GB10 core. The run itself does not record machine identity. |
| 302 | Whether the console showed the `efi 13` text was not recorded. |
| 303 | |
| 304 | Reading the stick back: after the run, macOS 26 refused to mount the stick's partition, even |
| 305 | read-only, although a `dd` copy of the same bytes mounts as a file and checks clean. Copy the raw |
| 306 | partition (`sudo dd if=/dev/rdiskNs1 of=STICK.img bs=1m`) and take the files out with |
| 307 | `MTOOLS_SKIP_CHECK=1 mcopy -i STICK.img ::/OLLM/OUT.TXT …`. |
| 308 | |
| 309 | ## DGX Spark and other Arm machines, without an operating system |
| 310 | |
| 311 | `TARGET=a64efi` gives `ollm-aa64.efi`, which a 64-bit Arm UEFI firmware starts as |
| 312 | `\EFI\BOOT\BOOTAA64.EFI` (or from a firmware boot entry). It reads `\OLLM\JOB.TXT` and writes |
| 313 | `\OLLM\OUT.TXT` exactly as the iMac image does. When `\OLLM\REBOOT.TXT` exists the image restarts |
| 314 | the machine when the job is done (after its wait for a key); without it, it returns to the firmware. |
| 315 | |
| 316 | ``` |
| 317 | sh tests/omegallm/a64efi-receipts.sh # virtualized: QEMU virt + EDK2, compared with a Linux build |
| 318 | ``` |
| 319 | |
| 320 | On a machine that already runs Linux from the same disk, one boot without touching the boot order: |
| 321 | copy the image to the EFI system partition (for example `\EFI\OMEGA\OLLM.EFI`) and the job files to |
| 322 | `\OLLM`, create a firmware entry for it (`efibootmgr -c ... -l '\EFI\OMEGA\OLLM.EFI'`), put the boot |
| 323 | order back as it was, and select the entry for the next boot only (`efibootmgr -n ENTRY`). After the |
| 324 | restart, compare `\OLLM\OUT.TXT` with `efi-check.sh` as above. Status and receipts: the Status table. |
| 325 | The model runs on the processor only: the GPU commands need the Linux NVIDIA driver and are not in |
| 326 | this image. |
| 327 | |
| 328 | ### Typing to the model on the bare machine |
| 329 | |
| 330 | A job line `ask CK SEED N TEMPMILLI [MERGES]` in `\OLLM\JOB.TXT` turns the machine's own keyboard and |
| 331 | screen into a conversation: the image prints `You: `, you type a line and press Enter, and the model |
| 332 | continues it with N tokens (the same computation as `sample CK SEED+turn N TEMPMILLI LINE [MERGES]`). |
| 333 | Backspace removes a character. An empty line, Esc, or ten minutes without a key ends it, and the |
| 334 | image goes on as after any job. Everything typed and answered is also in `\OLLM\OUT.TXT`. Both UEFI |
| 335 | images have it (x86efi and a64efi); the Linux programs do not, and no recorded job file uses it. |
| 336 | `tests/omegallm/a64efi-receipts.sh` types two lines on the virtual console and requires both answers |
| 337 | to equal the Linux build's `sample` output (row `ask`). On a physical keyboard: one session on a DGX |
| 338 | Spark (a64efi, 2026-11-12, two typed lines, both answers equal to `sample`'s: |
| 339 | `evidence/OMEGALLM/a64efi/dgx-spark-ask/RESULT.txt`); the x86efi image on a physical keyboard is NOT_RUN. |
| 340 | |
| 341 | ## Throughput |
| 342 | |
| 343 | All timings ran on Spark GB10 Grace core 6. `host.txt` records its `midr_el1` (0x410fd851, Arm part |
| 344 | 0xd85, Cortex-X925) and a 3900 MHz maximum clock. The process ran single-threaded under `nice -n 19` |
| 345 | on a shared host, so the step time depends on what else runs on that core. Each figure below is one |
| 346 | run, not a distribution. |
| 347 | |
| 348 | - `train-v0-50.txt`: 50 steps took 35.315644994 s wall, including 10 checkpoint saves. |
| 349 | - Per step: WolframLanguageEvaluator `35.315644994/50` → 0.70631 s. |
| 350 | - Throughput: `50*1024/35.315644994` → 1449.78 training bytes/s. |
| 351 | - `resume-a-0-40.txt`: 40 steps with one save took 28.143739881 s. Per step: `28.143739881/40` → |
| 352 | 0.70359 s. `100*(sps-s40)/s40` → 0.39%: this run's per-step time with a save every 5 steps was |
| 353 | 0.39% above the one-save run. With one sample of each, that is not a measured cost of saving. |
| 354 | - `gcheck-v0-init.txt`: 44.7 s for 76 indices. |
| 355 | - A checkpoint is `112+24*119104` → 2,858,608 B. |
| 356 | |
| 357 | ## The v0 run |
| 358 | |
| 359 | `tests/omegallm/v0-run.sh` is the script of the first full run. It is the init line of the receipts |
| 360 | with seed 1 and TOTAL 20000, trained in 1000-step chunks; each chunk is followed by a held-out eval |
| 361 | at W=256 and a saved checkpoint. Chunking does not change the result, because resume is |
| 362 | bit-identical (`resume-cmp.txt`). After the last chunk it runs one eval at W=4096 and writes three |
| 363 | samples at TEMPMILLI 800 and one argmax sample, each 400 bytes after the prompt "Once upon a time". |
| 364 | |
| 365 | The run directory holds `v0-run.sh` copied as `run.sh` (sha256 `4898aae5…`), the binary as |
| 366 | `ollm`, `train.bin` and `held.bin`. On 2026-11-04 a four-line usage comment (lines 2-5) was added |
| 367 | to `tests/omegallm/v0-run.sh`; `sed 2,5d tests/omegallm/v0-run.sh | sha256sum` still gives |
| 368 | `4898aae5…`, so the run's `run.sh` is the script without that comment. It was started with |
| 369 | |
| 370 | ```sh |
| 371 | systemd-run --user --unit=ollm-v0 --collect -p CPUAffinity=9 -p Nice=19 -p MemoryMax=1G \ |
| 372 | /bin/sh <run dir>/run.sh |
| 373 | ``` |
| 374 | |
| 375 | The unit keeps systemd's default working directory (the home directory); `run.sh` begins with |
| 376 | `cd "$(dirname "$0")"`, so every file it names is in the run directory. `provenance.txt` records |
| 377 | the unit's `ExecStart`, `CPUAffinity`, `Nice`, `MemoryMax`, `WorkingDirectory` and start time, and the |
| 378 | sha256 of the running `ollm`, `run.sh`, `ck-2000.bin` and data against the copies the equivalence |
| 379 | receipts used. |
| 380 | |
| 381 | The running binary is a9b5f3ec, built before the bounds fix. On in-range inputs it gives the same |
| 382 | output as b729cc35: `evidence/OMEGALLM/v0/equiv-a9b5f3ec-b729cc35.txt` evaluates and trains 10 steps |
| 383 | from the run's own step-2000 checkpoint with both binaries, and the two checkpoints are byte-equal |
| 384 | (`equiv-control-mut-b.txt` is the negative control). `bounds-ab.txt` shows where they differ: init at |
| 385 | the largest shape and the two overflow refusals. |
| 386 | |
| 387 | Planned length, WolframLanguageEvaluator with sps = 0.70631 s/step from `train-v0-50.txt`: |
| 388 | |
| 389 | - Duration: `20000*sps/3600` → 3.92 h of training on one X925 core at nice 19 on a shared host, |
| 390 | plus the evals. (The launch estimate, from an earlier run of the same receipt at 0.70749 s/step, |
| 391 | was 3.93 h.) |
| 392 | - Data seen: `20000*16*64/19883834` → 1.03 passes over the training bytes, in expectation. |
| 393 | - LRMICRO 3000 is the only learning rate exercised. |
| 394 | |
| 395 | ## v0 result |
| 396 | |
| 397 | All figures below come from `evidence/OMEGALLM/v0/run/` (core 9, Cortex-X925, nice 19, binary |
| 398 | a9b5f3ec, data `101b41c6…`/`729e0a4a…` in `shas.txt`). Arithmetic is WolframLanguageEvaluator, |
| 399 | quoted with each result. |
| 400 | |
| 401 | - The unit ended `Result=success`, `ExecMainStatus=0` (`unit.txt`). It ran from 15:24:54Z to |
| 402 | 19:23:57Z, 14343 s: `14343/20000` → 0.717 s/step, including 21 evals and 20 checkpoint copies. |
| 403 | - Final checkpoint `ck.bin` = `ck-20000.bin`, sha256 `ddf790fc…`, 2,858,608 B (not committed). |
| 404 | - Held-out loss, first 256 windows (`evals.txt`), bits per byte: |
| 405 | |
| 406 | | step | 0 | 1000 | 2000 | 5000 | 10000 | 15000 | 19000 | 20000 | |
| 407 | |---|---|---|---|---|---|---|---|---| |
| 408 | | bpb | 7.991001 | 2.163609 | 1.929394 | 1.693245 | 1.563117 | 1.491841 | 1.440312 | 1.432839 | |
| 409 | |
| 410 | Still falling at the end: 19000→20000 is `100*(1.432839-1.440312)/1.440312` → −0.519%, |
| 411 | 18000→19000 → −0.947%. This run does not show where it stops falling. |
| 412 | - Final eval (`final-eval.txt`): `E 20000 4096 1014099 1463036`, 1.463036 bpb over 4096 windows, |
| 413 | `4096*64/2220914` → 11.8% of the held-out positions (the W=256 series covers 0.74%). |
| 414 | `final-eval-b729cc35.txt` recomputes this line from `ck-20000.bin` with the bounds-fixed binary. |
| 415 | - Against the byte baselines in `base.txt`: `100*(1-1.463036/3.295113)` → 55.6% below bigram, |
| 416 | `100*(1-1.463036/4.415645)` → 66.9% below unigram. The baselines score every byte transition of |
| 417 | the held-out file, the eval only the first 4096 windows, so this compares different position sets. |
| 418 | - Training loss of the last step (`train.txt`, one batch): `T 20000 917244` → `0.917244/ln 2` → |
| 419 | 1.3233 bits per byte. Single-batch values swing (19500: 0.937854, 19750: 1.003060 nats), so the |
| 420 | gap to held-out is not measured here. |
| 421 | - Samples (`sample-*.txt`, 400 bytes after "Once upon a time"; not cross-checked by the oracle): |
| 422 | the model writes TinyStories-shaped text with names, quotes and sentence structure, plus misspelled |
| 423 | and invented words ("chisting", "spinnat"). The argmax sample falls into a loop ("The bird said, \"I |
| 424 | will help you to the park.\"" repeats from about byte 100). |
| 425 | |
| 426 | This is a 119,104-parameter byte model trained once with one learning rate on one seed. The run |
| 427 | shows that the `.om` trainer learns on real data end to end; it does not establish quality against |
| 428 | any other implementation's training run of the same shape. |
| 429 | |
| 430 | ## Self-check constants |
| 431 | |
| 432 | - `MCTOL 1e-15`: the allowed relative error of first-party `fexp`/`flog` against the correctly rounded |
| 433 | Wolfram value. |
| 434 | - In ulps: WolframLanguageEvaluator `10.^-15/2.^-52` → 4.50 ulp-equivalents. |
| 435 | - Observed (`mathck.txt`): exp 2.70e-16 (`2.70*^-16/2.^-52` → 1.22) and log 3.37e-16 (→ 1.52). |
| 436 | - The margin is `10.^-15/3.37*^-16` → 2.97×. |
| 437 | - `tests/omegallm/mathref.txt` is the reference: 3017 `e` lines and 2122 `l` lines. |
| 438 | - Each RBITS value is the round-half-even f64 of a 60-digit Wolfram `Exp`/`Log` at the exact |
| 439 | XBITS value. The bits are constructed explicitly, including the subnormal, overflow and zero |
| 440 | cases. |
| 441 | - The exp grid covers k/1000 on [−1, 1], 1000 points on [−745, 709.78], and the |
| 442 | overflow/underflow thresholds. |
| 443 | - The log grid covers 1/2 + k/1000 up to 2, 10^k for k = −307..307, the subnormals, the largest |
| 444 | f64, and 1 ± 1 ulp. |
| 445 | - The generator is `tests/omegallm/mathref.wl` (sha256 |
| 446 | `fd94187c1e267c527f9876bb4dd076e5a0b7487d1ba82149375e09d199f3bf75`). Running it, then evaluating |
| 447 | `{StringLength[text], IntegerString[Hash[text,"SHA256"],16,64]}` in WolframLanguageEvaluator, |
| 448 | gives 185004 and `3ecc26a3cdf64d640e098eb057e2adfbe390e78fef20b64d5f83e5fa907e961a`. That is the |
| 449 | same as `sha256sum tests/omegallm/mathref.txt`, so the committed file is exactly what the generator |
| 450 | writes. |
| 451 | - gcheck takes four indices per tensor instance, drawn by splitmix64, and computes the central |
| 452 | difference `(L(p+h)−L(p−h))/((p+h)−(p−h))` against the hand gradient. For each index, |
| 453 | `rel = |num−g|/max(|num|,|g|,GCFLOOR)`. GCFLOOR 1e-6 and GCTOL 1e-3 are unchanged. |
| 454 | - `GCH` was 1e-5. The h5 variant build reproduces that: on the v0 init checkpoint it fails (rc 40) |
| 455 | at index 34180, `c 34180 284589607 286581380` (hand gradient and difference, ×1e-12), rel |
| 456 | 6.950114e-3 (`var-h5-gcheck-v0-init.txt`); at step 50 it fails at index 82501, rel 2.588816e-3. |
| 457 | The real build (h = 1e-6) has `c 34180 284589607 284589241` at the same index |
| 458 | (`gcheck-v0-init.txt`), so the hand gradient is unchanged and only the difference moved. The |
| 459 | oracle's `xgrad-v0` agrees with the hand gradient code to ≤ 3.3e-12 per tensor |
| 460 | (`evidence/OMEGALLM/oracle/README.md`). A difference that is wrong while the gradient is right is |
| 461 | the signature of `p ± h` moving a ReLU pre-activation across 0, where the loss has a kink: the |
| 462 | difference then measures a one-sided slope, not the gradient. |
| 463 | - WolframLanguageEvaluator `rel[g_,n_]:=Abs[n-g]/Max[Abs[n],Abs[g],10^6]` on the two lines → |
| 464 | 6.950113e-3 (h = 1e-5) and 1.286062e-6 (h = 1e-6). |
| 465 | - `GCH` is now 1e-6. An index over GCTOL is redone once at `GCH2 = 2.5e-7`, and the smaller rel is |
| 466 | kept; the `C` line counts these retries. A smaller h narrows the band of pre-activations whose |
| 467 | kink it can cross. The cost is more f64 rounding noise in L(p±h)/h. |
| 468 | - Roundoff in the difference is about `eps·L/h` with eps = 2^-53 and L ≈ 5.545 (the init loss). |
| 469 | WolframLanguageEvaluator `With[{e=2.^-53,L=5.545},{e*L/10.^-6, e*L/(2.5*^-7), e*L/10.^-7}]` → |
| 470 | 6.16e-10, 2.46e-9, 6.16e-9 absolute. Divided by GCFLOOR 1e-6 that is a worst-case rel of 6.2e-4, |
| 471 | 2.5e-3 and 6.2e-3 for a gradient at the floor. |
| 472 | - The h7 variant build (h = 1e-7) fails on that roundoff, as the bound predicts: v0 init rel |
| 473 | 1.883774e-3 at index 27146, `c 27146 -6471488 -6483702`; step 50 rel 3.555355e-3 at index 76993 |
| 474 | (`var-h7-gcheck-v0-*.txt`). The real build has `c 27146 -6471488 -6471712` there; `rel` above → |
| 475 | 1.883800e-3 and 3.461217e-5. |
| 476 | - In the variant builds GCH2 equals GCH, so their retry count is a repeat at the same h, not a |
| 477 | second step size. |
| 478 | - The h/4 retry can exceed GCTOL from roundoff alone, but it only replaces rel when it is smaller, |
| 479 | so it cannot turn a pass into a fail, and a wrong gradient (mutant a, rel 2.0) fails at both step |
| 480 | sizes. |
| 481 | - Observed rels of the real build, all with 0 retries; margin WolframLanguageEvaluator |
| 482 | `10.^-3/{3.08146*^-4, 1.05146*^-4, 5.15267*^-4, 4.72375*^-4}` → {3.245, 9.511, 1.941, 2.117}: |
| 483 | small shape 3.08146e-4, v0 init 1.05146e-4, v0 at step 50 5.15267e-4, mutant-b small shape |
| 484 | 4.72375e-4. |
| 485 | - Mutant a reaches 2.0, with 23 retries on the small shape and 38 at v0. It exits 40 on both. |
| 486 | - These constants are deterministic per checkpoint, so a pass is reproducible. The 1.94× margin at |
| 487 | a trained v0 checkpoint is the tightest; recheck it if the shapes change. |
| 488 | - gcheck and adamck are smoke checks of the binary against itself. The gate for the gradient and |
| 489 | the Adam step is the oracle's `xgrad`/`xstep` (`evidence/OMEGALLM/oracle/`). |
| 490 | |
| 491 | ## Sizing |
| 492 | |
| 493 | Every query is WolframLanguageEvaluator, 2026-11-01. |
| 494 | |
| 495 | - **Pool (`OWN` 1400000 f64, model.om).** `geom` transcribes the layout of model.om |
| 496 | `ogeom`/`ogeom3`/`oastr`/`ogeom2`: |
| 497 | |
| 498 | ``` |
| 499 | geom[{v_,t_,d_,h_,f_,l_}]:=Module[{lstr,lay0,gf,p,astr,hf,sf,z,pr,end}, lstr=4 d d+2 d f+2 d; lay0=v d+t d; gf=lay0+l lstr; p=gf+d; astr=8 t d+2 t+h t t+2 t f; hf=4 p+l astr; sf=hf+t d; z=sf+t; pr=z+t d; end=pr+t v+7 t d+t f+256; {p,end}] |
| 500 | ``` |
| 501 | |
| 502 | `{geom[{256,64,64,4,256,2}], geom[{256,64,64,8,256,4}]}` → {{119104, 710464}, {217664, 1334336}}: |
| 503 | P and the pool end for v0 and for the largest shape. Both end below 1400000, and `ogeom` refuses |
| 504 | a layout past it (exit 12). `init-max.txt` prints `I 217664`. |
| 505 | - **Checkpoint buffer (`OCKCAP`, ckpt.om).** A checkpoint is 112 header bytes plus params, m and v: |
| 506 | `{112+24*217664, 112+24*119104}` → {5224048, 2858608} B for the largest shape and v0. |
| 507 | `OCKCAP` is 5224048 + 1: the spare byte lets a read detect a file longer than any checkpoint |
| 508 | (exit 15). `init-max.txt` records the 5224048 B file. |
| 509 | v2 (2026-11-04 note, CONTRACT-V2): the v2 maximum (V 4096, T 256, D 384, H 12, F 1536, L 8, |
| 510 | P 15,833,472) has a 120-byte header (`OLLMCK02`), so a checkpoint is `120+24*15833472` → |
| 511 | 380003448 B and `OCKCAP` is 380003449. `../../evidence/OMEGALLM/gpu-r7/cpu/ock-boundary.txt`: the |
| 512 | 380003448 B file loads, the file plus one or two bytes exits 15. The pool and the numbers above |
| 513 | are the v0/v1 sizing; the v2 storage split is in CONTRACT-V2 §2. |
| 514 | - **adamck under mutant c (adam.om).** Without bias correction the step-s update is the corrected |
| 515 | one times `r[s_]:=(1-(9/10)^(s+1))/Sqrt[1-(99/100)^(s+1)]`; `Table[r[s],{s,0,4}]` → {1, 1.346874, |
| 516 | 1.572475, 1.732455, 1.849790}. With adamck's warmup lr `lr[s_]:=(1/1000)(s+1)/100`, epsilon |
| 517 | `e=10^-8` and its gradients |g| ∈ {1, 2, 3}·1e-4: |
| 518 | |
| 519 | ``` |
| 520 | mut[g_]:=Sum[lr[s](1-(9/10)^(s+1)) g/(Abs[g] Sqrt[1-(99/100)^(s+1)]+e),{s,0,4}]; |
| 521 | ref[g_]:=Sum[lr[s] g/(Abs[g]+e),{s,0,4}]; rel[g_]:=Abs[mut[g]-ref[g]]/Abs[ref[g]]; |
| 522 | N[{rel[10^-4],rel[2 10^-4],rel[3 10^-4]},16] |
| 523 | ``` |
| 524 | |
| 525 | → {0.6386062690569244, 0.6389678457053756, 0.6390884175446797}. The maximum agrees with |
| 526 | `mut-c-adamck.txt`, `A 5 3fe473698d936acd 639088417544678` (maxrel × 1e15), to 14 significant |
| 527 | digits: WolframLanguageEvaluator decodes the bits to 0.6390884175446786, |Δ| → 1.143e-15, f64 |
| 528 | rounding of the sum. |
| 529 | |
| 530 | ## GB10 GPU training (rung 4) |
| 531 | |
| 532 | `ollm-gb10` is the `ollm_gb10` row of `train/units.tsv`: the aarch64 `ollm` with `native/gpu/` in |
| 533 | place of `nogpu.om`. `cli.om`'s `ocmd` offers each command word to `ogcmd` first (`gpu/gg.om` on |
| 534 | gb10, `nogpu.om` on the CPU targets), so no `main` is renamed. (Upstream `TARGET=gb10` renamed the |
| 535 | CPU `fn main` to `ocpumain` with `sed`; that composition no longer applies to these sources.) |
| 536 | `gk.om` (f32 GEMMs: 32×32 tiles as ids 0-7 plus the fused-epilogue |
| 537 | ids 25/26; 64×64 tiles as the even ids 40-54 plus the fused-epilogue ids 56/58, two slots each) and |
| 538 | `gr.om` (slots 9-24, with 12, 17 and 18 empty: embedding, RMS norm, column sums, causal softmax, |
| 539 | copy/zero, CE, the embedding-gradient CSR gather, the SQN sum of squares and ADAM) emit |
| 540 | SASS for sm_121 into a code image; `gg.om` plans |
| 541 | an arena, uploads, launches and reads back through `context.om`/`vector.om`/`launch.om`, vendored from |
| 542 | aien-dev/CUDApp dcba8bb8, on the raw NVIDIA driver. No CUDA runtime or toolkit is used to build or run |
| 543 | it; nvdisasm is a read-only oracle (`tests/omegallm/gpu-disasm.sh SLOT...`). |
| 544 | The `evidence/OMEGALLM/gpu-k*/run.sh` files are as-run window receipts with machine-local paths; the |
| 545 | reusable entry points are `tests/omegallm/build.sh` and `tests/omegallm/gpu-disasm.sh`. |
| 546 | |
| 547 | ```sh |
| 548 | B=../build/ollm-gb10 |
| 549 | $B gcmp CK DATA S # chip gradient vs CPU f64 ograd for batch S; GCMP PASS or exit 45 |
| 550 | $B gcmp2 CK DATA S # branch-conditioned parity (ReLU flips split out); GCMP2 PASS or exit 47 |
| 551 | $B gacmp CK DATA S # one step, on-chip f32 Adam vs CPU f64 oadam; GACMP PASS or exit 46 |
| 552 | $B gtrain CK TRAIN UNTIL EVERY # train with the chip gradient, Adam on the CPU |
| 553 | $B gtrainf CK TRAIN UNTIL EVERY # train with weights and Adam state resident on the chip |
| 554 | $B geval CK HELD W [MERGES] # eval's forward on the chip in f32; prints eval's E line |
| 555 | $B gprof CK TRAIN N # N gtrainf steps, nothing saved; GP id gx gy gz m n k wait_ns per launch of the last step |
| 556 | ``` |
| 557 | |
| 558 | Run them only inside a `spark-window`. The checkpoint format is unchanged, so CPU `eval`, `sample` and |
| 559 | `train` read what `gtrain`/`gtrainf` write. |
| 560 | |
| 561 | | What | Status | Receipt (`evidence/OMEGALLM/gpu/`) | |
| 562 | |---|---|---| |
| 563 | | chip gradient matches the CPU f64 gradient within γ_R = R·2^-24 | EXERCISED (GB10, non-quiet) | `gc-small.txt` rel 2.35e-7, `gc-night.txt` rel 1.614e-4 < 3.05e-4; mutant g FAIL rc 45 on both | |
| 564 | | on-chip Adam matches `oadam` above f32 weight rounding (resid < 2^-16) | EXERCISED (GB10, non-quiet) | `ga-small.txt` resid 2.34e-7, `ga-night.txt` resid 1.28e-7; mutant h FAIL rc 46 on the night checkpoint (step 1000); on the step-0 checkpoint mutant h is invisible by construction | |
| 565 | | `gtrain` 1750→9000 on the v1 night shape | EXERCISED (GB10, non-quiet) | `gtrain1-3.txt`, 0.235-0.248 s/step | |
| 566 | | `gtrainf` 0→9000, the whole v1 schedule | EXERCISED (GB10, non-quiet) | `gtrainf-0-9000.txt`, 483.8 s, 0.0538 s/step; trajectory within 1.14% of `gtrain` at every shared save point | |
| 567 | | held-out eval of both step-9000 checkpoints (CPU `eval`, W 4486) | EXERCISED | `eval9000-gtrain.txt` 1.824653 nats, 0.680680 bpb; `eval9000-gtrainf.txt` 1.826877 nats, 0.681510 bpb | |
| 568 | | rung 5 (V 4096, T 256, D 256, L 8, P 7,409,920, B 64): `gcmp` fails on ReLU branch flips; `gcmp2` passes | EXERCISED (GB10, non-quiet) | `../gpu-max/gc-max.txt` FAIL rc 45; `../gpu-max/gc2-max-s7.txt`, `gc2-max-s11.txt`, `gc2-night-s7.txt`, `gc2-small-s3.txt` PASS; mutants g, m, f FAIL rc 47 | |
| 569 | | rung 5 `gtrainf` 0→9000 | EXERCISED (GB10, non-quiet) | `../gpu-max/gtrainf-0-250.txt`, `gtrainf-250-9000.txt`: 0.3808 s/step, 43,023 tokens/s; mean batch loss of the last four saves 1.4978 nats | |
| 570 | | held-out eval of rung-5 steps 2000 and 9000 (CPU `eval`, W 2243 at T 256) | EXERCISED | `../gpu-max/eval2000.txt` 1.789590 nats, 0.667600 bpb; `../gpu-max/eval9000.txt` 1.445466 nats, 0.539226 bpb | |
| 571 | | CE kernel sum fix: the plain f32 sum of exp over V 4096 ran ~1.04e-5 low; Kahan sum in `grce` | EXERCISED (GB10, non-quiet) | `../geval/plain/gd-*.txt` before, `../geval/gd-*.txt` after; the rung-4 and rung-5 runs above trained with the plain sum | |
| 572 | | `geval` matches CPU `eval` within 10 µnats | EXERCISED (GB10, non-quiet) | `../geval/ge-night-gtrainf.txt`, `ge-night-gtrain.txt`, `ge-max-2000.txt`, `ge-max-9000.txt`: the CPU E lines exactly, 8.47 s of chip time for the step-9000 eval against 7323 s of CPU; mutant k (plain sum) Δ −11 FAIL; the first build failed the gate (`../geval/plain/`). `geval` has no loss gate and exits 0 whenever it completes (the mutant k receipts too); the 10 µnat gate is the E-line comparison against CPU `eval`, applied by the reviewer | |
| 573 | | rung 6 `gtrainf` 0→30000 at the rung-5 shape in 18 spark-windows, `geval` after every leg | EXERCISED (GB10, non-quiet) | `../gpu-r6/`: every leg and `geval` rc 0; 0.37712 s/step, 43,445 tokens/s; held-out loss fell at every leg to E 30000 2243 1338156 499194 (1.338156 nats, 0.499194 bpb); CPU `eval` of `ck30000` gives the same E line (`eval30000.txt`) | |
| 574 | | k1 kernels: one-warp softmax rows, split-K weight gradients, spin wait; product passes `gcmp2`, `gacmp`, `geval` | EXERCISED (GB10, non-quiet) | `../gpu-k1/`: `geval` of rung 5 `ck9000` and rung 6 `ck30000` give the earlier E lines exactly; mutants s, p FAIL rc 47; 200 steps 1.182× faster than the softmax-only build | |
| 575 | | k2: 64×64 f32 GEMM tile (slots 32-39) when m and n are multiples of 64 | EXERCISED (GB10, non-quiet) | `../gpu-k2/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant t FAIL rc 47; the checkpoint after 200 steps is bit-identical to k1's; 200 steps 1.061× faster than k1, GEMM wait −17.45% | |
| 576 | | k3: RMS norm kernels (ids 10, 11) one warp per row, coalesced, single pass | EXERCISED (GB10, non-quiet) | `../gpu-k3/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant r FAIL rc 47 (small and max); RMS kernels 2.50× and 2.47× faster in the profile; 200 steps 1.058× faster than k2 in the same window | |
| 577 | | k4: cross-entropy kernel (id 21) one warp per row, coalesced, no stored e (3 reads + 1 write) | EXERCISED (GB10, non-quiet) | `../gpu-k4/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant x FAIL rc 47 (small and max) and `geval` Δ −362083 µnats; `grce` 3.68× faster in the profile; 200 steps 1.041× faster than k3 in the same window | |
| 578 | | k5: causal attention GEMMs (ids 0, 1, 35 at batch 512) skip blocks and K tiles above the diagonal via arg words; `grsoftb` masks dp above it | EXERCISED (GB10, non-quiet) | `../gpu-k5/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant q FAIL rc 47 (small and max); the checkpoint after 200 steps is bit-identical to k4's; the three attention GEMMs 1.35×, 1.52×, 1.42× faster in the profile; 200 steps 1.059× faster than k4 in the same window | |
| 579 | | k6: softmax kernels (ids 15, 16) load and store only the causal chunks of each row (predicated `LDG`/`STG`); `gkisge` predicate-field fix | EXERCISED (GB10, non-quiet) | `../gpu-k6/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant w FAIL rc 47 (max; at the small shape its code equals the product's); the checkpoint after 200 steps is bit-identical to k5's; `grsoftf` 1.64× and `grsoftb` 1.68× faster in the profile; 200 steps 1.053× faster than k5 in the same window | |
| 580 | | k7: GEMM FFMAs (ids 0-7, 32-39) carry Ra operand reuse with control bit 109; accumulator columns remapped (j xor 1) off the b registers' banks | EXERCISED (GB10, non-quiet) | `../gpu-k7/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant t FAIL rc 47 (small and max); the checkpoint after 200 steps is bit-identical to k6's; 64×64 GEMM wait 0.918× of k6's in the profile, all from reuse (remap-only variant r0 0.989×, inside the k6 spread); 200 steps 1.034× faster than k6 in the same window | |
| 581 | | k7b: the accumulator remap removed (`OKBNK`, `gkcol`, variant b0); Ra reuse with bit 109 kept, GPU code byte-equal to k7's reuse-only variant | EXERCISED (GB10, non-quiet) | `../gpu-k7b/`: `gcmp2`, `gacmp`, both `geval` E lines exact; mutant t FAIL rc 47 (small and max); the checkpoint after 200 steps is bit-identical to k6's and k7's; GEMM wait 0.955× of k6's over three rotated profile rounds (k7 0.934×, max k7b below min k6); 200 steps 1.0457× faster than k6 and equal to k7 (1.0003) in the same window | |
| 582 | | k8: 64×64 GEMM K loop double-buffered (ids 40-54, two slots each, `gkgpr` 168); QMD word 36 TARGET sized per kernel by `gksmw` (Mesa NAK policy); `gpu-disasm.sh` GPR guard (`gkgpr` ≥ highest GPR + 3) | EXERCISED (GB10, non-quiet) | `../gpu-k8/`: three windows kept. a1 hung (R158 under `gkgpr` 160); a2 bit-identical but 1.12× slower GEMM wait (NULL); a3 (new prereg): `gcmp2`, `gacmp`, both `geval` E lines exact, mutant t FAIL rc 47 (small and max), the checkpoint after 200 steps bit-identical to k7b's; 64×64 wait 0.913× of k7b's kernel under the same TARGET rule (max k8 below min k7b every round); GEMM wait 0.914×, 200 steps 0.969× of k7b's wall in the same window | |
| 583 | | k9: ReLU fused into the FFN GEMM epilogues (ep 1 ids 25/56 store FP and relu(FP); ep 2 ids 26/58 mask dF by FP > 0); `gr.om` RELUF/RELUB (ids 17/18) removed; `gkope` arms the next `gkmm`, `gkepok` refuses any other combination (-22); mutant m moves to the ep 2 threshold | EXERCISED (GB10, non-quiet) | `../gpu-k9/`: `gcmp2` (small, max, and an odd shape F = 96 on the 32×32 ids 25/26), `gacmp`, both `geval` E lines exact; mutant t FAIL rc 47 (small and max), mutant m FAIL rc 47 (small, max, odd); the checkpoint after 200 steps bit-identical to k8's; 48 fewer launches per profile (3 steps); summed GPU wait 0.924× of k8's (144.56 → 133.54 ms/step, max k9 below min k8 every round); 200 steps 0.942× of k8's wall in the same window | |
| 584 | | rung 7: the v2 shape (D 384, F 1536, H 12, P 15,833,472) `gtrainf` 0→30000 on rung 6's data, seed and schedule in 12 spark-windows, `geval` after every leg | EXERCISED (GB10, non-quiet) | `../gpu-r7/`: every leg and `geval` rc 0; chip `geval` E 30000 2243 1254741 468077 (1.254741 nats, rung 6 1.338156); CPU `eval` of `ck30000` (P5) prints the identical E line (`run/eval30000.txt`) | |
| 585 | |
| 586 | The γ_R gate, the ReLU kink cases that the night shape exposes, the Adam residual, the windows and all |
| 587 | timings are in `evidence/OMEGALLM/gpu/README.md`. Not QUALIFIED: no quiet-machine timing, one chip, and |
| 588 | a bitwise comparison with the CPU path is not expected (f32 against f64). |