ByteCosts
prompt-cache-timing-side-channel.mdx

AI Coding Agents

Prompt Cache Timing Side Channels: What a 17-Provider Audit Found

A prompt cache timing side channel arises when a cached prefix tends to reach the first token faster than a comparable uncached prefix. If users share a cache, repeated timings can suggest that someone in that group recently sent a matching prefix. A 2024 audit detected global cache sharing on tested endpoints at seven of 17 providers.

A prompt cache timing side channel arises when a cached prefix tends to reach the first token faster than a comparable uncached prefix. If users share a cache, repeated timings can suggest that someone in that group recently sent a matching prefix. In September and early October 2024, Gu, Li, Kuditipudi, Liang and Hashimoto detected prompt caching through timing at eight of 17 providers and global cache sharing on tested endpoints at seven of them.

How a prompt cache becomes a timing channel

Prompt caching stores the attention key-value state for a prompt prefix and reuses it when a later request begins with the same tokens. Reuse reduces prefill work for the cached part, so hits tend to have a lower time to first token (TTFT) than misses on comparably sized prompts. The KV cache prefix caching explainer describes which computation is reused.

TTFT varies with network latency and server load. Routing can also send a request to a server whose cache lacks the prefix. The researchers therefore compared distributions of request timings. Client-side timings include the network trip, while server-side timings can give a closer view of processing time when the API exposes them. The authors could measure server-side timing at more than half of the APIs they tested. A measured difference is probabilistic evidence of reuse within the relevant sharing group. The signal concerns a matching prefix and leaves the sender’s identity and the remaining prompt unknown.

The paper defines three levels of cache sharing. Each describes who can reuse an existing entry.

  • Per-user caching. A user can only hit entries created by their own prompts. This prevents cross-user prefix inference in the paper’s model.
  • Per-organization caching. Users inside one billing organization share a cache. Leakage is limited to the org boundary, which the org owner controls through membership.
  • Global caching. The cache is shared across all users. An attacker could in principle learn that any other user sent a matching prefix, which is the highest-risk configuration.

What the audit measured

The audit first tested exact matches within one account. It then looked for reuse with partial prompt matches within an account, within an organization and across organizations. Later stages covered only endpoints where the preceding stage detected caching. The researchers randomized the order of their measurements and used a one-sided Kolmogorov-Smirnov test to assess whether the timings expected to produce cache hits were faster than the timings for misses. They corrected for multiple comparisons. Their largest test used roughly 34 million prompt tokens. The table records the historical results for the endpoints they tested.

ProviderModel auditedHighest sharing level detectedAvg. precision, client / server timing
Azuretext-embedding-3-smallGlobal0.80 / not measured
Deep InfraLlama 3.1 8B InstructGlobal0.84 / not measured
FireworksLlama 3.1 8B InstructGlobal0.77 / 0.79
LeptonLlama 3.1 8B InstructGlobal0.71 / 0.70
OpenAItext-embedding-3-smallGlobal0.78 / 0.79
PerplexityLlama 3.1 8B InstructGlobal0.90 / not measured
ReplicateLlama 3 8B InstructGlobalnot measured / 1.00
AnthropicClaude 3 HaikuPer-organization0.84 / not measured
OpenAIGPT-4o miniPer-organization0.79 / 0.86

Average precision summarizes the tradeoff across timing thresholds. Precision is the share of positive classifications that came from the procedure intended to produce hits. Recall is the share of that procedure’s samples the classifier identifies. Most detected endpoints had average precision near 0.8, and the paper reports near-perfect precision for part of the recall range. Those are results for the paper’s samples. Routing meant that even the group intended to produce hits could include misses. The Anthropic Claude 3 Haiku and OpenAI GPT-4o mini results matched their documented organization boundaries. The authors classified the global sharing on OpenAI’s embedding endpoint as a potential vulnerability.

The audit found no statistically significant timing separation at the tested endpoints of nine providers, including DeepSeek. Azure also illustrates the importance of checking the endpoint. Its GPT-4o mini endpoint showed no significant separation, while its text-embedding-3-small endpoint showed global sharing. At DeepSeek, the researchers confirmed actual cache hits using returned token counts despite seeing no significant timing difference. They also used those counts to verify the per-user boundary DeepSeek described in 2024. A usage field such as prompt_cache_hit_tokens reports how many tokens the current request reused. Establishing the separation between accounts took controlled comparisons.

What a timing leak can and cannot reveal

Prefix inference. Within a shared cache, timing can suggest that a candidate prefix has been submitted before. A prefix from a common template could apply to many prompts. The inference gets weaker as the shared prefix gets shorter in the paper’s tests. That limits what a timing difference can say about a whole prompt, especially about content after the matched prefix.

Prompt extraction. The researchers could not reliably distinguish the effect of one additional cached token. They also found that a request can populate the cache itself, making later hits ambiguous. The paper notes that inference may be easier against a restricted set of target prompts, such as known templates where users enter private personal information.

Architecture information. In a decoder-only Transformer, adding a suffix leaves the earlier tokens’ key-value state reusable because those tokens attend only to earlier positions. With bidirectional attention, the suffix can change the prefix’s state. The authors observed prefix reuse across different suffixes in OpenAI’s text-embedding-3-small, and changing the suffix still changed the embedding. Assuming the model is Transformer-based, they took this as evidence of a decoder-only architecture. Embeddings classified as cache hits also differed from misses on the order of 10^-4 to 10^-5 per coordinate. The authors hypothesized that the reused state was stored at lower precision.

