Download plot_software_transfer_fixed_validation.py from penfever/qwen3coder-iris-rl-data-sweep-artifacts: direct link, hf CLI and curl.
- Browser
- Download file 7.57 kB
-
https://huggingface.co/datasets/penfever/qwen3coder-iris-rl-data-sweep-artifacts/resolve/main/plot_software_transfer_fixed_validation.py
- Command line
-
hf download hf://datasets/penfever/qwen3coder-iris-rl-data-sweep-artifacts/plot_software_transfer_fixed_validation.py
-
curl -L -o plot_software_transfer_fixed_validation.py https://huggingface.co/datasets/penfever/qwen3coder-iris-rl-data-sweep-artifacts/resolve/main/plot_software_transfer_fixed_validation.py
7.57 kB
| #!/usr/bin/env python3 | |
| """Plot the fixed-validation curves for the software-transfer arms.""" | |
| from pathlib import Path | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| from matplotlib.lines import Line2D | |
| ARTIFACTS = Path(__file__).resolve().parent | |
| INPUT = ARTIFACTS / "software-transfer-fixed-validation.csv" | |
| OUTPUT = ARTIFACTS / "software-transfer-fixed-validation" | |
| SERIES = { | |
| "factorial_constdenom_g4_entropy_0.00003_lr_2e-6": ("constant_denominator", 4), | |
| "factorial_sequence_mean_g8_entropy_0.00003_lr_2e-6": ("sequence_mean", 8), | |
| "factorial_sequence_mean_g16_entropy_0.00003_lr_2e-6": ("sequence_mean", 16), | |
| "factorial_sequence_mean_g32_entropy_0.00003_lr_2e-6": ("sequence_mean", 32), | |
| "factorial_constdenom_g8_entropy_0.00003_lr_2e-6": ("constant_denominator", 8), | |
| "factorial_constdenom_g16_entropy_0.00003_lr_2e-6": ("constant_denominator", 16), | |
| "factorial_constdenom_g32_entropy_0.00003_lr_2e-6": ("constant_denominator", 32), | |
| "factorial_constdenom_g64_entropy_0.00003_lr_2e-6": ("constant_denominator", 64), | |
| } | |
| GROUP_COLORS = {4: "#E69F00", 8: "#0072B2", 16: "#D55E00", 32: "#009E73", 64: "#CC79A7"} | |
| LOSS_STYLES = {"sequence_mean": "--", "constant_denominator": "-"} | |
| # Non-paired Qwen3-Coder archive estimates published from marin issue #8809: | |
| # https://github.com/marin-community/marin/issues/8809#issuecomment-5516287195 | |
| BASE_REFERENCES = { | |
| "BugsInPy": {"pass@1": 0.3049, "pass@16": 0.5761}, | |
| "SWE-Gym": {"pass@1": 0.3943, "pass@16": 0.9084}, | |
| } | |
| BASE_STYLES = {"pass@1": ":", "pass@16": "-."} | |
| def main() -> None: | |
| frame = pd.read_csv(INPUT) | |
| frame = frame[ | |
| frame["status"].isin(["authoritative", "authoritative_policy_stop", "authoritative_user_stop"]) | |
| ].copy() | |
| frame = frame[frame["recipe"].isin(SERIES)].copy() | |
| # A restarted arm can have more than one authoritative attempt. Retain only | |
| # the latest attempt so disconnected histories are not presented as a curve. | |
| latest_attempts = frame.groupby(["dataset", "recipe"])["attempt"].transform("max") | |
| frame = frame[frame["attempt"] == latest_attempts] | |
| peaks = frame.groupby(["dataset", "recipe"])["pass_at_1"].max() | |
| leaders = peaks.groupby(level="dataset").idxmax().to_dict() | |
| plt.rcParams.update( | |
| { | |
| "font.family": "DejaVu Sans", | |
| "font.size": 12, | |
| "axes.titlesize": 17, | |
| "axes.titleweight": "bold", | |
| "axes.labelsize": 13, | |
| "legend.fontsize": 10.5, | |
| } | |
| ) | |
| fig, axes = plt.subplots(1, 2, figsize=(15.5, 8.5), sharey=True) | |
| for ax, dataset in zip(axes, ("BugsInPy", "SWE-Gym"), strict=True): | |
| panel = frame[frame["dataset"] == dataset] | |
| for recipe, (loss_reduction, group_size) in SERIES.items(): | |
| series = panel[panel["recipe"] == recipe].sort_values("step") | |
| if series.empty: | |
| continue | |
| is_leader = leaders[dataset][1] == recipe | |
| ax.plot( | |
| series["step"], | |
| series["pass_at_1"], | |
| color=GROUP_COLORS[group_size], | |
| linestyle=LOSS_STYLES[loss_reduction], | |
| marker="o", | |
| markersize=6 if is_leader else 5, | |
| linewidth=3.0 if is_leader else 1.8, | |
| alpha=1.0 if is_leader else 0.72, | |
| zorder=3 if is_leader else 2, | |
| ) | |
| peak_row = series.loc[series["pass_at_1"].idxmax()] | |
| ax.scatter( | |
| [peak_row["step"]], | |
| [peak_row["pass_at_1"]], | |
| marker="D", | |
| s=68 if is_leader else 48, | |
| color=GROUP_COLORS[group_size], | |
| edgecolor="white", | |
| linewidth=0.9, | |
| zorder=4, | |
| ) | |
| stop_rows = series[series["status"].isin(["authoritative_policy_stop", "authoritative_user_stop"])] | |
| if not stop_rows.empty: | |
| stop_row = stop_rows.sort_values("step").iloc[-1] | |
| ax.scatter( | |
| [stop_row["step"]], | |
| [stop_row["pass_at_1"]], | |
| marker="X", | |
| s=105 if is_leader else 82, | |
| color=GROUP_COLORS[group_size], | |
| edgecolor="white", | |
| linewidth=1.0, | |
| zorder=5, | |
| ) | |
| for metric, value in BASE_REFERENCES[dataset].items(): | |
| ax.axhline( | |
| value, | |
| color="#555555", | |
| linestyle=BASE_STYLES[metric], | |
| linewidth=1.6, | |
| alpha=0.82, | |
| zorder=1, | |
| ) | |
| ax.text( | |
| 0.985, | |
| value + 0.008, | |
| f"Archive base {metric} {value:.4f}", | |
| transform=ax.get_yaxis_transform(), | |
| ha="right", | |
| va="bottom", | |
| fontsize=9.5, | |
| color="#444444", | |
| bbox={"facecolor": "white", "edgecolor": "none", "alpha": 0.82, "pad": 1.4}, | |
| zorder=6, | |
| ) | |
| ax.set_title(dataset, pad=10) | |
| ax.set_xlabel("Training step") | |
| ax.set_xlim(-0.35, max(8.8, float(panel["step"].max()) + 0.8)) | |
| ax.set_ylim(0, 1.0) | |
| ax.set_xticks(sorted(panel["step"].unique())) | |
| ax.grid(True, color="#CFD5DC", linewidth=0.7, alpha=0.65) | |
| ax.set_axisbelow(True) | |
| axes[0].set_ylabel("Fixed-validation pass@1") | |
| fig.suptitle("Software-transfer performance so far", fontsize=21, fontweight="bold", y=0.96) | |
| fig.text( | |
| 0.5, | |
| 0.905, | |
| "Seed-42 disjoint 128-task validation; matched factorial arms only. Diamonds mark peaks; X marks termination; bold lines lead.\n" | |
| "Gray lines are non-paired Qwen3-Coder archive references from Marin issue #8809.", | |
| ha="center", | |
| va="top", | |
| fontsize=12.5, | |
| color="#444444", | |
| ) | |
| legend_handles = [ | |
| *[ | |
| Line2D( | |
| [0], | |
| [0], | |
| color=GROUP_COLORS[group_size], | |
| marker="o", | |
| linestyle="none", | |
| markersize=7, | |
| label=f"Group {group_size}", | |
| ) | |
| for group_size in GROUP_COLORS | |
| ], | |
| Line2D([0], [0], color="#333333", linestyle="--", linewidth=2.2, label="Sequence mean"), | |
| Line2D([0], [0], color="#333333", linestyle="-", linewidth=2.2, label="Constant denominator"), | |
| Line2D( | |
| [0], | |
| [0], | |
| color="#555555", | |
| marker="X", | |
| markeredgecolor="white", | |
| linestyle="none", | |
| markersize=9, | |
| label="Terminated", | |
| ), | |
| Line2D( | |
| [0], | |
| [0], | |
| color="#555555", | |
| linestyle=BASE_STYLES["pass@1"], | |
| linewidth=1.8, | |
| label="Archive base pass@1", | |
| ), | |
| Line2D( | |
| [0], | |
| [0], | |
| color="#555555", | |
| linestyle=BASE_STYLES["pass@16"], | |
| linewidth=1.8, | |
| label="Archive base pass@16", | |
| ), | |
| ] | |
| fig.legend( | |
| handles=legend_handles, | |
| loc="lower center", | |
| bbox_to_anchor=(0.5, 0.025), | |
| ncol=5, | |
| frameon=False, | |
| title="Color = group size; line = loss reduction", | |
| ) | |
| fig.tight_layout(rect=(0, 0.18, 1, 0.84), w_pad=3.0) | |
| fig.savefig(OUTPUT.with_suffix(".png"), dpi=180, bbox_inches="tight") | |
| fig.savefig(OUTPUT.with_suffix(".svg"), bbox_inches="tight") | |
| if __name__ == "__main__": | |
| main() | |