Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-train/blob/main/docs/ecosystem6/CONTRACT.md # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / docs / ecosystem6 / CONTRACT.md` 94 lines ยท 5901 bytes Raw Blame History Rendered 1 # Bounded native affine numerical consumer 2 3 This is an executable prerequisite for aien-train#6 and Omega#663/#664, not a 4 general trainer, automatic differentiation system, completed ecosystem M1 or 5 production consumer cutover. It reuses the existing L720 arithmetic and M20 6 metadata implementations. Their owners remain unchanged. L491 retains trainer 7 ownership. No compiler, runtime, model, GPU or service was changed. 8 9 `native/ecosystem6/affine.om` executes actual IEEE binary32 operations through 10 the external L720 `add32` and `mul32`. Inputs, intermediate results, gradients 11 and updated parameters are binary32 bit patterns held in ulong cells. These 12 carriers are not a new byte-addressed tensor allocator. Descriptor dtype1 means 13 the arithmetic value format; storage remains the declared fixed local carriers. 14 No foreign floating runtime, language wrapper or fixed-point product path is used. 15 16 The fixed graph has X[2,3], W[3,2], b[2], T[2,2]. It computes Y=XW+b and 17 L=sum((Y-T)^2), then dX, dW and db from the original W, followed by 18 W'=W-lr*dW and b'=b-lr*db. Each scalar multiply and addition rounds separately 19 to nearest, ties to even. This is not fused multiply-add. Reduction order is 20 the source's ascending row, column and inner-dimension order. The loss and 21 gradients describe the pre-update parameters. This explicit derivative is a 22 vector-Jacobian product for one fixed graph, not a general differentiation tape. 23 24 The eight slots X,W,b,T,Y,dX,dW,db occupy `AP[t*16+i]`. `AD[t*24+i]` contains 25 the M20 metadata-v1 descriptor and `AS[t*8+i]` its trusted allocator snapshot. 26 The consumer validates each with existing `emcheck`, then requires dtype1, 27 offset0, contiguous fixed dimensions, capacity exactly2/4/6, and distinct slot 28 identity t+1. The caller must supply trusted snapshots; these records do not 29 authenticate external memory or callers. Snapshot generations may vary so long 30 as the descriptor and live allocator snapshot agree. Shared `ED`/`ES` are scratch. 31 All operations are serialized. Padding cells are not part of a tensor. 32 33 `afstep(lr)` returns0 on success. Existing M20 failures retain their codes. 34 Additional failures are -20 incompatible local storage/dtype, -21 shape/stride, 35 -22 invalid input or learning rate, -23 nonfinite computed result. Inputs must 36 be finite canonical-width32 bit patterns. lr must be finite with a clear sign 37 bit; negative zero is deliberately refused. NaN and infinity inputs are refused. 38 Overflow and any nonfinite intermediate that reaches a result reject the step. 39 Subnormals and rounding underflow are supported. `AP` and `AL` remain unchanged 40 on every refusal; private scratch `AQ`, `ED` and `ES` may change. The final commit 41 replaces W,b,Y,dX,dW,db and writes the pre-update loss to `AL[0]`, preserving X,T. 42 43 ## Dependency and build freeze 44 45 `dependencies.json` records exact repositories, source commits, files and hashes. 46 The libraries remain external source dependencies, not copied replacement 47 libraries. Build order is L720 add32.om, L720 mul32.om, M20 metadata.om, affine.om, 48 then the chosen caller. Concatenation is existing host build glue and is not 49 claimed retired. All new executable implementation, tests and mutation tooling 50 are handwritten `.om`. External dependencies have AGPLv3 licensing; preserve 51 their existing SPDX declarations and repository licenses when distributing a unit. 52 53 On AArch64 Linux, materialize the three dependency files from their exact Git 54 objects, verify the SHA256 values, then use this existing command recipe with 55 private paths: 56 57 ```sh 58 cat "$ADD32" "$MUL32" "$METADATA" native/ecosystem6/affine.om tests/ecosystem6/step-test.om > "$OUT/unit.om" 59 quiet-build "$COMPILER" < "$OUT/unit.om" > "$OUT/unit.elf" 60 chmod +x "$OUT/unit.elf" 61 "$OUT/unit.elf" 62 ``` 63 64 Record compiler and program statuses separately and verify a real ELF before 65 execution. Expected output is `NATIVE_AFFINE_FP32_PASS checks=374708`, exit0. 66 The independent test oracle represents exactly expressible rational inputs as 67 integers solely to calculate expected answers: X=x/8,W=w/16,b=b/128,T=t/128, 68 lr=1/32. It computes integer polynomial derivatives and encodes exact expected 69 binary32 values without calling add32/mul32. 4096 deterministic cases have all 70 numerators within24 significant bits, so intermediate rounding is exact. 71 Additional literal fixtures check a hand-calculated loss36.46875, smallest 72 subnormal forward/gradient propagation, underflow to zero and midpoint ties. 73 The oracle's fixed rational representation is test-only, not the implementation. 74 75 `tests/ecosystem6/mutate.om` compiles using the same compiler. Its input is one 76 ASCII mode byte followed by affine.om. Modes0/1/2 invert the gradient sign, 77 remove dimension admission, or reverse the weight-update direction. It requires 78 exactly one source match and emits the full altered module. Concatenate the 79 same dependencies and unchanged test with the resulting module, compile and run. 80 All three compile0 and fail the test with exit1, at checks31/93/33 respectively. 81 The tests do not merely look for reduced loss or self-rebuild consistency. 82 83 ## Qualification boundaries 84 85 This host-native test is the first actual downstream numerical consumer of 86 these pinned primitives and M20 metadata in this slice. It does not replace an 87 existing production trainer. Arbitrary layouts, dynamic allocation, matmul sizes, 88 other operators, optimizer state, data loading, checkpoint/resume, evaluation, 89 export/serve, distributed and GPU execution remain open in their existing issues. 90 There is no simulator or physical-device numerical result, speedup, quality or 91 training convergence claim. Existing seeded compiler and L720 host-oracle corpus 92 evidence remain separately qualified; finite tests are not a proof of all IEEE 93 inputs. Performance and lifecycle costs are recorded without comparing to a 94 framework or claiming a win. Initial compiler refusals are preserved in evidence.