AWS Unveils Distributed KV Caching Skill Reducing Self-Hosted LLM Costs by 40% and Latency by 80%

AWS has unveiled a distributed KV caching agent skill that eliminates repeated prefill operations for self-hosted LLMs, reducing inference costs by up to 40% and the time to first token (TTFT) by up to 80%. By combining Amazon ElastiCache for Valkey with the LMCache connector, it shares KV state across GPU clusters and automates diagnostics, scaling, construction, and fault recovery in coding agents like Kiro and Claude Code using natural language. The KVTrace tool allows for free simulation of effectiveness based on internal traffic before infrastructure deployment, incorporating operational best practices such as tenant isolation, hash collision prevention, and layout validation.

Background: Cache Bottlenecks Faced by Self-Hosted LLMs

There is an increasing trend of companies self-hosting large language models (LLMs) on GPU clusters to control costs, accuracy, and latency. However, when each GPU server only has an independent small prefix cache, duplicate prefill operations occur every time conversation history accumulates, leading to a surge in costs and latency. According to the AWS blog, in workloads that accumulate hundreds of thousands of tokens of case history, resuming a conversation after lunch can take several minutes to generate the first token. This is because the GPU server receiving the request does not have the key-value (KV) attention state for that history, necessitating a re-execution of the prefill for all tokens. This bottleneck is common across long-context and multi-turn workloads, including coding agents, agentic AI assistants, and document Q&A systems.

Solution: Distributed KV Caching and Agent Toolkit Skill

AWS addresses this issue with a distributed KV cache layer based on Amazon ElastiCache for Valkey. By placing a shared cache tier next to the GPU local cache, it allows KV state to be reused across any server, even during session changes or failures over several days. The newly announced distributed KV caching skill of the Agent Toolkit for AWS automates the evaluation, construction, and operation of this architecture with just a few natural language prompts within coding agents. Supported agents include all tools following the Agent Skills protocol, such as Kiro, Claude Code, and OpenAI Codex.

"Announcing distributed KV caching for self-hosted LLMs with Amazon ElastiCache" dives into the technical details and the performance benchmarks.

The four conversation flows guided by the skill are as follows:

1. Slow First Token Diagnosis — Identify causes of cold prefill and prioritize review of non-infrastructure alternatives (reactivating prefix cache, session affinity) 2. Cache Size and Cost Estimation — Estimate savings using KVTrace simulation based on internal traffic 3. Cache Cluster Construction — Inject LMCache connector into vLLM/SGLang, unify KV ID mechanisms and data types 4. Transmission Failure Recovery — Troubleshoot operational issues such as layout mismatches and key mismatches

Technical Architecture and Prerequisites

To apply the distributed KV caching skill, the following runtime environment is required.

ComponentMinimum Version / SpecificationNotes
GPU Instancep5 (EFA RDMA write support)Elastic Fabric Adapter required
Inference EnginevLLM 0.11.1+ or SGLang 0.5.13+Includes llm-d, Ray Serve sub-workers
LMCache Connector0.5.8rc1+Plugin for vLLM/SGLang engine
Cache ClusterElastiCache for Valkey 9.1+, cache.i8ge.48xlarge nodeDuring production deployment
Coding AgentSupports Agent Skills such as Kiro, Claude Code, OpenAI CodexEntity executing the skill

The skill scans the GPU fleet with a read-only `describe-instances` call to count the number of EFA interfaces and asks the user for engine, model, tensor parallel (TP) size, KV data type, server pricing, and prompt repetition frequency. It immediately halts and explains the reason if conditions are not met.

Actual Application Flow: From Diagnosis to Construction

Flow 1: Legal Assistant 64K Context Diagnosis

User Prompt: "My vLLM fleet is serving a legal assistant with a 64K token context. It takes 13 seconds to get to the first token in resumed conversations. The GPU recalculates the entire conversation history every turn. How do I fix this?"

The agent identifies cold prefill as the cause and presents three practical considerations.

Flow 2: Scaling Estimation for 8 p5 Instances RAG Assistant

Example Fleet: 8 p5 instances, 64,000 token prompt, multi-turn RAG assistant. The agent queries the AWS pricing table for GPU and cache node prices and derives prefill speed and KV size from benchmarks, recommending 2 cache.i8ge.48xlarge nodes. Since the user did not provide the cache hit rate (the ratio of tokens being recalculated that the cache serves), the agent presented scenario-based estimates and recommended securing actual hit rates through KVTrace execution.

Cost Reduction 40%
TTFT Reduction 80%
2 Cache Nodes

Quantitative Effect Verification through KVTrace

KVTrace records KV cache events in vLLM or SGLang and then replays offline by candidate cache size to calculate hit rates. Token IDs or prompt texts are never recorded, only block hashes and token counts are stored. Since block hashes originate from token content, if the prompt is sensitive, it can be anonymized using the `--anonymize-key-file` option. The recorder runs on all GPU servers and can be used without additional charges.

The skill assesses whether the savings cover the cache costs based on KVTrace results, and if not covered, it halts the construction. All figures specify sources (AWS pricing table, benchmarks, internal traces).

Considerations and Best Practices for Deployment

The skill enforces the following validation steps before introducing production traffic.

These guardrails are designed to minimize operational risks while safely realizing the cost and latency benefits of distributed KV caching.

Verified figures

Our take

AWS packaging distributed KV caching into an agent skill that automates the process from diagnosis to construction using natural language is a practical approach that significantly reduces operational complexity. The ability to validate for free before deployment with KVTrace is a key differentiator that lowers enterprise adoption hurdles.

Open questions

Source

Back to catalog