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