Buckets:
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = ["matplotlib==3.10.8"] | |
| # /// | |
| """Plot the frozen comparison results as lines.""" | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| import matplotlib | |
| matplotlib.use("Agg") | |
| import matplotlib.pyplot as plt | |
| OUTPUT = Path(__file__).resolve().parent / "plots" | |
| def main(): | |
| data = json.loads((OUTPUT / "plot_data.json").read_text()) | |
| scores = {(r["model"], r["task"]): r["ndcg@10"] for r in data["results"]} | |
| tasks = ["dense", "multivector", "reranker"] | |
| models = [ | |
| ("modernbert-base", "ModernBERT-base (150M)", "tab:blue", "--", "o"), | |
| ("ettin-encoder-150m", "Ettin (150M)", "tab:green", "--", "o"), | |
| ("ultrabert-150m", "UltraBERT (150M)", "tab:orange", "--", "o"), | |
| ("modernbert-large", "ModernBERT-large (395M)", "tab:blue", "-", "s"), | |
| ("ettin-encoder-400m", "Ettin (400M)", "tab:green", "-", "s"), | |
| ("ultrabert-380m", "UltraBERT (380M)", "tab:orange", "-", "s"), | |
| ] | |
| plt.rcParams.update({"font.size": 11, "svg.fonttype": "none", "pdf.fonttype": 42}) | |
| fig, ax = plt.subplots(figsize=(10, 6)) | |
| for model, label, color, style, marker in models: | |
| ax.plot( | |
| range(3), | |
| [scores[model, task] for task in tasks], | |
| label=label, | |
| color=color, | |
| linestyle=style, | |
| marker=marker, | |
| linewidth=2, | |
| markersize=6, | |
| ) | |
| ax.set_title("Encoder comparison after matched fine-tuning", pad=14) | |
| ax.set_xticks(range(3), ["Dense", "Multi-Vector", "Reranker"]) | |
| ax.set_xlabel("Fine-tuning recipe") | |
| ax.set_ylabel("Mean nDCG@10 (NanoNQ, NanoFiQA2018, NanoSciFact)") | |
| ax.set_ylim(0.48, 0.70) | |
| ax.set_xlim(-0.12, 2.12) | |
| ax.legend(loc="lower right", frameon=False, fontsize=10) | |
| fig.tight_layout() | |
| for extension in ("png", "svg", "pdf"): | |
| path = OUTPUT / f"encoder_comparison_lines.{extension}" | |
| fig.savefig(path, dpi=200, facecolor="white") | |
| print(path) | |
| plt.close(fig) | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 2.09 kB
- Xet hash:
- 54ecb0561fb5937a9c3880876b2e937db547bc15a3ffe8e582c0e62ff060428a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.