← News

General models

AWS Adds KV Cache-Aware Routing to SageMaker AI Real-Time Endpoints

AWS launched KV cache-aware routing for SageMaker AI real-time endpoints, using container-reported cache events to pick instances by longest match and load, with p50 TTFT down up to 97% in tests.

Published: 2026-11-18 13:09 UTCUpdated: 2026-11-18 13:09 UTCSource date: 2026-11-17

AWS has introduced KV cache-aware routing for Amazon SageMaker AI real-time endpoints, a new request-distribution strategy that relies on cache state reported by the model container rather than inferring it from the request. According to the company, the router learns what each instance actually holds cached and then weighs how much of a prompt it can reuse against how busy that instance is.

LLM applications such as chat assistants, retrieval-augmented generation and agents with long system prompts repeatedly send requests that begin with the same text. A model stores the work done on that prefix in GPU memory as the KV cache and skips recomputation when the same start reaches the same instance. AWS's earlier prefix-aware routing hashed the opening bytes of a request, so it could not tell when an instance had evicted its cache, and multi-turn conversations could land on different instances before the history grew past the configured prefix length.

KV-aware routing has three parts. With an environment variable enabled, the container publishes a KV cache event whenever it stores or evicts entries. SageMaker AI maintains a managed cache index of that state, which AWS says holds only one-way truncated hashes and pointers to the instance or inference-component copy, never prompts, token IDs, request payloads or KV tensors. When a request arrives, the endpoint tokenizes the prompt, looks up the tokens, and receives the candidates holding part of it plus how much each holds. Because matching is on tokens rather than a fixed byte count, a growing multi-turn history can match in full. The router then picks among candidates by match length and load, skipping busy instances and falling back to load-aware routing when nothing useful matches.

Enabling it takes two steps: turn on KV cache events for the model container with SM_VLLM_KV_EVENTS_CONFIG, and set RoutingStrategy to KV_AWARE in the production variant's routing configuration. Client calls are unchanged and can use InvokeEndpoint, the streaming variant or the OpenAI-compatible Chat Completions API. The strategy only takes effect with at least two instances or two copies of an inference component, and at launch it requires the AWS vLLM Deep Learning Container with vLLM 0.33.0 or later.

AWS reports a 30-minute benchmark on seven ml.p5.48xlarge instances running Llama 3.1 70B Instruct, with 20 or 100 simulated users in multi-turn chats and document Q&A and prompts up to about 64,000 tokens. Compared with random routing under long prompts and load, AWS says p50 time to first token fell by up to 97 percent, throughput rose by up to 234 percent, and the KV cache hit rate climbed from 3–48 percent to 80–93 percent. AWS notes the smallest gains came with short prompts, and that fallbacks are not currently surfaced in the console or metrics.

The engineering implication is that routing becomes stateful and depends on container reporting, adding a few milliseconds per request for tokenization and index lookup. The payoff scales with how much context is reused and how much memory pressure instances face. For teams serving long conversations, shared documents or heavy concurrency on SageMaker, it offers a way to raise cache hit rates without changing client code; AWS suggests teams with stable short prefixes and moderate load may still start with prefix-aware routing and compare time to first token, throughput and hit rate on their own traffic.


Related articles