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/neuralese/nl1r/capacity.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 / neuralese / nl1r / capacity.om` 227 lines ยท 3580 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Extension of affine.om staged explicit SGD; historical bytes remain immutable. 3 note Globals are bounded scratch state. Receiver never reads NX or NT. 4 global NP f64 83 5 global NG f64 83 6 global NC f64 83 7 global NX f64 4 8 global NT f64 4 9 global NA f64 4 10 global NH f64 4 11 global NZ f64 4 12 global NO f64 4 13 global ND f64 4 14 global NU f64 8 15 global NV f64 8 16 global NE f64 8 17 global NSH ulong 4 18 global RNG ulong 1 19 20 fn nsoft x f64 to f64 21 ret div x add 1.0f64 fabs x 22 end 23 fn nslope x f64 to f64 24 d = add 1.0f64 fabs x 25 ret div 1.0f64 mul d d 26 end 27 fn nrelu x f64 to f64 28 if gt x 0.0f64 29 ret x 30 end 31 ret 0.0f64 32 end 33 fn nshape arm ulong to int 34 if gt arm 3 35 ret 1 36 end 37 put NSH 0 arm 38 put NSH 1 3 39 put NSH 2 31 40 if eq arm 1 41 put NSH 1 4 42 put NSH 2 40 43 end 44 if eq arm 2 45 put NSH 2 83 46 end 47 if eq arm 3 48 put NSH 1 1 49 put NSH 2 0 50 end 51 put NSH 3 0 52 ret 0 53 end 54 fn nrand to ulong 55 x = get RNG 0 56 x = and xor x shl x 13 `4294967295` 57 x = xor x shr x 17 58 x = and xor x shl x 5 `4294967295` 59 put RNG 0 x 60 ret x 61 end 62 fn ninit seed ulong to void 63 put RNG 0 seed 64 for i ulong get NSH 2 65 v = sub long rem nrand 33 16 66 put NP i div f64 v 64.0f64 67 end 68 put NSH 3 0 69 end 70 fn ninput id ulong target ulong to void 71 for j ulong 4 72 put NX j f64 and shr id j 1 73 put NT j f64 and shr target j 1 74 end 75 end 76 fn nsend to void 77 d = get NSH 1 78 for k ulong d 79 v = get NP add mul 4 d k 80 for j ulong 4 81 v = add v mul get NX j get NP add mul j d k 82 end 83 put NA k v 84 put NH k nsoft v 85 end 86 end 87 fn nhidden to void 88 for k ulong 8 89 v = get NP add 39 k 90 for j ulong 3 91 v = add v mul get NH j get NP add 15 add mul j 8 k 92 end 93 put NU k v 94 put NV k nrelu v 95 end 96 end 97 fn nrecv to void 98 d = get NSH 1 99 if eq get NSH 0 2 100 nhidden 101 end 102 for j ulong 4 103 v = 0.0f64 104 if eq get NSH 0 2 105 v = get NP add 79 j 106 for k ulong 8 107 v = add v mul get NV k get NP add 47 add mul k 4 j 108 end 109 else 110 v = get NP add mul 9 d j 111 for k ulong d 112 v = add v mul get NH k get NP add mul 5 d add mul k 4 j 113 end 114 end 115 put NZ j v 116 put NO j mul 0.5f64 add 1.0f64 nsoft v 117 end 118 end 119 fn nloss to f64 120 v = 0.0f64 121 for j ulong 4 122 r = sub get NO j get NT j 123 v = add v mul r r 124 end 125 ret v 126 end 127 fn ngout j ulong to f64 128 ret mul sub get NO j get NT j nslope get NZ j 129 end 130 fn ngaff to void 131 d = get NSH 1 132 for j ulong 4 133 v = ngout j 134 put NG add mul 9 d j v 135 for k ulong d 136 p = add mul 5 d add mul k 4 j 137 put NG p mul v get NH k 138 put ND k add get ND k mul v get NP p 139 end 140 end 141 end 142 fn ngnon to void 143 for j ulong 4 144 v = ngout j 145 put NG add 79 j v 146 for k ulong 8 147 p = add 47 add mul k 4 j 148 put NG p mul v get NV k 149 put NE k add get NE k mul v get NP p 150 end 151 end 152 for k ulong 8 153 v = 0.0f64 154 note ReLU subgradient is exactly zero at zero. 155 if gt get NU k 0.0f64 156 v = get NE k 157 end 158 put NG add 39 k v 159 for j ulong 3 160 p = add 15 add mul j 8 k 161 put NG p mul v get NH j 162 put ND j add get ND j mul v get NP p 163 end 164 end 165 end 166 fn ngrad to void 167 for i ulong get NSH 2 168 put NG i 0.0f64 169 end 170 for k ulong 4 171 put ND k 0.0f64 172 end 173 for k ulong 8 174 put NE k 0.0f64 175 end 176 if eq get NSH 0 2 177 ngnon 178 else 179 ngaff 180 end 181 d = get NSH 1 182 for k ulong d 183 v = mul get ND k nslope get NA k 184 put NG add mul 4 d k v 185 for j ulong 4 186 put NG add mul j d k mul v get NX j 187 end 188 end 189 end 190 fn nstep lr f64 to int 191 if not and ge lr 0.0f64 le lr 1.0f64 192 ret 1 193 end 194 for i ulong get NSH 2 195 v = sub get NP i mul lr get NG i 196 if not le fabs v `1000000`.0f64 197 ret 2 198 end 199 put NC i v 200 end 201 note No parameter mutation until every candidate has passed admission. 202 for i ulong get NSH 2 203 put NP i get NC i 204 end 205 put NSH 3 add get NSH 3 1 206 ret 0 207 end 208 fn ntrain mask ulong to int 209 if eq get NSH 0 3 210 ret 0 211 end 212 for epoch ulong 2000 213 for id ulong 16 214 if ne and shr mask id 1 0 215 ninput id id 216 nsend 217 nrecv 218 ngrad 219 rc = nstep 0.1f64 220 if ne rc 0 221 ret rc 222 end 223 end 224 end 225 end 226 ret 0 227 end