Amazon SageMaker AI real-time endpoints can now send each request to the instance that already holds the longest matching part of its prompt in the KV cache. AWS announced the KV_AWARE routing strategy on November 16. It needs GPU endpoints running the AWS vLLM container (0.33.0 or later) with at least two instances, and costs nothing extra. In AWS’s small-endpoint test, median time to first token fell from about 1.3-1.6 seconds to about 0.24 seconds on prompts that repeat a long document.

What KV_AWARE does

A KV cache holds the attention keys and values a model has already computed for a prompt. If the next request starts with the same tokens, the server can skip that work; vLLM’s automatic prefix caching reuses only the longest run of full blocks at the start of a prompt. That only helps if the request lands on the instance that holds those blocks. With random routing it often does not. Our explainer on KV cache memory covers what the cache costs in memory.

According to AWS’s launch post of November 17, the mechanism has three parts:

  1. The model container publishes an event whenever it stores or evicts a cache entry. You switch this on with the SM_VLLM_KV_EVENTS_CONFIG environment variable.
  2. SageMaker keeps an index of those events. AWS says it stores one-way, truncated hashes that point to an instance or inference component copy, and not prompts, token IDs, request payloads or KV tensors.
  3. For each request the endpoint tokenizes the prompt, looks it up in the index and weighs how much of it each candidate has cached against how busy that candidate is. Busy candidates are skipped.

If the lookup is slow, finds no useful match or every match is busy, the request falls back to load-aware routing, the same behavior as LEAST_OUTSTANDING_REQUESTS. AWS says the lookup adds a few milliseconds for short prompts and more for long ones, and that these fallbacks are not reported in the console or metrics at launch.

What you need

Item Requirement stated by AWS
Instances GPU instances, at least two instances or inference component copies
Container AWS vLLM Deep Learning Container 0.33.0 or later (Amazon Linux build server-sagemaker-cuda-v2.8.0 or later); prefix caching on, which is the default
Endpoint setting "RoutingConfig": {"RoutingStrategy": "KV_AWARE"} on the production variant
Container setting SM_VLLM_KV_EVENTS_CONFIG with enable_kv_cache_events set to true
Tooling Latest AWS SDK or CLI; detailed observability needs AWS CLI 2.35.6 or Boto3 1.43.31
Endpoint types Real-time single-model endpoints and inference components, including dynamic LoRA adapters
Regions and price Every commercial region with SageMaker AI real-time inference; no additional charge beyond the instances

AWS’s API reference had not caught up when we checked it on December 1: the RoutingStrategy page still lists only LEAST_OUTSTANDING_REQUESTS, RANDOM and PREFIX_AWARE. The KV_AWARE value is documented in the announcement and the blog post, so treat those as the source until the reference is updated.

AWS’s test results, as ratios

The post compares KV_AWARE with RANDOM on two ml.g5.xlarge instances serving Qwen3-4B-Instruct-2507: 128 requests per run, 32 users asking 4 questions each about 12 documents of about 7,400 tokens. Each column shows one of AWS’s two runs (pair 1, pair 2). The change column is our arithmetic from AWS’s figures.

Metric RANDOM KV_AWARE Change
ModelLatency average (ms) 4,124 / 5,100 1,235 / 1,314 -70% / -74%
ModelLatency p50 (ms) 3,153 / 4,083 656 / 700 -79% / -83%
ModelLatency p99 (ms) 17,779 / 16,249 6,876 / 7,238 -61% / -55%
TTFT p50, questions 2-4 (ms) 1,284 / 1,632 237 / 245 -82% / -85%
Share of prompt tokens from cache 0.761 / 0.701 0.903 / 0.903 +19% / +29%
Run duration (s) 31.1 / 36.9 17.9 / 18.0 -42% / -51%
OverheadLatency average (ms) 13.1 / 8.1 27.1 / 27.5 +14.0 ms / +19.4 ms

Two readings matter. First, the gain comes from the cache share rising only from about 70-76% to 90%, and the saved prefill work was worth 1,047 to 1,387 ms at the median first token. Second, the cost is real but small: about 14 to 19 ms more routing overhead per request in this test, against seconds saved. A short-prompt workload would not recover that overhead, and AWS says gains were smallest with short prompts.

On a larger fleet (Llama 3.1 70B Instruct on seven ml.p5.48xlarge instances, prompts up to about 64,000 tokens, random routing as baseline) AWS reports p50 time to first token down by up to 97%, throughput up by up to 234% and cache hit rate raised from 3-48% to 80-93%. These are AWS’s figures for its own workload mix; OSBBD has not run the feature.

KV_AWARE or PREFIX_AWARE

SageMaker already had PREFIX_AWARE, which hashes the start of the request and keeps requests with the same prefix on the same instance until a concurrency threshold is reached. AWS’s post sets the two side by side:

PREFIX_AWARE KV_AWARE
Where it learns cache location Infers it from the request alone Container reports real cache state
Matching Request prefix up to PrefixLength Tokens, via a managed index
Tuning PrefixLength, ConcurrencyThreshold None
Container changes Prefix caching only KV events configuration
Payloads Any OpenAI-compatible Completions or Chat Completions on a supported container

AWS recommends comparing the two on your own traffic and choosing PREFIX_AWARE if the results are similar.

Limits to check before switching

  • It works only with the AWS vLLM container on GPU instances. InvokeEndpointWithBidirectionalStream is not supported.
  • With one instance the setting has no effect.
  • A new context gets no cache benefit on its first request, and new or replaced instances start cold, which can raise latency after scale-out.
  • The endpoint ignores the prefix-aware ID header and the prompt_cache_key field. A non-null top-level cache_salt returns a 400 error.
  • If you set the model field it must match SM_VLLM_MODEL.
  • Routing decisions are not delivered to your account as logs.

For per-response proof that the cache is working, AWS says to set SM_VLLM_ENABLE_PROMPT_TOKENS_DETAILS to true, which adds usage.prompt_tokens_details.cached_tokens to each response.

The same idea applies on HyperPod: our note on the HyperPod Inference Gateway covers the Kubernetes version of model-aware routing. Checked against the AWS pages on December 1, 2026.