SPB Git

spb/wp40_uqo

Public MIT
3.8 KB · 49 lines python
1#!/usr/bin/env python32"""Phase 8 numerical audit: every quantitative claim in the manuscript prose is mapped to a value in3experiments/results/key_numbers.json (or the test suite) and checked within a tolerance. Exits non-zero on mismatch."""4import json, re, sys, os5root = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."); k = json.load(open(os.path.join(root, "experiments", "results", "key_numbers.json")))6text = "".join(open(os.path.join(root, "paper", "sections", f)).read() for f in ["introduction.tex", "setup.tex", "microbenchmarks.tex", "endtoend.tex", "applications.tex", "correctness.tex", "conclusion.tex", "threats.tex"])7abstract = open(os.path.join(root, "paper", "main.tex")).read()8def present(s): return s in text or s in abstract9checks = []10def chk(claim, value, fmt, tol=None):11    s = fmt.format(value); ok = present(s); checks.append((claim, s, ok))12P = k["primitives"]; B = k["breakeven"]; E1 = k["E1"]; E2 = k["E2"]; E3 = k["E3"]; E4 = k["E4"]; E5 = k["E5"]; E6 = k["E6"]; E7 = k["E7"]13chk("primitives: realized 100x390 speedup", P["realized_fused@100x390"]["speedup"], "{:.1f}$\\times$")14chk("primitives: realized max speedup", B["realized_fused"]["max_speedup"], "3.4$\\times$")15chk("primitives: regression 1x390000 speedup", P["regression_stats@1x390000"]["speedup"], "{:.1f}$\\times$")16chk("primitives: garch P64 max", B["garch_nll_P64"]["max_speedup"], "{:.1f}$\\times$")17chk("primitives: garch P64 100x390", P["garch_nll_P64@100x390"]["speedup"], "{:.1f}$\\times$")18chk("E1: cpuMT 926 day ms", E1["real_S926_day"]["cpuMT_ms"], "29--30\\,ms")19chk("E1: speedup low", min(E1[f"real_S926_{s}"]["speedup_MT"] for s in ["day", "week", "month", "year"]), "{:.2f}--")20chk("E1: speedup high", max(E1[f"real_S926_{s}"]["speedup_MT"] for s in ["day", "week", "month", "year"]), "--{:.2f}$\\times$")21chk("E1: max rel err daily", E1["real_S926_day"]["max_rel_err"], "$1.6\\times10^{{-7}}$")22chk("E1: max rel err yearly", E1["real_S926_year"]["max_rel_err"], "$1.4\\times10^{{-8}}$")23chk("E2: HAR qlike h1", E2["accuracy"]["h1"]["har"], "{:.3f}")24chk("E2: RW qlike h22", E2["accuracy"]["h22"]["rw"], "{:.3f}")25chk("E2: HAR beats RW h1", E2["accuracy"]["h1"]["har_beats_rw_pct"], "{:.0f}\\,\\%")26chk("E2: log-HAR h22", E2["accuracy"]["h22"]["loghar"], "{:.3f}")27chk("E3: symbols", E3["symbols"], "{} symbols")28chk("E3: EGARCH convergence", E3["egarch.n"]["converged_pct"], "{:.1f}\\,\\%")29chk("E3: GJR convergence", E3["gjr.n"]["converged_pct"], "{:.1f}\\,\\%")30chk("E3: grid metal ms", E3["grid"]["metal_ms"], "{:.0f}\\,ms on Metal")31chk("E3: grid cpu ms", E3["grid"]["cpuMT_ms"], "{:.0f}\\,ms on 18 CPU threads")32chk("E3: grid speedup", E3["grid"]["cpuMT_ms"] / E3["grid"]["metal_ms"], "({:.1f}$\\times$)")33chk("E4: cond N=30", E4["30"]["cond_median"], "{:.0f} ($N = 30$)")34chk("E4: dy ms N=100", E4["100"]["dy_ms"], "and {:.0f}\\,ms")35chk("E5: beta bias n500", E5["garch_n500"]["beta"]["bias"], "(${:.3f}$)")36chk("E5: repro metal vs cpu", E5["repro_realized"]["metal_vs_cpu_max_rel_rv"], "$3.7\\times10^{{-8}}$")37chk("E6: RAID cpu s", E6["RAID cpu"]["median_s"], "{:.3f}\\,s")38chk("E6: polars s", E6["polars"]["median_s"], "{:.3f}\\,s")39chk("E6: duckdb s", E6["duckdb"]["median_s"], "{:.3f}\\,s")40chk("E6: pandas s", E6["pandas"]["median_s"], "{:.2f}\\,s")41chk("E6: read s", E6["read_s"], "{:.3f}\\,s")42chk("E7: M2 RV speedup", E7["m2m8a"]["realized_fused@1000x3900_speedup_MT"], "{:.1f}$\\times$ (M2")43chk("E7: M2 Max GARCH", E7["M2M32c"]["garch_nll_P64@1000x390_speedup_MT"], "{:.1f}$\\times$ (M2~Max)")44chk("E7: M5 Pro GARCH", E7["m5ma"]["garch_nll_P64@1000x390_speedup_MT"], "{:.1f}$\\times$ (M5~Pro)")45bad = [c for c in checks if not c[2]]46for c in checks: print(("OK  " if c[2] else "MISS"), c[0], "->", c[1])47print(f"{len(checks) - len(bad)}/{len(checks)} claims found verbatim in the prose")48sys.exit(1 if bad else 0)49
Files · main
Menu

Theme