resume-unicode · e5ea29464d73
Browse filesFiles changed (6)
14 unmodified lines15161714 unmodified linesBefore any transfer evaluation, an invariant test on development fixtures showed that simple negation preserved absolute magnitude. The transfer implementation now reverses the sign and adds three to the absolute magnitude. Zero maps to minus three and is an explicit exception to sign reversal. For the same fixed problem IDs, cross the familiar and novel error with familiar and reserved layouts. These descriptive controls separate the two shifts. Method-level evidence results with the identical frozen Judge 3, input cohort and greedy decoder reuse a single observation set and name its source.The field-level breakdown counts syntactically complete reports, correct solver bits, correct audit bits and altered reviews correctly rejected with the exact field and replacement. All reports remain in their corresponding denominator, including malformed output. These counts describe the registered whole-pair failures after inspection of the frozen development examples. They leave the whole-pair success criterion intact.14 unmodified lines15161718192014 unmodified linesBefore any transfer evaluation, an invariant test on development fixtures showed that simple negation preserved absolute magnitude. The transfer implementation now reverses the sign and adds three to the absolute magnitude. Zero maps to minus three and is an explicit exception to sign reversal. For the same fixed problem IDs, cross the familiar and novel error with familiar and reserved layouts. These descriptive controls separate the two shifts. Method-level evidence results with the identical frozen Judge 3, input cohort and greedy decoder reuse a single observation set and name its source.The field-level breakdown counts syntactically complete reports, correct solver bits, correct audit bits and altered reviews correctly rejected with the exact field and replacement. All reports remain in their corresponding denominator, including malformed output. These counts describe the registered whole-pair failures after inspection of the frozen development examples. They leave the whole-pair success criterion intact.## Recovery of the first solver's development replayA mathematical minus sign interrupted the Windows redirected terminal while a replay batch was generating. The original prompt and partial output are present in its UTF-8 journal. The restarted evaluation reuses completed problem IDs, the same checkpoint, batch ordering and seeds. Terminal output now uses UTF-8 as well. Reported generation cost includes every completed call across attempts, including repeated work. Each unfinished batch is counted separately because its complete time and output-token count are unavailable. [Recovery tests](../tests/test_storage.py) · [Evaluation implementation](../src/study/evaluate.py)
8 unmodified lines9101112131415153 unmodified lines1691701711721731748 unmodified linesfrom .exposures import check_exposuresfrom .judging import chain, majority, twin, votesfrom .records import expected, mask_evidence, parse, solver_truth, sound, terminalfrom .storage import RESULTS, Journal, adapter, append, atomic, read_json, rows, stamp, write_jsondef weights_digest(name):153 unmodified linesevidence_sources[filename] = evidence_cohort(backend, snapshots[2], name, phase, "dev", 8, filename,pool=population(profile, "dev", 8))result = {"time": stamp(), "phase": phase, "weights": weights_digest(name) if run else "frozen base","usage": backend.totals, "evidence_sources": evidence_sources, "profile": profile}write_json(marker, result)return result8 unmodified lines9101112131415153 unmodified lines1691701711721731748 unmodified linesfrom .exposures import check_exposuresfrom .judging import chain, majority, twin, votesfrom .records import expected, mask_evidence, parse, solver_truth, sound, terminalfrom .storage import RESULTS, Journal, adapter, append, atomic, generation_cost, read_json, rows, stamp, write_jsondef weights_digest(name):153 unmodified linesevidence_sources[filename] = evidence_cohort(backend, snapshots[2], name, phase, "dev", 8, filename,pool=population(profile, "dev", 8))result = {"time": stamp(), "phase": phase, "weights": weights_digest(name) if run else "frozen base",**generation_cost(name+"-"+phase,backend.totals), "evidence_sources": evidence_sources, "profile": profile}write_json(marker, result)return result
8 unmodified lines910111213141544 unmodified lines606162636465665 unmodified lines7273747576777840 unmodified lines11912012112212312412524 unmodified lines1501511521531541551568 unmodified linesfrom .judging import chainfrom .learnability_analysis import cell_metrics, changes_by_parse, choose_cell, confirmed, learning_resultfrom .records import expected, parse, render, solver_truth, sound, terminalfrom .storage import RESULTS, Journal, append, read_json, rows, stamp, write_jsondef directory():return RESULTS/"learnability"44 unmodified linesreturn read_json(target)backend=Backend(Journal("learnability-screen"))cells=[measure(backend,family,style,"screen",16) for family in FAMILIES for style in STYLES]outcome=dict(time=stamp(),cells=cells,selected=choose_cell(cells),usage=backend.totals)write_json(target,outcome)return outcome5 unmodified linesc=selected()backend=Backend(Journal("learnability-confirm"))measurement=measure(backend,c["family"],c["style"],"confirm",48)outcome=dict(time=stamp(),cell=measurement,confirmed=confirmed(measurement),usage=backend.totals)write_json(target,outcome)return outcome40 unmodified linesmechanisms(backend,None,"learnability-confirm",len(pool),twin_path,population=pool)pairs=list(rows(twin_path))result=dict(time=stamp(),judges=levels,pairs=len(pairs),visible=mean(r["visible_pair"] for r in pairs),masked=mean(r["masked_pair"] for r in pairs),usage=backend.totals)write_json(target,result)return result24 unmodified linescorrect=solver_truth(p,t)[0],parsed=parse(t,len(p.values)) is not None))records=list(rows(path))result=dict(time=stamp(),n=len(records),correct=sum(r["correct"] for r in records),parsed=sum(r["parsed"] for r in records),weights=weights_digest(name) if snapshot else "frozen base",usage=backend.totals)write_json(target,result)return result8 unmodified lines910111213141544 unmodified lines606162636465665 unmodified lines7273747576777840 unmodified lines11912012112212312412524 unmodified lines1501511521531541551561578 unmodified linesfrom .judging import chainfrom .learnability_analysis import cell_metrics, changes_by_parse, choose_cell, confirmed, learning_resultfrom .records import expected, parse, render, solver_truth, sound, terminalfrom .storage import RESULTS, Journal, append, generation_cost, read_json, rows, stamp, write_jsondef directory():return RESULTS/"learnability"44 unmodified linesreturn read_json(target)backend=Backend(Journal("learnability-screen"))cells=[measure(backend,family,style,"screen",16) for family in FAMILIES for style in STYLES]outcome=dict(time=stamp(),cells=cells,selected=choose_cell(cells),**generation_cost("learnability-screen",backend.totals))write_json(target,outcome)return outcome5 unmodified linesc=selected()backend=Backend(Journal("learnability-confirm"))measurement=measure(backend,c["family"],c["style"],"confirm",48)outcome=dict(time=stamp(),cell=measurement,confirmed=confirmed(measurement),**generation_cost("learnability-confirm",backend.totals))write_json(target,outcome)return outcome40 unmodified linesmechanisms(backend,None,"learnability-confirm",len(pool),twin_path,population=pool)pairs=list(rows(twin_path))result=dict(time=stamp(),judges=levels,pairs=len(pairs),visible=mean(r["visible_pair"] for r in pairs),masked=mean(r["masked_pair"] for r in pairs),**generation_cost("learnability-audit",backend.totals))write_json(target,result)return result24 unmodified linescorrect=solver_truth(p,t)[0],parsed=parse(t,len(p.values)) is not None))records=list(rows(path))result=dict(time=stamp(),n=len(records),correct=sum(r["correct"] for r in records),parsed=sum(r["parsed"] for r in records),weights=weights_digest(name) if snapshot else "frozen base",**generation_cost("learnability-"+name+"-evaluation",backend.totals))write_json(target,result)return result
1 unmodified line23456777 unmodified lines8586878889909192939495961 unmodified lineimport jsonimport osimport timefrom datetime import datetime, timezonefrom pathlib import Path77 unmodified linesatomic(path, "".join(line + "\n" for line in data))class Journal:"""Mirror complete public model inputs and outputs to a timestamped log and terminal."""def __init__(self, run):self.run = runself.path = log_directory() / run / (stamp().replace(":", "-") + ".jsonl")def event(self, event, **values):record = {"time": stamp(), "run": self.run, "event": event, **values}1 unmodified line234567877 unmodified lines86878889909192939495969798991001011021031041051061071081091101111121131141151161171181 unmodified lineimport jsonimport osimport sysimport timefrom datetime import datetime, timezonefrom pathlib import Path77 unmodified linesatomic(path, "".join(line + "\n" for line in data))def generation_cost(run, fallback):"""Include completed GPU generations from every attempt, including repeated evaluation batches."""totals, unfinished = {}, 0fields = ("calls", "input_tokens", "output_tokens", "gpu_seconds", "wall_seconds")for path in sorted((log_directory()/run).glob("*.jsonl")):started = finished = 0for event in rows(path):if event["event"] == "prompts":started += 1elif event["event"] == "outputs":finished += 1counts = totals.setdefault(event["role"], dict.fromkeys(fields, 0))for field in fields:counts[field] += event[field]unfinished += max(0, started-finished)return dict(usage=totals or fallback, unfinished_generation_batches=unfinished)class Journal:"""Mirror complete public model inputs and outputs to a timestamped log and terminal."""def __init__(self, run):self.run = runself.path = log_directory() / run / (stamp().replace(":", "-") + ".jsonl")# A redirected Windows console can default to CP1252. Keep the terminal and UTF-8 file faithful.if hasattr(sys.stdout,"reconfigure") and (sys.stdout.encoding or "").lower().replace("-","") != "utf8":sys.stdout.reconfigure(encoding="utf-8")def event(self, event, **values):record = {"time": stamp(), "run": self.run, "event": event, **values}
18 unmodified lines19202122232425182 unmodified lines20820921021121221321418 unmodified linesfrom .domain import Problem, problemsfrom .judging import chain, make_example, majority, votesfrom .records import approval, expected, solver_truth, sound, terminalfrom .storage import RESULTS, STATE, Journal, adapter, append, read_json, retain, rows, stamp, write_jsondef frozen_sources(run):182 unmodified linesraise RuntimeError("Frozen judge adapter changed during optimization")backend.model.save_pretrained(adapter(run.name), selected_adapters=["default"])result = dict(time=stamp(), run=asdict(run), updates=trainer.state.global_step,elapsed_seconds=elapsed, resumed_at=last_step, frozen_checksum=after, usage=backend.totals)if run.name == "timing":record_timing_budget(result)write_json(out / "trained.json", result)18 unmodified lines19202122232425182 unmodified lines20820921021121221321418 unmodified linesfrom .domain import Problem, problemsfrom .judging import chain, make_example, majority, votesfrom .records import approval, expected, solver_truth, sound, terminalfrom .storage import RESULTS, STATE, Journal, adapter, append, generation_cost, read_json, retain, rows, stamp, write_jsondef frozen_sources(run):182 unmodified linesraise RuntimeError("Frozen judge adapter changed during optimization")backend.model.save_pretrained(adapter(run.name), selected_adapters=["default"])result = dict(time=stamp(), run=asdict(run), updates=trainer.state.global_step,elapsed_seconds=elapsed, resumed_at=last_step, frozen_checksum=after, **generation_cost(run.name,backend.totals))if run.name == "timing":record_timing_budget(result)write_json(out / "trained.json", result)
10 unmodified lines111213141516171810 unmodified linesassert list(rows(path))==[{"sample":"first"}]append(path,{"sample":"next"})assert list(rows(path))==[{"sample":"first"},{"sample":"next"}]def test_published_text_uses_git_line_endings(tmp_path):from study.storage import atomictarget = tmp_path / "receipt.json"atomic(target, "first\nsecond\n")assert target.read_bytes() == b"first\nsecond\n"10 unmodified lines11121314151617181920212223242526272829303132333435363738394041424344454610 unmodified linesassert list(rows(path))==[{"sample":"first"}]append(path,{"sample":"next"})assert list(rows(path))==[{"sample":"first"},{"sample":"next"}]def test_published_text_uses_git_line_endings(tmp_path):from study.storage import atomictarget = tmp_path / "receipt.json"atomic(target, "first\nsecond\n")assert target.read_bytes() == b"first\nsecond\n"def test_redirected_windows_terminal_preserves_model_unicode(tmp_path):import osimport subprocessimport sysprogram = "from study.storage import Journal; Journal('utf8').event('output_chunk',text=chr(0x2212))"result = subprocess.run([sys.executable,"-c",program],cwd=tmp_path,capture_output=True,env={**os.environ,"PYTHONIOENCODING":"cp1252"},check=True)assert "−" in result.stdout.decode("utf-8")log = next((tmp_path/"logs/utf8").glob("*.jsonl"))assert next(rows(log))["text"]=="−"def test_generation_cost_includes_completed_attempts_before_evaluation_resume(tmp_path,monkeypatch):from study import storagemonkeypatch.setattr(storage,"ROOT",tmp_path)for name in ("first","resumed"):path=tmp_path/"logs/run"/(name+".jsonl")append(path, dict(event="prompts",role="j3"))append(path, dict(event="outputs",role="j3",calls=8,input_tokens=20,output_tokens=16,gpu_seconds=4,wall_seconds=5))append(tmp_path/"logs/run/first.jsonl",dict(event="prompts",role="j3"))cost=storage.generation_cost("run",{})assert cost["usage"]["j3"]==dict(calls=16,input_tokens=40,output_tokens=32,gpu_seconds=8,wall_seconds=10)assert cost["unfinished_generation_batches"]==1
reports/amendments.md+3
src/study/evaluate.py+2-2
src/study/learnability.py+6-5
src/study/storage.py+22
src/study/training.py+2-2
tests/test_storage.py+28