From 07b10f06478514bbe9d9c77461a90f9d3254218b Mon Sep 17 00:00:00 2001 From: YurenHao0426 Date: Wed, 8 Apr 2026 04:46:59 -0500 Subject: Fill in tables 1-3 + generate figures 2/4/5 from existing data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tables filled with real values: Table 1: 5-method audit (3-seed mean ± std for acc, headline Γ, verdict) Table 2: 4-condition mode 2 validation (cos and ρ values from existing checkpoint measurements) Table 3: protocol thresholds (50×, 1e-7, 0.30, 2pp) Figures generated from existing data: fig2_decision_utility.pdf: 5×7 verdict heatmap from results/protocol_audit/ablation_decision_utility.json fig4_penalty_rescue.pdf: 3-panel — trajectory + cos/ρ bars + 2×2 acc from snapshot_evolution_v2 + dfa_residual_penalty + bp_with_penalty fig5_cross_arch_summary.pdf: 5×4 BP/DFA verdict matrix across architectures Compiles to 8 pages with all tables/figures rendered. §1-§7 main body still has only paragraph topic sentences (TODO: per-section prose filling via codex). Figure numbering is wrong (codex put figures in section order not numerical order — need fixing). --- paper/figures/render_fig2_decision_utility.py | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 paper/figures/render_fig2_decision_utility.py (limited to 'paper/figures/render_fig2_decision_utility.py') diff --git a/paper/figures/render_fig2_decision_utility.py b/paper/figures/render_fig2_decision_utility.py new file mode 100644 index 0000000..ba1a148 --- /dev/null +++ b/paper/figures/render_fig2_decision_utility.py @@ -0,0 +1,56 @@ +"""Render Figure 2: decision-utility ablation as a heatmap.""" +import os +import json +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import numpy as np + +REPO_ROOT = "/home/yurenh2/fa" +with open(os.path.join(REPO_ROOT, "results/protocol_audit/ablation_decision_utility.json")) as f: + data = json.load(f) + +methods = ["bp", "ep", "dfa", "credit_bridge", "state_bridge"] +method_labels = ["BP", "EP", "DFA", "Credit Bridge", "State Bridge"] +strategies = ["S0", "S1", "S2", "S3", "S4", "S5", "S_full"] +strategy_labels = ["S0\nacc only", "S1\n+$\\Gamma$\n(field std)", "S2\n+(a)\nscale", "S3\n+(b)\nfloor", "S4\n+(c)\nstability", "S5\n+(d)\nfrozen", "S$_\\mathrm{full}$\nfull"] + +# Build a verdict matrix: 1 = walk back (red), 0 = trustworthy (blue) +mat = np.zeros((len(methods), len(strategies))) +for i, m in enumerate(methods): + for j, s in enumerate(strategies): + v = data["table"][m][s] + if "WALK" in v: + mat[i, j] = 1.0 + +fig, ax = plt.subplots(figsize=(7, 3.2)) +cmap = matplotlib.colors.ListedColormap(["#4682b4", "#cc4444"]) +im = ax.imshow(mat, cmap=cmap, aspect="auto", vmin=0, vmax=1) + +# Annotate each cell +for i in range(len(methods)): + for j in range(len(strategies)): + v = data["table"][methods[i]][strategies[j]] + txt = "WB" if "WALK" in v else "$\\checkmark$" + ax.text(j, i, txt, ha="center", va="center", + color="white" if mat[i, j] > 0.5 else "white", fontsize=10, fontweight="bold") + +ax.set_xticks(range(len(strategies))) +ax.set_xticklabels(strategy_labels, fontsize=8) +ax.set_yticks(range(len(methods))) +ax.set_yticklabels(method_labels, fontsize=10) +ax.set_xlabel("reporting strategy", fontsize=10) + +# Color legend +from matplotlib.patches import Patch +legend_elements = [ + Patch(facecolor="#4682b4", label="$\\checkmark$ trustworthy"), + Patch(facecolor="#cc4444", label="WB walked back"), +] +ax.legend(handles=legend_elements, loc="upper center", bbox_to_anchor=(0.5, -0.25), ncol=2, fontsize=9, frameon=False) + +ax.set_title("Decision-utility ablation: 7 reporting strategies vs 5 methods\nfield-standard pair (S0, S1) walks back 0/5; full protocol walks back 3/5", fontsize=10) +plt.tight_layout() +out = os.path.join(REPO_ROOT, "paper/figures/fig2_decision_utility.pdf") +plt.savefig(out, bbox_inches="tight", dpi=200) +print(f"Saved {out}") -- cgit v1.2.3