Architecture Decision Records
ADR 0069: KV offload backends are compiled-in, engine-scoped descriptor rows assembled at one point
On this page
Date: 2026-11-16 · Status: Accepted (amends the parameter classes of ADR 0021; keeps the PD roles of ADR 0028 and the codes of ADR 0067)
Context
vLLM KV offload has one kind today, the platform's native one: the memory tier (kv_offloading_size) and the disk tier (kv_disk_offload, shared_kv_dir and related keys). No server-side type represents "a KV offload backend". About a dozen places each work out tier meaning from raw LaunchConfig fields:
- parameter validation and performance warnings;
- argv,
/dev/shmsizing and the disk mount; - the PD decode role clearing offload fields;
- the requested-feature snapshot;
- template reverse parsing and unset;
- the deploy form and the instance panel.
External backends are arriving: LMCache, Mooncake Store, and SGLang's HiCache. In the current shape each one adds another round of == "<id>" checks across Go and TS. It is also easy to mark a key that reaches the command line as a platform parameter, which breaks ADR 0021 decision 2.
Separately, engines.CommandFeatures classifies PD by kv_role. The non-PD disk tier also carries kv_both, so it is recorded as PD and refused on a vendor without PD support (Kunlun).
A connector name, kv_connector_module_path, extra config and environment variables all amount to code execution in the GPU container, so where they come from must be controlled.
Decision
- A backend is a descriptor row compiled into the binary, unique per (engine, id).
- Rows live in the leaf package
internal/server/kvbackend, which depends only onaccelerator,enginesandpdmode. It has noinit()registration and no mutable package state; the registry is an immutable value built byBuiltin(). - A row declares data only:
- its engine;
- whether it is the engine's default row (an empty selection resolves to it; at most one per engine);
- a vendor allow-list;
- whether it is external;
- the native dictionary keys it excludes (
Replaces); - the PD roles that keep it (
PDRoles), which always include prefill, the role whose KV a cache tier serves again; - the topologies it supports (a node-count cap, PP, DP);
- a display label.
- Rendering is not in the row. It is a plain Go builder function in
deploy, selected by id, with an optional reader. - A field is added only when the first row that needs it arrives.
- Rows live in the leaf package
- Callers select an id, nothing else.
- APIs, templates, manifests and nodes may only name a backend id. They never supply a connector, module path, environment variables or extra config, and values are serialized with
encoding/json. - Rows are never deleted. An unknown id returns a code on evaluate, edit and launch. Stored rows still decode, and running instances are unaffected.
- APIs, templates, manifests and nodes may only name a backend id. They never supply a connector, module path, environment variables or extra config, and values are serialized with
- The only new persisted fact is
LaunchConfig.kv_offload_backend.- An empty value means the engine's default row, which is
nativefor vLLM. - The registry generates the dictionary key. It is published only when the engine has a selectable (non-default) row. While unpublished, the key is dropped from requests as before, matching older releases.
- In the parameter table it is one definition carrying the
Selectormarker (its text comes from the parameter locale files); its options are generated per engine from the registry and labelled with each backend's product name. - It is a third class of key beyond ADR 0021, a selector key:
- it is not a member of an engine flag column, so it does not join the
--kv-transfer-configcomposite group and stored unset sets do not change; - it is not a platform parameter either, because it shapes the command line and the engine adapter reads it.
- it is not a member of an engine flag column, so it does not join the
- An empty value means the engine's default row, which is
- Exclusivity is judged on effective values, and the server refuses rather than silently clearing.
- With an external backend selected, any native key in
Replaceswith an effective value returnsKV_OFFLOAD_BACKEND_CONFLICTS_NATIVE_TIER. Effective values are:- a memory tier above 0;
- the disk tier on;
- a non-empty directory;
- a capacity cap above 0;
- threads and block size, but only while the disk tier is on.
kv_offload_block_size, which has no dictionary row, counts whenever it is above 0.- Values written by dictionary defaults do not count.
- With a backend selected, the adapter renders only that row, never the native tiers. Every selectable row's
Replacesmust therefore cover every key of the engine's own offload, which thekvBackendSetProblemstest indeployenforces. - Because of exclusivity, every native field is zero when a backend is selected, so the existing
/dev/shmand disk-mount readers need no knowledge of backends, and the form and instance panel can show both tiers as replaced for any backend.
- With an external backend selected, any native key in
- One assembly point per engine.
- vLLM's
--kv-transfer-configis composed only incomposeVLLMKVTransfer. The PD fragment comes frompdmodeand the offload fragment comes from the selected backend. - When both exist they become a
MultiConnector: the outer role is the PD role, and the load-failure policy stays at the top level. - A backend's renderer receives the whole launch (PD role, vendor, compute network, parallelism) and decides its own inner role, endpoint and environment. It may give keys the outer
MultiConnectorneeds, such as a vendor's connector module path (the composer's own keys win), and environment, whichvLLMEngine.Buildmerges in one place. - Without PD and with only the native memory tier, the
--kv-offloading-sizeform is kept. - The assembly point takes one PD fragment and one offload fragment, so a combination of two offload fragments cannot even be expressed, and no user-facing code exists for it.
- vLLM's
- Role scope under PD is declared by the row.
PDRoleLaunchConfigclears the selection and the native fields when the role is not inPDRoles. The native row is[prefill], as today. The PD evaluate warningPD_KV_OFFLOAD_PREFILL_ONLYreads the selected row'sPDRoles(it warns when decode does not keep offload), and the instance read model'skv_offload_backendis scoped to the instance's role the same way. - Vendor and topology are checked once, on the server.
ValidateTargetFeatures, which every validating mode reaches, checksBackend.Vendorsand (node count, PP, DP). It returnsKV_OFFLOAD_BACKEND_UNSUPPORTED_ON_TARGETorKV_OFFLOAD_BACKEND_TOPOLOGY_UNSUPPORTED.ProfileForTargetuses the same predicate to decide which backends to publish (kv_backends), and the UI only renders them.- An unknown vendor (evaluate with no node, before automatic placement) is not known yet and is allowed, as
accelerator.Supportsallows it; the assigned target is checked after placement. FeatureExternalKVCacheis only the identity for the requested feature and the scheduler reason (kv_backend_unsupported_on_node). It has no second vendor table.- For an external backend,
ResolveLaunchreturnsKV_OFFLOAD_BACKEND_CONFLICTS_ARGwhen a template or user argument layer states a flag that would replace its configuration (engine hookKVConflictFlags, matched after normalizing_/-,--x=yand quotes). - The check runs under PD too.
PD_CONNECTOR_ARG_CONFLICTmatches only the hyphen spelling, and the engine reads the underscore spelling as the same flag, which would push the backend out of the prefill'sMultiConnector. HowCheckPDArgsand warning W4 match flags for PD deployments without a backend does not change here.
- PD is classified by connector, not by
kv_role.- A known offload-only connector (today
OffloadingConnector) is not PD, whatever its role. - A
MultiConnectoris classified by its children. - Any other connector with a valid role is still PD.
- This table classifies only configs a user wrote. In a non-PD launch, a
--kv-transfer-configidentical to the one the platform composes carries only the selected offload backend, andResolveRequestedFeaturesclassifies it as not PD, so adding a backend needs no change to the table inengines.
- A known offload-only connector (today
- A backend's own configuration reads back as its selection.
- The engine hook
RecognizeKVBackendreads a selectable external backend's non-PD config back intokv_offload_backend. A backend with a reader decides and returns the values of its own dictionary keys, which are written back beside the selection; one without a reader is recognized only by its rendering with nothing else stated.ReverseArgsandCanUnsetTemplateFlagshare the hook, so a deployment saved as a template deploys again with the same selection. - An object wrapped in a PD
MultiConnectorstays opaque, and unsetting the native keys over it is still a conflict.
- The engine hook
Trade-offs
- Compiled in vs configurable at runtime. Adding a backend or following an upstream rename needs a release. This cost is accepted, because a backend descriptor is in effect code executed in the container and must not be supplied by an API or a node.
- Data rows plus Go builders vs a descriptor DSL. Each backend's configuration has a different shape, and a DSL would only grow a bag of optional fields. Rows hold only the data used for decisions, and shapes stay in testable Go functions.
- Landing the seam with only the native row first. The generic machinery for external backends (exclusivity, roles, gates, reverse parsing, form cards) is driven only by a test row at that point, and every user-facing surface is byte-identical to the previous release. The first external backend then only adds a row, a builder and tests.
- The PD classification changes behaviour. A non-PD vLLM disk tier on Kunlun is no longer refused, and that combination has not been verified on hardware. An unknown offload connector a user writes is still treated as PD until it is added to the list, which is the safe direction.
Consequences
- To add a KV offload backend, add one row in
kvbackendand one builder indeploy(with a reader when needed), with tests. Only vLLM has an offload adapter today; the tests refuse a row of another engine until that engine renders and reads it. Backend id literals must not appear in other Go code or inui/src; this is enforced by thekv_backend_id_literalsbudget inscripts/arch-constraints.txt, with a baseline of 0. - The first external backend wired onto this seam is
vllm/lmcache(LMCacheMPConnector,lmcache_driven, talking to a node-local daemon attcp://localhost:5555): it targets NVIDIA and Ascend, runs within one node per instance, stays on the PD prefill role only, and supplies"kv_connector_module_path": "vllm.distributed.kv_transfer.kv_connector.v1.multi_connector"in its PDwrappersovllm-ascend 0.30.0'sAscendMultiConnectoroverride does not pass empty block tables on cold misses. The external LMCache daemon remains managed outside the control plane. - Downgrade: an older server decodes with plain JSON and drops
kv_offload_backend.- A deployment that selected an external backend relaunches there with no offload.
- An edit or draft round-trip removes the selection.
- This behaviour is documented and pinned by a test.
- In a mixed-vendor cluster the scheduler does not filter nodes by a backend's vendor allow-list. An unsupported vendor is refused at assigned-target validation.
- Terms: the domain glossary (
CONTEXT.md).
Was this page helpful?