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 / tests / si19 / omexp-test.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note aien-train#24 ORIG-1 tests: record admission and every refusal class, the frozen |
| 3 | note features, partitions and leakage check, the allow-list (authorized, synthetic, revoked, |
| 4 | note absent, malformed) and the deterministic baselines, on the SYNTHETIC fixture and on |
| 5 | note hand-built records. v2 (ORIG1-CONTRACT-v2.md): per-record admission with counted |
| 6 | note reasons (pairing, duplicates, unsupported, range), the workload-family split, its |
| 7 | note disjointness check, v2 retrieval and the two-file leakage audit. |
| 8 | note Unit: deps + fixture + world + omexp + omexpfix + this file. |
| 9 | global OC ulong 1 |
| 10 | global OK ulong 4 |
| 11 | text OPASS "SI19_OMEXP_TEST_PASS checks=" |
| 12 | text OFAIL "SI19_OMEXP_TEST_FAIL check=" |
| 13 | text ONL "\n" |
| 14 | text LALL "16622604375676129865 AUTHORIZED owner-records-20261025\n3415637669635212362 SYNTHETIC fixture-seed7-100\n99 REVOKED withdrawn-example\n77 MALFORMED x\nabc AUTHORIZED junk\n" |
| 15 | text LREV "99 REVOKED withdrawn-example\n" |
| 16 | |
| 17 | fn okx ok bool to void |
| 18 | put OC 0 add get OC 0 1 |
| 19 | if not ok |
| 20 | w = write 1 OFAIL 0 len OFAIL |
| 21 | wnum get OC 0 |
| 22 | w = write 1 ONL 0 1 |
| 23 | exit 1 |
| 24 | end |
| 25 | end |
| 26 | |
| 27 | fn tbyte pos ulong v ulong to void |
| 28 | note Overwrite one little-endian record word in RB. |
| 29 | for i ulong 8 |
| 30 | put RB add pos i uchar and shr v mul i 8 255 |
| 31 | end |
| 32 | end |
| 33 | |
| 34 | fn tfresh to ulong |
| 35 | note A fresh 100-record fixture file in RB; returns its byte count. |
| 36 | ret sxgen 7 100 |
| 37 | end |
| 38 | |
| 39 | fn tlg16 to void |
| 40 | okx eq oxlg16 0 0 |
| 41 | okx eq oxlg16 1 0 |
| 42 | okx eq oxlg16 2 16 |
| 43 | okx eq oxlg16 3 24 |
| 44 | okx eq oxlg16 4 32 |
| 45 | okx eq oxlg16 1024 160 |
| 46 | okx eq oxlg16 1000 159 |
| 47 | okx eq oxlg16 8192 208 |
| 48 | okx eq oxlg16 1099511627776 640 |
| 49 | end |
| 50 | |
| 51 | fn tload to void |
| 52 | n = tfresh |
| 53 | okx eq oxload n 0 |
| 54 | okx eq get RC 0 100 |
| 55 | okx eq get RC 1 n |
| 56 | okx eq get RC 2 oxfnv n |
| 57 | okx eq get RC 2 3415637669635212362 |
| 58 | for f ulong 5 |
| 59 | okx eq get RC add 4 f 20 |
| 60 | end |
| 61 | okx eq oxfam 0 0 |
| 62 | okx eq oxfam 4 4 |
| 63 | okx eq oxcore 5 1 |
| 64 | okx eq oxpress 4 1 |
| 65 | okx eq oxpress 2 0 |
| 66 | okx eq oxseq 17 17 |
| 67 | end |
| 68 | |
| 69 | fn tword r ulong i ulong v ulong to void |
| 70 | tbyte add mul r 256 mul i 8 v |
| 71 | end |
| 72 | |
| 73 | fn trefone i ulong v ulong want int to void |
| 74 | note Corrupt word i of record 3 to v; the load must refuse with want and admit nothing. |
| 75 | n = tfresh |
| 76 | tword 3 i v |
| 77 | okx eq oxload n want |
| 78 | okx eq get RC 0 0 |
| 79 | end |
| 80 | |
| 81 | fn trefuse to void |
| 82 | n = tfresh |
| 83 | okx eq oxload 0 -1 |
| 84 | okx eq oxload add n 8 -1 |
| 85 | okx eq oxload 524544 -1 |
| 86 | trefone 0 1 -2 |
| 87 | trefone 1 2 -2 |
| 88 | trefone 2 5 -3 |
| 89 | trefone 3 3 -3 |
| 90 | trefone 4 16 -3 |
| 91 | trefone 13 0 -3 |
| 92 | trefone 13 9 -3 |
| 93 | trefone 5 0 -4 |
| 94 | trefone 5 8193 -4 |
| 95 | trefone 6 0 -4 |
| 96 | trefone 7 0 -4 |
| 97 | trefone 12 30 -5 |
| 98 | trefone 12 64 -5 |
| 99 | trefone 16 0 -6 |
| 100 | trefone 20 0 -6 |
| 101 | trefone 24 0 -6 |
| 102 | trefone 28 0 -6 |
| 103 | trefone 31 1 -7 |
| 104 | trefone 31 3 -7 |
| 105 | trefone 14 2 -8 |
| 106 | trefone 14 1 -8 |
| 107 | trefone 10 1048576 -9 |
| 108 | trefone 9 7 -9 |
| 109 | note A record outside the file's own count is never read: word 0 of record 100 is zero. |
| 110 | n = tfresh |
| 111 | okx eq oxload n 0 |
| 112 | note An eligible bit on an unmeasured arm is refused even when the measurement is forged later. |
| 113 | n = tfresh |
| 114 | tword 3 12 63 |
| 115 | okx eq oxload n -6 |
| 116 | tword 3 21 500 |
| 117 | okx eq oxload n -6 |
| 118 | tword 3 29 1 |
| 119 | okx eq oxload n 0 |
| 120 | okx oxcand 3 5 |
| 121 | n = tfresh |
| 122 | tword 3 12 47 |
| 123 | okx eq oxload n -6 |
| 124 | end |
| 125 | |
| 126 | fn tleak to void |
| 127 | note Family-2 record 2 given the shape of family-0 record 0: contamination refused. |
| 128 | n = tfresh |
| 129 | tword 2 5 oxword 0 5 |
| 130 | tword 2 6 oxword 0 6 |
| 131 | tword 2 9 oxword 0 9 |
| 132 | okx eq oxload n -11 |
| 133 | okx eq get RC 0 0 |
| 134 | note The same shape in family 3 is the declared partial overlap, not contamination. |
| 135 | n = tfresh |
| 136 | tword 3 5 oxword 0 5 |
| 137 | tword 3 6 oxword 0 6 |
| 138 | tword 3 9 oxword 0 9 |
| 139 | okx eq oxload n 0 |
| 140 | end |
| 141 | |
| 142 | fn tsplit to void |
| 143 | n = tfresh |
| 144 | okx eq oxload n 0 |
| 145 | for r ulong 100 |
| 146 | f = oxfam r |
| 147 | p = oxpart r |
| 148 | if eq f 0 |
| 149 | okx eq p 0 |
| 150 | end |
| 151 | if eq f 1 |
| 152 | okx eq p 1 |
| 153 | end |
| 154 | if gt f 1 |
| 155 | okx eq p 2 |
| 156 | end |
| 157 | end |
| 158 | note TRAIN and DEV share no M and no N value; H1 keys are absent from both; H3 keys equal H1 keys. |
| 159 | for r ulong 100 |
| 160 | if eq oxpart r 0 |
| 161 | for q ulong 100 |
| 162 | if eq oxpart q 1 |
| 163 | okx ne oxm r oxm q |
| 164 | okx ne oxn r oxn q |
| 165 | end |
| 166 | if eq oxfam q 2 |
| 167 | okx not and eq oxm r oxm q eq oxn r oxn q |
| 168 | end |
| 169 | end |
| 170 | end |
| 171 | if eq oxfam r 2 |
| 172 | okx eq oxm add r 2 oxm r |
| 173 | okx eq oxn add r 2 oxn r |
| 174 | okx eq oxfam add r 2 4 |
| 175 | end |
| 176 | end |
| 177 | end |
| 178 | |
| 179 | fn tallow to void |
| 180 | n = tfresh |
| 181 | okx eq oxload n 0 |
| 182 | h = get RC 2 |
| 183 | n = len LALL |
| 184 | for i ulong n |
| 185 | put LB i get LALL i |
| 186 | end |
| 187 | okx eq oxallow n h 2 |
| 188 | okx eq oxallow n 16622604375676129865 1 |
| 189 | okx eq oxallow n 99 -12 |
| 190 | okx eq oxallow n 77 -13 |
| 191 | okx eq oxallow n 5 -13 |
| 192 | okx eq oxallow 0 h -13 |
| 193 | okx eq oxallow 10 h -13 |
| 194 | note A revoked entry wins over nothing else: the lookup is by exact hash only. |
| 195 | n = len LREV |
| 196 | for i ulong n |
| 197 | put LB i get LREV i |
| 198 | end |
| 199 | okx eq oxallow n h -13 |
| 200 | okx eq oxallow n 99 -12 |
| 201 | end |
| 202 | |
| 203 | fn tfeat to void |
| 204 | n = tfresh |
| 205 | okx eq oxload n 0 |
| 206 | note Record 11: family 1, core 0, M 8, N 4, pressure 0. |
| 207 | okx eq oxm 11 8 |
| 208 | okx eq oxn 11 4 |
| 209 | oxfeat 11 |
| 210 | okx eq get XF 0 16 |
| 211 | okx eq get XF 1 48 |
| 212 | okx eq get XF 2 32 |
| 213 | okx eq get XF 3 6 |
| 214 | okx eq get XF 4 4 |
| 215 | okx eq get XF 5 0 |
| 216 | okx eq get XF 6 0 |
| 217 | okx eq get XF 7 0 |
| 218 | okx eq get XF 8 16 |
| 219 | okx eq get XF 9 0 |
| 220 | okx eq get XF 10 0 |
| 221 | okx eq get XF 11 0 |
| 222 | note Record 8: family 3, core 1, M 7, N 1: thin, odd, A725. |
| 223 | oxfeat 8 |
| 224 | okx eq get XF 1 44 |
| 225 | okx eq get XF 2 0 |
| 226 | okx eq get XF 5 16 |
| 227 | okx eq get XF 6 16 |
| 228 | okx eq get XF 8 0 |
| 229 | okx eq get XF 9 16 |
| 230 | note Record 9: family 4 carries pressure 1. |
| 231 | oxfeat 9 |
| 232 | okx eq get XF 11 16 |
| 233 | note Overflow doublings: a 1024 x 1024 state on an A725 (524288 B cache). |
| 234 | tword 9 5 1024 |
| 235 | tword 9 6 1024 |
| 236 | tword 9 9 8404992 |
| 237 | okx eq oxload n 0 |
| 238 | oxfeat 9 |
| 239 | okx eq get XF 7 64 |
| 240 | end |
| 241 | |
| 242 | fn tbase to void |
| 243 | n = tfresh |
| 244 | okx eq oxload n 0 |
| 245 | note Planted rule: core 0, N <= 3 -> unroll2; core 0, N >= 4 -> quad4; core 1 large N -> reference. |
| 246 | okx eq oxbest 0 2 |
| 247 | okx eq oxbest 1 4 |
| 248 | okx eq oxbest 7 0 |
| 249 | okx eq oxrule 0 2 |
| 250 | okx eq oxrule 2 3 |
| 251 | okx eq oxt16 0 0 0 |
| 252 | okx lt oxt16 0 2 0 |
| 253 | okx gt oxt16 0 1 0 |
| 254 | note Retrieval returns a TRAIN record of the same core; a train record is nearest to itself. |
| 255 | q = oxnear 2 |
| 256 | okx eq oxpart q 0 |
| 257 | okx eq oxcore q 0 |
| 258 | okx eq oxnear 0 0 |
| 259 | okx eq oxnear 10 10 |
| 260 | q = oxnear 7 |
| 261 | okx eq oxcore q 1 |
| 262 | note Best static arm on core 0 with 10 train shapes of N in 1..2 is unroll2. |
| 263 | okx eq oxstatic 0 2 |
| 264 | okx eq oxstatic 1 2 |
| 265 | note An arm missing from one train record is no static candidate. |
| 266 | tword 0 12 15 |
| 267 | tword 0 20 0 |
| 268 | tword 0 28 0 |
| 269 | okx eq oxload n 0 |
| 270 | okx not oxcand 0 4 |
| 271 | okx eq oxstatic 0 2 |
| 272 | end |
| 273 | |
| 274 | fn t2one r ulong i ulong v ulong want int to void |
| 275 | note Word i of record r set to v: only record r is refused, with reason want, counted once. |
| 276 | n = tfresh |
| 277 | tword r i v |
| 278 | okx eq oxadm2 n 0 |
| 279 | okx eq get RC 9 1 |
| 280 | okx eq get RA r long want |
| 281 | okx eq get RQ ulong neg long want 1 |
| 282 | okx eq get RQ 0 99 |
| 283 | okx eq get RS r 3 |
| 284 | okx eq oxpart r 3 |
| 285 | okx eq get RC 0 100 |
| 286 | okx eq get RC 10 99 |
| 287 | end |
| 288 | |
| 289 | fn tadm2 to void |
| 290 | n = tfresh |
| 291 | okx eq oxadm2 n 0 |
| 292 | okx eq get RC 0 100 |
| 293 | okx eq get RC 1 n |
| 294 | okx eq get RC 2 3415637669635212362 |
| 295 | okx eq get RQ 0 100 |
| 296 | okx eq get RC 10 100 |
| 297 | okx eq add add get RC 4 get RC 5 get RC 6 100 |
| 298 | for r ulong 100 |
| 299 | okx eq get RA r 0 |
| 300 | okx lt get RS r 3 |
| 301 | end |
| 302 | okx eq oxadm2 0 -1 |
| 303 | okx eq oxadm2 add n 8 -1 |
| 304 | okx eq get RC 0 0 |
| 305 | okx eq get RC 9 0 |
| 306 | note v1 admission restores v1 partitions. |
| 307 | n = tfresh |
| 308 | okx eq oxadm2 n 0 |
| 309 | okx eq oxload n 0 |
| 310 | okx eq get RC 9 0 |
| 311 | okx eq oxpart 4 2 |
| 312 | end |
| 313 | |
| 314 | fn trefuse2 to void |
| 315 | note Unsupported format and enumerations. |
| 316 | t2one 3 0 1 -2 |
| 317 | t2one 3 1 2 -2 |
| 318 | t2one 3 2 6 -3 |
| 319 | t2one 3 3 2 -3 |
| 320 | t2one 3 4 2 -3 |
| 321 | t2one 3 13 5 -3 |
| 322 | t2one 3 13 8 -3 |
| 323 | note Shape and calls out of range, profile. |
| 324 | t2one 3 5 0 -4 |
| 325 | t2one 3 6 8193 -4 |
| 326 | t2one 3 7 0 -4 |
| 327 | t2one 3 7 1048577 -4 |
| 328 | t2one 3 10 1048576 -9 |
| 329 | t2one 3 9 7 -9 |
| 330 | note Pairing: the complete arm set {0..4} measured and verified, arm 5 absent. |
| 331 | t2one 3 12 15 -14 |
| 332 | t2one 3 12 63 -14 |
| 333 | t2one 3 18 0 -14 |
| 334 | t2one 3 26 0 -14 |
| 335 | t2one 3 21 5 -14 |
| 336 | t2one 3 29 1 -14 |
| 337 | t2one 3 22 1 -14 |
| 338 | t2one 3 23 1 -14 |
| 339 | note Out of range measurement and the mismatch word. |
| 340 | t2one 3 17 1099511627776 -10 |
| 341 | t2one 3 31 1 -7 |
| 342 | note Sequence not increasing: only the regressing record is refused. |
| 343 | t2one 3 14 2 -8 |
| 344 | note A product above 2^19 elements is out of the consumer's range. |
| 345 | n = tfresh |
| 346 | tword 3 5 1024 |
| 347 | tword 3 6 1024 |
| 348 | tword 3 9 8404992 |
| 349 | okx eq oxadm2 n 0 |
| 350 | okx eq get RA 3 -4 |
| 351 | note Two refusals are counted separately and nothing else is refused. |
| 352 | n = tfresh |
| 353 | tword 3 31 1 |
| 354 | tword 8 31 2 |
| 355 | okx eq oxadm2 n 0 |
| 356 | okx eq get RQ 7 2 |
| 357 | okx eq get RQ 0 98 |
| 358 | end |
| 359 | |
| 360 | fn tcopyk q ulong r ulong to void |
| 361 | note Give record r the state key (M, N, state bytes) of record q. |
| 362 | tword r 5 oxword q 5 |
| 363 | tword r 6 oxword q 6 |
| 364 | tword r 9 oxword q 9 |
| 365 | end |
| 366 | |
| 367 | fn tdup2 to void |
| 368 | note Record 12 (family 2, core 0, pressure 0) given record 2's shape: duplicate state. |
| 369 | n = tfresh |
| 370 | okx eq oxdec n 100 |
| 371 | tcopyk 2 12 |
| 372 | okx eq oxadm2 n 0 |
| 373 | okx eq get RA 12 -15 |
| 374 | okx eq get RA 2 0 |
| 375 | okx eq get RQ 15 1 |
| 376 | note A different job seed is still the same decision state. |
| 377 | tword 12 8 999 |
| 378 | okx eq oxadm2 n 0 |
| 379 | okx eq get RA 12 -15 |
| 380 | note A different pressure bucket is a different state: record 4 (H3) has record 2's shape |
| 381 | note and core at pressure 1 and is admitted. |
| 382 | okx eq get RA 4 0 |
| 383 | okx eq oxm 4 oxm 2 |
| 384 | okx eq oxn 4 oxn 2 |
| 385 | okx eq oxcore 4 oxcore 2 |
| 386 | okx ne oxpress 4 oxpress 2 |
| 387 | note A duplicate of a refused record is admitted: only admitted states count. |
| 388 | tword 2 31 1 |
| 389 | okx eq oxadm2 n 0 |
| 390 | okx eq get RA 2 -7 |
| 391 | okx eq get RA 12 0 |
| 392 | note Record 22 duplicates record 12 too: two later duplicates of one state, both counted. |
| 393 | tword 2 31 0 |
| 394 | okx eq oxdec n 100 |
| 395 | tcopyk 2 22 |
| 396 | okx eq oxadm2 n 0 |
| 397 | okx eq get RA 12 -15 |
| 398 | okx eq get RA 22 -15 |
| 399 | okx eq get RQ 15 2 |
| 400 | end |
| 401 | |
| 402 | fn tsplit2 to void |
| 403 | note The frozen family coordinate and split, values computed outside this unit. |
| 404 | okx eq oxfl 1 0 |
| 405 | okx eq oxfl 2 1 |
| 406 | okx eq oxfl 3 1 |
| 407 | okx eq oxfl 8191 12 |
| 408 | okx eq oxfl 8192 13 |
| 409 | okx eq oxhspl 0 0 0 |
| 410 | okx eq oxhspl 0 1 0 |
| 411 | okx eq oxhspl 0 2 2 |
| 412 | okx eq oxhspl 1 1 1 |
| 413 | okx eq oxhspl 2 4 1 |
| 414 | okx eq oxhspl 3 13 2 |
| 415 | okx eq oxhspl 13 6 1 |
| 416 | okx eq oxhspl 7 7 0 |
| 417 | okx eq oxhspl 5 5 0 |
| 418 | okx eq oxhspl 10 6 2 |
| 419 | n = tfresh |
| 420 | okx eq oxadm2 n 0 |
| 421 | okx eq oxcell 11 50 |
| 422 | for r ulong 100 |
| 423 | okx eq oxpart r oxhspl oxfl oxm r oxfl oxn r |
| 424 | end |
| 425 | note No family and no shape crosses splits; held-out families are absent from TRAIN and |
| 426 | note VALIDATION (checked pairwise here, independently of oxdisj). |
| 427 | for r ulong 100 |
| 428 | for q ulong 100 |
| 429 | if ne oxpart q oxpart r |
| 430 | okx ne oxcell q oxcell r |
| 431 | okx not and eq oxm q oxm r eq oxn q oxn r |
| 432 | end |
| 433 | end |
| 434 | end |
| 435 | note H1 and H3 records (same workload, pressure 0 and 1) land in the same split. |
| 436 | okx eq oxpart 2 oxpart 4 |
| 437 | okx eq oxdisj 100 0 |
| 438 | note A split assignment that separates one family is caught. |
| 439 | put RS 4 uchar rem add get RS 2 1 3 |
| 440 | okx eq oxdisj 100 -11 |
| 441 | end |
| 442 | |
| 443 | fn tnear2 to void |
| 444 | note v2 retrieval: a TRAIN record of the same core class and pressure bucket. |
| 445 | n = tfresh |
| 446 | okx eq oxadm2 n 0 |
| 447 | k = ulong 0 |
| 448 | for r ulong 100 |
| 449 | q = oxnear r |
| 450 | if lt q 1048576 |
| 451 | k = add k 1 |
| 452 | okx eq oxpart q 0 |
| 453 | okx eq oxcore q oxcore r |
| 454 | okx eq oxpress q oxpress r |
| 455 | end |
| 456 | end |
| 457 | okx gt k 0 |
| 458 | note The same file under v1 admission ignores pressure (v1 rule unchanged). |
| 459 | okx eq oxload n 0 |
| 460 | okx eq oxpart oxnear 4 0 |
| 461 | end |
| 462 | |
| 463 | fn taudit to void |
| 464 | note File B = file A with record 0's job seed changed: 99 of 100 B workloads occur in A, |
| 465 | note every B state key occurs in A, every matched oracle arm agrees. |
| 466 | n = tfresh |
| 467 | for i ulong n |
| 468 | put RB add n i get RB i |
| 469 | end |
| 470 | tword 100 8 123456789 |
| 471 | okx eq oxdec mul n 2 200 |
| 472 | oxaudit 100 100 |
| 473 | okx eq get AU 0 99 |
| 474 | okx eq get AU 1 19 |
| 475 | okx eq get AU 3 20 |
| 476 | okx eq get AU 6 99 |
| 477 | okx eq get AU 7 100 |
| 478 | okx eq get AU 8 0 |
| 479 | okx eq get AU 9 0 |
| 480 | okx eq get AU 11 40 |
| 481 | okx eq get AU 12 60 |
| 482 | note Record 4 (family 4) given record 2's job seed: one workload under two family words |
| 483 | note on each side; a state key repeated inside A is counted. |
| 484 | tword 4 8 oxword 2 8 |
| 485 | tcopyk 0 10 |
| 486 | okx eq oxdec mul n 2 200 |
| 487 | oxaudit 100 100 |
| 488 | okx eq get AU 9 2 |
| 489 | okx eq get AU 8 1 |
| 490 | end |
| 491 | |
| 492 | fn main to int |
| 493 | tlg16 |
| 494 | tload |
| 495 | trefuse |
| 496 | tleak |
| 497 | tsplit |
| 498 | tallow |
| 499 | tfeat |
| 500 | tbase |
| 501 | tadm2 |
| 502 | trefuse2 |
| 503 | tdup2 |
| 504 | tsplit2 |
| 505 | tnear2 |
| 506 | taudit |
| 507 | w = write 1 OPASS 0 len OPASS |
| 508 | wnum get OC 0 |
| 509 | w = write 1 ONL 0 1 |
| 510 | ret 0 |
| 511 | end |