Download plot_dapo_min_five_steps.py from penfever/qwen3coder-iris-rl-data-sweep-artifacts: direct link, hf CLI and curl.
- Browser
- Download file 3.25 kB
-
https://huggingface.co/datasets/penfever/qwen3coder-iris-rl-data-sweep-artifacts/resolve/main/plot_dapo_min_five_steps.py
- Command line
-
hf download hf://datasets/penfever/qwen3coder-iris-rl-data-sweep-artifacts/plot_dapo_min_five_steps.py
-
curl -L -o plot_dapo_min_five_steps.py https://huggingface.co/datasets/penfever/qwen3coder-iris-rl-data-sweep-artifacts/resolve/main/plot_dapo_min_five_steps.py
3.25 kB
| #!/usr/bin/env python3 | |
| """Render DAPO reward curves with at least five recorded steps.""" | |
| from pathlib import Path | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| ARTIFACTS = Path(__file__).resolve().parent | |
| INPUT = ARTIFACTS / "top-five-v49-dapo-real-reward.csv" | |
| OUTPUT_STEM = ARTIFACTS / "top-five-v49-dapo-real-reward" | |
| def display_label(job: str) -> str: | |
| if "if-v49-dapo-b32" in job: | |
| return "DAPO, batch 32" | |
| if "agent-v49-sync-r5" in job: | |
| return "DAPO, batch 64, zero staleness" | |
| raise ValueError(f"No concise display label defined for {job}") | |
| def main() -> None: | |
| frame = pd.read_csv(INPUT) | |
| eligible = ( | |
| frame.groupby(["dataset", "job"], as_index=False) | |
| .agg(step_count=("step", "nunique")) | |
| .query("step_count >= 5") | |
| ) | |
| frame = frame.merge(eligible[["dataset", "job"]], on=["dataset", "job"], how="inner") | |
| frame["label"] = frame["job"].map(display_label) | |
| frame.to_csv(INPUT, index=False) | |
| plt.rcParams.update( | |
| { | |
| "font.family": "DejaVu Sans", | |
| "font.size": 12, | |
| "axes.titlesize": 18, | |
| "axes.titleweight": "bold", | |
| "axes.labelsize": 13, | |
| "legend.fontsize": 10.5, | |
| } | |
| ) | |
| fig, axes = plt.subplots(1, 2, figsize=(15.5, 11.5), sharey=True) | |
| for ax, dataset in zip(axes, ("Instruction-following", "Agent"), strict=True): | |
| panel = frame[frame["dataset"] == dataset] | |
| for row in panel[["job", "label"]].drop_duplicates().itertuples(index=False): | |
| series = panel[panel["job"] == row.job].sort_values("step") | |
| peak = series.loc[series["real_reward"].idxmax()] | |
| ax.plot( | |
| series["step"], | |
| series["real_reward"], | |
| color="#0072B2", | |
| marker="o", | |
| markersize=5, | |
| linewidth=2.3, | |
| label=f"{row.label} (peak {peak['real_reward']:.3f})", | |
| zorder=3, | |
| ) | |
| ax.scatter( | |
| [peak["step"]], | |
| [peak["real_reward"]], | |
| marker="D", | |
| s=62, | |
| color="#0072B2", | |
| edgecolor="white", | |
| linewidth=0.8, | |
| zorder=4, | |
| ) | |
| ax.set_title(dataset, pad=12) | |
| ax.set_xlabel("Training step") | |
| ax.set_xlim(0.65, max(7.35, float(panel["step"].max()) + 0.35)) | |
| ax.set_ylim(0, 0.82) | |
| ax.grid(True, color="#CFD5DC", linewidth=0.7, alpha=0.65) | |
| ax.set_axisbelow(True) | |
| ax.legend(loc="upper center", bbox_to_anchor=(0.5, -0.13), frameon=False) | |
| axes[0].set_ylabel("Verifier outcome reward") | |
| fig.suptitle("v4.9 DAPO runs with at least five steps", fontsize=21, fontweight="bold", y=0.98) | |
| fig.text( | |
| 0.5, | |
| 0.935, | |
| "Admission-conditioned reward over mixed groups; not an unbiased policy-evaluation score.", | |
| ha="center", | |
| fontsize=13, | |
| color="#444444", | |
| ) | |
| fig.tight_layout(rect=(0, 0.12, 1, 0.90), w_pad=3.0) | |
| fig.savefig(OUTPUT_STEM.with_suffix(".png"), dpi=180, bbox_inches="tight") | |
| fig.savefig(OUTPUT_STEM.with_suffix(".svg"), bbox_inches="tight") | |
| if __name__ == "__main__": | |
| main() | |