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 / native / si19 / omexp.om

797 lines · 14703 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note aien-train#24 ORIG-1: omexp-v1 experience records of the Omega matvec realization
3note chooser (docs/si19/ORIG1-CONTRACT.md). Reader, admission checks, typed features,
4note partitions and the deterministic baselines. No training here; no execution authority.
5note RB raw record bytes (at most 2048 records of 256 bytes); RW decoded words, record r
6note word i at r*32+i; RC: 0 records admitted, 1 bytes, 2 FNV-1a 64 of the bytes, 3 last
7note status, 4..8 records per family 0..4; XF the 12 state features of the last oxfeat
8note call in 1/16 units; LB the allow-list text (hashes with AUTHORIZED/SYNTHETIC/REVOKED).
9note v2 admission (docs/si19/ORIG1-CONTRACT-v2.md, oxadm2): RC[9] = 1, RA per-record code
10note (0 admitted, negative reason), RS per-record split (0 TRAIN, 1 VALIDATION, 2 HELD-OUT,
11note 3 refused), RQ refusal counts by reason (RQ[0] admitted, RQ[k] reason -k). AU: audit.
12global RB uchar 524288
13global RW ulong 65536
14global RC ulong 16
15global XF long 12
16global LB uchar 4100
17global RA long 2048
18global RS uchar 2048
19global RQ ulong 32
20global AU ulong 32
21
22fn oxlg16 v ulong to ulong
23note floor(log2 v)*16 plus a truncated 4-bit fraction; 0 for v = 0.
24if eq v 0
25ret 0
26end
27e = ulong 0
28q = v
29while gt q 1 bound 64
30q = shr q 1
31e = add e 1
32end
33ret sub add shr shl v 4 e mul 16 e 16
34end
35
36fn oxget pos ulong to ulong
37v = ulong 0
38for i ulong 8
39v = or v shl ulong get RB add pos i mul i 8
40end
41ret v
42end
43
44fn oxword r ulong i ulong to ulong
45ret get RW add mul r 32 i
46end
47
48fn oxfam r ulong to ulong
49ret oxword r 2
50end
51
52fn oxcore r ulong to ulong
53ret oxword r 3
54end
55
56fn oxpress r ulong to ulong
57ret oxword r 4
58end
59
60fn oxm r ulong to ulong
61ret oxword r 5
62end
63
64fn oxn r ulong to ulong
65ret oxword r 6
66end
67
68fn oxseq r ulong to ulong
69ret oxword r 14
70end
71
72fn oxpart r ulong to ulong
73note v1: family 0 TRAIN, 1 DEV, 2..4 TEST. v2 (RC[9] = 1): the record's workload-family
74note split from oxadm2, 3 for a refused record (never in any partition).
75if eq get RC 9 1
76ret ulong get RS r
77end
78f = oxfam r
79if gt f 1
80ret 2
81end
82ret f
83end
84
85fn oxcache core ulong to ulong
86note Last private cache per core class (contract s.1).
87if eq core 0
88ret 2097152
89end
90if eq core 1
91ret 524288
92end
93ret 1048576
94end
95
96fn oxchk1 r ulong to int
97note Header, enumerations, shape and profile words of one record.
98if ne oxword r 0 3553143591248351811
99ret -2
100end
101if ne oxword r 1 1
102ret -2
103end
104if or gt oxfam r 4 gt oxcore r 2
105ret -3
106end
107k = oxword r 13
108if or gt oxpress r 15 or eq k 0 gt k 8
109ret -3
110end
111m = oxm r
112n = oxn r
113if or or eq m 0 gt m 8192 or eq n 0 gt n 8192
114ret -4
115end
116if eq oxword r 7 0
117ret -4
118end
119if ne oxword r 10 oxcache oxcore r
120ret -9
121end
122if ne oxword r 9 mul add add mul m n m n 8
123ret -9
124end
125ret 0
126end
127
128fn oxchk2 r ulong to int
129note Eligible mask, measurements, verified flags and the mismatch word.
130k = oxword r 13
131e = oxword r 12
132if eq and e 1 0
133ret -5
134end
135if ge e shl 1 k
136ret -5
137end
138for a ulong k
139if ne and shr e a 1 0
140if eq oxword r add 16 a 0
141ret -6
142end
143if ne oxword r add 24 a 1
144ret -6
145end
146end
147end
148if ne oxword r 31 0
149ret -7
150end
151ret 0
152end
153
154fn oxleak n ulong to int
155note A TEST-H1 shape key present in TRAIN or DEV is held-out contamination.
156for r ulong n
157if eq oxfam r 2
158for q ulong n
159if lt oxfam q 2
160if and eq oxm q oxm r eq oxn q oxn r
161ret -11
162end
163end
164end
165end
166end
167ret 0
168end
169
170fn oxfnv n ulong to ulong
171note FNV-1a 64 over RB[0..n): the dataset identity for the allow-list and lineage.
172h = ulong 14695981039346656037
173for i ulong n
174h = mul xor h ulong get RB i 1099511628211
175end
176ret h
177end
178
179fn oxload n ulong to int
180note Decode and admit RB[0..n). Nothing is admitted on refusal.
181put RC 0 0
182put RC 3 0
183put RC 9 0
184if or eq n 0 or ne rem n 256 0 gt n 524288
185put RC 3 wsenc -1
186ret -1
187end
188c = div n 256
189for r ulong c
190for i ulong 32
191put RW add mul r 32 i oxget add mul r 256 mul i 8
192end
193end
194for r ulong c
195s = oxchk1 r
196if ge s 0
197s = oxchk2 r
198end
199if lt s 0
200put RC 3 wsenc long s
201ret s
202end
203if gt r 0
204if le oxseq r oxseq sub r 1
205put RC 3 wsenc -8
206ret -8
207end
208end
209end
210s = oxleak c
211if lt s 0
212put RC 3 wsenc long s
213ret s
214end
215for f ulong 5
216put RC add 4 f 0
217end
218for r ulong c
219f = add 4 oxfam r
220put RC f add get RC f 1
221end
222put RC 0 c
223put RC 1 n
224put RC 2 oxfnv n
225ret 0
226end
227
228fn oxdigit p ulong to bool
229b = get LB p
230ret and ge b 48 le b 57
231end
232
233fn oxline p ulong n ulong to ulong
234note Position after the end of the line that starts at p.
235while lt p n bound 4096
236if eq get LB p 10
237ret add p 1
238end
239p = add p 1
240end
241ret n
242end
243
244fn oxstatus p ulong n ulong to int
245note The status token at p: first letter and length decide; -13 when malformed.
246q = p
247go = true
248while and go lt q n bound 4096
249b = get LB q
250if or eq b 32 eq b 10
251go = false
252else
253q = add q 1
254end
255end
256k = sub q p
257b = get LB p
258if and eq b 65 eq k 10
259ret 1
260end
261if and eq b 83 eq k 9
262ret 2
263end
264if and eq b 82 eq k 7
265ret -12
266end
267ret -13
268end
269
270fn oxallow n ulong h ulong to int
271note Lines "<decimal fnv> <AUTHORIZED|SYNTHETIC|REVOKED> <label>". 1 authorized owner
272note data, 2 synthetic fixture, -12 revoked, -13 absent or malformed.
273p = ulong 0
274while lt p n bound 4096
275v = ulong 0
276q = p
277d = ulong 0
278while and lt q n oxdigit q bound 24
279v = add mul v 10 sub ulong get LB q 48
280q = add q 1
281d = add d 1
282end
283if and gt d 0 eq v h
284if and lt q n eq get LB q 32
285ret oxstatus add q 1 n
286end
287ret -13
288end
289p = oxline p n
290end
291ret -13
292end
293
294fn oxcand r ulong a ulong to bool
295note Admissible: eligible bit, a measurement and a verified flag.
296if ge a oxword r 13
297ret false
298end
299if eq and shr oxword r 12 a 1 0
300ret false
301end
302if eq oxword r add 16 a 0
303ret false
304end
305ret eq oxword r add 24 a 1
306end
307
308fn oxcost r ulong a ulong to ulong
309ret oxword r add 16 a
310end
311
312fn oxt16 r ulong a ulong to long
313ret sub long oxlg16 oxcost r a long oxlg16 oxcost r 0
314end
315
316fn oxflag v bool to long
317if v
318ret 16
319end
320ret 0
321end
322
323fn oxfeat r ulong to void
324note The frozen state vector (contract s.3), 1/16 units.
325m = oxm r
326n = oxn r
327lm = oxlg16 m
328ln = oxlg16 n
329put XF 0 16
330put XF 1 long lm
331put XF 2 long ln
332put XF 3 long shr mul lm ln 8
333put XF 4 long shr mul ln ln 8
334put XF 5 oxflag le n 3
335put XF 6 oxflag ne rem n 4 0
336d = sub long oxlg16 oxword r 9 long oxlg16 oxword r 10
337if lt d 0
338d = 0
339end
340if gt d 256
341d = 256
342end
343put XF 7 d
344c = oxcore r
345put XF 8 oxflag eq c 0
346put XF 9 oxflag eq c 1
347put XF 10 oxflag eq c 2
348p = oxpress r
349if gt p 15
350p = 15
351end
352put XF 11 mul 16 long p
353end
354
355fn oxbest r ulong to ulong
356note The cheapest admissible arm, lowest index on a tie (analysis bound).
357b = ulong 0
358k = oxword r 13
359for a ulong k
360if oxcand r a
361if lt oxcost r a oxcost r b
362b = a
363end
364end
365end
366ret b
367end
368
369fn oxrule r ulong to ulong
370note The incumbent fixed rule: unroll2 when N <= 8, else unroll4_dual; reference if not admissible.
371a = ulong 3
372if le oxn r 8
373a = 2
374end
375if oxcand r a
376ret a
377end
378ret 0
379end
380
381fn oxnearok q ulong c ulong p ulong to bool
382note A retrieval neighbour: TRAIN, same core class; in v2 also the same pressure bucket.
383if or ne oxpart q 0 ne oxcore q c
384ret false
385end
386if eq get RC 9 1
387ret eq oxpress q p
388end
389ret true
390end
391
392fn oxl1 q ulong lm long ln long to long
393note L1 distance of record q to (lm, ln) in lg16 units.
394ret add wsabs sub lm long oxlg16 oxm q wsabs sub ln long oxlg16 oxn q
395end
396
397fn oxnear r ulong to ulong
398note Nearest TRAIN record of the same core class by L1 on (lg16 M, lg16 N); lowest index tie.
399note v2 also requires the same pressure bucket (oxnearok).
400c = oxcore r
401p = oxpress r
402lm = long oxlg16 oxm r
403ln = long oxlg16 oxn r
404b = ulong 1048576
405bd = long 1099511627776
406for q ulong get RC 0
407if oxnearok q c p
408d = oxl1 q lm ln
409if lt d bd
410bd = d
411b = q
412end
413end
414end
415ret b
416end
417
418fn oxstatic core ulong to ulong
419note The single arm with the lowest total TRAIN cost on that core class, lowest index tie;
420note an arm missing from any such record is not a candidate.
421t = new ulong 8 0
422k = new ulong 8 0
423c = ulong 0
424for q ulong get RC 0
425if and eq oxpart q 0 eq oxcore q core
426c = add c 1
427for a ulong 8
428if oxcand q a
429put t a add get t a oxcost q a
430put k a add get k a 1
431end
432end
433end
434end
435b = ulong 0
436for a ulong 8
437if eq get k a c
438if lt get t a get t b
439b = a
440end
441end
442end
443ret b
444end
445
446fn oxfl v ulong to ulong
447note floor(log2 v) for v >= 1: the workload-family coordinate.
448e = ulong 0
449q = v
450while gt q 1 bound 64
451q = shr q 1
452e = add e 1
453end
454ret e
455end
456
457fn oxcell r ulong to ulong
458note Workload family (shape lineage) of record r: 16 floor(log2 M) + floor(log2 N).
459ret add mul oxfl oxm r 16 oxfl oxn r
460end
461
462fn oxhspl cm ulong cn ulong to ulong
463note Frozen split of the family (cm, cn): h = FNV-1a 64 over the two bytes cm, cn;
464note k = (h >> 32) mod 10; 0..5 TRAIN, 6..7 VALIDATION, 8..9 HELD-OUT.
465h = ulong 14695981039346656037
466h = mul xor h cm 1099511628211
467h = mul xor h cn 1099511628211
468k = rem shr h 32 10
469if le k 5
470ret 0
471end
472if le k 7
473ret 1
474end
475ret 2
476end
477
478fn oxspl r ulong to ulong
479ret oxhspl oxfl oxm r oxfl oxn r
480end
481
482fn oxfmt2 r ulong to int
483note v2 format, supported enumerations, shape range and profile of one record.
484if ne oxword r 0 3553143591248351811
485ret -2
486end
487if ne oxword r 1 1
488ret -2
489end
490if or gt oxfam r 5 gt oxcore r 1
491ret -3
492end
493if or gt oxpress r 1 ne oxword r 13 6
494ret -3
495end
496m = oxm r
497n = oxn r
498if or or eq m 0 gt m 8192 or eq n 0 gt n 8192
499ret -4
500end
501if gt mul m n 524288
502ret -4
503end
504k = oxword r 7
505if or eq k 0 gt k 1048576
506ret -4
507end
508if ne oxword r 10 oxcache oxcore r
509ret -9
510end
511if ne oxword r 9 mul add add mul m n m n 8
512ret -9
513end
514ret 0
515end
516
517fn oxpair2 r ulong to bool
518note The complete arm set of the profile for this state: arms 0..4 eligible, measured and
519note verified; arm 5 (planted) neither eligible, measured nor verified; arms 6, 7 absent.
520if ne oxword r 12 31
521ret false
522end
523for a ulong 5
524if or eq oxword r add 16 a 0 ne oxword r add 24 a 1
525ret false
526end
527end
528if or ne oxword r 21 0 ne oxword r 29 0
529ret false
530end
531ret and eq oxword r 22 0 eq oxword r 23 0
532end
533
534fn oxval2 r ulong to int
535note Pairing (-14), measurement range (-10: ps per call 1..2^40-1, the integer record's
536note analogue of a non-finite value) and the mismatch word (-7).
537if not oxpair2 r
538ret -14
539end
540for a ulong 5
541if ge oxword r add 16 a 1099511627776
542ret -10
543end
544end
545if gt oxword r 31 0
546ret -7
547end
548ret 0
549end
550
551fn oxsame q ulong r ulong to bool
552note Same decision state key: core class, pressure bucket, M and N.
553if or ne oxm q oxm r ne oxn q oxn r
554ret false
555end
556ret and eq oxcore q oxcore r eq oxpress q oxpress r
557end
558
559fn oxdup2 r ulong to bool
560note An earlier admitted record has the same state key (duplicate state, every arm).
561d = false
562for q ulong r
563if eq get RA q 0
564if oxsame q r
565d = true
566end
567end
568end
569ret d
570end
571
572fn oxrec2 r ulong to int
573note v2 reason for record r, first failing check: -2 format, -3 unsupported enumeration,
574note -4 shape, -9 profile, -14 unpaired, -10 out of range, -7 unverified, -8 sequence not
575note increasing, -15 duplicate state; 0 admitted.
576s = oxfmt2 r
577if ne s 0
578ret s
579end
580s = oxval2 r
581if ne s 0
582ret s
583end
584if gt r 0
585if ge oxseq sub r 1 oxseq r
586ret -8
587end
588end
589if oxdup2 r
590ret -15
591end
592ret 0
593end
594
595fn oxconf q ulong r ulong to bool
596note Two admitted records that share a workload family or a shape but not a split.
597if eq get RS q get RS r
598ret false
599end
600if eq oxcell q oxcell r
601ret true
602end
603ret and eq oxm q oxm r eq oxn q oxn r
604end
605
606fn oxdisj c ulong to int
607note Workload-disjoint split check over admitted records: -11 on any conflict.
608for r ulong c
609if lt get RS r 3
610for q ulong r
611if lt get RS q 3
612if oxconf q r
613ret int -11
614end
615end
616end
617end
618end
619ret 0
620end
621
622fn oxdec n ulong to ulong
623note Decode RB[0..n) into RW without any check; returns the record count.
624c = div n 256
625for r ulong c
626for i ulong 32
627put RW add mul r 32 i oxget add mul r 256 mul i 8
628end
629end
630ret c
631end
632
633fn oxtally c ulong to void
634note Per-record reasons into RA and RQ, splits into RS, admitted per split into RC[4..6].
635for r ulong c
636s = oxrec2 r
637put RA r long s
638k = ulong neg long s
639put RQ k add get RQ k 1
640put RS r 3
641if eq s 0
642p = oxspl r
643put RS r uchar p
644put RC add 4 p add get RC add 4 p 1
645end
646end
647end
648
649fn oxadm2 n ulong to int
650note v2 admission of RB[0..n): whole-file size refusal (-1) or disjointness failure (-11)
651note admits nothing; otherwise every record is admitted or refused with a counted reason.
652put RC 0 0
653put RC 3 0
654put RC 9 0
655for i ulong 32
656put RQ i 0
657end
658for i ulong 16
659put RC i 0
660end
661if or eq n 0 or ne rem n 256 0 gt n 524288
662put RC 3 wsenc -1
663ret -1
664end
665c = oxdec n
666put RC 9 1
667oxtally c
668s = oxdisj c
669if lt s 0
670put RC 9 0
671put RC 3 wsenc long s
672ret s
673end
674put RC 0 c
675put RC 1 n
676put RC 2 oxfnv n
677put RC 10 get RQ 0
678ret 0
679end
680
681fn oxwkey q ulong r ulong to bool
682note Same workload: core class, M, N and the job seed (operands are regenerated from it).
683if or ne oxm q oxm r ne oxn q oxn r
684ret false
685end
686ret and eq oxcore q oxcore r eq oxword q 8 oxword r 8
687end
688
689fn oxfirst r ulong a0 ulong a1 ulong to ulong
690note First record q in [a0, a1) with the workload of r; 1048576 when none.
691b = ulong 1048576
692q = a1
693while gt q a0 bound 4096
694q = sub q 1
695if oxwkey q r
696b = q
697end
698end
699ret b
700end
701
702fn oxfirsts r ulong a0 ulong a1 ulong to ulong
703note First record q in [a0, a1) with the state key of r (oxsame); 1048576 when none.
704b = ulong 1048576
705q = a1
706while gt q a0 bound 4096
707q = sub q 1
708if oxsame q r
709b = q
710end
711end
712ret b
713end
714
715fn oxauinc k ulong to void
716put AU k add get AU k 1
717end
718
719fn oxaub r ulong na ulong to void
720note Audit of one record r of file B against file A = records [0, na).
721f = oxfam r
722if gt f 1
723oxauinc 12
724end
725q = oxfirst r 0 na
726if lt q 1048576
727oxauinc 0
728oxauinc add 1 f
729if eq oxbest q oxbest r
730oxauinc 6
731end
732end
733if lt oxfirsts r 0 na 1048576
734oxauinc 7
735end
736end
737
738fn oxtrcell r ulong na ulong to bool
739note A TRAIN (family 0) record of file A, same core class, in the workload family of r.
740h = false
741for q ulong na
742if and eq oxfam q 0 eq oxcore q oxcore r
743if eq oxcell q oxcell r
744h = true
745end
746end
747end
748ret h
749end
750
751fn oxxfam r ulong na ulong to bool
752note The workload of r also occurs in file A under another family word.
753h = false
754for q ulong na
755if ne oxfam q oxfam r
756if oxwkey q r
757h = true
758end
759end
760end
761ret h
762end
763
764fn oxaua r ulong na ulong to void
765note Audit of one record r of file A against itself.
766if lt oxfirsts r 0 r 1048576
767oxauinc 8
768end
769if oxxfam r na
770oxauinc 9
771end
772f = oxfam r
773if or eq f 2 eq f 3
774oxauinc 11
775if oxtrcell r na
776oxauinc 10
777end
778end
779end
780
781fn oxaudit na ulong nb ulong to void
782note Leakage audit of two decoded files, A = records [0, na), B = [na, na + nb). AU: 0 B
783note workloads present in A, 1..5 by B family 0..4, 6 of those with the same oracle arm,
784note 7 B state keys present in A, 8 A duplicate state keys, 9 A workloads under two family
785note words, 10 A TEST (families 2, 3) records whose workload family holds an A TRAIN record
786note of the same core class, 11 A records of families 2, 3, 12 B records of families 2..4
787note (the v1 TEST partition).
788for i ulong 32
789put AU i 0
790end
791for r ulong na
792oxaua r na
793end
794for k ulong nb
795oxaub add na k na
796end
797end