Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-train/blob/main/native/alignment/project.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / native / alignment / project.om` 385 lines ยท 5747 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note NL2 bounded f64 projector. Caller owns paired rows and five-field identity. 3 note Fixed row stride four. No model capture, authority, allocation or external runtime. 4 global HX f64 128 5 global ZY f64 128 6 global HG f64 16 7 global HC f64 16 8 global HV f64 16 9 global HW f64 16 10 global HP f64 16 11 global HM ulong 5 12 global HI ulong 5 13 global HS ulong 5 14 global HE f64 3 15 16 fn ix r ulong c ulong to ulong 17 ret add mul r 4 c 18 end 19 20 fn finite x f64 to bool 21 ret lt and bitcast ulong x `9223372036854775807` `9218868437227405312` 22 end 23 24 fn clear to void 25 for i ulong 128 26 put HX i 0.0 27 put ZY i 0.0 28 end 29 for i ulong 16 30 put HG i 0.0 31 put HC i 0.0 32 put HV i 0.0 33 put HW i 0.0 34 end 35 end 36 37 fn dotxy n ulong i ulong j ulong to f64 38 s = f64 0.0 39 for r ulong n 40 x = get HX ix r i 41 y = get ZY ix r j 42 s = add s mul x y 43 end 44 ret s 45 end 46 47 fn dotxx n ulong i ulong j ulong to f64 48 s = f64 0.0 49 for r ulong n 50 x = get HX ix r i 51 y = get HX ix r j 52 s = add s mul x y 53 end 54 ret s 55 end 56 57 fn dotcc n ulong i ulong j ulong to f64 58 s = f64 0.0 59 for r ulong n 60 x = get HC ix r i 61 y = get HC ix r j 62 s = add s mul x y 63 end 64 ret s 65 end 66 67 fn cross n ulong d ulong o ulong to void 68 for i ulong d 69 for j ulong o 70 put HC ix i j dotxy n i j 71 end 72 end 73 end 74 75 fn gram n ulong d ulong to void 76 for i ulong d 77 for j ulong d 78 put HG ix i j dotxx n i j 79 end 80 end 81 end 82 83 fn polargram d ulong to void 84 for i ulong d 85 for j ulong d 86 put HG ix i j dotcc d i j 87 end 88 end 89 end 90 91 fn rotrow k ulong p ulong q ulong c f64 s f64 to void 92 if and ne k p ne k q 93 u = get HG ix k p 94 v = get HG ix k q 95 x = sub mul c u mul s v 96 y = add mul s u mul c v 97 put HG ix k p x 98 put HG ix p k x 99 put HG ix k q y 100 put HG ix q k y 101 end 102 u = get HV ix k p 103 v = get HV ix k q 104 x = sub mul c u mul s v 105 y = add mul s u mul c v 106 put HV ix k p x 107 put HV ix k q y 108 end 109 110 fn rotate p ulong q ulong d ulong to void 111 b = get HG ix p q 112 if eq b 0.0 113 ret 114 end 115 a = get HG ix p p 116 z = get HG ix q q 117 tau = div sub z a mul 2.0 b 118 t = div 1.0 add fabs tau fsqrt add 1.0 mul tau tau 119 if lt tau 0.0 120 t = sub 0.0 t 121 end 122 c = div 1.0 fsqrt add 1.0 mul t t 123 s = mul t c 124 put HG ix p p sub a mul t b 125 put HG ix q q add z mul t b 126 put HG ix p q 0.0 127 put HG ix q p 0.0 128 for k ulong d 129 rotrow k p q c s 130 end 131 end 132 133 fn converge d ulong to bool 134 mx = f64 1.0 135 off = f64 0.0 136 for i ulong d 137 mx = fmax mx fabs get HG ix i i 138 for j ulong d 139 if ne i j 140 off = fmax off fabs get HG ix i j 141 end 142 end 143 end 144 ret le off mul 0.`00000000000001` mx 145 end 146 147 fn eigen d ulong to bool 148 for i ulong 16 149 put HV i 0.0 150 end 151 for i ulong d 152 put HV ix i i 1.0 153 end 154 for sweep ulong 64 155 if converge d 156 ret true 157 end 158 for p ulong d 159 for q ulong d 160 if gt q p 161 rotate p q d 162 end 163 end 164 end 165 end 166 ret converge d 167 end 168 169 fn choose d ulong to ulong 170 best = ulong 0 171 val = f64 -1.0 172 for i ulong d 173 if gt get HG ix i i val 174 val = get HG ix i i 175 best = i 176 end 177 end 178 ret best 179 end 180 181 fn accum i ulong j ulong k ulong s f64 to void 182 pos = ix i j 183 v = mul get HV ix i k s 184 put HW pos add get HW pos v 185 end 186 187 fn accumt i ulong j ulong k ulong s f64 to void 188 pos = ix i j 189 v = mul get HV ix j k s 190 put HW pos add get HW pos v 191 end 192 193 fn pcrcol k ulong d ulong o ulong to void 194 lam = get HG ix k k 195 for j ulong o 196 s = f64 0.0 197 for r ulong d 198 s = add s mul get HV ix r k get HC ix r j 199 end 200 s = div s lam 201 for i ulong d 202 accum i j k s 203 end 204 end 205 end 206 207 fn polarcol k ulong d ulong to void 208 lam = fsqrt get HG ix k k 209 for i ulong d 210 s = f64 0.0 211 for r ulong d 212 s = add s mul get HC ix i r get HV ix r k 213 end 214 s = div s lam 215 for j ulong d 216 accumt i j k s 217 end 218 end 219 end 220 221 note fit: mode1 orthogonal; mode2 PCR. Lift nonlinear inputs before mode2. 222 note Returns 1 shape,2 nonfinite,3 nonconverged,4 deficient rank; no partial install. 223 fn fit n ulong d ulong o ulong rank ulong mode ulong to ulong 224 if or eq n 0 gt n 32 225 ret 1 226 end 227 if or or eq d 0 gt d 4 or eq o 0 gt o 4 228 ret 1 229 end 230 if or or eq rank 0 gt rank d and ne mode 1 ne mode 2 231 ret 1 232 end 233 if and eq mode 1 or ne d o ne rank d 234 ret 1 235 end 236 for r ulong n 237 for i ulong d 238 if not finite get HX ix r i 239 ret 2 240 end 241 end 242 for j ulong o 243 if not finite get ZY ix r j 244 ret 2 245 end 246 end 247 end 248 for i ulong 16 249 put HW i 0.0 250 end 251 cross n d o 252 if eq mode 1 253 polargram d 254 else 255 gram n d 256 end 257 for i ulong 16 258 if or not finite get HG i not finite get HC i 259 ret 2 260 end 261 end 262 if not eigen d 263 ret 3 264 end 265 k = choose d 266 cut = mul 0.`0000000001` get HG ix k k 267 if le cut 0.0 268 ret 4 269 end 270 for j ulong rank 271 k = choose d 272 if le get HG ix k k cut 273 ret 4 274 end 275 if eq mode 1 276 polarcol k d 277 else 278 pcrcol k d o 279 end 280 put HG ix k k -1.0 281 end 282 for i ulong 16 283 if not finite get HW i 284 ret 2 285 end 286 end 287 for i ulong 16 288 put HP i get HW i 289 end 290 for i ulong 5 291 put HI i get HM i 292 end 293 put HS 0 d 294 put HS 1 o 295 put HS 2 1 296 ret 0 297 end 298 299 note Metadata is identity comparison, never provenance authentication or authority. 300 fn mismatch to ulong 301 n = ulong 0 302 for i ulong 5 303 if ne get HM i get HI i 304 n = add n 1 305 end 306 end 307 ret n 308 end 309 310 fn predict r ulong j ulong to f64 311 s = f64 0.0 312 for i ulong get HS 0 313 s = add s mul get HX ix r i get HP ix i j 314 end 315 ret s 316 end 317 318 note HE stores residual sum of squares, target energy, max absolute feature error. 319 fn measure n ulong to ulong 320 if or eq n 0 gt n 32 321 ret 1 322 end 323 if or eq get HS 2 0 ne mismatch 0 324 ret 5 325 end 326 ss = f64 0.0 327 en = f64 0.0 328 mx = f64 0.0 329 for r ulong n 330 for i ulong get HS 0 331 if not finite get HX ix r i 332 ret 2 333 end 334 end 335 for j ulong get HS 1 336 y = get ZY ix r j 337 if not finite y 338 ret 2 339 end 340 e = sub predict r j y 341 if not finite e 342 ret 2 343 end 344 ss = add ss mul e e 345 en = add en mul y y 346 mx = fmax mx fabs e 347 end 348 end 349 if or or not finite ss not finite en not finite mx 350 ret 2 351 end 352 if le en 0.0 353 ret 6 354 end 355 put HE 0 ss 356 put HE 1 en 357 put HE 2 mx 358 ret 0 359 end 360 361 fn ortherr d ulong to f64 362 mx = f64 0.0 363 for i ulong d 364 for j ulong d 365 s = f64 0.0 366 for k ulong d 367 s = add s mul get HP ix k i get HP ix k j 368 end 369 if eq i j 370 s = sub s 1.0 371 end 372 mx = fmax mx fabs s 373 end 374 end 375 ret mx 376 end 377 378 fn lift n ulong to void 379 for r ulong n 380 x = get HX ix r 0 381 y = get HX ix r 1 382 put HX ix r 2 mul x x 383 put HX ix r 3 mul y y 384 end 385 end