cs.CLApr 11, 2026

CodeComp: Structural KV Cache Compression for Agentic Coding

Authors: Qiujiang Chen, Jing Xiong, Chenyang Zhao, Sidi Yang, Ngai Wong

Organizations: The University of Hong Kong · LMSYS Org

Abstract

Agentic code tasks such as fault localization and patch generation require processing long codebases under tight memory constraints, where the Key-Value (KV) cache becomes the primary inference bottleneck. Existing compression methods rely exclusively on attention signals to estimate token importance, systematically discarding structurally critical tokens such as call sites, branch conditions, and assignments that are essential for code understanding. We present CodeComp, a training-free KV cache compression framework that incorporates static program analysis into LLM inference via Code Property Graph priors extracted by Joern. Across bug localization and code generation benchmarks, CodeComp consistently outperforms attention-only compression baselines under equal memory budgets, recovering the majority of full-context accuracy under aggressive KV cache compression, while matching the patch generation quality of uncompressed full-context inference and integrating seamlessly into SGLang-based agentic coding pipelines without model modification.

Figures & tables

Appendix figures & tables1 asset

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. ActKV: Efficient LLM Agents through Action-Guided KV Cache Management

    Sep 25, 2026Zihan Wang, Cheng Tang, Lei Gong +4KV-Cache ManagementKV-Cache Compression

  2. AlignPred: Error-Controlled KV Cache Compression via Alignment and Predictive Coding

    Oct 13, 2026Xu Yang, Jiapeng Zhang, Zhiwei Zuo +5KV-Cache CompressionMemory Compression