atlas

Research map / Large language models / Reasoning and chain of thought

KeyDiff: Key Similarity-Based KV Cache Eviction for Long-Context LLM Inference in Resource-Constrained Environments

NeurIPS 2025 · Large language models › Reasoning and chain of thought · approach: KV cache compression · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes KeyDiff, a training-free, attention-free KV cache eviction method that keeps keys with the lowest cosine similarity to a mean-key anchor, enabling block-wise prompt processing under strict memory budgets.

Problem

KV cache memory grows with prompt length, and existing attention-based eviction policies degrade under block-wise prompt processing (where only the current block and cache are visible) and require materializing attention matrices, which is incompatible with FlashAttention in resource-constrained set

Approach

Observes that keys with low pairwise cosine similarity (geometrically distinctive keys) tend to receive high attention; scores each cached key by cosine similarity to an anchor vector (mean of normalized keys) and evicts the most similar ones, giving an O(n) attention-free score with a theoretical link to attention weights and a subset-diversity optimization view.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use KeyDiff instead of SnapKV for KV cache evictionLlama3.1-8B · LongBench English subset, 2K–8K cacheAvg. accuracy: 44.33 vs 39.60; 47.66 vs 45.18; 48.51 vs 47.12; 49.03 vs 48.06Helped
Use KeyDiff instead of SnapKV for KV cache evictionLlama3.2-3B · LongBench English subset, 2K–8K cacheAvg. accuracy: 38.14 vs 35.46; 43.67 vs 40.60; 45.27 vs 43.55; 45.78 vs 44.96Helped
Add a sliding window to KeyDiffKeyDiff · LongBench coding tasksAccuracyHelped
Vary the anchor vector choice (ablation)KeyDiff · Ablation benchmark resultsAccuracyNo clear effect
Use cosine similarity as the distance metric (ablation)KeyDiff · Ablation benchmark resultsAccuracyHelped
Use KeyDiff with FlashAttention instead of TOVA or SnapKVLlama3.2-3B · Inference latency evaluationEnd-to-end inference latency: up to 30%Helped

Surprising findings

Limitations

Experimental setup

Datasets: LongBench Needle In a Haystack Math-500

Benchmarks: LongBench Needle In a Haystack Math-500

Metrics: accuracy F1 / task score time to first token

Baselines: H2O TOVA SnapKV StreamingLLM (sink attention)

Builds on: H2O TOVA SnapKV StreamingLLM FlashAttention

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy