LMCache turns KV cache into shared infrastructure so agents stop repaying prefill

LMCache is an open Apache-2.0 KV cache layer for vLLM and SGLang that offloads and reuses prefixes across queries and engines. Reports cite up to 15x throughput and 3–10x TTFT wins on agentic workloads.

SaifullahSaifullah
4 min read
LMCache turns KV cache into shared infrastructure so agents stop repaying prefill

Agent turn 30 should not recompute turn 1's system prompt. Yet that is what happens when every vLLM replica keeps its own KV cache and your router sends the next tool result to a cold pod.

LMCache is the open-source layer Alpha Signal flagged for 10x-class inference wins. It is not a new foundation model. It is infrastructure that treats KV cache like reusable data, not disposable GPU state.

LMCache paper (arXiv:2510.09665)

The problem in one agent trace

I wrote about a similar pain in vLLM + Mooncake for distributed KV: coding agents drag huge prefixes turn after turn. vLLM's own Mooncake blog cited median ~33 turns and context near 80K tokens by turn 30 on SWE-style traces, with input:output ratios around 131:1.

Most of each request is prefix you already paid to prefill.

SymptomRoot cause
TTFT spikes on later agent turnsPrefix recomputed on a new replica
GPU memory fullKV evicted locally, no shared pool
Linear cost scalingEvery pod repeats the same prefill work

Single-instance prefix caching helps one process. Production agents hit many replicas. That gap is where LMCache lives.

Diagram comparing isolated per-pod KV cache versus LMCache shared tier across vLLM replicas

What LMCache actually does

LMCache sits beside inference engines (vLLM, SGLang, and others) as a KV cache connector:

  1. Extract KV blocks from GPU memory after prefill.
  2. Store them in tiered backends: CPU DRAM, local SSD, Redis, S3, RDMA paths.
  3. Lookup hashed prefixes on later requests, even on different engine instances.
  4. Orchestrate with control APIs: pin, cleanup, move, compress.

The project describes the shift as turning cache from temporary state into AI-native knowledge you can monitor and reuse. Marketing words aside, the engineering is offload + share.

LMCache is vendor-neutral Apache 2.0. That matters if you want to swap serving engines without throwing away cached prefixes.

LMCache on GitHub

Reported numbers (and how to read them)

The research paper and ecosystem blogs cite wide ranges because hit rate is everything:

MetricReported rangeWorkload notes
ThroughputUp to 15x vs baseline vLLMMulti-round QA, document analysis
TTFT3–10x reductionLong shared prefixes, cross-instance hits
Cache capacity100x more KV vs single GPUTiered CPU / disk / remote backends

Those are not guaranteed SaaS SLAs. They are what teams see when prefixes repeat and backends are wired correctly.

If your prompts change every turn, LMCache will not save you. If your agent constitution is stable and tool output appends at the end, LMCache can feel like free money.

Soft Paper flowchart of LMCache extract-store-lookup cycle for agent prefill reuse

LMCache vs Mooncake (both are in my stack notes)

This repo already has a Mooncake Store + vLLM post. They overlap in goal, differ in origin:

LayerFocus
Mooncake StoreDeep vLLM integration, RDMA-heavy clusters, agent traces with vLLM's connector story
LMCacheVendor-neutral connector, broad engine support, enterprise tiered storage story

You might run one or both depending on cloud, RDMA, and engine choice. The shared lesson: agent serving is a distributed systems problem.

When I recommend LMCache to clients

LMCache rises to the top of the checklist when:

  1. Multi-turn agents (coding, support, ops) with stable system prompts.
  2. Multiple vLLM replicas behind a naive load balancer.
  3. RAG with repeated document prefixes across users.
  4. Cost pressure on prefill-heavy models (long context + tools).

Skip it (for now) when:

  • Traffic is mostly single-turn chat.
  • Prompts are unique every request.
  • You have not fixed prompt stability yet (cache-unfriendly edits).

Prompt habits that make cache hit rates jump

Same table I give after Mooncake reviews:

HabitEffect
Byte-stable system prompt and tool schemasHigher prefix hash match rate
Append volatile tool output at endAvoid invalidating entire prefix
Pin hot documents with LMCache control APIsRepeat RAG corpora stay warm
Namespace caches per tenantPrevent cross-customer leakage

Security note: shared KV pools need tenant isolation in multi-tenant products. LMCache exposes orchestration hooks; your app still owns auth boundaries.

Where to start reading

# Pseudocode: your engine-specific flags differ; read LMCache docs for vLLM/SGLang export LMCACHE_CONFIG_PATH=lmcache_config.yaml vllm serve your-model \ --kv-transfer-config '{"kv_connector":"LMCacheConnector", ...}'

Treat the snippet as orientation, not copy-paste config. Connectors evolve quickly.

Bottom line for applied AI teams

LMCache will not fix a bad agent design. It will punish teams that already run long-horizon agents on multiple vLLM pods without shared KV.

Alpha Signal's digest framed it as a 10x inference story. The honest version: 10x when your prefixes repeat and your backends match your traffic. That condition is true for more production agents every month.

If you want help profiling prefix hit rates on your agent traces before you add LMCache or Mooncake, book a free discovery call.

Share this post

Related posts