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-task / controls.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Imports unchanged capacity controls for bounded GB/GV and ginit. |
| 3 | fn tgcheck to int |
| 4 | ginit |
| 5 | v = tloss 5 |
| 6 | ngrad |
| 7 | for j ulong 4 |
| 8 | if not tactive j |
| 9 | if ne get NG add 36 j 0.0f64 |
| 10 | ret 60 |
| 11 | end |
| 12 | end |
| 13 | end |
| 14 | for i ulong 40 |
| 15 | put GV i get NG i |
| 16 | end |
| 17 | for i ulong 40 |
| 18 | put NP i add get GB i 0.000001f64 |
| 19 | plus = tloss 5 |
| 20 | put NP i sub get GB i 0.000001f64 |
| 21 | minus = tloss 5 |
| 22 | put NP i get GB i |
| 23 | diff = div sub plus minus 0.000002f64 |
| 24 | if gt fabs sub diff get GV i 0.00000001f64 |
| 25 | ret 61 |
| 26 | end |
| 27 | end |
| 28 | for i ulong 40 |
| 29 | put NG i get GV i |
| 30 | end |
| 31 | rc = nstep 0.1f64 |
| 32 | if ne rc 0 |
| 33 | ret 62 |
| 34 | end |
| 35 | for i ulong 40 |
| 36 | wanted = sub get GB i mul 0.1f64 get GV i |
| 37 | if gt fabs sub get NP i wanted 0.000000000001f64 |
| 38 | ret 63 |
| 39 | end |
| 40 | z = write 1 GT 0 len GT |
| 41 | if ne z long len GT |
| 42 | ret 80 |
| 43 | end |
| 44 | field get TC 0 |
| 45 | field i |
| 46 | field bitcast ulong get GB i |
| 47 | field bitcast ulong get GV i |
| 48 | outnum bitcast ulong get NP i |
| 49 | newline |
| 50 | end |
| 51 | ret 0 |
| 52 | end |
| 53 | fn tsentin to void |
| 54 | for j ulong 4 |
| 55 | put NO j -77.0f64 |
| 56 | put NH j -66.0f64 |
| 57 | end |
| 58 | end |
| 59 | fn tstay rc int to void |
| 60 | if ne rc 2 |
| 61 | exit 41 |
| 62 | end |
| 63 | for j ulong 4 |
| 64 | if or ne get NO j -77.0f64 ne get NH j -66.0f64 |
| 65 | exit 42 |
| 66 | end |
| 67 | end |
| 68 | end |
| 69 | fn trefuse to void |
| 70 | put TC 0 0 |
| 71 | tclear |
| 72 | put TL 0 1 |
| 73 | tsentin |
| 74 | rc = tdecode 1 0 0 0 1 0 |
| 75 | tstay rc |
| 76 | rc = tdecode 2 0 0 0 1 1 |
| 77 | tstay rc |
| 78 | rc = tdecode 2 0 0 0 0 0 |
| 79 | tstay rc |
| 80 | rc = tdecode 2 0 0 0 2 0 |
| 81 | tstay rc |
| 82 | rc = tdecode 2 0 2 0 0 0 |
| 83 | tstay rc |
| 84 | rc = tdecode 2 0 0 1 1 0 |
| 85 | tstay rc |
| 86 | rc = tdecode 2 5 0 0 1 0 |
| 87 | tstay rc |
| 88 | put NSH 1 3 |
| 89 | rc = tdecode 2 0 0 0 1 0 |
| 90 | tstay rc |
| 91 | put NSH 1 4 |
| 92 | put NSH 2 31 |
| 93 | rc = tdecode 2 0 0 0 1 0 |
| 94 | tstay rc |
| 95 | put NSH 2 40 |
| 96 | put TC 0 2 |
| 97 | rc = tdecode 2 0 0 4 1 0 |
| 98 | tstay rc |
| 99 | put TC 0 3 |
| 100 | rc = tdecode 2 0 0 0 1 0 |
| 101 | tstay rc |
| 102 | put TC 0 0 |
| 103 | end |
| 104 | fn ttarget id ulong context ulong to ulong |
| 105 | if eq get TC 0 1 |
| 106 | ret tpar id |
| 107 | end |
| 108 | if eq get TC 0 2 |
| 109 | ret or and id 12 context |
| 110 | end |
| 111 | ret id |
| 112 | end |
| 113 | fn texact want ulong to void |
| 114 | for j ulong 4 |
| 115 | if ne get NO j f64 and shr want j 1 |
| 116 | exit 51 |
| 117 | end |
| 118 | end |
| 119 | end |
| 120 | fn twitness to void |
| 121 | rc = nconstruct 1 |
| 122 | if ne rc 0 |
| 123 | exit 52 |
| 124 | end |
| 125 | for task ulong 3 |
| 126 | put TC 0 task |
| 127 | for id ulong 16 |
| 128 | context = ulong 0 |
| 129 | if eq task 2 |
| 130 | context = and id 3 |
| 131 | end |
| 132 | for arm ulong 5 |
| 133 | for variant ulong 3 |
| 134 | rc = tencode id arm variant |
| 135 | if ne rc 0 |
| 136 | exit 53 |
| 137 | end |
| 138 | note Destroy all sender-private inputs before receiving the actual byte carrier. |
| 139 | for j ulong 4 |
| 140 | put NX j div 0.0f64 0.0f64 |
| 141 | put NT j div 0.0f64 0.0f64 |
| 142 | end |
| 143 | rc = tdecode 2 arm variant context get TL 0 0 |
| 144 | if eq variant 2 |
| 145 | if ne rc 2 |
| 146 | exit 54 |
| 147 | end |
| 148 | else |
| 149 | if ne rc 0 |
| 150 | exit 55 |
| 151 | end |
| 152 | src = id |
| 153 | if eq variant 1 |
| 154 | src = and add id 1 15 |
| 155 | end |
| 156 | if or eq arm 0 eq arm 4 |
| 157 | texact ttarget src context |
| 158 | end |
| 159 | if and eq task 0 or eq arm 1 eq arm 2 |
| 160 | for j ulong 4 |
| 161 | p = ulong 0 |
| 162 | if ge get NO j 0.5f64 |
| 163 | p = 1 |
| 164 | end |
| 165 | if ne p and shr src j 1 |
| 166 | exit 56 |
| 167 | end |
| 168 | end |
| 169 | if ne tabst rc 0 |
| 170 | exit 57 |
| 171 | end |
| 172 | end |
| 173 | end |
| 174 | end |
| 175 | end |
| 176 | end |
| 177 | end |
| 178 | end |
| 179 | fn tbytes to void |
| 180 | for task ulong 3 |
| 181 | put TC 0 task |
| 182 | limit = ulong 15 |
| 183 | if eq task 1 |
| 184 | limit = 1 |
| 185 | end |
| 186 | if eq task 2 |
| 187 | limit = 3 |
| 188 | end |
| 189 | for value ulong 256 |
| 190 | tclear |
| 191 | put WB 0 uchar value |
| 192 | tsentin |
| 193 | rc = tdecode 2 0 0 0 1 0 |
| 194 | if gt value limit |
| 195 | tstay rc |
| 196 | else |
| 197 | if ne rc 0 |
| 198 | exit 58 |
| 199 | end |
| 200 | end |
| 201 | tsentin |
| 202 | rc = tdecode 2 2 0 0 1 0 |
| 203 | if gt value 15 |
| 204 | tstay rc |
| 205 | else |
| 206 | if ne rc 0 |
| 207 | exit 59 |
| 208 | end |
| 209 | end |
| 210 | rc = tdecode 2 1 0 0 1 0 |
| 211 | if ne rc 0 |
| 212 | exit 64 |
| 213 | end |
| 214 | end |
| 215 | for pos ulong 4 |
| 216 | for value ulong 256 |
| 217 | tclear |
| 218 | for j ulong 4 |
| 219 | put WB j uchar 48 |
| 220 | end |
| 221 | put WB pos uchar value |
| 222 | tsentin |
| 223 | rc = tdecode 2 4 0 0 4 0 |
| 224 | if or eq value 48 eq value 49 |
| 225 | if ne rc 0 |
| 226 | exit 65 |
| 227 | end |
| 228 | else |
| 229 | tstay rc |
| 230 | end |
| 231 | end |
| 232 | end |
| 233 | end |
| 234 | end |
| 235 | fn main to int |
| 236 | rc = nshape 1 |
| 237 | if ne rc 0 |
| 238 | ret rc |
| 239 | end |
| 240 | for task ulong 3 |
| 241 | put TC 0 task |
| 242 | rc = tgcheck |
| 243 | if ne rc 0 |
| 244 | ret rc |
| 245 | end |
| 246 | end |
| 247 | trefuse |
| 248 | twitness |
| 249 | tbytes |
| 250 | z = write 1 PASS 0 len PASS |
| 251 | if ne z long len PASS |
| 252 | ret 80 |
| 253 | end |
| 254 | ret 0 |
| 255 | end |