aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / om / ribbon / q38-compare-adaptive-boundaries.py.txt
| 1 | # External independent score and timing comparison, not production. |
| 2 | from pathlib import Path |
| 3 | import sys,json,hashlib,struct,math |
| 4 | b,c,o=map(Path,sys.argv[1:]);br=json.loads((b/'report.json').read_text());cr=json.loads((c/'report.json').read_text());expected=[3,63,64,65,127,128,129]*2 |
| 5 | assert len(br['rows'])==len(cr['rows'])==len(expected) |
| 6 | assert br['mismatches']==cr['mismatches']==0 |
| 7 | rows=[] |
| 8 | for i,n in enumerate(expected): |
| 9 | x,y=br['rows'][i],cr['rows'][i];assert x['trial']==y['trial']==i and x['prompt_tokens']==y['prompt_tokens']==n and x['chunk']==y['chunk']==4096;assert x['next']==y['next'] |
| 10 | name=f'row{i:02}.u32le';raw=(b/name).read_bytes();assert raw==(c/name).read_bytes() and raw and len(raw)%4==0;assert all(math.isfinite(v[0]) for v in struct.iter_unpack('<f',raw)) |
| 11 | if i>=7: |
| 12 | assert raw==(b/f'row{i-7:02}.u32le').read_bytes()==(c/f'row{i-7:02}.u32le').read_bytes(), 'repeated size changed score' |
| 13 | rows.append({'trial':i,'prompt_tokens':n,'exact_full_scores_and_next':True,'score_sha256':hashlib.sha256(raw).hexdigest(),'baseline_s':x['wall_ns']/1e9,'candidate_s':y['wall_ns']/1e9,'wall_reduction_percent':100*(x['wall_ns']-y['wall_ns'])/x['wall_ns']}) |
| 14 | j={'status':'PASS_EXACT_BOUNDARY_SCORES','scope':'Two shared-machine observations per size, not quiet qualification or a statistical claim','formula':'seconds=ns/1e9; reduction_percent=100*(baseline_ns-candidate_ns)/baseline_ns','baseline':str(b),'candidate':str(c),'rows':rows};o.write_text(json.dumps(j,indent=2)+'\n');print(json.dumps(j,indent=2)) |