interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-train / native / neuralese / nl1r-task / evidence / gradient-query.wl

9 lines · 8531 bytes Raw Blame History
1(* Verification oracle only. Actual native G records are appended by the recorded query. *)
2ss[x_] := x/(1+Abs[x]);
3fromBits[n_Integer] := Module[{s,e,m},s=If[BitAnd[BitShiftRight[n,63],1]==1,-1,1];e=BitAnd[BitShiftRight[n,52],2047];m=BitAnd[n,2^52-1];If[e==0,s*m*2^-1074,s*(2^52+m)*2^(e-1075)]];
4active[t_] := {{1,1,1,1},{1,0,0,0},{0,0,1,1}}[[t+1]];
5target[t_] := If[t==1,{0,0,0,0},{1,0,1,0}];
6loss[p_,t_] := Module[{h,z,o},h=ss/@({1,0,1,0}.Partition[p[[1;;16]],4]+p[[17;;20]]);z=h.Partition[p[[21;;36]],4]+p[[37;;40]];o=(1+ss[#])/2&/@z;Total[active[t]*(o-target[t])^2]];
7check[rows_,t_] := Module[{p,a,h,z,o,dz,da,g,fd,ng,nu},p=Range[40]/128;a={1,0,1,0}.Partition[p[[1;;16]],4]+p[[17;;20]];h=ss/@a;z=h.Partition[p[[21;;36]],4]+p[[37;;40]];o=(1+ss[#])/2&/@z;dz=active[t]*(o-target[t])/(1+Abs[z])^2;da=(Partition[p[[21;;36]],4].dz)/(1+Abs[a])^2;g=Join[Flatten[Outer[Times,{1,0,1,0},da]],da,Flatten[Outer[Times,h,dz]],dz];fd=Table[(loss[ReplacePart[p,i->p[[i]]+1/1000000],t]-loss[ReplacePart[p,i->p[[i]]-1/1000000],t])/(2/1000000),{i,40}];ng=fromBits/@rows[[All,4]];nu=fromBits/@rows[[All,5]];<|"task"->t,"gradientMaxError"->N[Max[Abs[ng-g]],18],"updateMaxError"->N[Max[Abs[nu-(p-g/10)]],18],"finiteDifferenceMaxError"->N[Max[Abs[fd-g]],18],"PASS"->TrueQ[Max[Abs[ng-g]]<10^-12&&Max[Abs[nu-(p-g/10)]]<10^-12&&Max[Abs[fd-g]]<10^-8]|>];
8
9rows={{0,0,4575657221408423936,4585476797547188532,4571404440199308656},{0,1,4580160821035794432,4586126184716569549,4577774675563484385},{0,2,4582412620849479680,4586723929795776566,4581099999097483253},{0,3,4584664420663164928,4587274345180950726,4583241715834133669},{0,4,4585790320570007552,0,4585790320570007552},{0,5,4586916220476850176,0,4586916220476850176},{0,6,4588042120383692800,0,4588042120383692800},{0,7,4589168020290535424,0,4589168020290535424},{0,8,4589730970243956736,4585476797547188532,4589465171418387031},{0,9,4590293920197378048,4586126184716569549,4589995652013339292},{0,10,4590856870150799360,4586723929795776566,4590528714712800253},{0,11,4591419820104220672,4587274345180950726,4591064143896962857},{0,12,4591982770057641984,0,4591982770057641984},{0,13,4592545720011063296,0,4592545720011063296},{0,14,4593108669964484608,0,4593108669964484608},{0,15,4593671619917905920,0,4593671619917905920},{0,16,4593953094894616576,4585476797547188532,4593820195481831724},{0,17,4594234569871327232,4586126184716569549,4594085435779307854},{0,18,4594516044848037888,4586723929795776566,4594351967129038335},{0,19,4594797519824748544,4587274345180950726,4594619681721119637},{0,20,4595078994801459200,13807133014556684496,4595180291755127759},{0,21,4595360469778169856,4587813314506167745,4595169157441410523},{0,22,4595641944754880512,13806684267553253366,4595737632371006182},{0,23,4595923419731591168,4587601433737947914,4595737404414037331},{0,24,4596204894708301824,13807862466599979889,4596315309812511576},{0,25,4596486369685012480,4588502146548507960,4596277836547194642},{0,26,4596767844661723136,13807373326054749051,4596872145509117502},{0,27,4597049319638433792,4588271193531109409,4596846560326050918},{0,28,4597330794615144448,13808300595806509337,4597449988063042925},{0,29,4597612269591855104,4589165307831506302,4597387157421962307},{0,30,4597893744568565760,13808036581437685984,4598006337657243654},{0,31,4598175219545276416,4588915993331979171,4597956340237871798},{0,32,4598315957033631744,13808638883197440714,4598379782349967625},{0,33,4598456694521987072,4589486113703440796,4598336152195980175},{0,34,4598597432010342400,13808356136101782888,4598657722987982558},{0,35,4598738169498697728,4589352611593383585,4598620964725442262},{0,36,4598878906987053056,13818355252633691494,4599169666761472069},{0,37,4599019644475408384,4599162992547108992,4598470507212488077},{0,38,4599160381963763712,13818033235108081192,4599435040861902210},{0,39,4599301119452119040,4599010948477321613,4598767186596177471},{1,0,4575657221408423936,4585145940028760463,4571669126214051111},{1,1,4580160821035794432,4585872259021065074,4577876245841686175},{1,2,4582412620849479680,4586541485050399722,4581136488046558622},{1,3,4584664420663164928,4587158368848884525,4583264911100546909},{1,4,4585790320570007552,0,4585790320570007552},{1,5,4586916220476850176,0,4586916220476850176},{1,6,4588042120383692800,0,4588042120383692800},{1,7,4589168020290535424,0,4589168020290535424},{1,8,4589730970243956736,4585145940028760463,4589481714294308434},{1,9,4590293920197378048,4585872259021065074,4590008348298114516},{1,10,4590856870150799360,4586541485050399722,4590537836950069096},{1,11,4591419820104220672,4587158368848884525,4591069942713566167},{1,12,4591982770057641984,0,4591982770057641984},{1,13,4592545720011063296,0,4592545720011063296},{1,14,4593108669964484608,0,4593108669964484608},{1,15,4593671619917905920,0,4593671619917905920},{1,16,4593953094894616576,4585145940028760463,4593828466919792425},{1,17,4594234569871327232,4585872259021065074,4594091783921695466},{1,18,4594516044848037888,4586541485050399722,4594356528247672756},{1,19,4594797519824748544,4587158368848884525,4594622581129421292},{1,20,4595078994801459200,4587922250717923466,4594884959059405974},{1,21,4595360469778169856,0,4595360469778169856},{1,22,4595641944754880512,0,4595641944754880512},{1,23,4595923419731591168,0,4595923419731591168},{1,24,4596204894708301824,4588620888551476572,4595993393020409770},{1,25,4596486369685012480,0,4596486369685012480},{1,26,4596767844661723136,0,4596767844661723136},{1,27,4597049319638433792,0,4597049319638433792},{1,28,4597330794615144448,4589230755241505163,4597102477886227436},{1,29,4597612269591855104,0,4597612269591855104},{1,30,4597893744568565760,0,4597893744568565760},{1,31,4598175219545276416,0,4598175219545276416},{1,32,4598315957033631744,4589554752373449482,4598193698740874630},{1,33,4598456694521987072,0,4598456694521987072},{1,34,4598597432010342400,0,4598597432010342400},{1,35,4598738169498697728,0,4598738169498697728},{1,36,4598878906987053056,4599241164365729995,4598321952542270648},{1,37,4599019644475408384,0,4599019644475408384},{1,38,4599160381963763712,0,4599160381963763712},{1,39,4599301119452119040,0,4599301119452119040},{2,0,4575657221408423936,4581195758347996967,4573441806632594724},{2,1,4580160821035794432,4581838244986234768,4578924616320232266},{2,2,4582412620849479680,4582429444517860194,4581735398538536054},{2,3,4584664420663164928,4582973644588187651,4583932778345188556},{2,4,4585790320570007552,0,4585790320570007552},{2,5,4586916220476850176,0,4586916220476850176},{2,6,4588042120383692800,0,4588042120383692800},{2,7,4589168020290535424,0,4589168020290535424},{2,8,4589730970243956736,4581195758347996967,4589592506820467410},{2,9,4590293920197378048,4581838244986234768,4590139394607932777},{2,10,4590856870150799360,4582429444517860194,4590687564573063454},{2,11,4591419820104220672,4582973644588187651,4591236909524726579},{2,12,4591982770057641984,0,4591982770057641984},{2,13,4592545720011063296,0,4592545720011063296},{2,14,4593108669964484608,0,4593108669964484608},{2,15,4593671619917905920,0,4593671619917905920},{2,16,4593953094894616576,4581195758347996967,4593883863182871913},{2,17,4594234569871327232,4581838244986234768,4594157307076604597},{2,18,4594516044848037888,4582429444517860194,4594431392059169935},{2,19,4594797519824748544,4582973644588187651,4594706064535001498},{2,20,4595078994801459200,0,4595078994801459200},{2,21,4595360469778169856,0,4595360469778169856},{2,22,4595641944754880512,13806684267553253366,4595737632371006182},{2,23,4595923419731591168,4587601433737947914,4595737404414037331},{2,24,4596204894708301824,0,4596204894708301824},{2,25,4596486369685012480,0,4596486369685012480},{2,26,4596767844661723136,13807373326054749051,4596872145509117502},{2,27,4597049319638433792,4588271193531109409,4596846560326050918},{2,28,4597330794615144448,0,4597330794615144448},{2,29,4597612269591855104,0,4597612269591855104},{2,30,4597893744568565760,13808036581437685984,4598006337657243654},{2,31,4598175219545276416,4588915993331979171,4597956340237871798},{2,32,4598315957033631744,0,4598315957033631744},{2,33,4598456694521987072,0,4598456694521987072},{2,34,4598597432010342400,13808356136101782888,4598657722987982558},{2,35,4598738169498697728,4589352611593383585,4598620964725442262},{2,36,4598878906987053056,0,4598878906987053056},{2,37,4599019644475408384,0,4599019644475408384},{2,38,4599160381963763712,13818033235108081192,4599435040861902210},{2,39,4599301119452119040,4599010948477321613,4598767186596177471}};Table[check[Select[rows,#[[1]]==t&],t],{t,0,2}]