Skip to content

chore(bench): add --pad-entries to cache_hit_rate for threshold sweeps#33

Merged
engkimo merged 1 commit into
mainfrom
chore/cache-bench-pad-entries
May 15, 2026
Merged

chore(bench): add --pad-entries to cache_hit_rate for threshold sweeps#33
engkimo merged 1 commit into
mainfrom
chore/cache-bench-pad-entries

Conversation

@engkimo

@engkimo engkimo commented May 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add --pad-entries N flag to benchmarks/cache_hit_rate.py so the --verify-wiring pad size can be tuned independently of the default 160 entries (~8.4K tokens, ~50 tok/entry).
  • Used to binary-search Claude Haiku 4.5's empirical prompt-cache minimum.

Finding (TD-193 follow-up — Haiku 4.5 threshold pinned)

pad_entries prompt_tok result
60 3475 MISS
70 3965 MISS
72 4063 MISS
73 4112 MISS
74 4161 HIT
80 4455 HIT
100 5435 HIT
160 8375 HIT

Empirical Claude 4 cache minimums (this account):

  • Sonnet 4.6 ≈ 2048 tokens (2^11)
  • Haiku 4.5 ≈ 4096 tokens (2^12)

Both clean powers of 2; documented 1024-token minimum is wrong for both.

Test plan

  • ruff check benchmarks/cache_hit_rate.py — clean.
  • Live: 8 sweeps against real Anthropic API (claude-haiku-4-5-20251001); each --calls 3 --verify-wiring --pad-entries N. Results above.

🤖 Generated with Claude Code

Lets the verify-wiring pad size be tuned independently of the default
160 entries (~8.4K tokens). Used 2026-05-15 to binary-search Claude
Haiku 4.5's empirical cache minimum: 4112 tok = miss, 4161 tok = hit
→ threshold ≈ 4096 tokens (matches Sonnet 4.6's 2K boundary, both
clean powers of 2). Documented 1024-token minimum is wrong for
Claude 4 family.
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@engkimo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 53 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0a36c90b-23e6-49d3-8624-09b151f4e3ab

📥 Commits

Reviewing files that changed from the base of the PR and between 97f11a7 and f41a621.

📒 Files selected for processing (1)
  • benchmarks/cache_hit_rate.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/cache-bench-pad-entries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@engkimo engkimo merged commit 0662ce4 into main May 15, 2026
6 checks passed
@engkimo engkimo deleted the chore/cache-bench-pad-entries branch May 15, 2026 09:44
engkimo added a commit that referenced this pull request May 18, 2026
Covers 33 commits since v0.6.1:
- TD-194 Council Pilot full merge (#20) + 5 post-merge fix-ups (#22-#26)
- TD-189 steps 1-4: per-task cache_hit_rate plumbing (#27-#30)
- TD-192: fold OutputRequirementClassifier into FractalBypassClassifier (#31)
- Round 22 live latency regression — fractal-entry 2 → 1 LLM calls (#32)
- Haiku 4.5 cache threshold pinned at ~4096 tokens via --pad-entries (#33)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant