Skip to content
Opod

Endpoints

KV cache tiers

Host-memory, disk and auto-sized KV tiers below VRAM — the engine arguments, the memory and disk claims, the pruner, the auto loop, gangs, and why the peer tier is refused.

A KV tier keeps the blocks an engine evicts from the card in host memory, or on disk below that, and copies them back on a prefix hit instead of computing them again. This page is the detail behind the Tiers summary on the KV cache page.

A tier helps only a prefix that would be reused. It cannot fix a prompt whose first tokens change: see Prompt layout.

In short

A KV tier gives a worker extra cache in the machine's RAM, or on its disk, below the GPU. When the card must drop old prompt blocks, the tier keeps them, and the next request with the same prefix copies them back instead of computing them again. You set one field in the plan; the control plane writes the engine arguments, grows the pod's memory and claims that memory in the ledger. Every tier is proven on NVIDIA only.

When you need it

  • Many requests share a long prefix (RAG, agents, one long system prompt), and the card evicts it under load.
  • /kv/tier-advice reads advise for the endpoint.
  • Documents are re-read later on vLLM: a disk tier holds more than RAM can.
  • You do not know the right size: an auto tier sizes itself from measurement.

Do it

  1. Ask whether a tier would help

    Turn on plan.kvEvents: true (vLLM or SGLang, by a rollout), wait for traffic, then:

    curl -s -H "$H" https://cp.example.com/api/v1/endpoints/<id>/kv/tier-advice | jq .

    advise comes with a suggested size. none means a tier would serve under 5 %: stop here.

  2. Add the tier to the worker row

    workers:
      - { replicas: 2, engine: vllm, kvOffload: { tier: cpu, sizeGb: 8 } }

    Or { tier: disk, sizeGb: 8, diskGb: 200 } on vLLM with a pinned model.revision or model.version, or { tier: auto, maxGb: 16 }.

    In 0.3.0, the same from a terminal: opodcp endpoint kv --tier cpu --size-gb 8 chat, or opodcp endpoint kv --tier auto --size-gb 4 --max-gb 16 chat. The create form offers all four tiers under Advanced → KV cache tier.

  3. Preview, then roll it out

    Preview names the claim on each node and warns when the node's memory is unknown. Then post the plan to POST /api/v1/endpoints/{id}/rollouts. A tier changes engine arguments and pod memory, so it rides a rollout.

Check it worked

curl -s -H "$H" https://cp.example.com/api/v1/endpoints/<id>/kv | jq '.. | objects | select(has("tierHitPct")) | .tierHitPct'

A good answer is a tierHitPct above 0 once repeated prefixes arrive. An absent figure means the engine reports nothing about its tier; opodcp doctor says which worker. The Prometheus series opodcp_kv_tier_hit_tokens rises in step.

If it fails

CodeCauseFix
E-KV-RAMthe node's tiers pass kvOffload.maxNodePct of its memory, or tiers plus workers do not fit ita smaller sizeGb, a node with more memory, or a higher kvOffload.maxNodePct
E-DISKdiskGb does not fit the model-cache volume with 15 % kept freea smaller diskGb, or a node it names
E-KV-OFFLOADa vendor other than NVIDIA, a llama.cpp RPC gang, or tier: peer (with no store, or on a path not proven)NVIDIA, a vLLM gang, or cpu / disk
E-PD-TIERa tier on a vLLM prefill or decode halfremove the tier from that half
400: a tier argument in flags.extrathe tier was typed by handremove it and use kvOffload
400 on a disk tier with no pina disk tier needs model.revision or model.versionpin the model
An auto tier never resizesthe advice reads unknown: no kvEvents, or llama.cpp / TensorRT-LLMkvEvents: true on vLLM or SGLang, or a fixed cpu tier
prefix_index reads blocks: 0 on a vLLM worker with a tier and kvEventsthe worker's core is from before 0.3.0: the tier's own events failed every event batch, and its log says kv events: a batch could not be reada worker image from 0.3.0; until then, choose either the tier or block routing

The four tiers

TierPlan fieldWhat it is
cpuworkers[].kvOffload: {tier: cpu, sizeGb: 8}host memory per replica, in whole GiB
disk{tier: disk, sizeGb: 8, diskGb: 200}the CPU tier, with a disk tier of diskGb below it on the node's model-cache volume
auto{tier: auto, maxGb: 16}a CPU tier the control plane resizes from measurement, within maxGb
peer planned{tier: peer, sizeGb: 8}a CPU tier shared between the endpoint's workers through the kvstore connector (Valkey/Redis, or a shared volume from the release after 0.3.6); refused in 0.3.6; from the release after 0.3.6, vLLM on NVIDIA through a shared volume

A tier with no tier is cpu. sizeGb must be at least 1. diskGb is valid only with tier: disk.

The CPU tier

Each engine has its own host tier. The control plane renders it from sizeGb:

EngineWhat runsLazy fill
vLLM--kv-offloading-size <sizeGb> --kv-offloading-backend nativeyes: as blocks leave the card
SGLangHiCache: --enable-hierarchical-cache --hicache-write-policy write_through --hicache-size <sizeGb>not reported; it keeps 10 GiB of the pod's memory free before it allocates the pool
llama.cppthe host prompt cache, --cache-ram <sizeGb × 1024> MiB; without a tier --cache-ram 0yes: as slots are saved
TensorRT-LLMkv_cache_config.host_cache_size (bytes) with enable_block_reuse: true, in the engine's config filenot reported

You never type these arguments. A tier argument in flags.extra is refused: it would grow no /dev/shm and claim no memory, and the engine would die when it filled. A hand-typed --kv-transfer-config beside a tier is refused too, because the tier is the engine's KV connector and a second one would replace it.

How the pod changes. The engine maps the tier as a file in a memory-backed /dev/shm, so:

  • /dev/shm = the engine's own room (8 GiB for vLLM, SGLang and TensorRT-LLM) + sizeGb;
  • the memory limit grows by sizeGb (+ 10 GiB on SGLang);
  • the memory request is set equal to the limit, so the scheduler reserves the whole tier and the pod is evicted last, not first.

vLLM and llama.cpp fill their tier lazily, so the machine looks freer than it is until the tier is full. Preview says so.

Prefill and decode halves. On vLLM a worker with a role and a tier is refused E-PD-TIER: vLLM keeps one KV connector, and the tier would replace the transfer connector. On SGLang a decode half keeps HiCache natively. A tier on a prefill half is advised against: the decode pool holds the cache longer, so a tier helps there first.

The host-memory claim: E-KV-RAM

The tier is the one slice of host memory the ledger claims. After placement, on every node a tier lands on:

  1. Every endpoint's tiers on the node may take at most kvOffload.maxNodePct of the node's memory (chart value, default 50). Past it: E-KV-RAM.
  2. Every endpoint's tiers plus this plan's workers' own memory there (each worker's memory request, its /dev/shm, and SGLang's 10 GiB reserve) must fit the node's memory. Past it: E-KV-RAM.

A node that never reported its memory is not judged: Preview advises that a tier the machine cannot hold kills the engine when it fills. The placer chooses nodes by VRAM, not host memory, so the fix for E-KV-RAM is a smaller sizeGb, a node you name with more memory, or a higher kvOffload.maxNodePct.

helm upgrade opodcp … --reset-then-reuse-values --set kvOffload.maxNodePct=60

What a KV tier claims on the node

Host memory per node: workers, their /dev/shm and their tiers, against the two E-KV-RAM checks

Fits: tiers 64 of 128 GiB allowed; everything 112 of 256 GiB. Each worker's /dev/shm is 8 + 32 GiB, and its memory request equals its limit, so the scheduler reserves the whole tier.
worker's own memory (illustrative 16 GiB)engine /dev/shm room (8 GiB)KV tier (sizeGb)SGLang host reserve (10 GiB)

The disk tier

