Preprint
Article

This version is not peer-reviewed.

DepthSketch-KV: Query-Conditioned Cross-Layer Residual Sketches for Long-Context KV Cache Compression

Submitted:

08 July 2026

Posted:

09 July 2026

You are already at the latest version

Abstract

Long-context language model inference is increasingly limited by the memory footprint and bandwidth cost of KV caches, especially when retrieval-heavy prompts require preserving information across many layers. We introduce DepthSketch-KV, a cache compression method that exploits cross-layer redundancy by storing a shared low-rank residual sketch for adjacent transformer layers together with small per-layer key and value corrections. During decoding, query-conditioned depth gates estimate attention drift and choose whether each layer should access its local full-rank cache, the shared compressed cache, or a mixed reconstruction. A calibration-free error controller converts logit drift into per-sequence cache budgets, avoiding task-specific tuning while adapting to heterogeneous prompts. Across LongBench, Needle-in-a-Haystack, NarrativeQA, Qasper, HotpotQA, GovReport, MultiNews, HumanEval, and MBPP, DepthSketch-KV consistently reduces KV cache memory at 32k and 64k contexts while preserving retrieval, QA, summarization, and code completion accuracy. Compared with MiniCache, H2O, StreamingLLM, SnapKV, PyramidKV, KIVI, and FlexGen, it improves the accuracy-memory tradeoff, increases decoding throughput, and reduces time to first token with only small changes in perplexity.

Keywords: 
;  ;  ;  ;  ;  
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

© 2026 MDPI (Basel, Switzerland) unless otherwise stated

Accessibility

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings