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 / main.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note aien-train#19 host driver. First stdin byte selects the mode: |
| 3 | note U uninterrupted run to event 512, final image to fd 3, report to stdout. |
| 4 | note P / Q run to event 100 / 300 (phase A / phase B), image to fd 3, then stop. |
| 5 | note R read one image after the mode byte, admit it, continue to 512, image to fd 3, report. |
| 6 | note C read two images after the mode byte and require byte identity. |
| 7 | global IN uchar 1 |
| 8 | text TRUN "SI19 run events=" |
| 9 | text TUPD " updates=" |
| 10 | text TEXP " experiences_A=256 experiences_B=256 replay_ring=64 batch=2 lr=2^-9 updates_per_event=4\n" |
| 11 | text TRES "SI19 resumed_from_event=" |
| 12 | text TINI "SI19 params INIT" |
| 13 | text TMA "SI19 params after_A" |
| 14 | text TMF "SI19 params final_M" |
| 15 | text TCHG "SI19 changed_cells after_A_vs_INIT=" |
| 16 | text TCHF " final_M_vs_INIT=" |
| 17 | text TOF8 "/8" |
| 18 | text TSP " " |
| 19 | text TNL "\n" |
| 20 | text THA "SI19 heldout env=A n=128 unseen_keys mse:\n" |
| 21 | text THB "SI19 heldout env=B n=128 unseen_keys mse:\n" |
| 22 | text KM0 " model_M_after_A " |
| 23 | text KIN " init_model " |
| 24 | text KSH " shuffled_control_S " |
| 25 | text KR0 " rules_persistence " |
| 26 | text KR1 " rules_constant_velocity " |
| 27 | text KFQ " frequency_mode " |
| 28 | text KNN " nn_retrieval " |
| 29 | text KND " nn_retrieval_delta " |
| 30 | text KOR " reference_true_mean_dynamics(not_a_baseline) " |
| 31 | text KFA " model_M_after_B_with_A_replay " |
| 32 | text KFN " model_N_after_B_no_replay " |
| 33 | text KEH " frequency_exact_key_hits=" |
| 34 | text KCU "SI19 curve env=A experiences=" |
| 35 | text KMS " mse " |
| 36 | text KLI "SI19 lineage arm=" |
| 37 | text KLM "M" |
| 38 | text KLN "N" |
| 39 | text KLS "S" |
| 40 | text KLA "MA" |
| 41 | text KID " ids=" |
| 42 | text KUS " uses=" |
| 43 | text KLB " B_ids_in_lineage=" |
| 44 | text TCK "SI19 checkpoint bytes=51752 fnv=" |
| 45 | text TPAR "SI19 partial checkpoint at event=" |
| 46 | text TREF "SI19 checkpoint refused status=-" |
| 47 | text TIDN "SI19_RESTART_IDENTICAL bytes=51752 fnv=" |
| 48 | text TDIF "SI19_RESTART_DIFFERENT first_byte=" |
| 49 | |
| 50 | fn mline x ulong to void |
| 51 | wdec x |
| 52 | w = write 1 TSP 0 1 |
| 53 | wnum x |
| 54 | w = write 1 TNL 0 1 |
| 55 | end |
| 56 | |
| 57 | fn mparams pb ulong to void |
| 58 | for i ulong 8 |
| 59 | w = write 1 TSP 0 1 |
| 60 | wnum get WS add pb i |
| 61 | end |
| 62 | w = write 1 TNL 0 1 |
| 63 | end |
| 64 | |
| 65 | fn mchanged pb ulong to ulong |
| 66 | n = ulong 0 |
| 67 | for i ulong 8 |
| 68 | if ne get WS add pb i get WS add 40 i |
| 69 | n = add n 1 |
| 70 | end |
| 71 | end |
| 72 | ret n |
| 73 | end |
| 74 | |
| 75 | fn mlin arm ulong to void |
| 76 | w = write 1 KID 0 len KID |
| 77 | wnum wsids arm |
| 78 | w = write 1 KUS 0 len KUS |
| 79 | wnum wsuses arm |
| 80 | b = ulong 0 |
| 81 | for i ulong 256 |
| 82 | if wsaffect arm add 256 i |
| 83 | b = add b 1 |
| 84 | end |
| 85 | end |
| 86 | w = write 1 KLB 0 len KLB |
| 87 | wnum b |
| 88 | w = write 1 TNL 0 1 |
| 89 | end |
| 90 | |
| 91 | fn mevalA to void |
| 92 | wsfreq 0 |
| 93 | wsheld 0 |
| 94 | put EH 0 0 |
| 95 | w = write 1 THA 0 len THA |
| 96 | w = write 1 KM0 0 len KM0 |
| 97 | mline wsmse 0 0 32 |
| 98 | w = write 1 KIN 0 len KIN |
| 99 | mline wsmse 0 0 40 |
| 100 | w = write 1 KSH 0 len KSH |
| 101 | mline wsmse 0 0 24 |
| 102 | w = write 1 KR0 0 len KR0 |
| 103 | mline wsmse 0 1 0 |
| 104 | w = write 1 KR1 0 len KR1 |
| 105 | mline wsmse 0 2 0 |
| 106 | w = write 1 KFQ 0 len KFQ |
| 107 | mline wsmse 0 4 0 |
| 108 | w = write 1 KNN 0 len KNN |
| 109 | mline wsmse 0 5 0 |
| 110 | w = write 1 KND 0 len KND |
| 111 | mline wsmse 0 6 0 |
| 112 | w = write 1 KOR 0 len KOR |
| 113 | mline wsmse 0 3 0 |
| 114 | w = write 1 KFA 0 len KFA |
| 115 | mline wsmse 0 0 8 |
| 116 | w = write 1 KFN 0 len KFN |
| 117 | mline wsmse 0 0 16 |
| 118 | w = write 1 KEH 0 len KEH |
| 119 | wnum get EH 0 |
| 120 | w = write 1 TNL 0 1 |
| 121 | for k ulong 8 |
| 122 | w = write 1 KCU 0 len KCU |
| 123 | wnum mul add k 1 32 |
| 124 | w = write 1 KMS 0 len KMS |
| 125 | mline wsmse 0 0 add 48 mul k 8 |
| 126 | end |
| 127 | end |
| 128 | |
| 129 | fn mevalB to void |
| 130 | wsfreq 1 |
| 131 | wsheld 1 |
| 132 | put EH 0 0 |
| 133 | w = write 1 THB 0 len THB |
| 134 | w = write 1 KM0 0 len KM0 |
| 135 | mline wsmse 1 0 32 |
| 136 | w = write 1 KFA 0 len KFA |
| 137 | mline wsmse 1 0 8 |
| 138 | w = write 1 KFN 0 len KFN |
| 139 | mline wsmse 1 0 16 |
| 140 | w = write 1 KIN 0 len KIN |
| 141 | mline wsmse 1 0 40 |
| 142 | w = write 1 KR0 0 len KR0 |
| 143 | mline wsmse 1 1 0 |
| 144 | w = write 1 KR1 0 len KR1 |
| 145 | mline wsmse 1 2 0 |
| 146 | w = write 1 KFQ 0 len KFQ |
| 147 | mline wsmse 1 4 0 |
| 148 | w = write 1 KNN 0 len KNN |
| 149 | mline wsmse 1 5 0 |
| 150 | w = write 1 KND 0 len KND |
| 151 | mline wsmse 1 6 0 |
| 152 | w = write 1 KOR 0 len KOR |
| 153 | mline wsmse 1 3 0 |
| 154 | w = write 1 KEH 0 len KEH |
| 155 | wnum get EH 0 |
| 156 | w = write 1 TNL 0 1 |
| 157 | end |
| 158 | |
| 159 | fn mreport to void |
| 160 | note Called after the final image is saved; evaluation scratch is not checkpointed state. |
| 161 | w = write 1 TRUN 0 len TRUN |
| 162 | wnum get WS 0 |
| 163 | w = write 1 TUPD 0 len TUPD |
| 164 | wnum get WS 1 |
| 165 | w = write 1 TEXP 0 len TEXP |
| 166 | w = write 1 TINI 0 len TINI |
| 167 | mparams 40 |
| 168 | w = write 1 TMA 0 len TMA |
| 169 | mparams 32 |
| 170 | w = write 1 TMF 0 len TMF |
| 171 | mparams 8 |
| 172 | w = write 1 TCHG 0 len TCHG |
| 173 | wnum mchanged 32 |
| 174 | w = write 1 TOF8 0 len TOF8 |
| 175 | w = write 1 TCHF 0 len TCHF |
| 176 | wnum mchanged 8 |
| 177 | w = write 1 TOF8 0 len TOF8 |
| 178 | w = write 1 TNL 0 1 |
| 179 | w = write 1 KLI 0 len KLI |
| 180 | w = write 1 KLM 0 len KLM |
| 181 | mlin 0 |
| 182 | w = write 1 KLI 0 len KLI |
| 183 | w = write 1 KLN 0 len KLN |
| 184 | mlin 1 |
| 185 | w = write 1 KLI 0 len KLI |
| 186 | w = write 1 KLS 0 len KLS |
| 187 | mlin 2 |
| 188 | w = write 1 KLI 0 len KLI |
| 189 | w = write 1 KLA 0 len KLA |
| 190 | mlin 3 |
| 191 | w = write 1 TCK 0 len TCK |
| 192 | wnum ckget 51744 |
| 193 | w = write 1 TNL 0 1 |
| 194 | mevalA |
| 195 | mevalB |
| 196 | end |
| 197 | |
| 198 | fn mfinish to void |
| 199 | cksave 0 |
| 200 | ckwrite 3 0 51752 |
| 201 | mreport |
| 202 | end |
| 203 | |
| 204 | fn mpartial at ulong to void |
| 205 | wsinit |
| 206 | wsrun at |
| 207 | cksave 0 |
| 208 | ckwrite 3 0 51752 |
| 209 | w = write 1 TPAR 0 len TPAR |
| 210 | wnum at |
| 211 | w = write 1 TSP 0 1 |
| 212 | wnum ckget 51744 |
| 213 | w = write 1 TNL 0 1 |
| 214 | end |
| 215 | |
| 216 | fn mcompare to int |
| 217 | n = ckread 0 103504 |
| 218 | if ne n 103504 |
| 219 | w = write 1 TDIF 0 len TDIF |
| 220 | wnum n |
| 221 | w = write 1 TNL 0 1 |
| 222 | ret 1 |
| 223 | end |
| 224 | for i ulong 51752 |
| 225 | if ne get CB i get CB add 51752 i |
| 226 | w = write 1 TDIF 0 len TDIF |
| 227 | wnum i |
| 228 | w = write 1 TNL 0 1 |
| 229 | ret 1 |
| 230 | end |
| 231 | end |
| 232 | w = write 1 TIDN 0 len TIDN |
| 233 | wnum ckget 51744 |
| 234 | w = write 1 TNL 0 1 |
| 235 | ret 0 |
| 236 | end |
| 237 | |
| 238 | fn main to int |
| 239 | r = read 0 IN 0 1 |
| 240 | if ne r 1 |
| 241 | ret 64 |
| 242 | end |
| 243 | m = get IN 0 |
| 244 | if eq m 85 |
| 245 | wsinit |
| 246 | wsrun 512 |
| 247 | mfinish |
| 248 | ret 0 |
| 249 | end |
| 250 | if eq m 80 |
| 251 | mpartial 100 |
| 252 | ret 0 |
| 253 | end |
| 254 | if eq m 81 |
| 255 | mpartial 300 |
| 256 | ret 0 |
| 257 | end |
| 258 | if eq m 82 |
| 259 | n = ckread 0 51752 |
| 260 | st = ckload 0 n |
| 261 | if ne st 0 |
| 262 | w = write 1 TREF 0 len TREF |
| 263 | wnum ulong neg st |
| 264 | w = write 1 TNL 0 1 |
| 265 | ret 65 |
| 266 | end |
| 267 | w = write 1 TRES 0 len TRES |
| 268 | wnum get WS 0 |
| 269 | w = write 1 TNL 0 1 |
| 270 | wsrun 512 |
| 271 | mfinish |
| 272 | ret 0 |
| 273 | end |
| 274 | if eq m 67 |
| 275 | ret mcompare |
| 276 | end |
| 277 | ret 64 |
| 278 | end |