aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / docs / omegese45 / CORE-CLI.md
| 1 | # omegese45 core CLI (`oe45core`, `oe45gen`) |
| 2 | |
| 3 | Pipeline lane of [aien-train#45](https://github.com/aien-dev/aien-train/issues/45). The vocabulary, |
| 4 | grammar and exit codes are fixed by the shared interface (R45, 41 ids; `docs/omegese45/vocab.tsv` |
| 5 | sha256 `c1d7e15466e6585a776314c5c05f35466b2697d9631ad2e11c7918a434a4c18d`). This page documents only |
| 6 | the command line of the two binaries built from `native/omegese45/{data,core}/`. |
| 7 | Training and model details are in [PIPELINE.md](PIPELINE.md). |
| 8 | |
| 9 | ## Build |
| 10 | |
| 11 | ```sh |
| 12 | OMC=/path/to/omega-mv/seed/out/omc OMEGA=/path/to/omega-mv OUT=out sh tests/omegese45/core/build.sh |
| 13 | ``` |
| 14 | |
| 15 | `build.sh` checks the omc sha256 and extracts the SHA-256 unit at the pins recorded in |
| 16 | `native/omegese45/core/dependencies.json`. It prints `BUILD_OK` and writes `out/oe45gen`, `out/oe45core`, |
| 17 | `out/oe45test` (the test driver) and `out/oe45mut` (the fault injector). All four are static aarch64 ELF files |
| 18 | produced by omc bf54b19f (sha256 `62775d2a…f3712b`). The unit order is: |
| 19 | SHA unit, `vocab.om`, `msg.om`, `core/model.om`, `core/ckpt.om`, `core/run.om`, then `core/cli.om` |
| 20 | (or `tests/omegese45/core/main.om` for the driver). |
| 21 | |
| 22 | ## `oe45gen SEED COUNT OUT.oe45 OUT.ids` |
| 23 | |
| 24 | Generates COUNT (1..40000) episodes by the reference policy. The only source of randomness is |
| 25 | splitmix64 seeded with SEED. |
| 26 | |
| 27 | - `OUT.oe45` is OE45 v1 text. Each episode is a line `oe45 v1` followed by one message per line. |
| 28 | - `OUT.ids` holds one record per episode: one byte L (1..176), then the L ids, one byte each. |
| 29 | - stdout is one line, `oe45gen v1 SEED COUNT` followed by 26 counters, in this order: |
| 30 | - `mm pair oob retry stop okep`; |
| 31 | - the dimension edges `e000 e001 e100 e101`; |
| 32 | - refused × `replay budget worker transport receipt recomp verdict io`; |
| 33 | - fail × `replay budget worker transport receipt recomp verdict io`. |
| 34 | - Exit codes: 0 ok, 2 usage, 40 a generated message failed the contract validator (a generator defect), 70 I/O. |
| 35 | |
| 36 | The issue #45 data comes from `oe45gen 4501 20000` (train) and `oe45gen 4502 1000` (dev). |
| 37 | |
| 38 | ## `oe45core` |
| 39 | |
| 40 | | Command | Effect | stdout | |
| 41 | |---|---|---| |
| 42 | | `init CKDIR TRAIN.ids SEED P1 TOTAL ORDER LRSH` | Writes the step-0 checkpoint (generation 1, slot `ck.a`) bound to `sha256(TRAIN.ids)`. The learning rate is 2^-LRSH; P1 is the length of phase 1 in steps and TOTAL the total number of steps; ORDER seeds the epoch order. | nothing | |
| 43 | | `train CKDIR TRAIN.ids UNTIL EVERY` | Loads the newest valid slot and trains to step min(UNTIL, TOTAL), saving every EVERY steps and at the end. If `sha256(TRAIN.ids)` differs from the binding, exits 54. | `T step phase loss-bits positions` at each save | |
| 44 | | `evaldev CKDIR DEV.ids` | Computes the dev metrics. | `D step episodes positions correct messages exactU exactG` | |
| 45 | | `decode CKDIR U\|G EPFILE` | Decodes the next message after the prefix in EPFILE. | the message words, one line | |
| 46 | | `batch CKDIR U\|G IN OUT` | Decodes every prefix in IN (prefixes are concatenated, each starting at an `oe45 v1` line). | nothing; writes OUT | |
| 47 | | `info CKDIR` | Prints the header of the loaded slot. | `I slot seed step generation P1 total order lrbits algo payload-sha vocab-pin data-sha` | |
| 48 | |
| 49 | Decode modes: |
| 50 | |
| 51 | - `U` is unguided: argmax over all 41 ids until `end`. The message is then checked with the contract |
| 52 | validator, and an invalid message exits 50. |
| 53 | - `G` is guided: at each step the argmax is restricted to ids the grammar allows (`ocmask`), so the |
| 54 | message is valid by construction. |
| 55 | - Both modes stop at the decode budget of 31 ids. Exceeding the budget exits 53 and writes nothing to |
| 56 | stdout. |
| 57 | |
| 58 | A prefix must be OE45 v1 text whose messages are each valid and appear in the order `G (A R)*`, or |
| 59 | `G` followed by one final `act refuse C end` (interface §3: a refuse comes only right after G and gets |
| 60 | no R; its P is the message decoded next). So a prefix ends in a G, an R, or that refuse A. A refuse |
| 61 | after an R, or any message after the refuse, makes the prefix invalid and exits 40. |
| 62 | |
| 63 | Each `batch` OUT line is one of: |
| 64 | |
| 65 | - `ok <message>`; |
| 66 | - `err 50 <words>`, the invalid unguided message; |
| 67 | - `err 53 <words>`, the 31 ids emitted before the decode budget ran out; |
| 68 | - `40` (the bare code, no `err`) for an invalid prefix. |
| 69 | |
| 70 | Exit codes: |
| 71 | |
| 72 | | Code | Meaning | |
| 73 | |---|---| |
| 74 | | 0 | ok | |
| 75 | | 2 | usage, or a malformed data file | |
| 76 | | 40 | invalid prefix | |
| 77 | | 50 | DECODE_INVALID | |
| 78 | | 51 | CKPT_REFUSED (no structurally valid slot) | |
| 79 | | 52 | CKPT_VOCAB (the newest valid slot has a different vocab pin) | |
| 80 | | 53 | DECODE_BUDGET | |
| 81 | | 54 | training data differs from the checkpoint binding | |
| 82 | | 70 | file I/O | |
| 83 | |
| 84 | ## Checkpoint `OE45CK01` |
| 85 | |
| 86 | There are two slots, `CKDIR/ck.a` and `CKDIR/ck.b`, each 3,989,908 bytes: a 240-byte header followed by |
| 87 | 997,417 binary32 parameters. Every save writes generation g = loaded + 1, to `ck.a` when g is odd and to |
| 88 | `ck.b` when g is even, then calls fsync. The newest valid slot is therefore never the one being |
| 89 | written. A load takes the structurally valid slot with the highest generation, checking: |
| 90 | |
| 91 | - size, magic, the architecture words and the payload length; |
| 92 | - the header digest and the payload digest. |
| 93 | |
| 94 | The full layout is in the header comment of `native/omegese45/core/ckpt.om`. The suite exercises each |
| 95 | of these behaviors in `tests/omegese45/core/run-core.sh`, section 7: |
| 96 | |
| 97 | - fallback when the newest slot is corrupt or truncated; |
| 98 | - 51 when both slots are corrupt or the directory is empty; |
| 99 | - 52 on a wrong vocab pin. |
| 100 | |
| 101 | ## Tests |
| 102 | |
| 103 | ```sh |
| 104 | OMC=… OMEGA=… OUT=/tmp/oe45core-suite sh tests/omegese45/core/run-core.sh # last line OE45_CORE_PASS |
| 105 | ``` |
| 106 | |
| 107 | The receipt is under [`evidence/OMEGESE45/pipeline/`](../../evidence/OMEGESE45/pipeline/). |