interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-train / docs / omegallm / WSP-PATCH.md

222 lines · 11583 bytes Raw Blame History Source

Checked weight-space patches

tools/omegallm/wpatch implements inspect, diff, show, validate, apply, verify, revert, bind and checkbind in seeded Omega. This format describes an exact edit, not a training algorithm or a claim that the edit improves the model.

Base implementation revision: aien-train 0518c915dea370b3bffbb90d579b1daa5ba8b8f5. Compiler and SHA implementation: omega-mv e5b32567a7aff3ce594e3254a622a846a6cd190b. The tool README gives build instructions, commands, source hashes and cache rules.

Checkpoint convention

OLLMCK02 has fifteen little-endian u64 header words: magic, V, T, D, H, F, L, B, seed, step, total, learning-rate word, P, G and payload FNV-1a-64. The payload is P f64 weight words followed by P m words and P v words. This tool preserves all header words except the refreshed payload FNV. Diff requires BASE and EDITED to have the same first fourteen header words and identical m/v bytes. It rejects a no-op diff. It does not change training step or learning rate.

The tied embedding/head wte[V,D] comes first, then wpe[T,D]. Each layer has g1[1,D], wq[D,D], wk[D,D], wv[D,D], wo[D,D], g2[1,D], w1[D,F], w2[F,D]. The final tensor is gf[1,D]. All are row-major. Flat offsets are weight-element indices; checkpoint byte offsets are 120 + 8 times that index. The existing ogeom validator is reused, rather than duplicating its limits.

OLLMWP01 manifest

All integers and f64 bit patterns are little-endian u64. Hashes are raw 32-byte SHA-256 digests in their normal byte order, never integer words. There is no padding between the tables or text. A manifest is named <sha256>.wp using its whole-file SHA-256 in lowercase hexadecimal. Every patch-consuming command recomputes that digest. A filename of 64 hex digits plus .wp must match it; uppercase hex names are recognized but refused as noncanonical. Other filenames are permitted for transport and corruption diagnostics, without a filename identity assertion. The digest remains visible through show and bind.

Fixed header, 376 bytes:

Byte offsetField
0ASCII OLLMWP01
8Total file bytes
16Optimizer policy: 0 keep, 1 zero changed m, 2 zero changed m/v
24Tensor count, exactly 3 + 8L
32Number of changed weight words, nonzero
40P
48,56,64,72,80,88V,T,D,H,F,L
96SHA-256 of complete BASE checkpoint
128SHA-256 of expected applied checkpoint, including selected m/v policy
160SHA-256 of all expected weights cast to contiguous little-endian f32
192SHA-256 of the exact entry-table bytes
224,232Params and rationale byte lengths
240Saved checkpoint header length, exactly 120
248Reserved, zero
256Exact original 120-byte checkpoint header

Immediately after the header are tensor records, each 128 bytes, in the canonical checkpoint order. Kind codes: wte=0, wpe=1, g1=2, wq=3, wk=4, wv=5, wo=6, g2=7, w1=8, w2=9, gf=10. Every tensor is recorded, including unchanged tensors.

Record byte offsetField
0,8Kind code, layer (zero for nonlayer tensors)
16,24Rows, columns
32Dtype code, exactly 64 for f64
40Flat weight offset
48Changed-entry count in this tensor
56Reserved, zero
64,96Base and expected output raw tensor-byte SHA-256

The entry table follows. Policy 0 entries are 24 bytes: flat index, old f64 bits, new f64 bits. Policies 1 and 2 entries are 40 bytes: those three words, old m bits, old v bits. Both saved moment words are present even when only m is reset. Indices must be strictly ascending and unique. Every index belongs to its canonical tensor interval, and each tensor's count must agree with the scan. Old and new words must differ. New values must be finite with absolute magnitude at most 1e6. Old words may encode any f64, so a broken weight can be repaired and reverted exactly. New signed-zero changes are valid and retain their exact bits.

Params bytes follow the entry table, then rationale bytes. Both are strict UTF-8; overlong encodings, surrogates, invalid continuations and incomplete sequences are refused. NUL is permitted in metadata and escaped by show. Each field is at most 16 MiB. The length sum must equal the exact file length. The tool's mapped input ceiling is 2,400,000,000 bytes and entry ceiling is 29,995,392, further limited by the actual checkpoint geometry. Length checks precede table reads.

Validation and output behavior

Validate checks checkpoint format, exact size and FNV, manifest geometry, every tensor shape/dtype/offset, ordered entry membership and count, entries hash, exact saved base header, full base SHA, tensor hashes, old weight bits and saved optimizer bits. It applies the entries in a private copy and checks the resulting full SHA, per-tensor SHA and f32 SHA before reporting PASS. Apply repeats this path, creates OUT with exclusive creation, writes it, then reopens and hashes it. A postwrite hash mismatch unlinks the newly created output. No output is silently reused or overwritten. Revert verifies the edited checkpoint, restores saved words, refreshes FNV and requires the exact base SHA before and after writing.

F32 identity is SHA-256 over P contiguous little-endian IEEE-754 binary32 values cast from checkpoint f64 weights with the pinned CPU's round-to-nearest conversion. It excludes header, m and v. Verify compares f64 checkpoint and f32 identities and reports how many entries have different old/new f32 bits. Those counts distinguish an encoded edit from one that survives the deployed weight representation. This is not evidence that a serving process actually reloaded those weights.

