import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np epochs = ["ep0", "ep1", "ep2", "ep3"] gen = [3.072, 3.150, 3.205, 3.204] # generalist on code held-out spec = [3.191, 3.268, 3.340, 3.339] # code250k specialist on code held-out x = np.arange(len(epochs)); w = 0.38 fig, ax = plt.subplots(figsize=(7.2, 4.6)) b1 = ax.bar(x - w/2, gen, w, label="generalist (mixed 250k, 91k code)", color="#9aa7b8") b2 = ax.bar(x + w/2, spec, w, label="code specialist (from D0, 250k code)", color="#2e7d32") ax.axhline(3.205, ls="--", lw=1.2, color="#9aa7b8") ax.axhline(3.340, ls="--", lw=1.2, color="#2e7d32") ax.annotate("", xy=(3.34, 3.340), xytext=(3.34, 3.205), arrowprops=dict(arrowstyle="<->", color="black", lw=1.3)) ax.text(3.0, (3.205+3.340)/2, "+0.135", fontsize=12, fontweight="bold", va="center") for b in list(b1)+list(b2): ax.text(b.get_x()+b.get_width()/2, b.get_height()+0.006, f"{b.get_height():.3f}", ha="center", va="bottom", fontsize=8.5) ax.set_xticks(x); ax.set_xticklabels(epochs) ax.set_ylim(3.0, 3.42) ax.set_ylabel("code held-out accept length (AL)") ax.set_title("code: 250k single-domain specialist vs generalist (per-epoch, held-out=89)") ax.legend(loc="lower right", fontsize=9) ax.grid(axis="y", ls=":", alpha=0.5) fig.tight_layout() fig.savefig("code250k_vs_gen.png", dpi=130) print("OK")