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 / ecosystem5 / CONTRACT.md
| 1 | # PACK5 v1: bounded public-example packing |
| 2 | |
| 3 | This implements one component of aien-train5 and train3: integer token packing, |
| 4 | next-token labels, supervised-target masks and causal attention boundaries. |
| 5 | It consumes existing native public-example admission, retaining those owners. |
| 6 | No tokenizer, dataset reader, numerical tensor engine, model training loop, |
| 7 | worker runtime, durable cursor or checkpoint format is implemented here. |
| 8 | |
| 9 | ## Frozen dependencies and caller |
| 10 | |
| 11 | Compose these exact source files, in order, followed by a caller: |
| 12 | |
| 13 | 1. Omega L775 commit `84d03c5523f39ca1045d1c313c5f62597779462b`, |
| 14 | `src/learning/benchmark/core.om`, SHA256 |
| 15 | `a5a2e74c815f9ca6a90dbdfbfc7ecc343f0362c824064f2058e9d1d7c119c40c`. |
| 16 | 2. Omega L776 commit `d8d14c47647e49774f64b58e3c138335656f175d`, |
| 17 | `src/learning/curriculum/admit.om`, SHA256 |
| 18 | `533638a9f128853d696644de2bbf7b1859797b170a7e32e54c112ab94c3dadb1`. |
| 19 | 3. `native/ecosystem5/pack.om`. |
| 20 | |
| 21 | L776 published head is `1a14972c3b2d7494ba445df79967e7963359230e`. |
| 22 | The native compiler SHA256 is |
| 23 | `191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`, |
| 24 | independently rebuilt from omega-bridge |
| 25 | `0fc7d8662cb799e7c206b17c18ea4c3ec2b8fea9` by the compiler qualification lane. |
| 26 | The compilation target is static AArch64 Linux. No foreign runtime is linked. |
| 27 | |
| 28 | Callers first use existing `cbegin`, `csubmit` and `cfinish`. Only successful |
| 29 | completed admission with `CState[2]=1` and `LS[18]=1` may be consumed. `CGood` |
| 30 | is the accepted index list in submission order; `CFreeze` is its manifest |
| 31 | snapshot. Quarantined records never enter a packed sequence. Live `LT` changes |
| 32 | after admission cannot alter the consumed frozen split. |
| 33 | |
| 34 | These are trusted, single-thread, in-process arrays. The caller must preserve |
| 35 | the owner modules' state and supply measured identities and tokenization. |
| 36 | Public mutable arrays do not authenticate an attacker or prevent concurrent |
| 37 | mutation. Checking a supplied digest does not prove its contents. Existing |
| 38 | custody, tokenizer and execution owners retain those duties. |
| 39 | |
| 40 | ## Inputs |
| 41 | |
| 42 | `DPCfg[4]` holds schema1, vocabulary size1..4294967296, split1(train) or2(dev), |
| 43 | and padding token ID less than vocabulary size. Every accepted record must |
| 44 | belong to the requested split. Mixed accepted train/dev batches are refused. |
| 45 | Protected adaptive/final records are already refused by L775. |
| 46 | |
| 47 | `DPPin[16]` holds expected tokenizer SHA256 words0..3, observed tokenizer words4..7, |
| 48 | expected template SHA256 words8..11 and observed template words12..15. Every |
| 49 | identity has four big-endian u64 words representing all32 digest bytes. Both |
| 50 | expected identities must be nonzero and must match all observed words. They |
| 51 | may equal one another; no cryptographic independence is inferred. There is no |
| 52 | identity measurement or hashing implementation in this module. |
| 53 | |
| 54 | For accepted task slot `t`, `DPLen[t]` is1..256 and `DPPrompt[t]` is0..DPLen[t]. |
| 55 | `DPToken[t*256+j]` is token ID `j`, strictly below vocabulary size. Token zero |
| 56 | is legal. Prompt length counts prefix tokens excluded as prediction targets. |
| 57 | All-prompt examples are valid and contribute no supervised targets. Records |
| 58 | of length1 are valid and contribute no next-token targets. Empty records are |
| 59 | refused. Length/prompt entries for all quarantined or absent slots must be0; |
| 60 | unused token-array cells are ignored. Maximum64 admitted records and256 total |
| 61 | packed token positions. Oversized batches are refused, never truncated. |
| 62 | |
| 63 | ## Results and failures |
| 64 | |
| 65 | `dppack()->ulong` validates the entire input before changing payload arrays. |
| 66 | It clears `DPState[ready,count,records]` at entry. Failure leaves every payload |
| 67 | cell unchanged but invalid, and `dpattend` returns false until a later success. |
| 68 | Do not consume payloads without `DPState[0]=1`. |
| 69 | |
| 70 | On success, accepted records are copied in `CGood` order. `DPOut[256]` contains |
| 71 | token IDs; `DPTask[256]` holds original task slots; `DPPos[256]` holds positions |
| 72 | within each record. `DPState[1]` is the actual packed count; `DPState[2]` counts |
| 73 | records. An all-quarantined completed admission yields a valid empty batch. |
| 74 | |
| 75 | For position `p` within a record, `DPLabel[p]` is that record's next token when |
| 76 | one exists. `DPMask[p]=1` exactly when the next token exists and its within-record |
| 77 | index is at least the prompt length. Thus the last prompt token may predict |
| 78 | the first completion token, and no final record token predicts the next record. |
| 79 | Prompt-only labels may remain populated but must be ignored when mask0. This |
| 80 | is an integer supervision mask, not a loss computation. |
| 81 | |
| 82 | Unused output positions contain the configured padding token in output and |
| 83 | label, mask0, task sentinel18446744073709551615 and position0. Physical padding |
| 84 | IDs inside a real record are ordinary tokens; only explicit record length |
| 85 | defines padding. No special-token semantic is guessed. |
| 86 | |
| 87 | `dpattend(q,k)->bool` returns true only for valid packed positions in the same |
| 88 | record with k<=q. Padding and out-of-range indices, including maximumu64, |
| 89 | return false. Helpers `dpvalidate`, `dpinput` and `dpcopy` are internal and do |
| 90 | not independently provide a safe publication API; call `dppack`. |
| 91 | |
| 92 | | Code | Meaning | |
| 93 | | --- | --- | |
| 94 | | 0 | Valid packed batch | |
| 95 | | 70 | Admission incomplete, invalid or active | |
| 96 | | 71 | Schema, vocabulary, partition or padding configuration invalid | |
| 97 | | 72 | Zero or mismatched supplied tokenizer/template identity | |
| 98 | | 73 | Invalid/duplicate accepted index, inconsistent membership, or tokens declared for nonaccepted slot | |
| 99 | | 74 | Invalid record or prompt length | |
| 100 | | 75 | Token ID outside the declared vocabulary | |
| 101 | | 76 | Total packed capacity exceeded | |
| 102 | | 77 | Accepted record belongs to another partition | |
| 103 | |
| 104 | ## Qualification and remaining work |
| 105 | |
| 106 | The native author suite drives actual owner admission and passes282622 checks. |
| 107 | Its independent coordinate oracle enumerates196 two-record layouts and their |
| 108 | prompt boundaries, verifies targets and padding, and compares every attention |
| 109 | pair with separately defined partition intervals and a lower triangle. Direct |
| 110 | controls cover readiness, identities, malformed records, mixed partitions, |
| 111 | quarantine, reverse submission order, full capacity and64 records. Three |
| 112 | compiled mutants invert supervision, remove record attention isolation and |
| 113 | bypass partition refusal; they fail checks5163,19 and263254 respectively. |
| 114 | |
| 115 | Independent final-source review of088258d passed84378 additional native checks, |
| 116 | reproduced the original282622-check binary, and caught all three compiled |
| 117 | mutants with a separate caller. The full report is preserved under |
| 118 | `evidence/ECOSYSTEM5/independent-review/`. This slice |
| 119 | does not establish tokenizer parity, actual data-source authentication, |
| 120 | shuffling/resume, durable checkpoint recovery, model quality or physical GPU |
| 121 | results. All these remain assigned to train3/5/6 and their existing owners. |
| 122 | No prior first-party implementation or runtime dependency can be retired from |
| 123 | this additive component alone. The complete replacement issues stay open. |