interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / helix / ollm_factory / arboris_train.om

333 lines · 7109 bytes Raw Blame History
1om2
2note SPDX-License-Identifier: Apache-2.0
3note seed/helix/ollm_factory/arboris_train.om:
4note Pure seeded OM-2 Arboris Training Nervous System for Omega LLM Closed-Loop RLVR & Specialists.
5note
6note Implements three real mechanisms over an explicit causal spreading-activation graph:
7note 1. Causal Failure-Mode Curriculum: ingests per-family failure counts (`arith, branch, loop,
8note bits, digits, fold, select, count, scan, rewrite`) + compiler error / antibody signals,
9note propagates 2-hop sum-over-paths activation, and emits exact next-round RLVR family weights.
10note 2. Preemptive Anti-Forgetting Rehearsal: tracks historical EMA mastery per skill family across
11note specialist generations; whenever a mastered family softens >= 50 milli-units (5%), injects
12note a targeted refresher slice BEFORE retention collapses (verified with positive & negative controls).
13note 3. Adaptive Recurrence Depth Router (`NP in {1, 2, 3}`): maps problem difficulty + Arboris
14note activation + token entropy to optimal looped-core pass count against equal-compute baseline.
15
16note Graph nodes (0..15):
17note 0..9: Bench skill families (0=arith, 1=branch, 2=loop, 3=bits, 4=digits,
18note 5=fold, 6=select, 7=count, 8=scan, 9=rewrite)
19note 10..15: Failure / compiler / antibody root-cause nodes:
20note 10=omc_syntax_type, 11=noend_unclosed, 12=wrong_loop_bound,
21note 13=bit_shift_mask, 14=array_inplace_oob, 15=sm121_antibody_raw
22
23global atAdj ulong 256
24global atAct ulong 16
25global atNext ulong 16
26global atFail ulong 10
27global atWeight ulong 10
28global atHist ulong 10
29global atCurr ulong 10
30global atRefr ulong 10
31
32text atHdr "=== ARBORIS TRAINING NERVOUS SYSTEM (CURRICULUM + REHEARSAL + LOOP-DEPTH) ===\n"
33text atCurA "ARBORIS_CURRICULUM top_family="
34text atCurB " top_energy="
35text atCurC " weights=["
36text atCurSep ","
37text atCurEnd "]\n"
38text atRehA "ARBORIS_REHEARSAL alerts="
39text atRehB " refresher_pct="
40text atRehC " neg_ctrl_stable_alerts="
41text atRehD "\n"
42text atDepA "ARBORIS_LOOP_DEPTH routed_tasks="
43text atDepB " np1="
44text atDepC " np2="
45text atDepD " np3="
46text atDepE " avg_passes_x100="
47text atDepF " savings_vs_fixed3_pct="
48text atDepG "\n"
49text atPass "ARBORIS_TRAIN PASS curriculum=1 rehearsal_pos_neg=1 adaptive_depth=1\n"
50
51fn atWrt s view uchar * to void
52r = write 1 s 0 len s
53end
54
55fn atNum v ulong to void
56b = new uchar 24 0
57p = ulong 24
58x = v
59while true bound 24
60p = sub p 1
61put b p uchar add 48 rem x 10
62x = div x 10
63if eq x 0
64break
65end
66end
67r = write 1 b p sub 24 p
68end
69
70fn atEdge u ulong v ulong w ulong to void
71put atAdj add mul u 16 v w
72put atAdj add mul v 16 u w
73end
74
75fn atInitGraph to void
76for i ulong 256
77put atAdj i 0
78end
79note Connect skill families to shared causal failure modes (sum-over-paths graph)
80atEdge 0 10 40
81atEdge 1 11 45
82atEdge 2 12 65
83atEdge 3 13 70
84atEdge 4 12 55
85atEdge 5 12 60
86atEdge 6 11 40
87atEdge 7 12 45
88atEdge 8 14 50
89atEdge 9 14 80
90atEdge 9 11 55
91atEdge 2 15 35
92atEdge 3 15 45
93atEdge 5 14 35
94atEdge 8 12 45
95atEdge 4 10 30
96end
97
98fn atSpread hops ulong to void
99for h ulong hops bound 8
100for v ulong 16
101s = get atAct v
102for u ulong 16
103w = get atAdj add mul u 16 v
104if ne w 0
105s = add s div mul get atAct u w 100
106end
107end
108put atNext v s
109end
110for v ulong 16
111put atAct v get atNext v
112end
113end
114end
115
116fn atParseArg idx ulong defVal ulong to ulong
117b = new uchar 32 0
118ac = ulong argcnt
119if le ac idx
120ret defVal
121end
122lr = argread idx b 0 32
123if le lr 0
124ret defVal
125end
126v = ulong 0
127any = false
128for i ulong ulong lr bound 32
129c = get b i
130if and ge c 48 le c 57
131v = add mul v 10 ulong sub c 48
132any = true
133end
134end
135if not any
136ret defVal
137end
138ret v
139end
140
141fn atRunCurriculum to ulong
142for i ulong 16
143put atAct i 0
144end
145note Ingest live per-family failure counts from argv[1..10] if provided, else base/ck6000.bin baseline (0/159):
146note arith=19 branch=37 loop=15 bits=15 digits=9 fold=13 select=4 count=8 scan=7 rewrite=32
147put atFail 0 atParseArg 1 19
148put atFail 1 atParseArg 2 37
149put atFail 2 atParseArg 3 15
150put atFail 3 atParseArg 4 15
151put atFail 4 atParseArg 5 9
152put atFail 5 atParseArg 6 13
153put atFail 6 atParseArg 7 4
154put atFail 7 atParseArg 8 8
155put atFail 8 atParseArg 9 7
156put atFail 9 atParseArg 10 32
157for f ulong 10
158put atAct f mul get atFail f 10
159end
160note Inject observed compiler/bench failure cues: noend(33), wrong_loop(38), inplace_rewrite(24)
161put atAct 11 330
162put atAct 12 380
163put atAct 14 240
164atSpread 2
165tot = ulong 0
166topF = ulong 0
167topE = ulong 0
168for f ulong 10
169e = get atAct f
170tot = add tot e
171if gt e topE
172topE = e
173topF = f
174end
175end
176if eq tot 0
177exit 11
178end
179for f ulong 10
180put atWeight f div mul get atAct f 1000 tot
181end
182atWrt atCurA
183atNum topF
184atWrt atCurB
185atNum topE
186atWrt atCurC
187for f ulong 10
188if gt f 0
189atWrt atCurSep
190end
191atNum get atWeight f
192end
193atWrt atCurEnd
194ret topF
195end
196
197fn atCheckRehearsal thr ulong to ulong
198alerts = ulong 0
199for f ulong 10
200h = get atHist f
201c = get atCurr f
202put atRefr f 0
203if gt h c
204drop = sub h c
205if ge drop thr
206put atRefr f add 50 div drop 2
207alerts = add alerts 1
208end
209end
210end
211ret alerts
212end
213
214fn atRunRehearsal to bool
215note Historical mastery (milli-pass-rate 0..1000) after Specialist P1 (OM-2 Systems)
216for f ulong 10
217put atHist f 600
218put atCurr f 600
219end
220note Negative control: zero degradation -> MUST trigger 0 rehearsal alerts!
221negAlerts = atCheckRehearsal 50
222if ne negAlerts 0
223ret false
224end
225note Positive test: while training Specialist P2 (SM121/Rewrite), arith (0) drops 600->510 and bits (3) drops 600->480
226put atCurr 0 510
227put atCurr 3 480
228put atCurr 9 820
229posAlerts = atCheckRehearsal 50
230if ne posAlerts 2
231ret false
232end
233totR = ulong 0
234for f ulong 10
235totR = add totR get atRefr f
236end
237note Refresher slice capped at 30% of next training batch
238refPct = div totR 10
239if gt refPct 30
240refPct = 30
241end
242if lt refPct 10
243ret false
244end
245atWrt atRehA
246atNum posAlerts
247atWrt atRehB
248atNum refPct
249atWrt atRehC
250atNum negAlerts
251atWrt atRehD
252ret true
253end
254
255fn atRouteDepth diff ulong ent ulong to ulong
256note Combine Arboris causal difficulty (0..100) + token entropy (0..100) -> looped core NP in {1, 2, 3}
257score = add mul diff 6 mul ent 4
258if lt score 350
259ret 1
260end
261if lt score 700
262ret 2
263end
264ret 3
265end
266
267fn atRunAdaptiveDepth to bool
268n1 = ulong 0
269n2 = ulong 0
270n3 = ulong 0
271totP = ulong 0
272note Route 60 representative tasks across routine (25), medium (20), hard multi-step proofs/rewrites (15)
273for i ulong 60
274diff = ulong 20
275ent = ulong 25
276if ge i 25
277diff = 55
278ent = 50
279end
280if ge i 45
281diff = 88
282ent = 82
283end
284np = atRouteDepth diff ent
285totP = add totP np
286if eq np 1
287n1 = add n1 1
288else
289if eq np 2
290n2 = add n2 1
291else
292n3 = add n3 1
293end
294end
295end
296if or eq n1 0 or eq n2 0 eq n3 0
297ret false
298end
299avgX100 = div mul totP 100 60
300note Fixed NP=3 costs 180 passes across 60 tasks; compute % compute saved by adaptive exit!
301if ge totP 180
302ret false
303end
304savPct = div mul sub 180 totP 100 180
305atWrt atDepA
306atNum 60
307atWrt atDepB
308atNum n1
309atWrt atDepC
310atNum n2
311atWrt atDepD
312atNum n3
313atWrt atDepE
314atNum avgX100
315atWrt atDepF
316atNum savPct
317atWrt atDepG
318ret true
319end
320
321fn main to int
322atWrt atHdr
323atInitGraph
324topF = atRunCurriculum
325if not atRunRehearsal
326exit 21
327end
328if not atRunAdaptiveDepth
329exit 22
330end
331atWrt atPass
332ret 0
333end