Download README.md from jaytonde05/kv-cache-quantization-commands: direct link, hf CLI and curl.
- Browser
- Download file 3.31 kB
-
https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/README.md
- Command line
-
hf download hf://datasets/jaytonde05/kv-cache-quantization-commands/README.md
-
curl -L -o README.md https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/README.md
pretty_name: KV Cache Quantization Run Commands
tags:
- vllm
- kv-cache
- quantization
KV cache quantization: run commands
These are the scripts and commands for the post "KV Cache Quantization, Measured: What FP8 and NVFP4 Really Cost". This repo holds commands only. It does not hold model weights, benchmark data, or model responses.
Setup
| Item | Value |
|---|---|
| Models | Qwen/Qwen3.8-27B, google/gemma-4-31B-it (weights in BF16) |
| GPU | NVIDIA H200 141 GB, one GPU per config. A 2-GPU VM ran two configs at the same time. |
| vLLM | 0.32.0rc1.dev30+g3ad096faf (scripts/bench/setup_vllm.sh) |
| Python packages | requirements-freeze.txt |
| Terminal-Bench | Terminal-Bench 2.1 with Harbor and the terminus-2 agent |
Configs
| Name | --kv-cache-dtype |
--attention-backend |
|---|---|---|
| BF16 | bfloat16 |
FLASH_ATTN |
| BF16-FI | bfloat16 |
FLASHINFER |
| FP8 | fp8_e4m3 |
FLASH_ATTN |
| FP4 (NVFP4) | nvfp4 |
FLASHINFER |
| BF16-TFA | bfloat16 |
TRITON_FLASH_ATTN |
For RULER, DocVQA and MRCR, Gemma FP8 used TRITON_FLASH_ATTN, and Gemma BF16-FI and FP4 used --language-model-only (text only), because FlashInfer has no Gemma image attention on H100 or H200. All Gemma Terminal-Bench runs used --language-model-only and the backend in the table above.
Serve command used by scripts/bench/exp2.sh:
vllm serve $MODEL --served-model-name $NAME --port $PORT --dtype bfloat16 \
--max-model-len $MAXLEN --gpu-memory-utilization 0.90 --reasoning-parser $RP --seed 0 \
--kv-cache-dtype $KV --attention-backend $BE
Order of work
- Install and download:
setup_vllm.sh,download_model.sh. - Prepare data:
prep_data.py,make_6t.py,mrcr.py prep,prep_gemma.sh. - RULER, DocVQA, MRCR:
exp2.sh, driven byexp2_gpu0.sh,exp2_gpu1.sh,after_tb.sh,gemma_rest.sh. Score withscore_exp2.pyandmrcr.py. - Terminal-Bench:
tb_queue.sh,tb_server.sh,tb_rerun_timeouts.sh,gemma_tb.sh,gemma_env.sh. Score withscore_tb.pyandscore_nolim.py. - Nightly backend check for Gemma images, 9 Nov 2026:
scripts/nightly_check/.
COMMANDS.md has every vllm serve and vllm bench serve command written out in full.
top_level_commands.txt has the launch commands from the VM shell history. exp0* scripts, kl_probe.py, and the smoke scripts were exploratory, and the post does not use their results.
Run times
Time is the wall clock for the whole benchmark, including interruptions. It is not a speed test. Each config used the same concurrency, but response lengths differ.
| Config | RULER 4K + 32K + 128K | DocVQA | MRCR | Terminal-Bench k=3 |
|---|---|---|---|---|
| Qwen BF16 | 55 min | 7.2 min | 78 min | 37.3 h |
| Qwen BF16-FI | 62 min | 7.3 min | 89 min | 39.9 h |
| Qwen FP8 | 62 min | 7.3 min | 90 min | 24.0 h |
| Qwen NVFP4 | 93 min | 7.5 min | 131 min | 26.1 h |
| Gemma BF16 | 207 min | 10.9 min | 415 min | 34.5 h |
| Gemma BF16-FI | 190 min | not supported | 252 min | 29.2 h |
| Gemma FP8 | 181 min | 11.7 min | 337 min | 28.4 h |
| Gemma NVFP4 | 316 min | not supported | 443 min | 27.1 h |
Qwen no-limit reruns of timed-out Terminal-Bench tries took about 42 to 45 hours per config. Gemma reruns are not finished, so Gemma Terminal-Bench scores are raw.