File size: 1,529 Bytes
53a1159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Post-run baseline-adjusted view of the frozen intervention measurements."""

import json
from pathlib import Path

import matplotlib

matplotlib.use("Agg")
from matplotlib import pyplot as plt

folder = Path(__file__).resolve().parent
audit = json.loads((folder / "independent-audit.json").read_text())
fig, ax = plt.subplots(figsize=(6.5, 3.6))
for model, color in (("standard2", "#2467a2"), ("loop2", "#d56a22")):
    for component, marker in (("mlp_delta", "o"), ("postresidual", "s")):
        cells = [
            row
            for row in audit["patch_baseline_adjusted_descriptive_scores"]
            if row["state"].startswith(model) and row["component"] == component
        ]
        cells.sort(key=lambda row: int(row["state"].rsplit("s", 1)[1]))
        ax.plot(
            [int(row["state"].rsplit("s", 1)[1]) for row in cells],
            [100 * row["accuracy_delta"] for row in cells],
            marker=marker,
            color=color,
            linestyle="-" if component == "mlp_delta" else "--",
            label=f"{model} {component}",
        )
ax.axhline(0, color="black", linewidth=0.8)
ax.set_xticks([8000, 32000, 64000], ["8k", "32k", "64k"])
ax.set_xlabel("Parent checkpoint training updates")
ax.set_ylabel("Alternative-route accuracy change (pp)")
ax.set_title("First-block r1 patch minus native alternative-route accuracy")
ax.grid(alpha=0.2)
ax.legend(fontsize=8)
fig.tight_layout()
for suffix in ("png", "pdf"):
    fig.savefig(folder / f"patch-delta.{suffix}", dpi=180)
plt.close(fig)