Inputs use private file mappings and must remain stable for the command's entire lifetime. There is no lock against an external writer. Forced termination can leave a partial new output, and writes are not an atomic deployment transaction. Run verify before consuming a checkpoint. Content addressing detects accidental corruption and binds exact content; it does not authenticate an author.

OLLMWB01 binding

The 168-byte binding record contains ASCII OLLMWB01 at offset 0; complete checkpoint SHA at 8; f32 weight SHA at 40; runtime executable SHA at 72; manifest SHA at 104; SHA of the preceding 136 bytes at 136. Bind verifies PATCH against CK before creating the record. Checkbind validates record magic/length/checksum and CK/runtime identities. It takes no manifest argument and never rereads a manifest, so it cannot detect a replaced manifest. The stored manifest digest identifies what bind checked earlier, not what a manifest path contains now. Checkbind also does not prove that the recorded patch is trusted. Preserve the canonical manifest alongside the binding and check its intended identity separately.

A consumer must fail closed on checkbind failure, discard previously loaded weight and KV caches, and load the bound checkpoint with the bound executable. Changing a manifest, checkpoint or runtime requires a fresh checked binding. No server, loader or live model is changed by this tool.

Refusal exit codes

Exit 0 means command success. There is no automatic fallback.

ExitRefusal
2Invalid command, arity or numeric argument
20Empty input or checkpoint shorter than header
21Input exceeds mapped size ceiling
22Checkpoint magic
23Unsupported/invalid checkpoint geometry, G or total
24Checkpoint P disagrees with geometry
25Checkpoint exact payload length
26Checkpoint payload FNV
27Unknown tensor/layer or invalid slice bounds
30Content-addressed manifest filename does not match bytes
31Metadata is not strict UTF-8
32Manifest truncated, length mismatch or table bounds
33Manifest magic, fixed header length or reserved header word
34Unsupported optimizer policy
35Zero or excessive manifest edit count
36Manifest/base geometry or checkpoint-header mismatch
37Tensor order, shape, dtype, offset or reserved word
38Flat entry index is out of bounds
39Entry indices descend
40New weight is NaN
41New weight is infinite
42New weight magnitude exceeds 1e6
43Duplicate entry index
44Entry old bits equal new bits
45Tensor changed count disagrees with entries
46Entry-table SHA mismatch
47Expected old/new weight bits mismatch
48Saved or policy-applied optimizer bits mismatch
49Tensor SHA mismatch
50Input base/applied full checkpoint SHA mismatch
52OUT already exists, including symlinks
53Generated or written output checkpoint SHA mismatch
54F32 weight SHA mismatch
55Diff has no changed weight words
56Diff EDITED changed m or v
57Metadata field exceeds limit
58Binding magic or length
59Binding checksum
60Bound checkpoint SHA mismatch
61Bound f32 SHA mismatch
62Bound runtime executable SHA mismatch
70Open, map, read, write, permission or close I/O failure
71Failed to unlink a newly created rejected output

When an input violates multiple rules, the first check determines the code. For example, a truncated canonical-name patch can fail filename identity before a later field check. Noncanonical corruption fixtures in wpcheck isolate the individual refusal paths. Omega runtime traps remain nonzero compiler/runtime errors, not successful refusals; no trap is counted as an expected test result.

Evidence and dependency boundary

evidence/OMEGALLM/wsp-patch-20261107/ records host CPU execution, the source composition diff, exact identities, small acceptance and round40 rollback; its pure-omega/ directory holds the receipts for the Omega build and test drivers. All product transformations and hashing are Omega, and so are the build driver wpbuild.om and the test driver wpcheck.om (see the wpatch README for how to run them). The build driver composes the aarch64 ollm source itself and checks the three vendored net sources with the vendored Omega SHA-256, so it no longer runs tests/omegallm/build.sh or a shell. It runs these pinned host build tools: the compiler, git 2.43.0, GNU sha256sum 9.4 (only for the compiler and SHA source pins), GNU diffutils 3.10, taskset util-linux 2.39.3 and GNU nice 9.4. None of them edits checkpoints or composes source; source composition and SHA vendoring are done in Omega. Python 3.12.3 with hashlib/struct/mmap appears only as the ORACLE wporacle.py, a digest calculator called by wpcheck; it never decides a result. No new host library enters the product runtime.

WolframLanguageEvaluator checks used during implementation:

FromDigits[Reverse[ToCharacterCode["OLLMWP01"]],256] -> 3544421242629803087
FromDigits[Reverse[ToCharacterCode["OLLMWB01"]],256] -> 3544405849467014223
With[{v=256,t=8,d=16,f=32,l=2},v*d+t*d+l*(4*d*d+2*d*f+2*d)+d] -> 8400
With[{v=4096,t=256,d=384,f=1536,l=8},
 {v*d+t*d+l*(4*d*d+2*d*f+2*d)+d,
  v*d+t*d+3*(4*d*d+2*d*f+2*d)+2*d+4*d*d+d*f}]
 -> {15833472,8162304}
FullSimplify[(m^2*s+a^2)/a^2,Assumptions->{a>m>0,s>=0}]
 -> 1 + (m^2*s)/a^2
FullSimplify[Sqrt[m^2*s/n],Assumptions->{m>=0,s>=0,n>0}]
 -> m*Sqrt[s/n]

The last two identities justify the scaled RMS accumulator, which avoids squaring the largest finite f64. Evidence labels remain separate: this tool is IMPLEMENTED and host-CPU EXERCISED. GPU qualification, model-quality improvement, merge and deployment are not established by these receipts.