[New Press] ProactiveCachePress - Training-Free Proactive KV Eviction via Attention Prototypes
Hi @maxjeblick,
I'm an independent researcher (20, third-year CS undergraduate) and I've implemented a ProactiveCachePress for kvpress based on my paper on training-free proactive KV cache eviction.
Headline result on LLaMA 3.1 8B, PG-19(Project Guntenberg) books:
- Budget 512: PPL 26.14 vs StreamingLLM 156.22 - a 5.98× improvement
- Budget 512 on WikiText: PPL 10.25 vs StreamingLLM 47.34 - a 4.6× improvement
- Zero training required - works on any frozen pretrained model
- Makes the decode step of inference o(1) , prefill still stays quadratic
Links:
- 📄 OpenReview: https://openreview.net/forum?id=UsdzvxDZUO
- 📄 Zenodo DOI: https://doi.org/10.5281/zenodo.20465914
- 💻 Implementation: https://github.com/skhavin/proactive-cache
- 🤗 Demo: https://huggingface.co/spaces/skhavin/proactive-cache
- 📦 pip install proactive-cache
Core idea:
Unlike reactive methods (StreamingLLM, H2O) that score tokens after attention, Proactive Cache profiles a frozen model's attention heads offline, clusters per-head patterns into behavioral prototypes, and predicts which tokens to retain before any query arrives. Tokens are evicted at ingest - never written to cache - bounding decode attention to O(B²) = O(1) in sequence length.
Architecture - three phases:
- Offline calibration: K-Means clustering of attention patterns into 4 prototypes per (layer, head) pair. Converges in ~300 documents.
- Inference prediction: Lightweight TF-IDF encoder matches incoming document to nearest prototype. O(1) lookup.
- Split-budget eviction: 4 sink tokens + 50% contiguous recency + remaining budget for semantic prototypes. Maintains RoPE coherence across all budgets.
KVPress standard harness results (LLaMA 3.1 8B, 25% retention):
| Method | PPL ↓ | Status |
|---|---|---|
| Full Attention | 6.50 | Baseline |
| Proactive Cache (ours) | 13.11 | ✅ Stable |
| StreamingLLM | 11.41 | ✅ Stable |
for
NUM_DOCS = 2 SEQ_LEN = 128 EVAL_TOKENS = 15
Integration:
ProactiveCachePress inherits from ScorerPress and is ready to plug in:
from proactive_cache import ProactiveCachePress
press = ProactiveCachePress(
compression_ratio=0.75,
prototype_path="prototypes.pkl"
)
with press_context(model, press):
outputs = model.generate(**inputs)
Happy to submit a PR - the ScorerPress interface is already implemented and tested. Let me know if you'd like me to proceed.
Best regards,
S. Khavin - Independent Researcher, Chennai, Indiahttps://skhavin.github.io ORCID: 0009-0008-7536-5254
Thanks a lot for the detailed proposal. Before we consider adding a new press, please benchmark it against the standard kvpress evaluation setup used for the leaderboard: https://huggingface.co/spaces/nvidia/kvpress-leaderboard
PPL-only results are not enough for us to judge whether a method is useful in kvpress. Please compare against the existing presses on the leaderboard tasks and submit a PR only if the method is competitive there.
Once you have those results, feel free to open a PR and we can review the implementation in that context.
Thanks for the guidance. Running RULER evaluation. I will run it on cloud and post the updates within 24hrs
Apologies for the delay in updating this thread. I hit a cloud credit limit during the final benchmark runs, but I have successfully recovered the finalized results.csv data.
The RULER scores confirm that this method is not optimized for standard needle-retrieval tasks. This is expected by design, as the architecture intentionally trades isolated needle retrieval for global structural coverage with zero per-input computation overhead.
Because of this flat computation profile, the method is better suited for resource-constrained edge deployment scenarios rather than standard long-context leaderboard use cases. I will close this issue now, but the repository remains open for anyone looking to explore this query-free operating regime.
Thanks for the guidance, @maxjeblick!