Skip to content
MAC-AutoMLPublic

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🧭 CommitKV

Commit-Aligned KV Cache Compression for Multimodal Agents

Weizhong Huang · Jinchao Zhang · Xiawu Zheng

arXiv Project Page Apache 2.0 License Python 3.11 PyTorch 2.6+ Backends

Method · Results · Installation · Benchmarks · Docs · Citation

Minimalist frosted-glass KV cache cards gliding through two brushed-metal commit gates as retained emerald and amber pages align into a compact cache tray

Important

CommitKV is a training-free KV cache compressor for multimodal tool-use agents. It measures how each cache page's evidence changes across a tool interaction to retire stale pages, temporarily protect recently influential pages, and rank remaining candidates within a fixed token budget.

🎯 512-Token Mean Accuracy 💾 Peak GPU Memory Saved ⚡ End-to-End Speedup
69.85% (Qwen3-VL-8B; +9.19 on Qwen3.8-27B) 54.37 – 55.23% (256 tokens) 2.12 – 2.17× (SGLang & vLLM)

🔬 Method

Paper Figure: CommitKV commit-aligned measurement, page retirement and protection, and joint token ranking within a fixed KV budget

1 · Measure Across Tool Call 2 · Retire & Protect Pages 3 · Joint Budget Ranking
Compares each KV page's deletion effect before the tool call and immediately after the observation returns. Retires pages with low influence in both windows and temporarily protects recently influential pages. Ranks remaining candidates using attention, key redundancy, and token-level deletion effects.

📊 Key Results

Paper overview: Qwen3-VL-8B accuracy across KV budgets and headline speedup and memory savings

Main Results (Avg. across 8 Benchmarks @ 512 Tokens)

Unweighted mean (%) across MMSearch, A-OKVQA, ViQuAE, V*Bench, RWQA, MathVista, MMVP, and OCRBench. Full per-benchmark tables, 256/1024 budgets, and ablations are in docs/results.md.

Model FullKV (Ref) Best Baseline CommitKV Gain
Qwen3-VL-8B-Instruct 70.76 68.07 (AgentKV) 69.85 +1.78
Qwen3.8-27B 82.26 57.45 (R-KV) 66.64 +9.19
Phi-4-Reasoning-Vision-15B 63.54 60.26 (R-KV) 62.02 +1.76
MiniCPM-V-4.7-35B-A3B 77.74 72.94 (AgentKV) 74.21 +1.27

Inference Efficiency (8,192 Prompt + 163,840 Generated Tokens)

Paper Figure: Peak GPU memory and end-to-end latency for SGLang and vLLM at 256 cache tokens

Backend Method Budget Peak GPU Memory (GiB) Latency (s) Speedup
SGLang FullKV — 41.43 2253.2 1.00×
SGLang CommitKV 256 18.55 1060.3 2.13×
vLLM FullKV — 41.20 2274.2 1.00×
vLLM CommitKV 256 18.80 1046.3 2.17×

⚙️ Supported Configurations

Checkpoint Model Key Task Evaluation Backend vLLM Efficiency Path
Qwen3-VL-8B-Instruct qwen3vl SGLang ✅ Single-request V1 worker
Qwen3.8-27B qwen38 SGLang —
Phi-4-Reasoning-Vision-15B phi Transformers —
MiniCPM-V-4.7-35B-A3B minicpm Transformers —

Note

These portable adapters target batch size 1 on a single device with prefix reuse and CUDA graphs disabled. The vLLM path uses its native V1 worker and elastic physical KV cache, while SGLang reclaims evicted slots in its native KV pool. Matching the paper's exact optimized latency additionally uses graph captures and backend-specific fused kernels.


🛠️ Installation

Use Linux, Python 3.11, and a CUDA-capable NVIDIA GPU. Set up each backend in its own virtual environment.

SGLang (qwen3vl, qwen38)

python3.11 -m venv .venv-sglang
source .venv-sglang/bin/activate
python -m pip install --upgrade pip
python -m pip install 'sglang==0.5.12.post1'
python -m pip install -e '.[data,eval]'
commitkv serve --model-key qwen3vl --budget 512 --audit runs/sglang.jsonl

For Qwen3.8, pass --model-key qwen38 (or a local path via --model). See the SGLang installation guide.

Transformers (phi, minicpm)

python3.11 -m venv .venv-transformers
source .venv-transformers/bin/activate
python -m pip install --upgrade pip
python -m pip install 'transformers==4.57.6' 'accelerate>=1.6' torchvision
python -m pip install -e '.[data,eval]'
commitkv serve --model-key phi --budget 512 --audit runs/phi.jsonl

Use a separate environment for MiniCPM-V with transformers==5.20.2 and --model-key minicpm. Match PyTorch wheels to your driver via PyTorch installation.

vLLM (qwen3vl)

python3.11 -m venv .venv-vllm
source .venv-vllm/bin/activate
python -m pip install --upgrade pip
python -m pip install 'vllm==0.11.0' 'transformers==4.57.1'
python -m pip install -e '.[eval]'
commitkv serve --backend vllm --model-key qwen3vl --budget 512

See the vLLM 0.11.0 GPU guide. For an auditable check after a prompt longer than --budget, inspect http://127.0.0.1:8000/commitkv/snapshot (also exposed by Transformers).


🧪 Benchmarks

commitkv prepare --output data
commitkv evaluate --model-key qwen3vl --dataset mmvp \
  --data data/mmvp.jsonl --budget 512 --limit 2 --output runs/mmvp_smoke.jsonl

Remove --limit for the full split. For retrieval-only tools, run commitkv retrieval in a second terminal with SERPER_API_KEY set and pass --tool-url http://127.0.0.1:8010/tools --tools search image_search. See docs/benchmarks.md for all splits, judge setup, and tool contracts.


📚 Documentation & Tests

Guide Description
docs/results.md Complete per-benchmark tables, 256/512/1024 budgets, efficiency, and ablations
docs/benchmarks.md Dataset preparation, pinned revisions, judge server, and retrieval tool contract
docs/serving.md GPU smoke tests, audit snapshots, and serving verification commands
NOTICE.md Third-party attribution, dependencies, model weights, and dataset notices
📁 Repository Structure & Unit Tests
CommitKV/
├── docs/                  # Paper results, benchmark & serving guides, paper figures
├── examples/              # Compression smoke test script
├── src/commitkv/
│   ├── core.py            # Shared commit-aligned eviction & protection policy
│   ├── scoring.py         # Attention, key redundancy & deletion-effect ranking
│   ├── events.py          # Tool boundary & literal alignment to token positions
│   ├── backends/          # SGLang, vLLM, and Transformers runtime adapters
│   └── data/              # Public dataset preparation & revision pins
└── tests/                 # Unit tests for deletion effects, retention & scoring
python -m pip install -e '.[test,eval]'
python -m unittest discover -s tests -v

📝 Citation

@article{huang2026commitkv,
  title   = {CommitKV: Commit-Aligned KV Cache Compression for Multimodal Agents},
  author  = {Huang, Weizhong and Zhang, Jinchao and Zheng, Xiawu},
  journal = {arXiv preprint arXiv:2608.07855},
  year    = {2026},
  url     = {https://arxiv.org/abs/2608.07855v2}
}

📄 License

Released under the Apache-2.0 License. See NOTICE.md for third-party attributions.

Releases

Packages

Contributors

Languages