Disclosure and what providers changed

The authors disclosed results to every provider where they detected caching in October 2024, with a 60-day window before publication; the actual elapsed time ended up longer. To their knowledge, at least five providers made changes in response, such as disabling global cache sharing across organizations and updating documentation. OpenAI’s global sharing on text-embedding-3-small was patched after the disclosure.

Per-user isolation prevents cross-user prefix inference in the paper’s model. The authors expect it to retain many of the performance benefits of global sharing, since different users are unlikely to send prompts with long matching prefixes. If a provider shares within an organization, publishing the boundary helps customers decide whether to put workloads in separate organizations.

Architecture inference can persist with a cache that serves a single user. Disabling that cache removes the timing signal it produces, including the architecture signal. The authors also discuss delaying hits to resemble misses. That trades away the user’s latency benefit while preserving the provider’s compute savings.

Where providers draw the cache boundary now

Check the isolation policy for the service and deployment you use. The table distinguishes the guides available as of November 30, 2026 from DeepSeek’s historical audit result.

ProviderSharing and retention evidenceSource
AnthropicOrganizations never share caches, even for identical prompts. On the Claude API, Claude Platform on AWS and Microsoft Foundry, caches are also isolated between workspaces; on Google Cloud managed Claude and Amazon Bedrock, isolation is per organization onlyPrompt caching docs
Azure OpenAIThe in-memory retention section documents subscription isolation and typical clearing after 5 to 10 minutes of inactivity, with a maximum of one hour since last use. Extended retention and GPT-5.6-or-later minimum lifetimes follow separate rules.Azure prompt caching doc
OpenAICaches are not shared across organizations and cannot be reused across regional processing boundariesOpenAI prompt caching guide
DeepSeekThe auditors observed per-user isolation in 2024. The current context caching guide documents hit and miss token counts.Gu et al. and DeepSeek Context Caching

Retention describes how long an entry can be reused. Isolation determines who can reuse it during that time. Anthropic says prompt caching is eligible for Zero Data Retention and that it holds cached KV state and cryptographic hashes in memory. It gives a minimum lifetime of 5 minutes or 1 hour, depending on the selected TTL. Azure uses a different distinction. For earlier models, the extended policy allows up to 24 hours of retention. On GPT-5.6 and later, its TTL sets a minimum lifetime, so cached state may stay eligible longer.

On OpenAI GPT-5.6 and later, use a distinct prompt_cache_key for each customer whose cache accounting you want to keep separate. OpenAI says consistent keys also help prevent cross-customer cache-hit probing. For provider-level isolation rely on OpenAI’s documented organization and regional processing boundaries. The OpenAI prompt_cache_key routing guide covers the key’s different role on earlier models.

For a shared vLLM deployment, check whether prefix caching is enabled. With caching on, vLLM includes the optional cache_salt in the first block’s hash so reuse is restricted to requests with the same salt. Set the salt at a trusted gateway from the authenticated tenant’s identity, keep it consistent within the intended trust group and prevent callers from overriding it. Follow the same rule on every path that can send requests to the shared engine. vLLM defaults to sha256 as of v0.11 to reduce collision risk and warns that non-cryptographic options such as xxhash increase that risk. The vLLM vs SGLang prefix caching comparison covers the engines’ cache internals.

Mistral recommends using a stable application identifier, such as a conversation, session or workflow ID, for prompt_cache_key. Its guidance excludes secrets, API keys and sensitive user data from the value.

How to verify your cache boundary

  1. Identify the scope your workload uses. Record the model, endpoint, deployment and documented account boundary before sending sensitive prefixes. On hosted endpoints where you lack server-side visibility, base your isolation decision on the provider’s documented scope. Usage counters such as OpenAI’s cached_tokens report reuse for the current request and carry no information about who populated the cache.
  2. Review the partition mapping on a deployment you control. Trace how authentication determines the cache partition. In staging, use synthetic inputs and verify from server-side cache telemetry that a repeated request can reuse its own partition’s entry. Keep the model and cache settings fixed. This positive control establishes that your setup can observe reuse at all.
  3. Check the separation between partitions. With the same staging configuration, confirm that the synthetic requests in different partitions use independent entries. Where available, use server-side records of hits and partition assignment. A miss is inconclusive if the same-partition control also misses, and latency alone cannot distinguish an isolation boundary from a weak timing signal.
  4. Match partitions to the data’s trust groups. For example, if a provider’s boundary is the organization, two teams inside it share the documented scope. If their data requires separation, place the workloads in separate documented partitions. On infrastructure you control, disabling shared prefix caching removes that shared cache when you cannot enforce the partition.

What to do next

  • If the provider’s documented boundary is broader than your trust group, use separate organizations, subscriptions or workspaces where the service documents those boundaries. Budget for a separate first cache fill in each partition using the AI Provider Pricing Index.
  • If you operate vLLM, check that authenticated tenants map to different cache_salt values and that the gateway owns the value even when the caller supplies one.
  • If you need to quantify the cost of isolation, record how much of each workload’s input is read from cache before and after the change. The prompt caching overview describes the basic read and write charges.

Sources

How this note was produced

Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.

Prompt Cache Timing Side Channels: What a 17-Provider Audit Found. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/prompt-cache-timing-side-channel/

Sources