Similarity is not effectiveness: defending large language model semantic caches against poisoning attacksSimilarity Is Not Validity: Defending LLM Semantic Caches Against Poisoning
Translation in progress — untranslated text is omitted.
The paper proposes a defense method against poisoning attacks on large language model semantic caches, intercepting 82.0% to 98.2% of poisoned entries at a 5% false positive rate across three types of poisoning attacks, with negligible serving overhead. Semantic caches reduce serving costs by reusing existing answers to semantically similar queries, but retrieval relies only on the embedding similarity between the query and cache entries, so an attacker can cache a malicious response under a query with high cosine similarity to benign requests. From an information bottleneck perspective, the authors point out that query embeddings may lose the information needed to distinguish valid from invalid cache hits, limiting matching algorithms that use only these embeddings. The defense exploits the paraphrase-plus-residue structure shared by poisoned queries, that is, the paraphrase maintains high similarity while the residue content induces the malicious response, using Deletion Gain to search shortened variants of the cached query for similarity gain, then using Answer Check to test whether the deleted text contributes to the stored answer, and searching with a sliding window for deletions that satisfy the condition.
- Semantic caches directly reuse stored answers by embedding similarity, so an attacker can cache a malicious answer and make similar benign queries hit it. The authors argue that similarity does not equal hit effectiveness, and that embeddings may lose the information needed to distinguish effective from ineffective hits.
- The authors observe that poisoned queries exhibit a rewrite–residual structure: the rewrite maintains similarity, and the residual content induces a malicious answer. Deletion Gain deletes segments of the cache key to find the similarity gain, and Answer Check tests whether the deleted text affects the stored answer; a hit is rejected only when both trigger. Variant embeddings are precomputed at write time.
- On e5 at 5% FPR, BR on CAP/SCP/KCA is 82.0%/95.6%/98.2%, end-to-end ASR drops from 30.0%/80.2%/91.6% to 0.6%/2.6%/1.4%, and each hit adds 0.021 ms. Under five adaptive attacks, the authors state that there is a trade-off between evasion and attack effectiveness.
- The authors note: fused or interleaved residuals weaken the Deletion Gain signal; when some deployments use only part of the input as the cache key, an attacker can place the residual in the excluded input. Evaluation is limited to three attack types, four small embedding models, and one victim LLM (Qwen3-8B).
Related papers
- LaCache: Robust Semantic Caching for LLM ServingDefensesarXiv