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/patches/a129102d6d447db5 # 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 ## Fine-tune a finished Omega LLM checkpoint on new text with ollm tune merged `a129102d6d447db5` #70 路 opened 2026-11-06 20:42 UTC 路 closed 2026-11-06 21:10 UTC 路 merged 2026-11-06 21:10 UTC Imported from GitHub aien-dev/aien-train#70, by drakestapleton Base `77cffb6d6698f59b0644552bcbfe0b639da94abe` 路 Head `22cc38d682d185da47d12b7f478ab0d28b43bd9e` Merged on GitHub as `9da121d02f6999930969c288f6cf7ca681d37b48`; reachable from main `1739217e7c91f8d512a00d3eddb6f3f6e4f154c3` (observed 2026-11-18T16:40:29Z) drakestapleton wrote on 2026-11-06 20:42 UTC ## Problem omegallm can only train from random init. A finished checkpoint (such as the rung-10 model the Mac UI serves) cannot be fine-tuned on new text: `train` past TOTAL makes no step, and the schedule and Adam state belong to the original run. ## Solution `ollm tune CK OUT TOTAL LRMICRO` (cli.om, 26 lines): load any accepted checkpoint, keep shapes, G and weights, set step 0, the new TOTAL and lr, zero Adam m and v, save with the loaded magic. `train`, `gtrain` and `gtrainf` then fine-tune from OUT on any token file. Warmup and bias correction restart with the new schedule. ## Verification (MEASURED, DGX Spark host CPU, commit `b4187da`) ``` $ OLLM= OMC= sh tests/omegallm/tune-check.sh PASS train past TOTAL makes no step (why tune exists): 0 PASS tune: U 119104 PASS weights kept (eval loss and bpb equal): 4 4901318 7071108 PASS step reset: 0 PASS Adam m and v zeroed: 0 PASS fine-tune lowered eval loss (micro-nats 4901318 to 4816743) PASS fine-tune resume 0..10..20 bit-identical to 0..20: 0 PASS TOTAL 0 refused: 12 / TOTAL 1000000 refused: 12 / argument count refused: 2 / truncated checkpoint refused: 10 PASS negative control caught: moments not reset (1899279 nonzero bytes) TUNE_PASS ``` Full output: evidence/OMEGALLM/tune/check.txt. TARGET=gb10 builds (ollm-gb10 `bf87a3ae`); not run on the chip. ## Limits Smoke data (repository LICENSE, v0 shape). No quality claim, no GPU run. Touches only ocmd dispatch plus a new function at the end of cli.om; it does not overlap the cli.om hunks on feat/macbook-local-exploration. 馃 Generated with Claude Code Queen review note (2026-11-06): only the G = 1 checkpoint format (OLLMCK01) is tested; G > 1 (OLLMCK02) is untested. - reviewed (APPROVED) on - Agent review (RevTrain70, Opus 5.5, AIEN Completion Hive; requested by Queen under Drake authorization DRA-162 2026-11-06), not a human review. Head `22cc38d6`: build.sh rc0 BUILD_OK `f3005415` (same binary hash as the evidence); tune-check.sh rc0 TUNE_PASS (22 PASS lines); the negative control fails as intended. Only G=1 checkpoints are tested. Conflicts with #71 in cli.om; #71 needs a rebase after this merges. ### Apply it ``` git checkout -b patch-a129102d6d447db5 77cffb6d6698f59b0644552bcbfe0b639da94abe curl -fsSL https://interplane.io/drakestapleton/aien-train/patches/a129102d6d447db5.patch | git am ``` Raw patch (mbox) 路 Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aien-train 70 22cc38d682d185da47d12b7f478ab0d28b43bd9e ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-train","number":70,"url":"https://github.com/aien-dev/aien-train/pull/70","export_sha256":"e2d49089563cb3d01f7a323b1228844868dc3e2c89531906e1b60f6b775ad91a","imported_utc":"2026-11-18T16:40:29Z"} ``` ### Changes ``` diff --git a/docs/omegallm/README.md b/docs/omegallm/README.md index d6286ea..c42716c 100644 --- a/docs/omegallm/README.md +++ b/docs/omegallm/README.md @@ -25,6 +25,7 @@ ollm init CK V T D H F L B SEED TOTAL LRMICRO [G] ollm train CK TOKS UNTIL EVERY [K] # K worker processes, G mod K = 0 (Linux only) ollm eval CK HELD W MERGES # MERGES required when V > 256 ollm sample CK SEED N TEMPMILLI PROMPT MERGES +ollm tune CK OUT TOTAL LRMICRO # fine-tune: keep weights, step 0, new TOTAL and lr, Adam m = v = 0 ``` | What | Status | Receipt | diff --git a/evidence/OMEGALLM/tune/README.md b/evidence/OMEGALLM/tune/README.md new file mode 100644 index 0000000..93371d6 --- /dev/null +++ b/evidence/OMEGALLM/tune/README.md @@ -0,0 +1,17 @@ +# ollm tune host evidence + +Source commit: `b4187dae0954825de7488d811b7884419e1a0f44`. Base: train main `77cffb6`. +Host: Linux 7.0.0-1019-nvidia aarch64 (DGX Spark host CPU), CPU only. No GPU ran. +Build: `OMC= sh tests/omegallm/build.sh` with omc sha256 +`2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`: +`ollm` sha256 `f3005415ecc48239ac19f498e24a27e386abb7661318f7dcc4fa74b9b0cd1559` +(source `c83edec0`). `TARGET=gb10` also builds: `ollm-gb10` `bf87a3ae` (source `d90f9abd`), not run. +Command: `OLLM= OMC= sh tests/omegallm/tune-check.sh`, exit 0, output in `check.txt` +(MEASURED, 2026-11-06, about 43 s). + +Data is the repository `LICENSE` as V 256 bytes on the v0 shape (P 119104): a smoke task for the +command, not a quality result. The checks cover: training past TOTAL makes no step (the gap this +closes), tune keeps the weights (eval loss and bpb equal), resets the step, zeroes Adam m and v, +fine-tuning then lowers eval loss (4.901318 to 4.816743 nats after 20 steps), resume is +bit-identical, tune is deterministic, bad TOTAL, argument count and a truncated checkpoint are +refused with no output, and a build with the moment reset removed is caught. diff --git a/evidence/OMEGALLM/tune/check.txt b/evidence/OMEGALLM/tune/check.txt new file mode 100644 index 0000000..a6a71c1 --- /dev/null +++ b/evidence/OMEGALLM/tune/check.txt @@ -0,0 +1,25 @@ +ollm_sha256=f3005415ecc48239ac19f498e24a27e386abb7661318f7dcc4fa74b9b0cd1559 +data_sha256=0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 +PASS init: I 119104 +PASS train base 0..30 rc: 0 +PASS train past TOTAL makes no step (why tune exists): 0 +PASS checkpoint unchanged past TOTAL: 0 +PASS tune: U 119104 +PASS weights kept (eval loss and bpb equal): 4 4901318 7071108 +PASS step reset: 0 +PASS Adam m and v zeroed: 0 +PASS control: base checkpoint moments nonzero (1899279 bytes) +PASS fine-tune 0..20 rc: 0 +PASS fine-tune saves: T 10,T 20, +PASS fine-tune resume 0..10..20 bit-identical to 0..20: 0 +PASS fine-tune changed the weights +PASS fine-tune lowered eval loss (micro-nats 4901318 to 4816743) +PASS tune deterministic: 0 +PASS TOTAL 0 refused: 12 +PASS TOTAL 1000000 refused: 12 +PASS argument count refused: 2 +PASS truncated checkpoint refused: 10 +PASS refused tune wrote no output +PASS negative control: one moment-reset line to remove: 1 +PASS negative control caught: moments not reset (1899279 nonzero bytes) +TUNE_PASS diff --git a/native/omegallm/cli.om b/native/omegallm/cli.om index 702395d..e5d2dfa 100644 --- a/native/omegallm/cli.om +++ b/native/omegallm/cli.om @@ -5,7 +5,8 @@ note Command words are matched as little-endian u64 packings of their bytes (Wol note FromDigits[Reverse[ToCharacterCode[w]],256]): prep 1885696624, init 1953066601, note grad 1684107879, train 474214396532, eval 1818326629, base 1702060386, sample 111516417089907, note gcheck 118074647274343, mathck 118074698391917, adamck 118074781033569; v1: bpefit -note 127996038312034, bpeenc 109325798699106, bpedec 109287127216226 (bpe.om). +note 127996038312034, bpeenc 109325798699106, bpedec 109287127216226 (bpe.om). Fine-tune: +note tune 1701737844. note Exit codes: 0 ok; 2 usage; 10-15 checkpoint refusals (ckpt.om); 20 data file shorter than note T + 1 bytes; 21 data over 2^25 bytes or OFFS not exactly 8 B bytes; 22 an OFFS offset with note o + T >= N; 23 eval W = 0 or W T + 1 > M; 24 prep story over 999999 bytes; 40 gcheck over @@ -78,6 +79,10 @@ if eq w 118074781033569 cmdadamck ret 0 end +if eq w 1701737844 +cmdtune +ret 0 +end exit 2 end @@ -628,3 +633,29 @@ oputl long mul bitcast f64 get og add 52 b 1e18 oputc 10 oflush end + +note tune CK OUT TOTAL LRMICRO: fine-tune entry. Load CK (any checkpoint ckpt.om accepts), keep +note its shapes, G and weights, and start a new schedule on them: step 0, the given TOTAL and +note lr = f64(LRMICRO)/1000000.0, Adam moments m = v = 0 (so warmup and bias correction restart). +note Save to OUT with the loaded magic and print `U P`. train, gtrain and gtrainf then continue +note from OUT on any token file. TOTAL 0 or over 999999 exits 12; wrong argument count exits 2. +fn cmdtune to void +if ne oargc 6 +exit 2 +end +ockload 2 +tt = oargu 4 +if or eq tt 0 gt tt 999999 +exit 12 +end +put og 41 0 +put og 42 tt +put og 43 bitcast ulong div f64 oargu 5 1000000.0 +ozerom mul 2 get og 8 +ocksave 3 +oputc 85 +oputc 32 +oputu get og 8 +oputc 10 +oflush +end diff --git a/tests/omegallm/tune-check.sh b/tests/omegallm/tune-check.sh new file mode 100644 index 0000000..5e2c164 --- /dev/null +++ b/tests/omegallm/tune-check.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# SPDX-License-Identifier: AGPL-3.0-only +# Checks for `ollm tune` (fine-tune entry, cli.om). Host CPU only. +# Usage: OLLM=path/to/ollm OMC=path/to/pinned/omc sh tests/omegallm/tune-check.sh (build with tests/omegallm/build.sh) +# Data: the repository LICENSE as V 256 byte data (public, fixed bytes). Scratch in a temp dir. +# Prints one line per check and TUNE_PASS, or TUNE_FAIL and exit 1. +set -u +ROOT=$(cd "$(dirname "$0")/../.." && pwd) +OLLM=${OLLM:?set OLLM to the built ollm} +OMC=${OMC:?set OMC to the pinned omc (builds the negative control)} +W=$(mktemp -d "${TMPDIR:-/tmp}/tune.XXXXXX") +D=$ROOT/LICENSE +bad=0 +ok() { echo "PASS $*"; } +no() { echo "FAIL $*"; bad=1; } +want() { [ "$2" = "$3" ] && ok "$1: $2" || no "$1: got [$2] want [$3]"; } +echo "ollm_sha256=$(sha256sum "$OLLM" | cut -d" " -f1)" +echo "data_sha256=$(sha256sum "$D" | cut -d" " -f1)" +"$OLLM" init "$W/a.ck" 256 64 64 4 256 2 16 1 30 1000 > "$W/i.txt"; want init "$(cat "$W/i.txt")" "I 119104" +"$OLLM" train "$W/a.ck" "$D" 30 10 > "$W/t.txt"; want "train base 0..30 rc" $? 0 +cp "$W/a.ck" "$W/b.ck" +"$OLLM" train "$W/b.ck" "$D" 40 10 > "$W/t2.txt"; want "train past TOTAL makes no step (why tune exists)" "$(wc -c < "$W/t2.txt" | tr -d " ")" 0 +cmp -s "$W/a.ck" "$W/b.ck"; want "checkpoint unchanged past TOTAL" $? 0 +"$OLLM" tune "$W/a.ck" "$W/u.ck" 20 500 > "$W/u.txt"; want tune "$(cat "$W/u.txt")" "U 119104" +e1=$("$OLLM" eval "$W/a.ck" "$D" 4 | cut -d" " -f3-) +e2=$("$OLLM" eval "$W/u.ck" "$D" 4 | cut -d" " -f3-) +want "weights kept (eval loss and bpb equal)" "$e2" "$e1" +s2=$("$OLLM" eval "$W/u.ck" "$D" 4 | cut -d" " -f2); want "step reset" "$s2" 0 +P=119104; H=112 +z=$(tail -c +$((H + 8 * P + 1)) "$W/u.ck" | head -c $((16 * P)) | tr -d "\000" | wc -c | tr -d " ") +want "Adam m and v zeroed" "$z" 0 +z0=$(tail -c +$((H + 8 * P + 1)) "$W/a.ck" | head -c $((16 * P)) | tr -d "\000" | wc -c | tr -d " ") +[ "$z0" -gt 0 ] && ok "control: base checkpoint moments nonzero ($z0 bytes)" || no "control: base moments zero" +cp "$W/u.ck" "$W/u1.ck"; cp "$W/u.ck" "$W/u2.ck" +"$OLLM" train "$W/u1.ck" "$D" 20 10 > "$W/f.txt"; want "fine-tune 0..20 rc" $? 0 +want "fine-tune saves" "$(cut -d" " -f1-2 "$W/f.txt" | tr "\n" ,)" "T 10,T 20," +"$OLLM" train "$W/u2.ck" "$D" 10 10 > /dev/null; "$OLLM" train "$W/u2.ck" "$D" 20 10 > /dev/null +cmp -s "$W/u1.ck" "$W/u2.ck"; want "fine-tune resume 0..10..20 bit-identical to 0..20" $? 0 +cmp -s "$W/u1.ck" "$W/u.ck"; [ $? -ne 0 ] && ok "fine-tune changed the weights" || no "fine-tune changed nothing" +l0=$("$OLLM" eval "$W/u.ck" "$D" 4 | cut -d" " -f4); l1=$("$OLLM" eval "$W/u1.ck" "$D" 4 | cut -d" " -f4) +[ "$l1" -lt "$l0" ] && ok "fine-tune lowered eval loss (micro-nats $l0 to $l1)" || no "fine-tune loss $l0 to $l1" +"$OLLM" tune "$W/a.ck" "$W/v.ck" 20 500 > /dev/null; cmp -s "$W/u.ck" "$W/v.ck"; want "tune deterministic" $? 0 +"$OLLM" tune "$W/a.ck" "$W/x.ck" 0 500 > /dev/null 2>&1; want "TOTAL 0 refused" $? 12 +"$OLLM" tune "$W/a.ck" "$W/x.ck" 1000000 500 > /dev/null 2>&1; want "TOTAL 1000000 refused" $? 12 +"$OLLM" tune "$W/a.ck" "$W/x.ck" 20 > /dev/null 2>&1; want "argument count refused" $? 2 +head -c 1000 "$W/a.ck" > "$W/short.ck"; "$OLLM" tune "$W/short.ck" "$W/x.ck" 20 500 > /dev/null 2>&1; want "truncated checkpoint refused" $? 10 +[ -e "$W/x.ck" ] && no "refused tune left an output file" || ok "refused tune wrote no output" +# Negative control: the same source with the moment reset removed must fail the zero check. +[ -f "$OLLM.om" ] || no "negative control: $OLLM.om (build.sh concatenated source) missing" +if [ -f "$OLLM.om" ]; then + n=$(grep -c "^ozerom mul 2 get og 8\$" "$OLLM.om") + want "negative control: one moment-reset line to remove" "$n" 1 + grep -v "^ozerom mul 2 get og 8\$" "$OLLM.om" > "$W/mut.om" + "$OMC" < "$W/mut.om" > "$W/mut" && chmod +x "$W/mut" + "$W/mut" tune "$W/a.ck" "$W/m.ck" 20 500 > /dev/null + zm=$(tail -c +$((H + 8 * P + 1)) "$W/m.ck" | head -c $((16 * P)) | tr -d "\000" | wc -c | tr -d " ") + [ "$zm" -gt 0 ] && ok "negative control caught: moments not reset ($zm nonzero bytes)" || no "negative control not caught" +fi +rm -rf "$W" +[ $bad = 0 ] && echo TUNE_PASS || { echo TUNE_FAIL; exit 1; } ```