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 / tests / omegallm / equiv.sh

41 lines · 1942 bytes Raw Blame History
1#!/bin/sh
2# Show that two ollm builds compute the same thing from one checkpoint: the same held-out eval line,
3# and a byte-identical checkpoint after N more training steps.
4# Usage: sh tests/omegallm/equiv.sh OLD NEW CK TRAIN HELD N WORK > receipt
5# Env: CORE (taskset core, default 7). CK is only read; both arms train copies of it inside WORK.
6# Pass relative paths so the receipt names no private path. Exit 0 only if every command exits 0 and
7# both comparisons agree (two arms that fail the same way would otherwise compare equal).
8set -u
9[ $# -eq 7 ] || { echo "usage: equiv.sh OLD NEW CK TRAIN HELD N WORK" >&2; exit 2; }
10OLD=$1 NEW=$2 CK=$3 TRAIN=$4 HELD=$5 N=$6 WORK=$7
11CORE=${CORE:-7}
12RUN="taskset -c $CORE nice -n 19"
13mkdir -p "$WORK"
14echo "host_cpu: core $CORE ($(lscpu -e=CPU,MODELNAME 2>/dev/null | awk -v c="$CORE" '$1==c {$1=""; print substr($0,2)}'))"
15sha256sum "$OLD" "$NEW" "$CK" "$TRAIN" "$HELD"
16fail=0
17step=$(od -An -tu8 -j72 -N8 "$CK" | tr -d ' ')
18until=$((step + N))
19for arm in old new; do
20 [ $arm = old ] && b=$OLD || b=$NEW
21 cp "$CK" "$WORK/$arm.ck"
22 echo "\$ $RUN $b eval $CK $HELD 256"
23 $RUN "$b" eval "$CK" "$HELD" 256 > "$WORK/$arm.eval" 2>&1
24 rc=$?
25 echo "rc=$rc $(cat "$WORK/$arm.eval")"
26 [ $rc -eq 0 ] || fail=1
27 echo "\$ $RUN $b train $WORK/$arm.ck $TRAIN $until $N"
28 $RUN "$b" train "$WORK/$arm.ck" "$TRAIN" "$until" "$N" > "$WORK/$arm.train" 2>&1
29 rc=$?
30 echo "rc=$rc $(cat "$WORK/$arm.train")"
31 [ $rc -eq 0 ] || fail=1
32done
33if cmp "$WORK/old.eval" "$WORK/new.eval"; then echo "eval lines equal"; else echo "eval lines DIFFER"; fail=1; fi
34if cmp "$WORK/old.ck" "$WORK/new.ck"; then
35 echo "checkpoints after step $until equal: $(sha256sum < "$WORK/new.ck" | cut -d' ' -f1)"
36else
37 echo "checkpoints after step $until DIFFER"; fail=1
38fi
39if cmp -s "$CK" "$WORK/new.ck"; then echo "training did not change the checkpoint"; fail=1; fi
40echo "verdict $([ $fail -eq 0 ] && echo EQUAL || echo DIFFERENT)"
41exit $fail