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 / neuralese / nl1r / controls.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Central differences at strictly positive hidden preactivations; separate kink policy. |
| 3 | global GB f64 83 |
| 4 | global GV f64 83 |
| 5 | text GT "G," |
| 6 | text PASS "CONTROLS PASS\n" |
| 7 | fn ginit to void |
| 8 | for i ulong get NSH 2 |
| 9 | v = div f64 add i 1 128.0f64 |
| 10 | put NP i v |
| 11 | put GB i v |
| 12 | end |
| 13 | ninput 5 5 |
| 14 | end |
| 15 | fn geval to f64 |
| 16 | nsend |
| 17 | nrecv |
| 18 | ret nloss |
| 19 | end |
| 20 | fn gcheck to int |
| 21 | ginit |
| 22 | v = geval |
| 23 | ngrad |
| 24 | for i ulong get NSH 2 |
| 25 | put GV i get NG i |
| 26 | end |
| 27 | for i ulong get NSH 2 |
| 28 | put NP i add get GB i 0.000001f64 |
| 29 | plus = geval |
| 30 | put NP i sub get GB i 0.000001f64 |
| 31 | minus = geval |
| 32 | put NP i get GB i |
| 33 | diff = div sub plus minus 0.000002f64 |
| 34 | if gt fabs sub diff get GV i 0.00000001f64 |
| 35 | ret 61 |
| 36 | end |
| 37 | end |
| 38 | for i ulong get NSH 2 |
| 39 | put NG i get GV i |
| 40 | end |
| 41 | rc = nstep 0.1f64 |
| 42 | if ne rc 0 |
| 43 | ret 62 |
| 44 | end |
| 45 | for i ulong get NSH 2 |
| 46 | wanted = sub get GB i mul 0.1f64 get GV i |
| 47 | if gt fabs sub get NP i wanted 0.000000000001f64 |
| 48 | ret 63 |
| 49 | end |
| 50 | z = write 1 GT 0 len GT |
| 51 | if ne z long len GT |
| 52 | ret 80 |
| 53 | end |
| 54 | field get NSH 0 |
| 55 | field i |
| 56 | field bitcast ulong get GB i |
| 57 | field bitcast ulong get GV i |
| 58 | outnum bitcast ulong get NP i |
| 59 | newline |
| 60 | end |
| 61 | ret 0 |
| 62 | end |
| 63 | fn atomic to int |
| 64 | ginit |
| 65 | for i ulong get NSH 2 |
| 66 | put NG i 1.0f64 |
| 67 | end |
| 68 | put NG sub get NSH 2 1 div 0.0f64 0.0f64 |
| 69 | rc = nstep 0.1f64 |
| 70 | if ne rc 2 |
| 71 | ret 64 |
| 72 | end |
| 73 | for i ulong get NSH 2 |
| 74 | if ne get NP i get GB i |
| 75 | ret 65 |
| 76 | end |
| 77 | end |
| 78 | rc = nstep -0.1f64 |
| 79 | if ne rc 1 |
| 80 | ret 66 |
| 81 | end |
| 82 | rc = nstep div 1.0f64 0.0f64 |
| 83 | if ne rc 1 |
| 84 | ret 67 |
| 85 | end |
| 86 | if ne get NSH 3 0 |
| 87 | ret 68 |
| 88 | end |
| 89 | ret 0 |
| 90 | end |
| 91 | fn refuses to int |
| 92 | for j ulong 4 |
| 93 | put NO j -77.0f64 |
| 94 | put NH j 0.0f64 |
| 95 | end |
| 96 | npack |
| 97 | rc = ndecode 0 get NSH 1 wirelen 0 |
| 98 | if ne rc 2 |
| 99 | ret 41 |
| 100 | end |
| 101 | rc = ndecode 1 add get NSH 1 1 wirelen 0 |
| 102 | if ne rc 2 |
| 103 | ret 42 |
| 104 | end |
| 105 | rc = ndecode 1 get NSH 1 add wirelen 1 0 |
| 106 | if ne rc 2 |
| 107 | ret 43 |
| 108 | end |
| 109 | for mode ulong 3 |
| 110 | v = 2.0f64 |
| 111 | if eq mode 0 |
| 112 | v = div 0.0f64 0.0f64 |
| 113 | end |
| 114 | if eq mode 1 |
| 115 | v = div 1.0f64 0.0f64 |
| 116 | end |
| 117 | wput sub get NSH 1 1 bitcast ulong v |
| 118 | rc = ndecode 1 get NSH 1 wirelen 0 |
| 119 | if ne rc 2 |
| 120 | ret 44 |
| 121 | end |
| 122 | for j ulong 4 |
| 123 | if ne get NO j -77.0f64 |
| 124 | ret 45 |
| 125 | end |
| 126 | end |
| 127 | end |
| 128 | ret 0 |
| 129 | end |
| 130 | fn kink to int |
| 131 | ginit |
| 132 | v = geval |
| 133 | for k ulong 8 |
| 134 | put NU k 0.0f64 |
| 135 | put NV k 0.0f64 |
| 136 | end |
| 137 | ngrad |
| 138 | for i ulong 47 |
| 139 | if ne get NG i 0.0f64 |
| 140 | ret 69 |
| 141 | end |
| 142 | end |
| 143 | for k ulong 8 |
| 144 | put NU k -1.0f64 |
| 145 | end |
| 146 | ngrad |
| 147 | for i ulong 47 |
| 148 | if ne get NG i 0.0f64 |
| 149 | ret 70 |
| 150 | end |
| 151 | end |
| 152 | ret 0 |
| 153 | end |
| 154 | fn dcontrol to int |
| 155 | put CFG 3 15 |
| 156 | npack |
| 157 | rc = ndecode 1 1 1 0 |
| 158 | if ne rc 0 |
| 159 | ret 71 |
| 160 | end |
| 161 | for j ulong 4 |
| 162 | if ne get NO j 1.0f64 |
| 163 | ret 72 |
| 164 | end |
| 165 | end |
| 166 | put WB 0 uchar 0 |
| 167 | rc = ndecode 1 1 1 0 |
| 168 | for j ulong 4 |
| 169 | if ne get NO j 0.0f64 |
| 170 | ret 73 |
| 171 | end |
| 172 | end |
| 173 | put WB 0 uchar 16 |
| 174 | rc = ndecode 1 1 1 0 |
| 175 | if ne rc 2 |
| 176 | ret 74 |
| 177 | end |
| 178 | ret 0 |
| 179 | end |
| 180 | fn controls to int |
| 181 | if eq get NSH 0 3 |
| 182 | ret dcontrol |
| 183 | end |
| 184 | rc = gcheck |
| 185 | if ne rc 0 |
| 186 | ret rc |
| 187 | end |
| 188 | put NSH 3 0 |
| 189 | rc = atomic |
| 190 | if ne rc 0 |
| 191 | ret rc |
| 192 | end |
| 193 | rc = refuses |
| 194 | if ne rc 0 |
| 195 | ret rc |
| 196 | end |
| 197 | if eq get NSH 0 2 |
| 198 | rc = kink |
| 199 | if ne rc 0 |
| 200 | ret rc |
| 201 | end |
| 202 | end |
| 203 | z = write 1 PASS 0 len PASS |
| 204 | if ne z long len PASS |
| 205 | ret 80 |
| 206 | end |
| 207 | ret 0 |
| 208 | end |