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 / si19 / ORIG1-CONTRACT.md
| 1 | # ORIG-1: original mini-model selector task and owner-controlled experience dataset |
| 2 | |
| 3 | aien-train#24, child of #19. Frozen before any ORIG-2 training. A change to any |
| 4 | numbered rule below is a new contract version, never an edit of this one. |
| 5 | |
| 6 | Status words used here: PASS, FAIL, INCONCLUSIVE, NOT_RUN, BLOCKED. Host-only |
| 7 | results are development results, never hardware qualification. |
| 8 | |
| 9 | ## 1. The consumer (pinned) |
| 10 | |
| 11 | | item | identity | |
| 12 | |---|---| |
| 13 | | consumer | the Omega empirical cost model's matvec realization choice, `rx_cm_decide` in `src/runtime/rx_costmodel.{c,h}`, exercised by `tests/runtime/rx_empirical_optimizer.c` (`make test-empirical`) | |
| 14 | | repository, revision | aien-dev/omega-mv `18c653b3101fa09c157dca8d222efab41ab5e89d` (main, 2026-10-25); the consumer files are byte-identical to `a0eafa39` | |
| 15 | | record tap | `tests/runtime/rx_empirical_optimizer.c` at `1ec813726aef5f5abf8ab449c5d8bd9738f88d2e` (branch `feat/731-orig4-shadow-advice`): `OMEGA_EMPIRICAL_RECORDS=<path>` appends one record per cost table; default off; nothing in the consumer reads it. Since omega-mv `03057d27` the variable names a descriptor instead: `OMEGA_EMPIRICAL_RECORDS=<fd>` with fd 3..1023 open for append on a regular file (e.g. `3>>records.bin`); anything else turns the tap off (omega-mv `spec/shadow-advice-v0.md`) | |
| 16 | | admissible-candidate generator | the consumer's `eligible` bit mask: an arm is admissible only when its forked differential verification passed (`g_verified`) and the caller allows it. The reference arm (0) is always admissible | |
| 17 | | transformation family | integer matvec `y = A x` realizations on one AArch64 core: 0 `reference` (compiled), 1 `scalar`, 2 `unroll2`, 3 `unroll4_dual` (M12 emitters), 4 `quad4` (R10), 5 `planted_wrong` (never admissible). Cap: 8 arms (`RX_CM_ARMS`) | |
| 18 | | incumbent planner | `omega_matvec_dispatch`'s fixed rule: `unroll2` when N <= 8, else `unroll4_dual` | |
| 19 | | verifier | every timed run's output digest equals the reference digest for that job (`time_arm`); a table with any mismatch is ineligible | |
| 20 | | cost | picoseconds per call, best of 5 rounds per arm, rotating order (`truth_table`) | |
| 21 | | hardware profile | DGX Spark host: `Linux 7.0.0-1019-nvidia aarch64`; core classes from MIDR: 0 Cortex-X925 (last private cache 2097152 B), 1 Cortex-A725 (524288 B), 2 other (1048576 B) | |
| 22 | | compiler for the .om side | seeded `omc` sha256 `191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9` (the pin of `docs/si19/dependencies.json`, R5b, source omega-mv `29b12760`); the R6 compiler `734f0a39...6b61` (omega-mv main `seed/out/omc`) must also compile every unit unchanged | |
| 23 | |
| 24 | The scorer ranks the admissible arms of one decision. It never proposes an arm, |
| 25 | never widens `eligible`, and has no execution authority: deterministic code |
| 26 | generates, verifies, selects and runs. |
| 27 | |
| 28 | ## 2. Record format `omexp-v1` |
| 29 | |
| 30 | One record is 32 little-endian 64-bit words (256 bytes). A file is a whole |
| 31 | number of records, at most 2048. |
| 32 | |
| 33 | | word | field | rule | |
| 34 | |---|---|---| |
| 35 | | 0 | magic | 3553143591248351811 (`0x314f4d4558505243`) | |
| 36 | | 1 | version | 1 | |
| 37 | | 2 | family | 0 train grid, 1 validation grid, 2 H1 unseen shapes, 3 H2 thin-heavy mix, 4 H3 = H1 shapes under memory pressure | |
| 38 | | 3 | core class | 0, 1 or 2 | |
| 39 | | 4 | pressure bucket | 0..15; the consumer uses 0 and 1 | |
| 40 | | 5, 6 | M, N | 1..8192 each | |
| 41 | | 7 | calls | timed calls per measurement, >= 1 | |
| 42 | | 8 | job seed | the consumer's job seed (operands are regenerated from it) | |
| 43 | | 9 | state bytes | (M*N + M + N) * 8 | |
| 44 | | 10 | cache bytes | must equal the class value of section 1 (profile check) | |
| 45 | | 11 | thermal C | recorded, never a feature | |
| 46 | | 12 | eligible mask | bit 0 must be set; no bit at or above the arm count | |
| 47 | | 13 | arm count | 1..8 | |
| 48 | | 14 | sequence | strictly increasing within a file | |
| 49 | | 15 | monotonic ns | recorded, never a feature | |
| 50 | | 16..23 | ps per call, arm 0..7 | 0 = not measured; an eligible arm must be measured | |
| 51 | | 24..31 | per arm verified flag (24..29), reference digest (30), mismatches (31) | word 31 must be 0 | |
| 52 | |
| 53 | A decision instance is one record: the state is words 2..13, the candidates |
| 54 | are the arms whose eligible bit, measurement and verified flag are all set. |
| 55 | Incorrect results are ineligible (word 31 != 0 refuses the record). An |
| 56 | unmeasured cost is unknown (0), never a fabricated number. |
| 57 | |
| 58 | ## 3. Typed features (frozen) |
| 59 | |
| 60 | All quantities are integers in 1/16 units, converted to binary32 exactly with |
| 61 | `wmbits n 4`. `lg16 v` for v >= 1 with bit length L and e = L - 1 is |
| 62 | `(v << 4 >> e) + 16 (e - 1)`: floor(log2 v) plus a truncated 4-bit fraction. |
| 63 | |
| 64 | State vector x (12): |
| 65 | |
| 66 | | j | value | note | |
| 67 | |---|---|---| |
| 68 | | 0 | 16 | constant 1 (bias) | |
| 69 | | 1 | lg16 M | | |
| 70 | | 2 | lg16 N | | |
| 71 | | 3 | (lg16 M * lg16 N) >> 8 | log2 M * log2 N / 16 | |
| 72 | | 4 | (lg16 N * lg16 N) >> 8 | (log2 N)^2 / 16 | |
| 73 | | 5 | 16 if N <= 3 else 0 | | |
| 74 | | 6 | 16 if N rem 4 != 0 else 0 | | |
| 75 | | 7 | max(0, lg16 state_bytes - lg16 cache_bytes), capped at 256 | doublings past the private cache | |
| 76 | | 8, 9, 10 | 16 for the matching core class 0, 1, 2 | one hot | |
| 77 | | 11 | 16 * min(pressure, 15) | | |
| 78 | |
| 79 | Candidate vector c (8): 16 at the arm's index, 0 elsewhere. The model input is |
| 80 | x (affine: per arm) or x concatenated with c (nonlinear). Thermal state, calls, |
| 81 | seed, sequence and time are never features. These are the consumer's own |
| 82 | basis (spec/empirical-optimizer.md, "Features and targets") plus core and |
| 83 | pressure as inputs instead of cells. |
| 84 | |
| 85 | ## 4. Target and objective (frozen) |
| 86 | |
| 87 | Per (record, admissible arm a): `t16 = lg16 ps_a - lg16 ps_0`, the cost of the |
| 88 | arm relative to the always-admissible reference, in 1/16 log2 units. The |
| 89 | reference anchors the scale, and argmin over arms of t16 is argmin of ps. |
| 90 | |
| 91 | Normalization is fitted on the TRAIN partition only: `mu16` = floor of the mean |
| 92 | of t16 over train pairs; `sh` = max(0, bitlen(s16) - 5) where s16 is the |
| 93 | integer square root of the mean of (t16 - mu16)^2. The learning target is |
| 94 | `y = (t16 - mu16) / 2^(4 + sh)` as binary32, exact while |t16 - mu16| < 2^24. |
| 95 | The predicted score is in the same units; selection is the arm with the |
| 96 | smallest score among admissible arms, lowest index on a tie. The loss is the |
| 97 | squared error of the score against y, summed over the admissible arms of a |
| 98 | record and averaged over records. |
| 99 | |
| 100 | ## 5. Provenance, authorization, privacy |
| 101 | |
| 102 | - Random initialization only. No pretrained weights, teacher outputs or logits, |
| 103 | distilled answers, external model traces, or pretrained tokenizer anywhere in |
| 104 | the primary arm. The test `tprovenance` fails if the checkpoint image carries |
| 105 | any lineage word other than the declared seed and the admitted dataset hash. |
| 106 | - A dataset file is admitted only when its FNV-1a 64 over all bytes appears in |
| 107 | `docs/si19/orig1-datasets.txt` with status `AUTHORIZED` (owner measurement) or |
| 108 | `SYNTHETIC` (project fixture). `REVOKED` refuses; an absent hash refuses. |
| 109 | The list is public and holds hashes only. |
| 110 | - The owner dataset stays local: `~/.local/state/aien-train/orig1/` on the |
| 111 | Spark (mode 0600). Public artifacts carry its hash, record counts and the |
| 112 | receipts of runs over it, never the bytes. Releasing it is a separate owner |
| 113 | decision; it holds no personal data (hardware timings of a public harness). |
| 114 | - Synthetic fixture: `native/si19/omexpfix.om` writes a labelled SYNTHETIC |
| 115 | record file from a seeded generator with a planted cost structure. Fixture |
| 116 | evidence and real-record evidence are reported under separate headings and |
| 117 | never mixed in one number. |
| 118 | |
| 119 | ## 6. Splits (frozen, by family and shape lineage) |
| 120 | |
| 121 | | partition | families | lineage rule | |
| 122 | |---|---|---| |
| 123 | | TRAIN | 0 | the consumer's training grid, M in {1,4,16,64,256,1024}, N in {1,2,3,5,8,12,16,33,64,100,256,512,1024}; two timing passes of each shape stay together | |
| 124 | | DEV | 1 | validation grid, M in {2,8,32,128,512}, N in {4,6,10,24,48,200,700}: no M or N value shared with TRAIN | |
| 125 | | TEST-H1 | 2 | 60 log-uniform shapes per core with no M or N value seen in TRAIN or DEV | |
| 126 | | TEST-H2 | 3 | thin-heavy mix: unseen M values; 70% reuse TRAIN N values in 1..7 (declared partial lineage overlap) | |
| 127 | | TEST-H3 | 4 | the H1 shapes under memory pressure, a condition absent from TRAIN and DEV (out-of-distribution) | |
| 128 | |
| 129 | The loader refuses a file in which any TEST-H1 (M, N) key also appears in |
| 130 | TRAIN or DEV (future/held-out contamination). The trainer admits only TRAIN |
| 131 | records; DEV is used for the lr choice and early stopping; TEST is read only |
| 132 | by the evaluation mode after the checkpoint is final. There is no sealed |
| 133 | judge-held holdout on this machine: every TEST number here is |
| 134 | development-only. ORIG-3 obtains a sealed test set by running the tap again |
| 135 | after the candidate checkpoint is frozen (the records do not exist at training |
| 136 | time), which is the only sealing available without an independent operator. |
| 137 | |
| 138 | ## 7. Baselines (frozen) |
| 139 | |
| 140 | | name | choice | |
| 141 | |---|---| |
| 142 | | fixed rule (incumbent) | arm 2 when N <= 8 else arm 3, if admissible, else arm 0 | |
| 143 | | always reference | arm 0 | |
| 144 | | best static | the single arm with the lowest total TRAIN cost for that core class | |
| 145 | | retrieval | the TRAIN record of the same core class nearest in (lg16 M, lg16 N) by L1 distance (lowest sequence on a tie); choose its cheapest admissible arm | |
| 146 | | affine | per-arm linear scorer on x (8 x 12 = 96 parameters), trained as in ORIG-2 | |
| 147 | | oracle | the cheapest admissible arm of the record (analysis bound only) | |
| 148 | | controls | untrained scorer (declared init), shuffled targets (t16 permuted among train pairs by the trainer RNG), no-update run (lr = 0; parameters must stay bit-identical) | |
| 149 | |
| 150 | Metric: total chosen cost over oracle cost, sum of ps per call over the |
| 151 | partition's records (unweighted by calls), per core class and overall; top-1 |
| 152 | agreement with the oracle; paired per-record wins and losses against each |
| 153 | baseline. |
| 154 | |
| 155 | ## 8. Budgets and stop rules (predeclared) |
| 156 | |
| 157 | | item | limit | |
| 158 | |---|---| |
| 159 | | seeds | trainer 19024; init from the same LCG as `wsrand` | |
| 160 | | nonlinear model | at most 100000 trainable parameters (engineering budget, not an optimum); ORIG-2's first model is 705 | |
| 161 | | learning rate | one of 2^-8, 2^-10, 2^-12 chosen on DEV loss; nothing is chosen on TEST | |
| 162 | | epochs | at most 64 full passes over TRAIN, per-record order from the trainer RNG; stop early when DEV loss has not improved for 16 epochs | |
| 163 | | updates | at most 2^20 | |
| 164 | | data | at most 2048 records per file; at most one owner dataset per run | |
| 165 | | memory | program image under 16 MiB; checkpoint under 64 KiB | |
| 166 | | wall | compile + tests + one training run under 30 minutes on the host | |
| 167 | | failed experiments | counted in the evidence README; a failed or inconclusive run is kept | |
| 168 | |
| 169 | A hardware (GB10) run is not part of ORIG-1 or ORIG-2: NOT_RUN. Any later |
| 170 | Spark experiment needs an exclusive reservation and never loads a second model |
| 171 | beside the resident service. |
| 172 | |
| 173 | ## 9. Acceptance mapping |
| 174 | |
| 175 | | #24 acceptance | where | |
| 176 | |---|---| |
| 177 | | versioned manifest, exact identities | `docs/si19/orig1-manifest.json`, this file | |
| 178 | | provenance tests | `tests/si19/omexp-test.om` `tprovenance`, `tallow` | |
| 179 | | refusal tests: revoked, unauthorized, corrupt, duplicate, wrong profile, contaminated | `tests/si19/omexp-test.om` `trefuse*` | |
| 180 | | family/episode isolation, holdout boundary testable | `tsplit`, `tleak` | |
| 181 | | baselines, units, fixture vs real, stop rules explicit | sections 4, 7, 8 | |
| 182 | | consent-safe dataset local, public fixtures synthetic | section 5 | |
| 183 | | missing real experience or sealed holdout = BLOCKED/development-only | section 6; receipts say `development-only` | |