Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/images/speed_vs_ndcg_cold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/speed_vs_ndcg_warm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Quality and speed across all methods.
| BM25 | 0.673 | 263 ms | 0.02 ms |
| ripgrep | 0.126 | — | 12 ms |

| ![Speed vs quality (cold)](results/speed_vs_ndcg_cold.png) | ![Speed vs quality (warm)](results/speed_vs_ndcg_warm.png) |
| ![Speed vs quality (cold)](../assets/images/speed_vs_ndcg_cold.png) | ![Speed vs quality (warm)](../assets/images/speed_vs_ndcg_warm.png) |
|:--:|:--:|
| *Time to first result (index + query) vs NDCG@10* | *Query latency on a warm index vs NDCG@10* |

Expand Down Expand Up @@ -197,6 +197,6 @@ uv run python -m benchmarks.baselines.coderankembed --mode semantic
uv run python -m benchmarks.plot
```

Writes `speed_vs_ndcg_cold.png` and `speed_vs_ndcg_warm.png` to `benchmarks/results/`.
Writes `speed_vs_ndcg_cold.png` and `speed_vs_ndcg_warm.png` to `assets/images/`.

</details>
8 changes: 5 additions & 3 deletions benchmarks/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def _format_ms(v: float, _: object) -> str:


def _make_plot(out_path: Path, *, warm: bool = False) -> None:
"""Generate a speed-vs-quality scatter plot.
"""
Generate a speed-vs-quality scatter plot.

:param out_path: Destination PNG path.
:param warm: If True, use per-query latency (index pre-built). If False, use index + query latency.
Expand Down Expand Up @@ -176,14 +177,15 @@ def _make_plot(out_path: Path, *, warm: bool = False) -> None:
ax.set_ylabel("NDCG@10", fontsize=10, color="#444444")
ax.set_ylim(0.05, 0.95)

ax.set_xlabel("Query latency", fontsize=10, color="#444444")
if warm:
ax.set_xlabel("Query latency (warm)", fontsize=10, color="#444444")
ax.set_xlim(0.01, 500)
ax.set_xticks([0.1, 1, 10, 100])
ax.set_title("Code search quality vs. latency (warm)", fontsize=12, color="#222222", pad=12)
else:
ax.set_xlabel("Query latency (cold)", fontsize=10, color="#444444")
ax.set_xlim(5, 200_000)
ax.set_xticks([100, 1_000, 10_000, 100_000])
ax.set_title("Code search quality vs. latency (cold)", fontsize=12, color="#222222", pad=12)

ax.xaxis.set_major_formatter(ticker.FuncFormatter(_format_ms))
ax.tick_params(labelsize=9, colors="#555555")
Expand Down
Loading