File size: 4,749 Bytes
0d2c6f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""Three-judge validity comparison figure.

Why: the original two-judge figure predates (a) the gpt-oss-120b result and
(b) the UNREADABLE/BLIND distinction. It also understated the sharpest finding:
gpt-oss-120b scores the ROBOTIC transcript HIGHER than the real one.
"""
import json, matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from huggingface_hub import hf_hub_download

SRC = {
    "Qwen2.5-32B": "judgecheck/judgecheck.json",
    "Qwen2.5-72B-AWQ": "judgecheck_72b/judgecheck.json",
    "gpt-oss-120b": "judgecheck_gptoss120b_v2/judgecheck.json",
}
D = {}
for name, f in SRC.items():
    D[name] = json.load(open(hf_hub_download("ygoldi/edumirror-repro-results", f,
                                             repo_type="dataset")))


def verdict(d):
    """Derive the verdict under current semantics (the two early probes predate the field)."""
    a = d["absolute"]
    if "verdict" in a:
        return a["verdict"]
    # Early runs: readable (they produced scores), so VALID iff every margin > 0.
    return "VALID" if all((m or 0) > 0 for m in a["margins"].values()) else "BLIND"


judges = list(SRC)
corr = ["shuffled", "robotic"]
COL = {"Qwen2.5-32B": "#C44E52", "Qwen2.5-72B-AWQ": "#4C72B0", "gpt-oss-120b": "#DD8452"}

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12.2, 4.6))
x = np.arange(len(corr)); w = 0.26

for i, j in enumerate(judges):
    m = [D[j]["absolute"]["margins"][c] for c in corr]
    off = (i - 1) * w
    bars = ax1.bar(x + off, m, w, label=f"{j} [{verdict(D[j])}]", color=COL[j])
    for xi, v in zip(x + off, m):
        ax1.text(xi, v + (0.06 if v >= 0 else -0.17), f"{v:+.2f}", ha="center", fontsize=8,
                 fontweight="bold" if v <= 0 else "normal",
                 color="#B22222" if v <= 0 else "#333")
ax1.axhline(0, color="#333", lw=1.2)
ax1.axhline(2.45, color="#C9A24A", ls="--", lw=1.5)
ax1.text(-0.45, 2.52, "paper's Table 1 spread (2.45)", fontsize=8, color="#8a6d1f")
ax1.set_xticks(x); ax1.set_xticklabels(["shuffled\n(kills coherence)", "robotic\n(kills naturalness)"])
ax1.set_ylabel("Score margin: real − corrupted")
ax1.set_title("Absolute rater: does it score a corrupted transcript lower?")
ax1.legend(fontsize=7.5, loc="upper left"); ax1.grid(axis="y", alpha=0.3)
ax1.set_ylim(-0.9, 2.9)
ax1.annotate("gpt-oss-120b rates the ROBOTIC transcript\nHIGHER than the real one (inverted)",
             xy=(1 + w, -0.55), xytext=(-0.42, 1.35), fontsize=8.5, color="#B22222",
             fontweight="bold", ha="left",
             arrowprops=dict(arrowstyle="->", color="#B22222", lw=1.3,
                             connectionstyle="arc3,rad=-0.15"))

for i, j in enumerate(judges):
    p = [D[j]["pairwise"][c]["real_win_rate"] for c in corr]
    off = (i - 1) * w
    ax2.bar(x + off, p, w, label=j, color=COL[j])
    for xi, v in zip(x + off, p):
        ax2.text(xi, v + 0.03, f"{v:.2f}", ha="center", fontsize=8,
                 fontweight="bold" if v < 0.5 else "normal")
ax2.axhline(0.5, color="#333", ls=":", lw=1.2); ax2.text(-0.45, 0.52, "chance", fontsize=8)
ax2.axhline(0.7, color="#888", ls="--", lw=1); ax2.text(-0.45, 0.72, "validity bar", fontsize=8, color="#666")
ax2.set_xticks(x); ax2.set_xticklabels(["shuffled\n(kills coherence)", "robotic\n(kills naturalness)"])
ax2.set_ylabel("Win rate of the REAL transcript"); ax2.set_ylim(0, 1.18)
ax2.set_title("Pairwise judge: does it prefer the real transcript?\n(SATURATES at 1.00 — a gate, not a ranking)")
ax2.legend(fontsize=7.5, loc="lower right"); ax2.grid(axis="y", alpha=0.3)

fig.suptitle("Judge validity across three open judges: bigger is not better.\n"
             "Only Qwen2.5-72B is usable for absolute scoring — and only barely.", fontsize=11)
fig.tight_layout()
fig.savefig("outputs/figures/judge_validity.png", dpi=150)
print("wrote outputs/figures/judge_validity.png")

import csv
rows = []
for j in judges:
    a, pw = D[j]["absolute"], D[j]["pairwise"]
    for c in corr:
        rows.append({"judge": j, "corruption": c,
                     "absolute_real_avg": a["real"]["average"],
                     "absolute_corrupt_avg": a[c]["average"],
                     "absolute_margin": a["margins"][c],
                     "absolute_verdict": verdict(D[j]),
                     "pairwise_real_win_rate": pw[c]["real_win_rate"],
                     "pairwise_n": pw[c]["n"],
                     "pairwise_verdict": pw.get("verdict", "VALID" if all(
                         (pw[k]["real_win_rate"] or 0) >= 0.7 for k in corr) else "BLIND")})
with open("outputs/judge_validity.csv", "w", newline="") as f:
    wr = csv.DictWriter(f, fieldnames=list(rows[0])); wr.writeheader(); wr.writerows(rows)
print(open("outputs/judge_validity.csv").read())