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 / collective / admit_p0.om

598 lines · 9217 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note aien-train#26 P0 refusal contract (DRA-15, Spark hive card t_8cf72aaf).
3note Admits ONE synthetic bank descriptor and ONE microjob request before any
4note adapter arithmetic. Contract, codes, check order and the 46 cases:
5note native/collective/fixtures/admission_v0.json (committed before this file).
6note The merged pilot shared_bank_p0.om is not changed; this unit reuses its
7note numbers (B, x, U_i, V_i, scores) as the baseline descriptor.
8note Refusal = nonzero status, no response written, counters unchanged.
9note Score and permission are distinct abstract types: passing one where the
10note other is needed is a compile refusal (omc error 7); a permission entry
11note that is not 0 or 1 (scores stored as permissions) is a runtime refusal.
12note Synthetic P0 admission only: not AEGIS authority, not a router, no model,
13note no checkpoint, no GPU. Names are at most 8 characters (omc error 13).
14om2
15abstract perm ulong
16abstract score ulong
17
18const NCAND ulong 8
19const KMAX ulong 3
20const VMAX long 65536
21const NCASE ulong 46
22note FNV-1a 64 identities computed by Wolfram (evidence/COLLECTIVE-P0-ADMIT):
23note BASEID of B, ALTID of B with B[4]=1, OVRID of B with B[0]=65537.
24const BASEID ulong 10035045484153181716
25const ALTID ulong 9153321889483684885
26const OVRID ulong 9990611769663005102
27
28note Descriptor Dsc: 0 rank, 1 rows, 2 cols, 3 base identity, 4 generation.
29note Request Req: 0 rank, 1 rows, 2 cols, 3 base identity, 4 generation,
30note 5 active count, 6 mode (0 explicit indices, 1 select top-k by score).
31global Dsc ulong 8
32global Req ulong 8
33global Ract ulong 4
34global Rph long 4
35global B long 6
36global U long 16
37global V long 24
38global X long 3
39global PermA ulong 8
40global ScoreA ulong 8
41global Cgen ulong 8
42global PlanA ulong 4
43global PlanP long 4
44global Yv long 2
45global Counts ulong 2
46global Exp long 64
47
48fn permmk x ulong to perm
49ret seal perm x
50end
51
52fn scoremk x ulong to score
53ret seal score x
54end
55
56fn permat id ulong to perm
57ret permmk get PermA id
58end
59
60fn scoreat id ulong to score
61ret scoremk get ScoreA id
62end
63
64note A permission is valid only as 0 (denied) or 1 (granted).
65fn permbad p perm to bool
66ret gt open p 1
67end
68
69fn denied p perm to bool
70ret ne open p 1
71end
72
73fn above a score b score to bool
74ret gt open a open b
75end
76
77note Baseline descriptor and request. Response Yv and Counts are not touched.
78fn reset to void
79put B 0 2
80put B 1 -1
81put B 2 3
82put B 3 1
83put B 4 0
84put B 5 -2
85for id ulong 8
86sid = long id
87ui = mul id 2
88vi = mul id 3
89put U ui sub sid 3
90put U add ui 1 add sid 1
91put V vi 1
92put V add vi 1 sub 3 sid
93put V add vi 2 -1
94put PermA id 1
95put Cgen id 7
96end
97put ScoreA 0 4
98put ScoreA 1 11
99put ScoreA 2 7
100put ScoreA 3 9
101put ScoreA 4 8
102put ScoreA 5 0
103put ScoreA 6 3
104put ScoreA 7 2
105put X 0 2
106put X 1 3
107put X 2 5
108put Dsc 0 1
109put Dsc 1 2
110put Dsc 2 3
111put Dsc 3 BASEID
112put Dsc 4 7
113put Req 0 1
114put Req 1 2
115put Req 2 3
116put Req 3 BASEID
117put Req 4 7
118put Req 5 2
119put Req 6 0
120put Ract 0 1
121put Ract 1 3
122put Ract 2 0
123put Ract 3 0
124put Rph 0 1
125put Rph 1 -1
126put Rph 2 1
127put Rph 3 1
128end
129
130note Base identity: FNV-1a 64 over B row-major, 8 little-endian bytes each.
131fn bdigest to ulong
132h = ulong 14695981039346656037
133for i ulong 6
134w = bitcast ulong get B i
135for b ulong 8
136byt = and shr w mul b 8 255
137h = mul xor h byt 1099511628211
138end
139end
140ret h
141end
142
143fn badval v long to bool
144ret or lt v neg VMAX gt v VMAX
145end
146
147note Range of x, B and the U/V of every planned candidate (first k slots).
148fn rangebad k ulong to bool
149for i ulong 3
150if badval get X i
151ret true
152end
153end
154for i ulong 6
155if badval get B i
156ret true
157end
158end
159for j ulong k
160id = get PlanA j
161ui = mul id 2
162vi = mul id 3
163for r ulong 2
164if badval get U add ui r
165ret true
166end
167end
168for c ulong 3
169if badval get V add vi c
170ret true
171end
172end
173end
174ret false
175end
176
177note Highest-score permitted candidate not in the used mask; 8 when none.
178fn pick used ulong to ulong
179best = ulong 8
180bsc = scoremk 0
181for id ulong 8
182if denied permat id
183continue
184end
185if ne and used shl ulong 1 id 0
186continue
187end
188s = scoreat id
189if eq best 8
190best = id
191bsc = s
192continue
193end
194if above s bsc
195best = id
196bsc = s
197end
198end
199ret best
200end
201
202note Shape: descriptor 2x3, request equal to the descriptor.
203fn shapebad to bool
204d = or ne get Dsc 1 2 ne get Dsc 2 3
205r = or ne get Req 1 get Dsc 1 ne get Req 2 get Dsc 2
206ret or d r
207end
208
209fn dupat j ulong id ulong to bool
210for i ulong j
211if eq get PlanA i id
212ret true
213end
214end
215ret false
216end
217
218note Admission. Writes only the internal plan; never Yv or Counts.
219note Codes and order: fixtures/admission_v0.json "codes" and "check_order".
220fn admit to long
221if or ne get Dsc 0 1 ne get Req 0 get Dsc 0
222ret -4
223end
224if shapebad
225ret -5
226end
227if or eq get Dsc 3 0 eq get Req 3 0
228ret -6
229end
230if ne get Req 3 get Dsc 3
231ret -7
232end
233if ne bdigest get Dsc 3
234ret -7
235end
236if ne get Req 4 get Dsc 4
237ret -8
238end
239for i ulong 8
240if permbad permat i
241ret -13
242end
243end
244md = get Req 6
245if gt md 1
246ret -16
247end
248k = get Req 5
249if eq k 0
250ret -10
251end
252if gt k KMAX
253ret -11
254end
255used = ulong 0
256for j ulong k
257id = get Ract j
258if eq md 1
259id = pick used
260if ge id NCAND
261ret -14
262end
263used = or used shl ulong 1 id
264end
265put PlanA j id
266put PlanP j get Rph j
267end
268for j ulong k
269id = get PlanA j
270if ge id NCAND
271ret -1
272end
273if denied permat id
274ret -2
275end
276if ne get Cgen id get Dsc 4
277ret -9
278end
279ph = get PlanP j
280if and ne ph 1 ne ph -1
281ret -3
282end
283if dupat j id
284ret -12
285end
286end
287if rangebad k
288ret -15
289end
290ret 0
291end
292
293note y = B.x + sum_j phase_j U_j (V_j . x), into a local, then published.
294fn bxrow r ulong to long
295s = long 0
296for c ulong 3
297s = add s mul get B add mul r 3 c get X c
298end
299ret s
300end
301
302fn vdot id ulong to long
303vi = mul id 3
304dot = long 0
305for c ulong 3
306dot = add dot mul get V add vi c get X c
307end
308ret dot
309end
310
311fn compute k ulong to void
312acc = new long 2 0
313put acc 0 bxrow 0
314put acc 1 bxrow 1
315for j ulong k
316id = get PlanA j
317f = mul get PlanP j vdot id
318ui = mul id 2
319for r ulong 2
320d = mul f get U add ui r
321put acc r add get acc r d
322end
323end
324put Yv 0 get acc 0
325put Yv 1 get acc 1
326put Counts 0 add get Counts 0 1
327put Counts 1 add get Counts 1 k
328end
329
330fn run to long
331st = admit
332if ne st 0
333ret st
334end
335compute get Req 5
336ret 0
337end
338
339note The 46 cases of fixtures/admission_v0.json, each from the baseline.
340fn setcase n ulong to void
341reset
342if eq n 1
343put Dsc 0 2
344put Req 0 2
345end
346if eq n 2
347put Req 0 2
348end
349if eq n 3
350put Dsc 1 3
351put Req 1 3
352end
353if eq n 4
354put Dsc 2 2
355put Req 2 2
356end
357if eq n 5
358put Req 1 1
359end
360if eq n 6
361put Req 2 4
362end
363if eq n 7
364put Dsc 3 0
365put Req 3 0
366end
367if eq n 8
368put Req 3 0
369end
370if eq n 9
371put Req 3 xor BASEID 1
372end
373if eq n 10
374put B 4 1
375end
376if eq n 11
377put B 4 1
378put Dsc 3 ALTID
379put Req 3 ALTID
380end
381if eq n 12
382put Req 4 6
383end
384if eq n 13
385put Cgen 3 6
386end
387if eq n 14
388put Cgen 1 8
389end
390if eq n 15
391put Cgen 5 6
392end
393if eq n 16
394put Dsc 4 9
395put Req 4 9
396for i ulong 8
397put Cgen i 9
398end
399end
400if eq n 17
401put Req 5 0
402end
403if eq n 18
404put Req 5 4
405put Ract 0 0
406put Ract 1 2
407put Ract 2 4
408put Ract 3 6
409put Rph 1 1
410end
411if eq n 19
412put Req 5 1
413put Ract 0 6
414put Rph 0 -1
415end
416if eq n 20
417put Req 5 3
418put Ract 0 0
419put Ract 1 4
420put Ract 2 7
421end
422if eq n 21
423put Ract 1 8
424end
425if eq n 22
426put Ract 1 18446744073709551615
427end
428if eq n 23
429put Ract 0 7
430end
431if eq n 24
432put PermA 3 0
433end
434if eq n 25
435put PermA 2 0
436end
437if eq n 26
438put Rph 0 0
439end
440if eq n 27
441put Rph 1 2
442end
443if eq n 28
444put Rph 0 -1
445end
446if eq n 29
447put Ract 0 3
448end
449if eq n 30
450put Req 5 3
451put Ract 2 1
452put Rph 1 1
453end
454if eq n 31
455for i ulong 8
456put PermA i get ScoreA i
457put ScoreA i 1
458end
459end
460if eq n 32
461put PermA 5 2
462end
463if eq n 33
464put Req 6 1
465put Rph 1 1
466end
467if eq n 34
468put Req 6 1
469put Req 5 1
470put PermA 1 0
471end
472if eq n 35
473put Req 6 1
474put Req 5 3
475end
476if eq n 36
477put Req 6 1
478put Req 5 1
479for i ulong 8
480put PermA i 0
481end
482end
483if eq n 37
484put Req 6 1
485put Req 5 3
486for i ulong 8
487put PermA i 0
488end
489put PermA 0 1
490put PermA 5 1
491end
492if eq n 38
493put Req 6 2
494end
495if eq n 39
496put X 0 65536
497put X 1 -65536
498put X 2 65536
499end
500if eq n 40
501put X 0 65537
502end
503if eq n 41
504put X 2 4611686018427387904
505end
506if eq n 42
507put U 6 -65537
508end
509if eq n 43
510put B 0 65537
511put Dsc 3 OVRID
512put Req 3 OVRID
513end
514if eq n 44
515put U 10 70000
516end
517if eq n 45
518put Req 6 1
519put Cgen 3 6
520end
521end
522
523note Precommitted expect_status of every case (fixtures/admission_v0.json).
524fn fillexp to void
525put Exp 0 0
526put Exp 1 -4
527put Exp 2 -4
528put Exp 3 -5
529put Exp 4 -5
530put Exp 5 -5
531put Exp 6 -5
532put Exp 7 -6
533put Exp 8 -6
534put Exp 9 -7
535put Exp 10 -7
536put Exp 11 0
537put Exp 12 -8
538put Exp 13 -9
539put Exp 14 -9
540put Exp 15 0
541put Exp 16 0
542put Exp 17 -10
543put Exp 18 -11
544put Exp 19 0
545put Exp 20 0
546put Exp 21 -1
547put Exp 22 -1
548put Exp 23 0
549put Exp 24 -2
550put Exp 25 0
551put Exp 26 -3
552put Exp 27 -3
553put Exp 28 0
554put Exp 29 -12
555put Exp 30 -12
556put Exp 31 -13
557put Exp 32 -13
558put Exp 33 0
559put Exp 34 0
560put Exp 35 0
561put Exp 36 -14
562put Exp 37 -14
563put Exp 38 -16
564put Exp 39 0
565put Exp 40 -15
566put Exp 41 -15
567put Exp 42 -15
568put Exp 43 -15
569put Exp 44 0
570put Exp 45 -9
571end
572
573note Self-test: exit n+1 when case n returns another status, 47..50 when the
574note final response or counters differ, 0 when all agree. The independent
575note judge is native/collective/admit/run.sh with the Wolfram expectations.
576fn main to int
577fillexp
578for n ulong NCASE
579setcase n
580s = run
581if ne s get Exp n
582ret int add n 1
583end
584end
585if ne get Yv 0 10
586ret 47
587end
588if ne get Yv 1 10
589ret 48
590end
591if ne get Counts 0 14
592ret 49
593end
594if ne get Counts 1 28
595ret 50
596end
597ret 0
598end