interplane.Get Omega
Read in your language

omega-tool-model

First-party Omega tool-use model source, serving harnesses, and verification records

Brought by drakestapleton

branch main Branches Tags History

omega-tool-model / pilot / report.py

47 lines · 5446 bytes Raw Blame History
1"""Generate a source-backed local report after all pilot checks finish."""
2from pathlib import Path
3import json,hashlib,datetime
4R=Path(__file__).parent
5res=json.loads((R/'results.json').read_text())
6beh=json.loads((R/'behavior.json').read_text())
7cov=json.loads((R/'coverage.json').read_text())
8cyc=json.loads((R/'tool-cycles.json').read_text())
9sel=json.loads((R/'selection.json').read_text())
10def sha(p):
11 with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
12base=Path('/tmp/gk/r10/run/ck60000.bin')
13assert sha(base)=='a53ced7265818c8f6197449315e9ca4082721665022fec4f81d4538e8d6c2d0f'
14ck=Path(sel['selected']['checkpoint']);assert sha(ck)==sel['sha256']
15summary=cov['summary']
16toolnames=['read','list','check'];codenames=['add','max','print']
17toolpass=sum(summary[k]['pass'] for k in toolnames);tooln=sum(summary[k]['total'] for k in toolnames)
18codepass=sum(summary[k]['pass'] for k in codenames);coden=sum(summary[k]['total'] for k in codenames)
19old,new=res['final_scores'];olds,news=res['story_scores']
20calc={'final_transcript_loss_nats_per_token':[x['loss_micronats']/1e6 for x in [old,new]],
21 'story_loss_nats_per_token':[x['loss_micronats']/1e6 for x in [olds,news]],
22 'story_loss_change_percent':100*(news['loss_micronats']/olds['loss_micronats']-1),
23 'tool_correct':toolpass,'tool_total':tooln,'code_correct':codepass,'code_total':coden}
24(R/'calculations.json').write_text(json.dumps(calc,indent=2))
25lines=['# Tool use and Omega teaching results','',
26f'The selected experimental copy is [{ck.name}]({ck}). It was selected using development examples before the final tests.', '',
27f'On the 180 reserved final exercises it passed {cov["total_pass"]}. Tool requests were correct on {toolpass} of {tooln} cases. Generated Omega programs compiled and produced the expected result on {codepass} of {coden} cases.', '',
28f'Complete file-reading cycles passed {cyc["pass"]} of {cyc["total"]}: the model had to request the right file, receive the actual fixture contents, and report those contents correctly.', '',
29'| Reserved exercise | Correct | Tested |','| --- | ---: | ---: |']
30names={'read':'Request a file read','list':'Request a directory listing','check':'Request an Omega compile check','result':'Report a tool result','failure':'Report a tool error','add':'Write an addition program','max':'Write a larger-value program','print':'Write a printing program'}
31for k,v in summary.items():lines.append(f'| {names[k]} | {v["pass"]} | {v["total"]} |')
32lines+=['',f'The original model passed {beh["counts"]["baseline"]["passed"]} of the eight fixed paired probes. The selected copy passed {beh["counts"]["selected"]["passed"]} of those same eight probes. The original was not tested on all 180 final exercises.','',
33'## What this establishes','',
34'These are elementary, template-based skills. Reserved examples contain new file identifiers, strings and operand pairs, but use the same kinds of requests as the lessons. This does not demonstrate arbitrary Omega development, debugging unfamiliar programs, broad instruction following, or reliable autonomous work. The tool tests use disposable fixture files. No user files or installed harness are exposed to model-generated commands.','',
35'The generated-code checker admits only the bounded lesson grammar. Answers outside that grammar count as failures even if a broader compiler could accept them. All reference programs passed the real compiler and runtime before training, and negative controls prove the checker rejects wrong results and unapproved operations.','',
36'## Tradeoff with the original training','',
37f'Final lesson transcript error fell from {old["loss_micronats"]/1e6:.6f} to {new["loss_micronats"]/1e6:.6f} nats per token. This measure includes prompt text; the execution tests above are the evidence for skills.', '',
38f'On the fixed 64-window story check, error changed from {olds["loss_micronats"]/1e6:.6f} to {news["loss_micronats"]/1e6:.6f} nats per token ({calc["story_loss_change_percent"]:+.2f}%). Lower is better. This is a small common slice, not a full general-language assessment.','',
39'The trained copy is retained separately. The original checkpoint is byte-for-byte unchanged. No model was automatically promoted, and no OMP configuration or running model service was changed.','',
40'## Reproduction and records','',
41'See [METHOD.md](METHOD.md), [PREREG.md](PREREG.md), [EVALUATION-EXTENSION.md](EVALUATION-EXTENSION.md), commands.json, selection.json, behavior.json, coverage.json, tool-cycles.json and the raw receipts directory. The calculations above are generated by report.py and saved with units in calculations.json. Training and inference arithmetic execute in Omega. The Python files are external preparation and checking instruments.','',
42f'Selected checkpoint SHA256: `{sel["sha256"]}`.','']
43(R/'RESULTS.md').write_text('\n'.join(lines))
44pins={str(p.relative_to(R)):sha(p) for p in sorted(R.glob('*.py'))+sorted(R.glob('*.om'))+[R/'PREREG.md',R/'EVALUATION-EXTENSION.md',R/'build/sample',R/'build/reset']}
45(R/'final-method-pins.json').write_text(json.dumps(pins,indent=2))
46(R/'COMPLETE.json').write_text(json.dumps({'pilot_complete':True,'selected_checkpoint':str(ck),'selected_sha256':sha(ck),'original_unchanged':True,'coverage_pass':cov['total_pass'],'coverage_total':cov['total'],'tool_cycles_pass':cyc['pass'],'tool_cycles_total':cyc['total'],'promoted':False},indent=2))
47print(json.dumps(calc),flush=True)