qwen3coder-iris-rl-data-sweep-artifacts / plot_top_ten_checkpoint_fixed_validation.py
penfever's picture
Add files using upload-large-folder tool
d2d7bf7 verified
Raw History Blame Contribute Delete
4.4 kB
#!/usr/bin/env python3
"""Plot fixed-holdout validation for the ten selected calendar RL candidates."""
from pathlib import Path
import matplotlib.pyplot as plt
import pandas as pd
ARTIFACTS = Path(__file__).resolve().parent
INPUT = ARTIFACTS / "top-ten-checkpoint-fixed-validation.csv"
OUTPUT_PNG = ARTIFACTS / "top-ten-checkpoint-fixed-validation.png"
OUTPUT_SVG = ARTIFACTS / "top-ten-checkpoint-fixed-validation.svg"
LABELS = {
"q3c-rl-calendar-if-v47-r6": "Historical R6 (v2 train verifier)",
"q3c-rl-calendar-if-v49-nodapo-lr2-r1": "RLOO, LR 2e-6",
"q3c-rl-calendar-if-v49-nodapo-lr4-r1": "RLOO, LR 4e-6",
"q3c-rl-calendar-if-v49-dapo-b32-r1": "DAPO, batch 32",
"q3c-rl-calendar-if-v49-rloo-entropy3e3-stale0-lr1-r1": "RLOO, entropy 0.003, LR 1e-6",
"q3c-rl-calendar-if-v49-rloo-entropy3e5-lr2-g16-constdenom-warmup4-r1": (
"RLOO, constant denominator, group 16"
),
"q3c-rl-calendar-agent-v49-sync-r5": "Synchronous RLOO",
"q3c-rl-calendar-agent-v49-shaped-nodapo-lr2-r1": "Shaped RLOO, LR 2e-6",
"q3c-rl-calendar-agent-v49-shaped-nodapo-lr4-r1": "Shaped RLOO, LR 4e-6",
"q3c-rl-calendar-agent-v49-shaped-rloo-entropy3e3-stale0-lr1-r1": (
"Shaped RLOO, entropy 0.003, LR 1e-6"
),
"q3c-rl-calendar-agent-v49-shaped-rloo-entropy3e5-lr2-g16-constdenom-warmup4-r1": (
"Shaped RLOO, constant denominator, group 16"
),
}
def main() -> None:
frame = pd.read_csv(INPUT)
figure, axes = plt.subplots(1, 2, figsize=(18, 11), sharey=True)
colors = plt.get_cmap("tab10").colors
for axis, dataset, title in zip(
axes,
("instruction-following", "agent"),
("Instruction-following calendar", "Agent calendar"),
strict=True,
):
subset = frame[frame["dataset"] == dataset]
base = subset[subset["source_job"] == "Qwen/Qwen3-Coder-30B-A3B-Instruct"].iloc[0]
axis.axhline(
base["val_avg_score"],
color="#5f6368",
linestyle=(0, (5, 3)),
linewidth=2,
label=f"Base model ({base['val_avg_score']:.3f})",
)
jobs = [job for job in subset["source_job"].drop_duplicates() if job != base["source_job"]]
for index, job in enumerate(jobs):
series = subset[subset["source_job"] == job].sort_values("checkpoint_step")
historical = job == "q3c-rl-calendar-if-v47-r6"
color = "#8a8a8a" if historical else colors[index % len(colors)]
line_style = ":" if historical else "-"
axis.plot(
series["checkpoint_step"],
series["val_avg_score"],
marker="o",
markersize=6,
linewidth=2.5,
linestyle=line_style,
color=color,
label=LABELS[job],
)
peak = series.loc[series["val_avg_score"].idxmax()]
axis.scatter(
[peak["checkpoint_step"]],
[peak["val_avg_score"]],
marker="D",
s=90,
color=color,
edgecolor="white",
linewidth=1.2,
zorder=4,
)
axis.set_title(title, fontsize=20, fontweight="bold", pad=14)
axis.set_xlabel("Checkpoint step", fontsize=15)
axis.set_xticks(sorted(subset["checkpoint_step"].unique()))
axis.set_xlim(-0.6, subset["checkpoint_step"].max() + 0.8)
axis.set_ylim(0, 0.52)
axis.grid(True, alpha=0.25)
axis.legend(loc="upper center", bbox_to_anchor=(0.5, -0.15), frameon=False, fontsize=11, ncol=2)
axes[0].set_ylabel("Fixed-holdout mean reward", fontsize=15)
figure.suptitle("Qwen3-Coder calendar RL checkpoint validation", fontsize=25, fontweight="bold", y=0.98)
figure.text(
0.5,
0.935,
"Seed-42, 128-task holdouts, temperature 0. All RL candidates trained on sources containing the later holdout; R6 also used the older v2 verifier.",
ha="center",
fontsize=14,
color="#4f4f4f",
)
figure.text(0.5, 0.055, "Diamonds mark each curve's peak.", ha="center", fontsize=12, color="#4f4f4f")
figure.subplots_adjust(top=0.86, bottom=0.27, left=0.08, right=0.98, wspace=0.10)
figure.savefig(OUTPUT_PNG, dpi=180)
figure.savefig(OUTPUT_SVG)
if __name__ == "__main__":
main()