Seal Phase 4AG author-APL audit and fixed CAL failure
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
"""Seal a completed gate or preserved failure; never claim learning."""
|
||||
import json
|
||||
from context import ROOT,MODEL,EXP,CFG,check,save,digest,integrity,budget
|
||||
|
||||
|
||||
def seal(root):
|
||||
assert not (root/'manifest.json').exists() and not (root/'checksums.sha256').exists()
|
||||
rows=[dict(path=str(p.relative_to(root)),bytes=p.stat().st_size,sha256=digest(p))
|
||||
for p in sorted(root.rglob('*')) if p.is_file() and '__pycache__' not in p.parts]
|
||||
save(root/'manifest.json',dict(root=str(root),files=rows))
|
||||
with (root/'checksums.sha256').open('x') as f:
|
||||
for row in rows:f.write(row['sha256']+' '+row['path']+'\n')
|
||||
f.write(digest(root/'manifest.json')+' manifest.json\n')
|
||||
|
||||
|
||||
def main():
|
||||
from compare import compare,compare_gpu_repeats
|
||||
check();budget();comparisons=[];repeats={};components={}
|
||||
for p in sorted((EXP/'audit').glob('compare-*.json')):
|
||||
name=p.stem[len('compare-'):]
|
||||
actual=compare(EXP/'cases'/name,EXP/'gpu'/(name+'-r0'),EXP/'oracle'/name,None)
|
||||
assert actual==json.loads(p.read_text()),'Changed raw closed-loop evidence: '+name
|
||||
comparisons.append(dict(case=name,pass_all=actual['pass_all']))
|
||||
for p in sorted((EXP/'audit').glob('repeat-*.json')):
|
||||
name,repeat=p.stem[len('repeat-'):].rsplit('-r',1)
|
||||
actual=compare_gpu_repeats(EXP/'gpu'/(name+'-r0'),EXP/'gpu'/f'{name}-r{repeat}',None)
|
||||
assert actual==json.loads(p.read_text()),'Changed raw repeat evidence: '+name
|
||||
repeats[f'{name}-r{repeat}']=actual['pass_all']
|
||||
for p in (EXP/'component-audit').glob('*.json'):
|
||||
result=json.loads(p.read_text())
|
||||
components[p.stem]=result['pass_all']
|
||||
for filename,sha in result.get('input_sha256',{}).items():
|
||||
assert digest(EXP/'gpu'/(p.stem+'-r0')/filename)==sha
|
||||
gates={}
|
||||
for name in ('fixtures','probes','calibration'):
|
||||
path=EXP/'audit'/(name+'-gate.json')
|
||||
gates[name]=json.loads(path.read_text()) if path.exists() else None
|
||||
calpath=EXP/'calibration/summary.json'
|
||||
cal=json.loads(calpath.read_text()) if calpath.exists() else None
|
||||
if cal is not None:
|
||||
from calibration import summarize
|
||||
assert summarize(out_json=None)==cal,'CAL raw evidence changed'
|
||||
frozen=json.loads((EXP/'regression/frozen-five.json').read_text())
|
||||
after=integrity();save(EXP/'regression/old-integrity-after.json',after)
|
||||
stops=[dict(path=str(p.relative_to(EXP)),report=json.loads(p.read_text())) for p in sorted((EXP/'audit').glob('stopped-*.json'))]
|
||||
expected_cases=CFG['fixtures']+CFG['calibration']['full_oracle_probes']
|
||||
expected_repeats=[f'{name}-r{r}' for name in CFG['fixtures'] for r in range(1,CFG['fixture_repeats'])]
|
||||
compared={x['case']:x['pass_all'] for x in comparisons}
|
||||
missing=dict(comparisons=sorted(set(expected_cases)-set(compared)),
|
||||
components=sorted(set(expected_cases)-set(components)),repeats=sorted(set(expected_repeats)-set(repeats)))
|
||||
evidence_ok=(set(compared)==set(components)==set(expected_cases) and set(repeats)==set(expected_repeats) and
|
||||
all(compared.values()) and all(components.values()) and all(repeats.values()))
|
||||
numerical=evidence_ok and all(gates[x] is not None and gates[x]['pass_all'] for x in ('fixtures','probes'))
|
||||
representation=bool(cal is not None and cal['pass_all'])
|
||||
if numerical:status='PASS-FIXED-CAL-REPRESENTATION' if representation else 'FAIL-FIXED-CAL-REPRESENTATION' if cal is not None else 'INCOMPLETE-CAL-EXECUTION'
|
||||
else:status='FAIL-NUMERICAL-OR-AUDIT-GATE' if any(not p for group in (compared,components,repeats) for p in group.values()) else 'INCOMPLETE-NUMERICAL-EXECUTION'
|
||||
oldpass=bool(frozen['pass_all'] and all(r['pass'] for r in after.values()))
|
||||
if not oldpass:status='FAIL-FROZEN-INTEGRITY-OR-REGRESSION'
|
||||
measurements=[]
|
||||
for p in sorted((EXP/'gpu').glob('*/summary.json')):
|
||||
s=json.loads(p.read_text())
|
||||
measurements.append({k:s[k] for k in ('case','total_spikes','accepted_requests','nodes','edges','diagnostic_simulation_seconds','peak_allocated_vram_bytes')})
|
||||
result=dict(status=status,numerical_gate_pass=bool(numerical),fixed_CAL_representation_pass=representation,
|
||||
gates=gates,closed_loop_comparisons=comparisons,component_results=components,repeat_results=repeats,
|
||||
missing_numerical_evidence=missing,calibration=cal,stopped=stops,
|
||||
old_frozen_integrity_and_five_reference_pass=oldpass,measurements=measurements,
|
||||
unchanged_APL_parameters=CFG['apl'],author_LIF_precision='float64',legacy_APL_precision='float32',
|
||||
explicit_hypothesis=CFG['hypothesis'],APL_nonKC_fast_edges_unreplaced=1212,
|
||||
shared_APL_component_oracle_limitation=True,whole_brain_universal_equivalence_claim=False,
|
||||
heldout_generalization_tested=False,formal_AB_tested=False,learning_achieved=False,candidate_generated=False,
|
||||
payload_bytes_before_manifest=budget(),
|
||||
next_gate='Independent seeds/novel-odor representation, then credit specificity; no learning promotion from CAL' if numerical and representation else
|
||||
'Audit first failure in this explicitly declared hypothesis; no gain search, no heldout tuning, no conditioning')
|
||||
save(EXP/'audit/final-status.json',result)
|
||||
lines=['# Phase 4AG: author LIF + unchanged legacy graded APL','',f'Status: `{status}`.','',
|
||||
f'Numerical closed-loop gate: {numerical}; original complete fixed six-CAL gate: {representation}.',
|
||||
'The independent Brian LIF and candidate use independent state but share the APL arithmetic component. Original frozen APL AST replay and a float64 error audit are separately recorded.',
|
||||
'Author LIF uses float64; APL retains float32, tau20ms/gain0.01/normalization1, full original matrices and order. No learning/parameter search.',
|
||||
'The explicitly hypothesized unconditional end-APL write includes refractory KC. Original fast APL mask leaves1,212 non-KC edges unreplaced; this scope limitation was not silently fixed.',
|
||||
f'Old checksums and five frozen reference trials: {oldpass}.',
|
||||
f'Successfully compared cases: {comparisons}.',
|
||||
'Detailed CAL, exact comparisons, component errors, event/request traces and execution exceptions are linked from audit/final-status.json.',
|
||||
'Wall/VRAM here include per-tick CPU synchronization, IPC and hashes. They are diagnostic costs, not runtime-performance benchmarks.',
|
||||
'No heldout dynamic outputs, formal A/B, learning, game, reward, decoder or new candidate.',
|
||||
'Next gate: '+result['next_gate'],'']
|
||||
with (EXP/'REPORT.md').open('x',encoding='utf-8') as f:f.write('\n'.join(lines))
|
||||
check();seal(MODEL);seal(EXP);print(status,flush=True)
|
||||
|
||||
|
||||
if __name__=='__main__':main()
|
||||
Reference in New Issue
Block a user