The Convexity Law of Prefix Caching: The Price of Prefix-Closure, Throughput-Tail-Latency Tradeoffs, and Competitive Eviction

In LLM prefix caching, recomputing a missing KV block at depth d incurs prefill cost c(d) = alpha + beta*d: cumulative prefix cost F(s) = alpha*s + (beta/2)*s^2 is strictly convex in s, making missing-suffix recomputation F(L) - F(s) strictly concave in s and evicted tail length x = L - s. Governed by rho(L) = beta*L/(2*alpha), this duality raises a core question: even for an omniscient offline oracle, how much unavoidable recomputation does prefix-closure impose? First, we prove a tight Offline-Optimal Price of Prefix-Closure (Theorem 1): prefix-closure is free at beta = 0 (OPT_PC = OPT_GT), yet incurs a tight Theta(1 + rho(L)) worst-case penalty for beta > 0, lower-bounded by 1 + beta*(L - 1)/(2*alpha) (within epsilon from empty cache, exact from shared warmed state) and upper-bounded by OPT_PC <= (1 + beta*(L_max - 1)/alpha)*OPT_GT. Second, for disjoint trajectories we prove a Concave-Tail Conservation Law (Theorem 2): uniform tail eviction minimizes maximum first-return cost C_max while maximizing aggregate compute (up to (2 - 1/m)x LRU as rho -> infinity), whereas gap-tolerant head eviction reverses both to (1/m)x compute and (1/m^2)x C_max as rho -> infinity. Third, we prove an explicit k/2 + (beta/(4*alpha))*k*(k - 2) competitive lower bound for Radix-LRU, Radix-RR, and pinned Gap-SIEVE (k >= 6, Theorem 3), and prove exact-min Adaptive-Prefix-Landlord (APL) is (M_max / r_min)*k-competitive under pinning and batch eviction (Theorem 4). Exact MILP sweeps, 1.26B real KV accesses, 20-seed true-CRN closed-loop queues, and RTX 5060 Qwen2.5-7B runs validate our bounds; both Gap-APL variants beat LRU in CSR across all six freeinference/chutes settings (full: +11.79 pp at 16k, -39.6% TurnP99 at 64k; no-ghost: +12.30 pp at 16k). v3 camera-ready & artifact-verified release (GitHub commit 65dbf08): replaces Lemma 1 with a complete two-pass single-block Belady reduction, aligns Theorem 1 warmup accounting (S_warm) and Figure 1a to 0.00% LB match (4.50x and 28.50x), restricts Gap-SIEVE in Theorem 3 to k >= 6, adds disjoint-KV assumption in Theorem 2, unifies exact Algorithm 1 across all experiments (Theorem 3 exact-min Gap-APL achieves 1.0x), implements true pre-generated-trace NHPP CRN closed-loop evaluation with exact (T - 1)Z Little's Law accounting, and ships complete clean-checkout reproducible artifacts. Code, exact MILP solver, simulators, header-only C++20 APL policy, and reproducible artifacts: https://github.com/OdeenChang/prefix-cache-convexity

Authors

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-12-02
DOI
https://doi.org/10.5281/zenodo.24739445
Primary Topic
Optimization and Search Problems
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

The Convexity Law of Prefix Caching: The Price of Prefix-Closure, Throughput-Tail-Latency Tradeoffs, and Competitive Eviction

Yuyang Zhang
Zenodo (CERN European Organization for Nuclear Research)
Optimization and Search Problems
preprint

The Convexity Law of Prefix Caching: The Price of Prefix-Closure, Throughput-Tail-Latency Tradeoffs, and Competitive Eviction

Yuyang Zhang
preprint en

Abstract

In LLM prefix caching, recomputing a missing KV block at depth d incurs prefill cost c(d) = alpha + beta*d: cumulative prefix cost F(s) = alpha*s + (beta/2)*s^2 is strictly convex in s, making missing-suffix recomputation F(L) - F(s) strictly concave in s and evicted tail length x = L - s. Governed by rho(L) = beta*L/(2*alpha), this duality raises a core question: even for an omniscient offline oracle, how much unavoidable recomputation does prefix-closure impose? First, we prove a tight Offline-Optimal Price of Prefix-Closure (Theorem 1): prefix-closure is free at beta = 0 (OPT_PC = OPT_GT), yet incurs a tight Theta(1 + rho(L)) worst-case penalty for beta > 0, lower-bounded by 1 + beta*(L - 1)/(2*alpha) (within epsilon from empty cache, exact from shared warmed state) and upper-bounded by OPT_PC <= (1 + beta*(L_max - 1)/alpha)*OPT_GT. Second, for disjoint trajectories we prove a Concave-Tail Conservation Law (Theorem 2): uniform tail eviction minimizes maximum first-return cost C_max while maximizing aggregate compute (up to (2 - 1/m)x LRU as rho -> infinity), whereas gap-tolerant head eviction reverses both to (1/m)x compute and (1/m^2)x C_max as rho -> infinity. Third, we prove an explicit k/2 + (beta/(4*alpha))*k*(k - 2) competitive lower bound for Radix-LRU, Radix-RR, and pinned Gap-SIEVE (k >= 6, Theorem 3), and prove exact-min Adaptive-Prefix-Landlord (APL) is (M_max / r_min)*k-competitive under pinning and batch eviction (Theorem 4). Exact MILP sweeps, 1.26B real KV accesses, 20-seed true-CRN closed-loop queues, and RTX 5060 Qwen2.5-7B runs validate our bounds; both Gap-APL variants beat LRU in CSR across all six freeinference/chutes settings (full: +11.79 pp at 16k, -39.6% TurnP99 at 64k; no-ghost: +12.30 pp at 16k). v3 camera-ready & artifact-verified release (GitHub commit 65dbf08): replaces Lemma 1 with a complete two-pass single-block Belady reduction, aligns Theorem 1 warmup accounting (S_warm) and Figure 1a to 0.00% LB match (4.50x and 28.50x), restricts Gap-SIEVE in Theorem 3 to k >= 6, adds disjoint-KV assumption in Theorem 2, unifies exact Algorithm 1 across all experiments (Theorem 3 exact-min Gap-APL achieves 1.0x), implements true pre-generated-trace NHPP CRN closed-loop evaluation with exact (T - 1)Z Little's Law accounting, and ships complete clean-checkout reproducible artifacts. Code, exact MILP solver, simulators, header-only C++20 APL policy, and reproducible artifacts: https://github.com/OdeenChang/prefix-cache-convexity

Zenodo (CERN European Organization for Nuclear Research)
Chengdu University of Technology (CN)
Optimization and Search Problems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon