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/gradient.wl # 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 / gradient.wl` 19 lines ยท 1664 bytes Raw Blame History 1 (* Independent mathematical verification of bounded ecosystem6 extension. *) 2 (* Symbolic D/Simplify over 31 parameters timed out (HTTP 504): symbolic path NOT_RUN. 3 Direct exact rational explicit derivative plus central difference is used instead. *) 4 soft[x_] := x/(1+Abs[x]); 5 x = {1,0,1,0}; t = {1,0,1,0}; 6 lossF[q_List] := Module[{w,b,v,c,a,h,z,o}, 7 w = Partition[Take[q,12],3]; b = q[[13;;15]]; v = Partition[q[[16;;27]],4]; c = q[[28;;31]]; 8 a = x.w+b; h = soft/@a; z = h.v+c; o = (1+soft[#])/2&/@z; Total[(o-t)^2]]; 9 p0 = Table[(-1)^i i/64,{i,1,31}]; 10 w = Partition[Take[p0,12],3]; b = p0[[13;;15]]; v = Partition[p0[[16;;27]],4]; c = p0[[28;;31]]; 11 a = x.w+b; h = soft/@a; z = h.v+c; o = (1+soft[#])/2&/@z; 12 dz = (o-t)/(1+Abs[z])^2; 13 dh = v.dz; 14 da = dh/(1+Abs[a])^2; 15 grad = Join[Flatten[Outer[Times,x,da]],da,Flatten[Outer[Times,h,dz]],dz]; 16 eps = 1/`1000000`; 17 fd = Table[(lossF[ReplacePart[p0,i->p0[[i]]+eps]]-lossF[ReplacePart[p0,i->p0[[i]]-eps]])/(2 eps),{i,31}]; 18 err = Max[Abs[fd-grad]]; 19 ExportString[<|"status"->If[Length[grad]==31&&err<1/`100000000`,"PASS","FAIL"],"profile"->"MODELED exact rational softsign network; explicit derivative plus central difference; symbolic D/Simplify NOT_RUN (504 timeout)","parameters"->31,"input"->x,"target"->t,"initial"->N[p0,17],"output"->N[o,17],"loss"->N[lossF[p0],17],"gradient"->N[grad,17],"updated"->N[p0-grad/10,17],"manualDerivativeExact"->"NOT_RUN","centralDifferenceMaxError"->N[err,17],"signMutantRejected"->TrueQ[Max[Abs[-grad-grad]]>1/`100000000`],"indexMutantRejected"->TrueQ[Max[Abs[RotateLeft[grad]-grad]]>1/`100000000`],"updateMutantRejected"->TrueQ[Max[Abs[(p0+grad/10)-(p0-grad/10)]]>1/`100000000`]|>,"RawJSON"]