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/evidence/gradient-query.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 / nl1r / evidence / gradient-query.wl` 17 lines ยท 11913 bytes Raw Blame History 1 (* Independent exact-rational derivative and native-carrier oracle; no product runtime. *) 2 soft[x_] := x/(1+Abs[x]); 3 fromBits[n_Integer] := Module[{sgn,e,m},sgn=If[BitAnd[BitShiftRight[n,63],1]==1,-1,1];e=BitAnd[BitShiftRight[n,52],2047];m=BitAnd[n,2^52-1];If[e==0,sgn m 2^-1074,sgn (2^52+m) 2^(e-1075)]]; 4 lossF[q_List,d_,non_] := Module[{a,h,u,r,z,o},a={1,0,1,0}.Partition[Take[q,4d],d]+q[[4d+1;;5d]];h=soft/@a;If[non,u=h.Partition[q[[16;;39]],8]+q[[40;;47]];r=Max[0,#]&/@u;z=r.Partition[q[[48;;79]],4]+q[[80;;83]],z=h.Partition[q[[5d+1;;9d]],4]+q[[9d+1;;9d+4]]];o=(1+soft[#])/2&/@z;Total[(o-{1,0,1,0})^2]]; 5 check[rows_,d_,non_] := Module[{n,p0,a,h,u,r,z,o,dz,dh,du,da,g,fd,ng,nu}, 6 n=If[non,83,9d+4];p0=Range[n]/128; 7 a={1,0,1,0}.Partition[Take[p0,4d],d]+p0[[4d+1;;5d]];h=soft/@a; 8 If[non,u=h.Partition[p0[[16;;39]],8]+p0[[40;;47]];r=Max[0,#]&/@u;z=r.Partition[p0[[48;;79]],4]+p0[[80;;83]],z=h.Partition[p0[[5d+1;;9d]],4]+p0[[9d+1;;9d+4]]]; 9 o=(1+soft[#])/2&/@z;dz=(o-{1,0,1,0})/(1+Abs[z])^2; 10 If[non,du=(Partition[p0[[48;;79]],4].dz)*(Boole[#>0]&/@u);dh=Partition[p0[[16;;39]],8].du,dh=Partition[p0[[5d+1;;9d]],4].dz]; 11 da=dh/(1+Abs[a])^2; 12 g=If[non,Join[Flatten[Outer[Times,{1,0,1,0},da]],da,Flatten[Outer[Times,h,du]],du,Flatten[Outer[Times,r,dz]],dz],Join[Flatten[Outer[Times,{1,0,1,0},da]],da,Flatten[Outer[Times,h,dz]],dz]]; 13 fd=Table[(lossF[ReplacePart[p0,i->p0[[i]]+1/`1000000`],d,non]-lossF[ReplacePart[p0,i->p0[[i]]-1/`1000000`],d,non])/(2/`1000000`),{i,n}]; 14 ng=fromBits/@rows[[All,4]];nu=fromBits/@rows[[All,5]]; 15 <|"parameters"->n,"gradientMaxError"->N[Max[Abs[ng-g]],18],"updateMaxError"->N[Max[Abs[nu-(p0-g/10)]],18],"finiteDifferenceMaxError"->N[Max[Abs[fd-g]],18],"PASS"->TrueQ[Max[Abs[ng-g]]<10^-12&&Max[Abs[nu-(p0-g/10)]]<10^-12&&Max[Abs[fd-g]]<10^-8],"signMutantRejected"->TrueQ[Max[Abs[-g-g]]>10^-8],"indexMutantRejected"->TrueQ[Max[Abs[RotateLeft[g]-g]]>10^-8]|>]; 16 17 ExportString[{check[{{0,0,`4575657221408423936`,`4584356174884836814`,`4572177640017858784`},{0,1,`4580160821035794432`,`4585188671238818221`,`4578149680954584916`},{0,2,`4582412620849479680`,`4585811775005259660`,`4581282430055586634`},{0,3,`4584664420663164928`,0,`4584664420663164928`},{0,4,`4585790320570007552`,0,`4585790320570007552`},{0,5,`4586916220476850176`,0,`4586916220476850176`},{0,6,`4588042120383692800`,`4584356174884836814`,`4587607172709872156`},{0,7,`4589168020290535424`,`4585188671238818221`,`4588665235270233045`},{0,8,`4589730970243956736`,`4585811775005259660`,`4589448422545483475`},{0,9,`4590293920197378048`,0,`4590293920197378048`},{0,10,`4590856870150799360`,0,`4590856870150799360`},{0,11,`4591419820104220672`,0,`4591419820104220672`},{0,12,`4591982770057641984`,`4584356174884836814`,`4591765296220731662`},{0,13,`4592545720011063296`,`4585188671238818221`,`4592294327500912107`},{0,14,`4593108669964484608`,`4585811775005259660`,`4592826122266011347`},{0,15,`4593671619917905920`,`13808223283559484142`,`4593788880559628768`},{0,16,`4593953094894616576`,`4587516313593159324`,`4593769207580682454`},{0,17,`4594234569871327232`,`13807926729354986778`,`4594345788259974570`},{0,18,`4594516044848037888`,`4587340031305817573`,`4594336564591287309`},{0,19,`4594797519824748544`,`13808787545294090326`,`4594928887009836546`},{0,20,`4595078994801459200`,`4588401184878255852`,`4594872985705397664`},{0,21,`4595360469778169856`,`13808516779667548692`,`4595485067822594317`},{0,22,`4595641944754880512`,`4588203695699203816`,`4595440872888295277`},{0,23,`4595923419731591168`,`13809329964638969819`,`4596068347400301157`},{0,24,`4596204894708301824`,`4589209911685942034`,`4595977620157162969`},{0,25,`4596486369685012480`,`13809031249012269048`,`4596623829463054950`},{0,26,`4596767844661723136`,`4589033927922523495`,`4596546016989554909`},{0,27,`4597049319638433792`,`13820859978867551369`,`4597881311810657806`},{0,28,`4597330794615144448`,`4600195241293187878`,`4596026070340088056`},{0,29,`4597612269591855104`,`13820431266625527114`,`4598288305042576554`},{0,30,`4597893744568565760`,`4600038895693105016`,`4596620289413525941`}},3,False],check[{{1,0,`4575657221408423936`,`4585476797547188532`,`4571404440199308656`},{1,1,`4580160821035794432`,`4586126184716569549`,`4577774675563484385`},{1,2,`4582412620849479680`,`4586723929795776566`,`4581099999097483253`},{1,3,`4584664420663164928`,`4587274345180950726`,`4583241715834133669`},{1,4,`4585790320570007552`,0,`4585790320570007552`},{1,5,`4586916220476850176`,0,`4586916220476850176`},{1,6,`4588042120383692800`,0,`4588042120383692800`},{1,7,`4589168020290535424`,0,`4589168020290535424`},{1,8,`4589730970243956736`,`4585476797547188532`,`4589465171418387031`},{1,9,`4590293920197378048`,`4586126184716569549`,`4589995652013339292`},{1,10,`4590856870150799360`,`4586723929795776566`,`4590528714712800253`},{1,11,`4591419820104220672`,`4587274345180950726`,`4591064143896962857`},{1,12,`4591982770057641984`,0,`4591982770057641984`},{1,13,`4592545720011063296`,0,`4592545720011063296`},{1,14,`4593108669964484608`,0,`4593108669964484608`},{1,15,`4593671619917905920`,0,`4593671619917905920`},{1,16,`4593953094894616576`,`4585476797547188532`,`4593820195481831724`},{1,17,`4594234569871327232`,`4586126184716569549`,`4594085435779307854`},{1,18,`4594516044848037888`,`4586723929795776566`,`4594351967129038335`},{1,19,`4594797519824748544`,`4587274345180950726`,`4594619681721119637`},{1,20,`4595078994801459200`,`13807133014556684496`,`4595180291755127759`},{1,21,`4595360469778169856`,`4587813314506167745`,`4595169157441410523`},{1,22,`4595641944754880512`,`13806684267553253366`,`4595737632371006182`},{1,23,`4595923419731591168`,`4587601433737947914`,`4595737404414037331`},{1,24,`4596204894708301824`,`13807862466599979889`,`4596315309812511576`},{1,25,`4596486369685012480`,`4588502146548507960`,`4596277836547194642`},{1,26,`4596767844661723136`,`13807373326054749051`,`4596872145509117502`},{1,27,`4597049319638433792`,`4588271193531109409`,`4596846560326050918`},{1,28,`4597330794615144448`,`13808300595806509337`,`4597449988063042925`},{1,29,`4597612269591855104`,`4589165307831506302`,`4597387157421962307`},{1,30,`4597893744568565760`,`13808036581437685984`,`4598006337657243654`},{1,31,`4598175219545276416`,`4588915993331979171`,`4597956340237871798`},{1,32,`4598315957033631744`,`13808638883197440714`,`4598379782349967625`},{1,33,`4598456694521987072`,`4589486113703440796`,`4598336152195980175`},{1,34,`4598597432010342400`,`13808356136101782888`,`4598657722987982558`},{1,35,`4598738169498697728`,`4589352611593383585`,`4598620964725442262`},{1,36,`4598878906987053056`,`13818355252633691494`,`4599169666761472069`},{1,37,`4599019644475408384`,`4599162992547108992`,`4598470507212488077`},{1,38,`4599160381963763712`,`13818033235108081192`,`4599435040861902210`},{1,39,`4599301119452119040`,`4599010948477321613`,`4598767186596177471`}},4,False],check[{{2,0,`4575657221408423936`,`4588071396619231213`,`4567503900102295582`},{2,1,`4580160821035794432`,`4589998655160630188`,`4575893433437822224`},{2,2,`4582412620849479680`,`4591268914456918715`,`4579380825628161898`},{2,3,`4584664420663164928`,0,`4584664420663164928`},{2,4,`4585790320570007552`,0,`4585790320570007552`},{2,5,`4586916220476850176`,0,`4586916220476850176`},{2,6,`4588042120383692800`,`4588071396619231213`,`4587251062825349122`},{2,7,`4589168020290535424`,`4589998655160630188`,`4588101173391042372`},{2,8,`4589730970243956736`,`4591268914456918715`,`4588973021438627290`},{2,9,`4590293920197378048`,0,`4590293920197378048`},{2,10,`4590856870150799360`,0,`4590856870150799360`},{2,11,`4591419820104220672`,0,`4591419820104220672`},{2,12,`4591982770057641984`,`4588071396619231213`,`4591587241278470145`},{2,13,`4592545720011063296`,`4589998655160630188`,`4592012296561316770`},{2,14,`4593108669964484608`,`4591268914456918715`,`4592448220585109229`},{2,15,`4593671619917905920`,`4574276220962079438`,`4593623956175353442`},{2,16,`4593953094894616576`,`4574883916410082844`,`4593927363975065326`},{2,17,`4594234569871327232`,`4575491611858086248`,`4594206939903500972`},{2,18,`4594516044848037888`,`4575878264357256794`,`4594486515831936617`},{2,19,`4594797519824748544`,`4576182112081258497`,`4594766091760372262`},{2,20,`4595078994801459200`,`4576485959805260199`,`4595045667688807908`},{2,21,`4595360469778169856`,`4576789807529261901`,`4595325243617243553`},{2,22,`4595641944754880512`,`4577093655253263604`,`4595604819545679198`},{2,23,`4595923419731591168`,`4575193658412713603`,`4595896720868281697`},{2,24,`4596204894708301824`,`4575765840744224812`,`4596176068339782003`},{2,25,`4596486369685012480`,`4576106241577880855`,`4596455415811282309`},{2,26,`4596767844661723136`,`4576446642411536897`,`4596734763282782614`},{2,27,`4597049319638433792`,`4576787043245192940`,`4597014110754282920`},{2,28,`4597330794615144448`,`4577127444078848982`,`4597293458225783226`},{2,29,`4597612269591855104`,`4577467844912505024`,`4597572805697283532`},{2,30,`4597893744568565760`,`4577808245746161067`,`4597852153168783837`},{2,31,`4598175219545276416`,`4575866401782002610`,`4598145764670270484`},{2,32,`4598315957033631744`,`4576241940766229600`,`4598300056036803068`},{2,33,`4598456694521987072`,`4576617479750456588`,`4598439619965832687`},{2,34,`4598597432010342400`,`4576993018734683577`,`4598579183894862306`},{2,35,`4598738169498697728`,`4577368557718910566`,`4598718747823891924`},{2,36,`4598878906987053056`,`4577744096703137554`,`4598858311752921543`},{2,37,`4599019644475408384`,`4578119635687364543`,`4598997875681951162`},{2,38,`4599160381963763712`,`4578495174671591533`,`4599137439610980780`},{2,39,`4599301119452119040`,`4586924533074193704`,`4599216573051639049`},{2,40,`4599441856940474368`,`4587463501060815772`,`4599350573440161601`},{2,41,`4599582594428829696`,`4588002469047437839`,`4599484573828684153`},{2,42,`4599723331917185024`,`4588541437034059906`,`4599618574217206706`},{2,43,`4599864069405540352`,`4589080405020681974`,`4599752574605729258`},{2,44,`4600004806893895680`,`4589393696648919732`,`4599886574994251810`},{2,45,`4600145544382251008`,`4589663180642230766`,`4600020575382774362`},{2,46,`4600286281870606336`,`4589932664635541800`,`4600154575771296914`},{2,47,`4600427019358961664`,`13796156741928039421`,`4600436604801023509`},{2,48,`4600567756847316992`,`4584259396165751538`,`4600513993255083694`},{2,49,`4600708494335672320`,`13795783253670480843`,`4600717496202331730`},{2,50,`4600849231824027648`,`4583939429664817859`,`4600797468022425186`},{2,51,`4600989969312382976`,`13796331805593975886`,`4600999828291422847`},{2,52,`4601130706800738304`,`4584504873930093240`,`4601075408972477871`},{2,53,`4601271444289093632`,`13795947659210413152`,`4601280703039409186`},{2,54,`4601412181777448960`,`4584175776637989976`,`4601358940807264172`},{2,55,`4601552919265804288`,`13796506869259912350`,`4601563051781822184`},{2,56,`4601693656754159616`,`4584707386178799935`,`4601636824689872047`},{2,57,`4601834394242514944`,`13796112064750345462`,`4601843909876486642`},{2,58,`4601975131730870272`,`4584412123611162092`,`4601920413592103159`},{2,59,`4602115869219225600`,`13796681932925848815`,`4602126275272221522`},{2,60,`4602256606707580928`,`4584830125060970786`,`4602198240407266224`},{2,61,`4602397344195936256`,`13796276470290277772`,`4602407116713564098`},{2,62,`4602538081684291584`,`4584648470584334209`,`4602481886376942145`},{2,63,`4602678819172646912`,`13796856996591785280`,`4602684158967633886`},{2,64,`4602749187916824576`,`4584952863943141637`,`4602719237648653656`},{2,65,`4602819556661002240`,`13796440875830210082`,`4602824571361644233`},{2,66,`4602889925405179904`,`4584774619110335627`,`4602861089167214022`},{2,67,`4602960294149357568`,`13797032060257721745`,`4602965770712833555`},{2,68,`4603030662893535232`,`4585075602825312488`,`4602999945507350744`},{2,69,`4603101031637712896`,`13796605281370142392`,`4603106174780182961`},{2,70,`4603171400381890560`,`4584892792596921686`,`4603141825559633515`},{2,71,`4603241769126068224`,`13797207123923658209`,`4603247382458033224`},{2,72,`4603312137870245888`,`4585198341707483339`,`4603280653366047832`},{2,73,`4603382506614423552`,`13796769686910074701`,`4603387778198721689`},{2,74,`4603452875358601216`,`4585010966083507744`,`4603422561952053008`},{2,75,`4603523244102778880`,`13797382187589594674`,`4603528994203232892`},{2,76,`4603593612846956544`,`4585321080589654191`,`4603561361224744921`},{2,77,`4603663981591134208`,`13796934092450007012`,`4603669381617260418`},{2,78,`4603734350335311872`,`4585129139570093803`,`4603703298344472501`},{2,79,`4603804719079489536`,`13802131811073744298`,`4603816603692673778`},{2,80,`4603875087823667200`,`4589997169996710843`,`4603808428456997876`},{2,81,`4603945456567844864`,`13801668737650390250`,`4603956617628805116`},{2,82,`4604015825312022528`,`4589798813047131597`,`4603951645407222945`}},3,True]},"RawJSON"]