vLLM KV connector for KVStash

The vllm-kvblockd package is a native vLLM KV connector. vLLM loads it with one flag, and it writes and reads KV-cache blocks in KVStash directly, with no LMCache in between.

Status
GPU-tested
Adapter
vllm-kvblockd
Interface
KV connector API (v1)
Tested on
vLLM 0.25.1, 0.27.1, 0.33.0
GPUs
L40S, A10G, A100, L4

Last updated

How KVStash connects to vLLM

vLLM lets an external package take part in KV-cache transfer through its connector API (KVConnectorBase_V1). The KVStash connector implements it, so vLLM itself is not modified.

vLLM serverone process per GPU server

  1. GPU Paged KV cache vLLM's own blocks in GPU memory
  2. Host Pinned host buffers Blocks read from KVStash land here, then copy to the GPU
  3. KV vllm-kvblockd KvblockdConnector, loaded with one vLLM flag
plain TCP batched, multi-stream

KVStash daemon

One store for every server. Survives engine restarts.

  • DRAMhot
  • NVMewarm
  • S3cold
FIGURE 1. The connector reads blocks over several TCP streams into pinned host memory, then copies them into vLLM's paged cache. Each vLLM server runs its own connector; all of them reach the same KVStash daemon.

The package has two entry points. Use the first.

  • KvblockdConnector implements the connector API and is set with one flag. It is GPU-tested and produced every vLLM number on this site.
  • KvblockdTierManager plugs into vLLM's tiered offloading (vLLM: tiered KV offloading). It is complete and tested against a real daemon on CPU; its GPU end-to-end test has not been run.
  • Checksums stay on. Each block carries an xxh3 checksum that is checked on read.

Configure vLLM to use KVStash

Install the connector next to vLLM, pin PYTHONHASHSEED, and pass the transfer config. These are the settings from our test runs.

Shell
pip install vllm-kvblockd       # into the Python environment vLLM runs in
export PYTHONHASHSEED=0   # required on every worker

vllm serve MODEL --kv-transfer-config '{
  "kv_connector": "KvblockdConnector",
  "kv_role": "kv_both",
  "kv_connector_module_path": "vllm_kvblockd.connector",
  "kv_connector_extra_config": {
    "kvblockd_endpoint": "kvblockd://STORE_HOST:9440",
    "kvblockd_namespace": "vllm",
    "kvblockd_token": "YOUR_TOKEN",
    "kvblockd_streams": 8,
    "kvblockd_get_fanout": 8
  }}'
Get the KVStash daemon from the install page.
SettingWhat it does
STORE_HOST:9440The KVStash daemon's address. Port 9440 is the data plane; keep it on a private network.
kvblockd_namespace, kvblockd_tokenThe namespace and bearer token the daemon has for this engine.
kvblockd_streams, kvblockd_get_fanoutTCP streams and parallel reads. 8 and 8 are the settings we measured.
PYTHONHASHSEED=0Makes block keys identical across workers and restarts. The connector refuses to start without it.

Check it is working

A transfer config that vLLM ignores fails quietly, so check each step. Daemon metrics are on its metrics port, loopback by default: curl 127.0.0.1:9442/metrics.

  1. Start vLLM. The log shows Creating v1 connector with name: KvblockdConnector. No line means vLLM ignored the transfer config.
  2. Send one long prompt. The daemon's kvb_bytes_total{dir="in"} rises.
  3. Restart the engine, not the daemon, and send the same prompt. kvb_hits_total rises and time to first token drops.

Measured results with vLLM

474 s→2.77 s

A 524k-token prompt, read back after a restart instead of recomputed

Time to first token in a new vLLM engine on a 524,231-token prompt, 145.6-194.2x faster than recomputing across 6 machines (medians shown). KVStash is for when vLLM's own prefix cache is gone; while the engine still holds the prompt, that cache is faster. The same five passkey answers before and after the reload, identical to vLLM's own cache, and 8,191 store hits (21.47 GB) on every timed request.

vLLM 0.25.1 with the KVStash native connector, GLM-4-9B-chat-1M (fp8 KV cache), one NVIDIA L40S per machine, store on the same host over TCP, 6 Modal machines, 4 Nov 2026. Median of 5 timed requests per machine. Study 2: method, raw data and checker

The first vLLM result, from July: one 131,072-token prefix, reloaded from KVStash into a freshly started vLLM engine, against recomputing it.