tier: disk is vLLM only. The CPU tier feeds a disk tier below it (vLLM's file-system tier, which core starts from the engine flag kv_tier_fs). The engine writes one file per block and never deletes from the directory, so the control plane bounds it in three places:

  1. The claim. diskGb is claimed on the worker's node in the disk ledger. Every endpoint's disk tiers on the node must fit:

    room = free space on the model-cache volume
         + what these tiers already wrote there (up to each tier's claim)
         − the model's weights, when the node does not hold them yet
         − 15 % of the volume

    Past it: E-DISK, naming other nodes of the same vendor where it fits. The 15 % is the kubelet's default hard eviction threshold (10 %) plus what a tier writes between two pruner passes (5 %). A node whose cache volume was never measured is advised, not judged.

  2. The pruner. A kv-prune container beside the engine runs opod cache kv-prune --dir <tier dir> --max-gb <diskGb> --every 10s --apply. Past the cap it removes the oldest blocks first, down to 90 % of diskGb. It touches only the tier's own files. From core v0.4.7 it also trims ahead of the growth it measured since its last pass. In core v0.4.7 a burst that starts while it is idle can pass the cap for up to one --every interval; from core v0.4.8 the pruner watches the volume's free space every second while idle and starts a pass at once. See opod cache.

  3. The sweep. Every 5 minutes the control plane looks for tier directories no plan names any more (an endpoint deleted, a revision or layout changed) and empties them with a short Job (kv-prune --max-gb 0).

The directory is /data/models/.kvtier/<endpoint id>/<key>, inside the node's model cache, so the free space the disk ledger reads is the volume the tier fills.

A disk tier needs a pinned model. Set model.revision (a commit) or model.version. The tier outlives the pod, and the engine names a block by the model's name, dtype and split, not by the weights' bytes. Without a pin, a branch head that moved between two pod starts would read the old weights' blocks as hits: wrong answers, not slow ones. The pinned revision is part of the directory's name.

Proven on vLLM on NVIDIA: a disk hit after the CPU tier evicted the block, and a disk-full drill.

The auto tier

tier: auto is a CPU tier whose size the control plane chooses from the tier advice.

  • maxGb must be at least 1. The tier starts at sizeGb, or at the smaller of maxGb and 4 GiB.
  • Every 10 minutes, for each serving endpoint, the kv-tier-auto loop reads the tier advice capped at maxGb.
  • It resizes only when the suggestion differs from the current size by at least a quarter of it (and at least 1 GiB), and the last resize is at least 30 minutes old.
  • The resize is a verified rollout of the plan with the new sizeGb, noted kv-tier-auto. A failed rollout restores the previous plan.
  • It never removes the tier, never goes to 0 and never exceeds maxGb. Each size is judged by the planner first, so it never takes more than the node's memory allows (E-KV-RAM).

The advice needs the engine's cache events, so an auto tier resizes only with plan.kvEvents: true on vLLM or SGLang. On llama.cpp and TensorRT-LLM the advice reads unknown and the tier stays at its starting size. Only the plan's first auto worker is resized.

Tiers on gangs

A vLLM gang may take a CPU tier on shardGroups[].kvOffload: {tier: cpu, sizeGb}. There sizeGb is the gang's total. In 0.3.0 each part claims its ranks' share, ⌈total × its devices ÷ all devices⌉ GiB, on its own node. From 0.3.2 each part claims the whole total: vLLM maps the tier as one shared region of the total in each part's pod, so a 4 GiB tier on a two-part gang holds 4 GiB on each node. Each node is judged for E-KV-RAM.

Refused on a gang, each by name:

  • a llama.cpp RPC gang (E-KV-OFFLOAD): its coordinator holds the whole KV cache, so a restore would pull the remote parts' layers over the network;
  • any engine but vLLM: how it splits a tier over ranks has not been read on its image;
  • tier: peer and diskGb: a disk tier is a worker's, not a gang's.

A tier under tensor parallel on one node is built but not yet proven on hardware. Across two nodes it is: a vLLM tensor-2 gang, one NVIDIA card on each node, read 12 of 12 tier hits equal to the card's own hit, with 18,080 tokens from the tier (on the release after 0.3.6, for the reason below). A gang tier is proven from 0.3.2 and a leader from core v0.4.1: a vLLM pipeline-2 gang across two NVIDIA nodes read 12 of 12 tier hits equal to the card's own hit, with both parts' layers copied back from the tier. In 0.3.0 the tier never reached a gang's engine. Up to 0.3.6 it reached the engine only when the leader formed the gang before the control plane did; when the control plane formed it first, the engine started with no tier and the tier served nothing. From the release after 0.3.6 the tier reaches the engine either way (the same drill: 12 of 12, 18,080 tokens from the tier).

A gang with kvEvents: true is accepted, but in core v0.4.6 a gang's engine does not publish its prefix-cache events, and the leader routes among gangs by load alone: it reads no pin for a gang either. From core v0.4.7 a vLLM Ray gang and an SGLang gang publish them: the leader starts the gang's engine with the publisher when the head's worker runs with OPOD_KV_EVENTS=1 (an SGLang gang gets --page-size 16 on every rank unless the plan sets one), and it scores the blocks the head reports for that gang, as it does for a worker. A vLLM expert (data-parallel) gang and a llama.cpp gang still publish nothing. Proven on the design-partner cell with two vLLM pipeline-parallel gangs on NVIDIA: the leader indexed blocks from both gang heads, and with the pins on, 60 of 60 later turns of 20 conversations found their earlier prompt in their gang's cache. An SGLang gang's events are tested on a laptop only.

Vendors

In 0.3.0 every tier is proven on NVIDIA only: the vLLM CPU tier (99.6 % of a repeated prompt's tokens read from the tier, 0 with it off), the vLLM disk tier, SGLang's HiCache, llama.cpp's host prompt cache and TensorRT-LLM's host pool. From 0.3.2, vLLM's CPU and disk tiers are also open on AMD: on the ROCm image and a Radeon RX 7900 XTX, answers read from the tier equalled the card's own cache hit 24 of 24 on two seeds, and an hour with the tier full kept memory flat. The disk tier there has one drill and no soak yet. From the same release, llama.cpp's host prompt cache is open on AMD too: on a Radeon RX 7900 XTX the drill read 6 of 6 answers equal to the card's own hit, with 822 tokens from host memory, the same as on NVIDIA. vLLM on that card is not bitwise repeatable with or without a tier: about one first token in 5,000 differed from the card's own hit with a tier, and one in 9,000 between two hits with no tier, a difference that sample cannot tell apart. On any other engine × vendor a tier is refused E-KV-OFFLOAD, naming the vendors it is proven on. A Tenstorrent card is refused by name: its vLLM build has no offloading connector.

The peer tier and kvStore

The peer tier lets a worker read a prefix a sibling computed. It is the worker's CPU tier, shared through the cell's kvstore connector. The plan field is the same for every store; the connected store picks the path.

StoreOPODCP_KVSTORE_URLHow the workers shareToday
noneunsetnothing to share throughrefused E-KV-OFFLOAD by name
Valkey or Redisredis://valkey.example.com:6379, or kvStore.enabled=truevLLM with LMCache: each chunk a worker computes goes to the storerefused on every vendor
shared volume arrives in the release after 0.3.6pvc://nfs-rwx?size=200GivLLM's own file tier on one ReadWriteMany volume per endpointproven for vLLM on NVIDIA; refused by name on AMD, Intel and Tenstorrent

With no store, a peer tier is refused E-KV-OFFLOAD (no shared KV store connected), and the refusal names both stores. In 0.3.6 it was accepted and ran as each worker's own CPU tier, with the advisory kv-no-store; from the release after 0.3.6 it is refused, so nothing runs that differs from what you asked. The console's endpoint form then shows peer disabled, with the same reason and a link to the kvstore card on the Connectors page; a tier, a prefill/decode split or KV block events that the chosen engine or the chosen machine's vendor cannot take is shown the same way.

Through Valkey or Redis it is refused on every vendor, whatever store is connected: on the pinned NVIDIA vLLM image, a request served from the shared cache returned a different answer from the same request computed — another prompt's answer, or garbage — in every configuration tried (0 of 6 hits correct). The cause is in the image's LMCache build, not in opod. The chart's optional kvStore (one Valkey Deployment, kvStore.enabled, maxMemory: 8gb with LRU eviction, a generated password) and the Valkey/Redis connector stay unused until it opens. See Helm values.

Through a shared volume (the release after 0.3.6), the endpoint gets one ReadWriteMany volume and every peer worker mounts it. To vLLM, each worker is its CPU tier plus a disk tier on that volume, in one directory per layout (engine, vendor, KV precision, tensor and pipeline split, block size, model revision), so one layout never reads another's blocks. vLLM writes one file per block and renames it into place, so two workers that write the same block are safe, and a sibling reads it instead of computing it. One pruner per volume keeps it under 85 % of its size. On a network filesystem a pass is slow (a round trip per directory), so from core v0.4.7 the pruner lists 32 directories at once and trims ahead of the growth it measured. The setup is Connector setup → KV store: a shared volume.

  1. Connect the volume store

    On the Connectors page, open kvstore, choose shared-volume, and save pvc://nfs-rwx?size=200Gi (your ReadWriteMany class). Verify answers no-probe.

  2. Give the workers a peer tier

    The model must be pinned (model.revision or model.version): the volume outlives the workers.

    {
      "model": { "id": "qwen3-8b", "revision": "0123456789abcdef0123456789abcdef01234567" },
      "workers": [
        { "node": "node-a", "engine": "vllm", "replicas": 1, "kvOffload": { "tier": "peer", "sizeGb": 8 } },
        { "node": "node-b", "engine": "vllm", "replicas": 1, "kvOffload": { "tier": "peer", "sizeGb": 8 } }
      ]
    }
  3. Check it

    kubectl -n opodcp get pvc,deploy -l opod.io/endpoint=chat

    One …-kvshared claim Bound, one …-kvprune Deployment, and the workers. The path is proven for vLLM on NVIDIA only. On the design-partner cell, a worker on one host computed 6 documents, and a worker on another host that never saw them answered all 6 identically with 12,368 prompt tokens read from the volume; two hosts writing 60 new documents each at once kept the volume at 0.95–1.08 × its pruner's cap in four runs with core v0.4.8's pruner. On AMD, Intel or Tenstorrent nodes, Preview refuses the plan E-KV-OFFLOAD with the shared-volume peer tier is not proven for vllm on amd (or that vendor). On that cell's 1 Gb/s NFS volume with a 0.5B model, a read from the tier was slower than computing the prompt (time to first token 453 ms against 193 ms), so the tier saves GPU work there, not time; measure it on your storage.

If it failsCauseFix
E-KV-OFFLOAD … no shared KV store connectedno kvstore is savedconnect one, above
E-KV-OFFLOAD … proven on no vendorthe path is not proven on any vendor yettier: cpu or disk meanwhile
400 naming model.revisionthe model is not pinnedset model.revision or model.version
endpoint degraded, KVSharedVolumePending (…): ProvisioningFailed: …the class does not exist, cannot give ReadWriteMany, or has no provisionersave a class that offers ReadWriteMany, then delete the claim so the next rollout makes it again
E-KV-OFFLOAD on SGLang or another engineonly vLLM has a file tier the control plane drivesengine: vllm, or tier: cpu

Measure a tier

WhereWhat
GET /api/v1/endpoints/{id}/kvper worker: tierHitPct (tier hit tokens ÷ tokens looked up there, since the engine started) and the tier counters in load
/metrics on opodcpopodcp_kv_tier_hit_tokens, opodcp_kv_tier_query_tokens, opodcp_kv_tier_loaded_bytes, opodcp_kv_tier_stored_bytes, opodcp_kv_tier_used_percent, opodcp_kv_tier_alloc_failures
GET /api/v1/endpoints/{id}/kv/tier-advicewhat a tier of each size would have served, and the size to use
opodcp doctorwhether every worker the plan gives a tier reported tier figures

A worker whose engine says nothing about its tier has no series: absent, never zero.

When not to use a tier

  • Requests that share no prefix: the tier fills and serves nothing. Read /kv/tier-advice first; none means a tier would serve under 5 %.
  • A node short of memory: the tier is reserved in full from the first second.
  • A non-NVIDIA card: refused until proven.
  • On vLLM with prefill and decode halves: refused (E-PD-TIER).

Last updated · Source: content/docs/control-plane-endpoints/kv-tiers.mdx · View as Markdown