LMCache

Framework · Text & code

A cache layer for language model servers that stores attention key-value data in RAM or on disk, so repeated prompts are answered without recomputing.

Latest · Oct 13After a vLLM restart, LMCache kept 141 ms with 99.9% hits; vLLM prefix cache and CPU offload fell back to about 1.35 s.

AccessOpen codeLicenseApache 2.0

Seen running on

MachineSpeedHowSeen by
3 runs on 748 GB
DGX Stationno speed givenAlex Ziskind · Oct 13
DGX Stationno speed givenAlex Ziskind · Oct 13
DGX Stationno speed givenAlex Ziskind · Oct 13

Evidence

  1. Oct 13
    Described as a cache layer for vLLM that stores KV notes in a separate server, in RAM and sometimes on NVMe.
    Hands-on testAlex Ziskind
  2. Oct 13
    With 16 clients (about 144 concurrent requests): no cache 187 s, vLLM GPU prefix cache 107 s, vLLM CPU offload 69 s; LMCache about tied with offload.
    Hands-on testAlex Ziskind
  3. Oct 13
    After vLLM died, LMCache held about 89 GB of GPU memory for 2 minutes, crashing the new vLLM; restart took 277 s versus about 150 s.
    Hands-on testAlex Ziskind
  4. Oct 13
    The memory-release wait setting has a 30-second minimum (6 s refused); at 30 s, restart took 173 s, still 20-30 s slower than plain vLLM.
    Hands-on testAlex Ziskind
  5. Oct 13
    With only 40 GB RAM plus NVMe, LMCache served about 265 ms, and still 265 ms after restart by reading the cache from disk; RAM only gave about 1.4 s, all misses.
    Hands-on testAlex Ziskind
Show all 11
  1. Oct 13
    CacheBlend, reusing document chunks in shuffled order (under 5% cache hits when shuffled), could not be tested because one mode has no vLLM support yet.
    Hands-on testAlex Ziskind
  2. Oct 13
    With DeepSeek V4 Flash after a restart, 16 documents took 5.7 s with LMCache versus 13.8 s with vLLM's cache.
    Hands-on testAlex Ziskind
  3. Oct 13
    With Qwen Flash Next after restart, the 16-document round took 12.3 s with LMCache versus 27.4 s with vLLM.
    Hands-on testAlex Ziskind
  4. Oct 13
    After a vLLM restart at turn 16, vLLM's cache took 9.5 s while LMCache took 1.1 s, reusing almost 60,000 tokens.
    Hands-on testAlex Ziskind
  5. Oct 13
    A 30-turn session took about 350 s uncached, 65 s with vLLM cache and 55 s with LMCache; counting restart (88 s vs 58 s) LMCache ends about 20 s behind.
    Hands-on testAlex Ziskind
  6. Oct 13
    Recommends keeping vLLM prefix caching on; use vLLM CPU offload if it fits RAM; use LMCache for restarts or caches larger than RAM, at the cost of more moving parts.
    Hands-on testAlex Ziskind

Everything said about LMCache, on the wire

Alternatives

vLLMWith CPU RAM spill on 48 documents, vLLM's own offload took 164 ms (99.9% hits) and LMCache 140 ms, almost the same.
Works with