Complete native inference release with five student checkpoints replayed
Browse filesFiles changed (6)
- releases/native13-inference-20261129/MANIFEST.json+86-1
- releases/native13-inference-20261129/README.md+4
- releases/native13-inference-20261129/replay_students.pyAdded+45
- releases/native13-inference-20261129/student-casmi2022.jsonAdded+21
- releases/native13-inference-20261129/student-msg_test.jsonAdded+21
- releases/native13-inference-20261129/student-validation.jsonAdded+21
3 unmodified lines45678913 unmodified lines23242526273 unmodified lines"path": "native13-real-inference.tar.gz","bytes": 32470668,"sha256": "b5baa7c2d14eb9be88b10c1f15ce68df6a61d3758cad7b5558e994c1c43bedee"}],"audit": {13 unmodified lines}},"core_revision": "ccd5df01692edf7c7d053ecaf8e3bc608444338c","history_revision": "a7e177a57d07d56713ea0c4d5e490b7cc645d970"}3 unmodified lines456789101112131415161718192021222324252627282913 unmodified lines4344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111123 unmodified lines"path": "native13-real-inference.tar.gz","bytes": 32470668,"sha256": "b5baa7c2d14eb9be88b10c1f15ce68df6a61d3758cad7b5558e994c1c43bedee"},{"path": "replay_students.py","sha256": "3b745cc7b3d1b72c6a19756c5e0d3a2e97589e933a2a2ed00484b8dd6b784845","bytes": 3152},{"path": "student-validation.json","sha256": "7c5f564de6ec959d87bb4f25de3d19b74f1702b09ee15f4c5fa7dbff2ff9267a","bytes": 287},{"path": "student-msg_test.json","sha256": "05a99650ee5ef7c8e8da0cd64d28755322ed5b0efe7a22871b4dec70f2fa7156","bytes": 285},{"path": "student-casmi2022.json","sha256": "40c2c5d25d48f8b9f9978a3c860fd4ba64f25e45d8e76e348e3cc11b1df25937","bytes": 282}],"audit": {13 unmodified lines}},"core_revision": "ccd5df01692edf7c7d053ecaf8e3bc608444338c","history_revision": "a7e177a57d07d56713ea0c4d5e490b7cc645d970","students": [{"split": "validation","query_views": 38858,"candidate_rows": 1425627,"students": ["S0","S1","S1shuffle","C2","C3"],"labels_read": false,"max_abs_difference": [0.0,0.0,0.0,0.0,0.0],"n_rows_over_1e_minus_4": 0},{"split": "msg_test","query_views": 35112,"candidate_rows": 1334766,"students": ["S0","S1","S1shuffle","C2","C3"],"labels_read": false,"max_abs_difference": [0.0,0.0,0.0,0.0,0.0],"n_rows_over_1e_minus_4": 0},{"split": "casmi2022","query_views": 500,"candidate_rows": 23533,"students": ["S0","S1","S1shuffle","C2","C3"],"labels_read": false,"max_abs_difference": [0.0,0.0,0.0,0.0,0.0],"n_rows_over_1e_minus_4": 0}]}
4 unmodified lines5674 unmodified linesThis supplement is optional to the final-decision replay in the [primary release](../deep19-20261129/README.md). The feature builder consumes the 13 numeric native rank lists, A4 score distribution, adduct/metadata and proposal gaps. It never receives test references or answers; empty slates return −1. Archived pre-calibration raw winners and final protected picks are both included. CASMI here means **neural-only** before optional CSI fusion.[Download the tested source+input bundle](native13-real-inference.tar.gz), SHA-256 `b5baa7c2d14eb9be88b10c1f15ce68df6a61d3758cad7b5558e994c1c43bedee`. For MSG Test and CASMI the regenerated first candidate matched the pre-existing sealed prediction for all 35,112 spectrum/view records and all 500 spectra respectively. Validation is a fixed-weight replay and is not a replacement for grouped out-of-fold validation.4 unmodified lines5678910114 unmodified linesThis supplement is optional to the final-decision replay in the [primary release](../deep19-20261129/README.md). The feature builder consumes the 13 numeric native rank lists, A4 score distribution, adduct/metadata and proposal gaps. It never receives test references or answers; empty slates return −1. Archived pre-calibration raw winners and final protected picks are both included. CASMI here means **neural-only** before optional CSI fusion.[Download the tested source+input bundle](native13-real-inference.tar.gz), SHA-256 `b5baa7c2d14eb9be88b10c1f15ce68df6a61d3758cad7b5558e994c1c43bedee`. For MSG Test and CASMI the regenerated first candidate matched the pre-existing sealed prediction for all 35,112 spectrum/view records and all 500 spectra respectively. Validation is a fixed-weight replay and is not a replacement for grouped out-of-fold validation.## Recompute the five actual student outputsWith the core and history releases in separate directories, run `python replay_students.py --core CORE --history HISTORY --split msg_test --verify`, or use `validation` or `casmi2022` instead. This starts from measured peak features, precursor, adduct and candidate fingerprints; it reads the five state dictionaries using PyTorch weights_only=True. The independent replay matched the archived standardized scores for all 2,783,926 candidate rows across the five students (maximum absolute error 0 in the release environment). This checks student inference, not evidence of a performance gain.
123456789101112131415161718192021222324252627282930313233343536373839404142434445"""Forward pass of five released students, no labels, CSI, external services or training.python replay_students.py --core CORE --history HISTORY --split msg_test --verify"""import argparse,jsonfrom pathlib import Pathimport numpy as np,torchfrom torch import nnfrom torch.nn import functional as fnS=['S0','S1','S1shuffle','C2','C3']class Encoder(nn.Module): def __init__(self): super().__init__();self.register_buffer('prior',torch.zeros(6,512));self.fc=nn.Linear(2311,256);self.norm=nn.LayerNorm(256);self.out=nn.Linear(256,512) def forward(self,p,pr,ad): m,w=p.unbind(-1);dl=(pr[:,None]-m).clamp_min(0);x=w.new_zeros((len(pr),2304)) for j,v in enumerate((m,dl,m*20,dl*20)):x.scatter_add_(1,torch.round(v).long().remainder(576)+j*576,w) x=torch.cat([fn.normalize(x,p=2,dim=1)*5,fn.one_hot(ad.long(),6).float(),(pr/800).clamp(0,3)[:,None]],1);return self.out(fn.gelu(self.norm(self.fc(x)))).clamp(-8,8)def run(core,history,ds,verify,output): torch.set_num_threads(2) with np.load(history/'evidence'/(ds+'.student-inputs.npz'),allow_pickle=False) as z: assert set(z.files)=={'pr','pk','ad','bits','idx'};pk,pr,ad=(torch.as_tensor(z[k]) for k in ('pk','pr','ad'));ids=z['idx'];bank=np.unpackbits(z['bits'],axis=1).astype('f4') with np.load(core/'data/replay'/(ds+'.npz'),allow_pickle=False) as a: assert set(a.files)=={'off','ev','ids','hashes','view','ix','log'};off=a['off'];expected=a['ev'] if verify else None assert len(off)==len(pk)+1 and len(ids)==off[-1] bank*=2.3/np.sqrt(np.maximum(bank.sum(axis=1,keepdims=True),1));models=[] for n in S: m=Encoder();m.load_state_dict(torch.load(core/'models/students'/(n+'.pt'),map_location='cpu',weights_only=True),strict=True);models.append(m.eval()) ev=np.empty((len(ids),5),'f4') with torch.inference_mode(): for a in range(0,len(pk),180): sl=slice(a,a+180);vs=np.stack([m(pk[sl],pr[sl],ad[sl]).numpy().astype('f2').astype('f4') for m in models],axis=1) for t,v in enumerate(vs): l,h=off[a+t:a+t+2] if h<=l:continue c=bank[ids[l:h]];s=np.column_stack([c@vv for vv in v]);q=np.percentile(s,[25,50,75],axis=0);ev[l:h]=np.clip((s-q[1])/np.maximum(.35,q[2]-q[0]),-3.5,3.5) if output: if output.exists():raise FileExistsError('choose a new output') np.save(output,ev) info={'split':ds,'query_views':len(pk),'candidate_rows':len(ev),'students':S,'labels_read':False} if expected is not None: delta=np.abs(expected-ev);info.update(max_abs_difference=delta.max(axis=0).tolist(),n_rows_over_1e_minus_4=int((delta>1e-4).any(axis=1).sum()));assert np.allclose(expected,ev,rtol=3e-5,atol=1e-4),info return infoif __name__=='__main__': p=argparse.ArgumentParser(description=__doc__);p.add_argument('--core',type=Path,required=True);p.add_argument('--history',type=Path,required=True);p.add_argument('--split',choices=['msg_test','validation','casmi2022'],required=True);p.add_argument('--output',type=Path);p.add_argument('--verify',action='store_true');p.add_argument('--receipt',type=Path);a=p.parse_args();r=run(a.core,a.history,a.split,a.verify,a.output) if a.receipt:a.receipt.write_text(json.dumps(r,indent=2)) print(json.dumps(r),flush=True)123456789101112131415161718192021{ "split": "casmi2022", "query_views": 500, "candidate_rows": 23533, "students": [ "S0", "S1", "S1shuffle", "C2", "C3" ], "labels_read": false, "max_abs_difference": [ 0.0, 0.0, 0.0, 0.0, 0.0 ], "n_rows_over_1e_minus_4": 0}123456789101112131415161718192021{ "split": "msg_test", "query_views": 35112, "candidate_rows": 1334766, "students": [ "S0", "S1", "S1shuffle", "C2", "C3" ], "labels_read": false, "max_abs_difference": [ 0.0, 0.0, 0.0, 0.0, 0.0 ], "n_rows_over_1e_minus_4": 0}123456789101112131415161718192021{ "split": "validation", "query_views": 38858, "candidate_rows": 1425627, "students": [ "S0", "S1", "S1shuffle", "C2", "C3" ], "labels_read": false, "max_abs_difference": [ 0.0, 0.0, 0.0, 0.0, 0.0 ], "n_rows_over_1e_minus_4": 0}releases/native13-inference-20261129/MANIFEST.json+86-1
releases/native13-inference-20261129/README.md+4
releases/native13-inference-20261129/replay_students.pyAdded+45
releases/native13-inference-20261129/student-casmi2022.jsonAdded+21
releases/native13-inference-20261129/student-msg_test.jsonAdded+21
releases/native13-inference-20261129/student-validation.jsonAdded+21