FIGURE 2. Time to first token in seconds, lower is better. One A10G, fp8 KV cache in both arms; full conditions under each result below.
  • 50.9x

    Faster time to first token on vLLM 0.25.1

    131,072-token prefix reloaded into a fresh vLLM engine in 1.63 s vs 82.9 s to recompute (50.9x).

    vLLM 0.25.1, Qwen2.5-7B-Instruct-1M (standard attention), fp8 KV cache in both arms, one A10G, store over loopback TCP, 30 Jul 2026. Answers: the first 8 generated tokens were identical on the 2 of 6 prompts with a clear top choice; the other 4 were near-ties (top two tokens within 2 nats), excluded by a rule set before the run, and the 2 compared prompts reached only 4 blocks deep. Correctness of the full prefix rests on per-block checksums and hit counts. The 524k study above checks answers at full depth.

  • 47.2x

    Faster time to first token on vLLM 0.27.1

    Same test on vLLM 0.27.1: 1.87 s vs 88.2 s (47.2x).

    vLLM 0.27.1, same model, fp8 KV, A10G. About 7% below the 0.25.1 result; 0.27 changed the KV cache memory layout and the connector was updated for it.

A separate lane from the SGLang study

Different engine, models (GLM-4-9B-chat-1M and Qwen2.5-7B-Instruct-1M), KV precision (fp8) and GPUs from the SGLang results, and one prompt reloaded rather than a serving load. Do not set the two side by side without their captions.

How the connector handles the vLLM 0.27 layout change

In vLLM 0.27, a configured KV connector receives the paged KV cache as a permuted view: the logical shape is (blocks, heads, block size, ...) while memory is ordered (blocks, block size, heads, ...). The connector's fast copy assumed flat rows, so every reload quietly dropped to a slow per-block path. CPU tests could not see it; a GPU run did.

vllm-kvblockd 0.1.2 on PyPI still takes that per-block path on vLLM 0.27 and newer: reloads are correct but slower. The stride-aware copy below ships in the next connector release.

  • Reads the real layout. The connector checks the tensor's sizes and strides, and when the cache is a plain permutation of contiguous memory it writes stride-aware into it, with one layout transform per chunk.
  • Keeps stored blocks valid. Blocks on the wire keep the same logical byte order, so blocks written under either layout read back under both.
  • Refuses loudly. A layout it cannot prove is logged and handled by the slower, correct per-block path.

Known limits

  • One GPU per engine. Tensor parallel above 1 is refused at start, because block keys do not yet carry the GPU rank.
  • Block size is part of the key. Blocks written with one --block-size are not hits at another. Change it only with a fresh namespace.
  • Performance is measured on vLLM 0.25.1 and 0.27.1, not the current release. On 0.33.0, the latest release as of November 2026, vllm-kvblockd 0.1.2 is checked end to end (store, restart, reload, same answer), not benchmarked. See how we track releases.
  • Prompt embeddings bypass the store. Requests sent with --enable-prompt-embeds are neither stored nor loaded: their embedding positions carry placeholder token ids, so two prompts with the same text and different embeddings would look identical.
  • The tier-manager entry point is not GPU-tested. Use KvblockdConnector.
  • Single-prompt reloads only. We have not published a vLLM serving load test or a multi-server test; those exist for SGLang.

vLLM integration FAQ

Do I need LMCache to use KVStash with vLLM?

No. vllm-kvblockd is a native vLLM KV connector: vLLM loads it directly through --kv-transfer-config and it talks to the KVStash daemon itself. A separate LMCache plugin exists, but it is not qualified on GPUs.

Which vLLM versions does the connector support?

vLLM 0.25.1, 0.27.1, 0.33.0 are GPU-tested (A10G, L40S, A100 and L4); the 524k study ran on 0.25.1 and the 131k results on 0.25.1 and 0.27.1, and 0.33.0, the latest release as of November 2026, is checked end to end with vllm-kvblockd 0.1.2, not benchmarked.

Does it work with tensor parallelism?

Not yet. The connector supports one GPU per engine (tensor parallel 1) and refuses to start on more, because block keys do not carry the GPU rank yet. Refusing is safer than loading one rank's KV shard into another.

Why must PYTHONHASHSEED be set?

Block keys are derived from hashes that must be identical across workers and engine restarts. With PYTHONHASHSEED unset, two engines would compute different keys for the same prompt and could not share blocks, so the connector refuses to start until it is pinned (use 0 on every worker).

What happens if the KVStash daemon is down or slow?

The connector is built to fail open: a daemon that is down, slow or returns a bad block becomes a cache miss and vLLM recomputes those tokens. It does not raise errors into vLLM's serving path.

Can I compare the vLLM numbers with the SGLang numbers?

No. The vLLM results reload one long prompt (524k tokens on GLM-4-9B-chat-1M on L40S, 131k tokens on Qwen2.5-7B-Instruct-1M on A10G) with an fp8 KV cache; the SGLang study uses a different engine, model, precision and serving load. Read each with its own caption.

Running vLLM with long, repeated prompts?

Tell us your vLLM version, model, GPUs and how often the same context comes back. We reply with what we would measure and when KVStash is not worth it.

Or write to rudray@kvstash.com