A
Member
We ran a 1,200-request, 8-hour sample on a chat service with a 2,140-token system prompt and a shared prefix. The cache log said 62.3% hit rate. The token-level saving we could actually bill was 41.8%. The gap was not a rounding error, and it took three separate measurements to explain it.
1) Fix the accounting unit first. A request-level hit counts a 2-token continuation as a "hit" if the prefix matched; a token-level hit counts only tokens that were actually reused. On the same window: 62.3% of requests hit, 41.8% of prompt tokens reused. Report both, and state the denominator. Our first dashboard reported only the first number, and it overstated the saving by roughly 1.5×.
2) Measure the TTL decay curve, do not assume a flat hit rate. Bucketing by idle gap since the previous identical prefix: under 60 s 88% hit, 2–5 min 61%, 10 min and above 9%. Our traffic has a 4.7-minute median gap in the morning and a 40-second gap in the evening peak, so the same cache configuration read 71% at 09:00 and 34% at 21:00. A single daily average hides a 2× swing.
3) Freeze the template version and hash the prefix. 12% of requests in the window still carried the previous template, whose first 600 tokens differ. Those requests cannot hit, but they were counted in the denominator as "cache misses", which made the feature look worse than it was; after splitting by template hash, hit rate on the current template was 68.9% and on the old one 0%.
4) Check tenant isolation before you claim cross-tenant reuse. Ours blocks it by policy, so a naive "global hit rate" was 6 points higher than the hit rate any single tenant could experience.
Order matters: tag the prefix hash and template version at the layer that sees the final prompt, then bucket by idle gap, then split by tenant, and only then compute tokens saved. If you compute the saving first, you will spend a week reconciling it against the bill.
Two traps we hit: measuring at the edge gateway counts a per-user injected memory block as part of the prefix, producing false hits that were later rejected upstream; and counting cache writes as free, when a 2,140-token prefix write costs a prefill that a short request would not have paid.
Question: do you report prefix-cache benefit per request or per reused token, and how do you keep template drift from silently landing in the miss denominator?
1) Fix the accounting unit first. A request-level hit counts a 2-token continuation as a "hit" if the prefix matched; a token-level hit counts only tokens that were actually reused. On the same window: 62.3% of requests hit, 41.8% of prompt tokens reused. Report both, and state the denominator. Our first dashboard reported only the first number, and it overstated the saving by roughly 1.5×.
2) Measure the TTL decay curve, do not assume a flat hit rate. Bucketing by idle gap since the previous identical prefix: under 60 s 88% hit, 2–5 min 61%, 10 min and above 9%. Our traffic has a 4.7-minute median gap in the morning and a 40-second gap in the evening peak, so the same cache configuration read 71% at 09:00 and 34% at 21:00. A single daily average hides a 2× swing.
3) Freeze the template version and hash the prefix. 12% of requests in the window still carried the previous template, whose first 600 tokens differ. Those requests cannot hit, but they were counted in the denominator as "cache misses", which made the feature look worse than it was; after splitting by template hash, hit rate on the current template was 68.9% and on the old one 0%.
4) Check tenant isolation before you claim cross-tenant reuse. Ours blocks it by policy, so a naive "global hit rate" was 6 points higher than the hit rate any single tenant could experience.
Order matters: tag the prefix hash and template version at the layer that sees the final prompt, then bucket by idle gap, then split by tenant, and only then compute tokens saved. If you compute the saving first, you will spend a week reconciling it against the bill.
Two traps we hit: measuring at the edge gateway counts a per-user injected memory block as part of the prefix, producing false hits that were later rejected upstream; and counting cache writes as free, when a 2,140-token prefix write costs a prefill that a short request would not have paid.
Question: do you report prefix-cache benefit per request or per reused token, and how do you keep template drift from silently landing in the miss denominator?