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
aien-train / native / si19 / fixture.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note FIXTURE for aien-train#19: a seeded, resettable transition micro-world. |
| 3 | note It stands in for Omega X1 ExperienceTransition (omega-mv#699), which is not on |
| 4 | note main. It is not World, J-Space or Cortex evidence. Transitions are executed by |
| 5 | note these fixed dynamics; no model, teacher or corpus generates them. |
| 6 | note Typed finite observation: position p -12..12, velocity v -3..3. Action u -1,0,1. |
| 7 | note Dynamics: p2 = p + v; v2 = v + gain*u + gust. gust is -1 w.p. 1/8, +1 w.p. 1/8, else 0. |
| 8 | note A transition is terminal when p2 leaves -12..12, v2 leaves -3..3, or step 7 ends. |
| 9 | note A terminal transition records its true successor, never the reset state. The next |
| 10 | note transition starts from a fresh reset, so no transition crosses an episode boundary. |
| 11 | note FS slot s occupies FS[16s..16s+15]: 0 gain, 1 env rng, 2 p, 3 v, 4 step, 5 episode, |
| 12 | note 6 reset p low, 7 reset p high, 8 behaviour-policy rng, 9 transitions emitted. |
| 13 | note FT receives one transition: 0 p, 1 v, 2 u, 3 p2, 4 v2, 5 done, 6 episode*16+step. |
| 14 | global FS long 64 |
| 15 | global FT long 8 |
| 16 | |
| 17 | fn fxrand at ulong to long |
| 18 | n = get FS at |
| 19 | n = rem add mul n 1664525 1013904223 4294967296 |
| 20 | put FS at n |
| 21 | ret shr n 8 |
| 22 | end |
| 23 | |
| 24 | fn fxreset s ulong to void |
| 25 | b = mul s 16 |
| 26 | lo = get FS add b 6 |
| 27 | span = add sub get FS add b 7 lo 1 |
| 28 | put FS add b 2 add lo rem fxrand add b 1 span |
| 29 | put FS add b 3 sub rem fxrand add b 1 5 2 |
| 30 | put FS add b 4 0 |
| 31 | end |
| 32 | |
| 33 | fn fxinit s ulong gain long seed long wide long to void |
| 34 | note wide 0: reset p in -12..-4 (training region); wide 1: reset p in -12..12. |
| 35 | b = mul s 16 |
| 36 | for i ulong 16 |
| 37 | put FS add b i 0 |
| 38 | end |
| 39 | put FS b gain |
| 40 | put FS add b 1 seed |
| 41 | put FS add b 6 -12 |
| 42 | hi = long -4 |
| 43 | if eq wide 1 |
| 44 | hi = 12 |
| 45 | end |
| 46 | put FS add b 7 hi |
| 47 | put FS add b 8 add seed 7919 |
| 48 | fxreset s |
| 49 | end |
| 50 | |
| 51 | fn fxact s ulong to long |
| 52 | note Uniform random behaviour policy from its own seeded stream. |
| 53 | ret sub rem fxrand add mul s 16 8 3 1 |
| 54 | end |
| 55 | |
| 56 | fn fxdone p2 long v2 long step long to long |
| 57 | if or gt p2 12 lt p2 -12 |
| 58 | ret 1 |
| 59 | end |
| 60 | if or gt v2 3 lt v2 -3 |
| 61 | ret 1 |
| 62 | end |
| 63 | if ge add step 1 8 |
| 64 | ret 1 |
| 65 | end |
| 66 | ret 0 |
| 67 | end |
| 68 | |
| 69 | fn fxvel b ulong v long u long to long |
| 70 | note Successor velocity: v + gain*u + gust, drawn from the environment stream. |
| 71 | r = rem fxrand add b 1 8 |
| 72 | v2 = add v mul get FS b u |
| 73 | if eq r 0 |
| 74 | ret sub v2 1 |
| 75 | end |
| 76 | if eq r 7 |
| 77 | ret add v2 1 |
| 78 | end |
| 79 | ret v2 |
| 80 | end |
| 81 | |
| 82 | fn fxstep s ulong u long to void |
| 83 | b = mul s 16 |
| 84 | v = get FS add b 3 |
| 85 | put FT 0 get FS add b 2 |
| 86 | put FT 1 v |
| 87 | put FT 2 u |
| 88 | put FT 3 add get FT 0 v |
| 89 | put FT 4 fxvel b v u |
| 90 | step = get FS add b 4 |
| 91 | done = fxdone get FT 3 get FT 4 step |
| 92 | put FT 5 done |
| 93 | put FT 6 add mul get FS add b 5 16 step |
| 94 | put FS add b 9 add get FS add b 9 1 |
| 95 | if eq done 1 |
| 96 | put FS add b 5 add get FS add b 5 1 |
| 97 | fxreset s |
| 98 | else |
| 99 | put FS add b 2 get FT 3 |
| 100 | put FS add b 3 get FT 4 |
| 101 | put FS add b 4 add step 1 |
| 102 | end |
| 103 | end |