KV Cache Architecture

The KV cache is service state governing routing, isolation, reuse, and recovery—not merely a memory optimization.

Design block lifecycle, prefix reuse, tiered storage, eviction, and tenant boundaries around the workload.

01

Problem definition

As context and concurrency grow, cache fragmentation and eviction can bottleneck before compute.

Routing for reuse may worsen tenant isolation and tail latency.

  • Long prefixes or system prompts repeat across requests
  • Memory pressure and recomputation are material under long-context concurrency
  • Requests are mostly short and non-repeating
  • Cache keys and tenant isolation policy cannot be defined
02

KV Cache Architecture: system plate

  1. 01

    State 1

    Trace per-request cache occupancy, prefix duplication, and lifetime distributions.

  2. 02

    State 2

    Define an explicit lifecycle for block allocation, reference, replication, eviction, and recovery.

  3. 03

    State 3

    Measure bandwidth and recomputation break-even points across GPU, host, and remote tiers.

  4. 04

    State 4

    Validate isolation with failures including cache poisoning and cross-tenant leakage.

FEEDBACKFailed acceptance returns evidence to the first controlled stage: Prefix hit rate and recompute reduction.

A decision and validation view for KV Cache Architecture; labels describe architecture, not a measured deployment result.
  1. The workflow begins with Trace per-request cache occupancy, prefix duplication, and lifetime distributions..
  2. It reaches an acceptance decision through Prefix hit rate and recompute reduction.

03

Design method

The KV cache is service state governing routing, isolation, reuse, and recovery—not merely a memory optimization.

  1. 01

    Stage 1

    Trace per-request cache occupancy, prefix duplication, and lifetime distributions.

  2. 02

    Stage 2

    Define an explicit lifecycle for block allocation, reference, replication, eviction, and recovery.

  3. 03

    Stage 3

    Measure bandwidth and recomputation break-even points across GPU, host, and remote tiers.

  4. 04

    Stage 4

    Validate isolation with failures including cache poisoning and cross-tenant leakage.

04

Application scenarios

Hypothetical application scenario

Long prefixes or system prompts repeat across requests

As context and concurrency grow, cache fragmentation and eviction can bottleneck before compute.

APPROACH
Trace per-request cache occupancy, prefix duplication, and lifetime distributions.
BOUNDARY
A higher hit rate does not always mean lower end-to-end latency.
Hypothetical application scenario

Memory pressure and recomputation are material under long-context concurrency

Routing for reuse may worsen tenant isolation and tail latency.

APPROACH
Define an explicit lifecycle for block allocation, reference, replication, eviction, and recovery.
BOUNDARY
Sensitive prefixes prioritize isolation over reuse.

05

Design choices

DecisionGainCostWatch
Long prefixes or system prompts repeat across requestsTrace per-request cache occupancy, prefix duplication, and lifetime distributions.A higher hit rate does not always mean lower end-to-end latency.Prefix hit rate and recompute reduction
Memory pressure and recomputation are material under long-context concurrencyDefine an explicit lifecycle for block allocation, reference, replication, eviction, and recovery.Sensitive prefixes prioritize isolation over reuse.Cache occupancy, eviction, and fragmentation
06

KV Cache Architecture: system plate

Client boundaryLong prefixes or system prompts repeat across requests
  • As context and concurrency grow, cache fragmentation and eviction can bottleneck before compute.
  • A higher hit rate does not always mean lower end-to-end latency.
PattyTrace per-request cache occupancy, prefix duplication, and lifetime distributions.
  • Define an explicit lifecycle for block allocation, reference, replication, eviction, and recovery.
  • Prefix hit rate and recompute reduction
AcceptanceCache occupancy, eviction, and fragmentation
  • Tail latency and isolation
  • Sensitive prefixes prioritize isolation over reuse.
A decision and validation view for KV Cache Architecture; labels describe architecture, not a measured deployment result.
  1. The workflow begins with Trace per-request cache occupancy, prefix duplication, and lifetime distributions..
  2. It reaches an acceptance decision through Prefix hit rate and recompute reduction.

07

Validation plan

MeasureMethodPass conditionCaveat
Prefix hit rate and recompute reductionTrace per-request cache occupancy, prefix duplication, and lifetime distributions.Repeated runs satisfy the acceptance threshold agreed during discoveryA higher hit rate does not always mean lower end-to-end latency.
Cache occupancy, eviction, and fragmentationDefine an explicit lifecycle for block allocation, reference, replication, eviction, and recovery.Repeated runs satisfy the acceptance threshold agreed during discovery—
Tail latency and isolationMeasure bandwidth and recomputation break-even points across GPU, host, and remote tiers.Repeated runs satisfy the acceptance threshold agreed during discovery—

08

Constraints and failure conditions

Requests are mostly short and non-repeating

A higher hit rate does not always mean lower end-to-end latency.

Cache keys and tenant isolation policy cannot be defined

Sensitive prefixes prioritize isolation over reuse.

10

Durable deliverables

KV Cache Architecture decision record
The KV cache is service state governing routing, isolation, reuse, and recovery—not merely a memory optimization.Client-owned · Patty-reviewed
Validation harness and acceptance criteria
Prefix hit rate and recompute reduction · Cache occupancy, eviction, and fragmentation · Tail latency and isolationJointly maintained
Operations and recovery runbook
A higher hit rate does not always mean lower end-to-end latency. · Sensitive prefixes prioritize isolation over reuse.Operating-team owned

11

Terminology

KV Cache Architecture
Design block lifecycle, prefix reuse, tiered storage, eviction, and tenant boundaries around the workload.
Acceptance criterion
Prefix hit rate and recompute reduction
Operating boundary
A higher hit rate does not always mean lower end-to-end latency.

REFERENCES

References and primary material

  1. PagedAttention

    Primary material for the method and terminology.

  2. vLLM Automatic Prefix Caching

    Primary material for the method and terminology.