Record rate-limit waits in benchmark runs, and leave them out of time
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m17s

The client waits RATE_LIMIT_RETRY_S and retries once on a 429, silently.
A benchmark run that waited looked slower than the model is: on
2026-09-27, fast models under the unit-test key's 200k tokens/minute
limit had 20-45 s runs that were probably waits.

Both clients now report last_rate_limit_wait_s after every call, even
one that then fails. The benchmark sums it per run into
rate_limit_wait_s, the report's time column leaves it out, and a new
429 column counts the runs that waited. Results stored before this
load unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongarandClaude Opus 5.5 committed 2026-09-27 20:57:15 +00:00
1 parent a716d5ec8d
commit 4e45dfe06a
6 files changed
+116 -9

No files matched your search

+15 -4
View File
@@ -60,9 +60,10 @@ class Row:
runs: int
successes: int
median_turns: float
mean_wall_s: float
mean_wall_s: float # working time: rate-limit waits are left out
cost_per_run: float
stale: bool
rate_limited: int = 0 # runs that waited out the proxy's rate limit
@property
def interval(self) -> tuple[float, float]:
@@ -86,9 +87,12 @@ def summarise(
runs=len(runs),
successes=sum(1 for r in runs if r["success"]),
median_turns=statistics.median(r["turns"] for r in runs),
mean_wall_s=statistics.fmean(r["wall_s"] for r in runs),
mean_wall_s=statistics.fmean(
r["wall_s"] - r.get("rate_limit_wait_s", 0.0) for r in runs
),
cost_per_run=statistics.fmean(r["cost"] for r in runs),
stale=current_hashes.get(task) != task_hash,
rate_limited=sum(1 for r in runs if r.get("rate_limit_wait_s")),
)
)
return rows
@@ -97,7 +101,7 @@ def summarise(
def render(rows: list[Row]) -> str:
header = (
f"{'model':<34} {'note':<22} {'task':<15} {'success':>8} {'95% CI':>11} "
f"{'turns':>6} {'time':>7} {'$/run':>8}"
f"{'turns':>6} {'time':>7} {'$/run':>8} {'429':>4}"
)
lines = [header, "-" * len(header)]
for row in rows:
@@ -106,7 +110,14 @@ def render(rows: list[Row]) -> str:
lines.append(
f"{row.model[:34]:<34} {row.note[:22]:<22} {task[:15]:<15} "
f"{row.successes:>3}/{row.runs:<4} {low:>4.0%}-{high:<5.0%} "
f"{row.median_turns:>6.0f} {row.mean_wall_s:>6.0f}s {row.cost_per_run:>8.4f}"
f"{row.median_turns:>6.0f} {row.mean_wall_s:>6.0f}s {row.cost_per_run:>8.4f} "
f"{row.rate_limited or '':>4}"
)
if any(row.rate_limited for row in rows):
lines.append("")
lines.append(
"429 = runs that waited out the proxy's rate limit; time leaves the "
"waits out."
)
if any(row.stale for row in rows):
lines.append("")