Skip to content

Operator task guide

How to configure vLLM KV cache quantization, FP8, and offloading

Switching the KV cache from BF16/FP16 to FP8 (--kv-cache-dtype fp8) cuts per-token KV memory in half on supported Hopper, Ada, and Blackwell GPUs, allowing roughly twice the concurrent context or batch capacity before hitting cache-block OOM or preemption.

Before rolling FP8 KV cache or CPU offloading into production, confirm your attention backend supports the chosen dtype, check whether explicit KV scaling factors are required, and benchmark accuracy plus p99 latency on representative long prompts.

Reviewed . Reference guidance is not a diagnosis of your workload.

Step-by-step method

  1. 1

    Measure baseline KV cache capacity and token pressure

    Inspect startup logs for the exact GiB allocated to KV cache blocks and maximum concurrency at your target context length before altering dtype or offloading flags.

    grep -iE 'available kv cache|maximum concurrency|gpu blocks' vllm.log
    nvidia-smi --query-gpu=name,compute_cap,memory.total,memory.free --format=csv
  2. 2

    Enable FP8 KV cache on supported GPUs

    On NVIDIA Ada (sm_89), Hopper (sm_90), or Blackwell (sm_100/sm_120) GPUs, test --kv-cache-dtype fp8 (or fp8_e4m3 depending on vLLM release). Check startup logs to confirm FlashAttention or FlashInfer accepts the selected cache dtype.

    vllm serve YOUR_MODEL \
      --kv-cache-dtype fp8 \
      --calculate-kv-scales \
      --max-model-len 32768 \
      --gpu-memory-utilization 0.90
  3. 3

    Evaluate CPU KV cache offloading tradeoffs

    If weights plus minimum active KV blocks still exhaust HBM, test CPU offloading or prefix caching carefully. PCIe host-to-device transfers add tail latency compared with scaling tensor parallelism across an extra GPU.

    # Test CPU swap space or KV offloading limits on a single control replica
    vllm serve YOUR_MODEL --swap-space 16 --max-num-seqs 64
  4. 4

    Verify output quality and throughput under fixed load

    Run an evaluation set with long-context reasoning or tool-calling prompts to verify FP8 KV quantization did not introduce quality drift, and compare preemption counts against the BF16 baseline.

    vllm bench serve --backend vllm --base-url http://127.0.0.1:8000 \
      --model YOUR_MODEL --dataset-name random --random-input-len 8192 --random-output-len 512 --num-prompts 100

Choosing between FP8 KV cache, TP scaling, and offloading

Signals, meanings and actions for how to configure vllm kv cache quantization, fp8, and offloading.
SignalWhat it meansNext action
H100/H200/B200/L40S hitting KV cache preemptions at long contextFP16 KV cache occupies excess HBM.Test --kv-cache-dtype fp8 with --calculate-kv-scales and validate accuracy.
Startup error: FP8 KV cache not supported on backend/compute_capOlder GPU architecture or incompatible attention kernel.Check compute capability (sm_80 Ampere lacks native FP8 KV in some backends) or update vLLM.
Startup error: No available memory for the cache blocks even with FP8 KVModel weights alone consume nearly all HBM.Quantize model weights (FP8/AWQ/GPTQ) or increase --tensor-parallel-size.
Latency spikes after raising --swap-spaceRequests are swapping KV blocks over PCIe to host RAM.Lower --max-num-seqs or add GPU capacity for interactive SLOs.

Evidence checklist

  • vLLM startup log showing KV cache GiB and block counts
  • GPU architecture and compute capability (sm_80, sm_89, sm_90, sm_100)
  • Attention backend selected by vLLM at startup
  • Preemption rate and p99 ITL before and after --kv-cache-dtype fp8
  • Host PCIe/RAM utilization if CPU swap or offloading is enabled

Common mistakes

Enabling FP8 KV cache without checking accuracy on long context

Dynamic range loss can affect needle-in-a-haystack or math reasoning if KV scales are omitted or mismatched.

Assuming --swap-space gives free VRAM capacity

Swap space only stages preempted blocks in host RAM; active batches still must fit inside GPU HBM.

Leaving --max-model-len at a huge default

Models advertising 128k+ context force vLLM to reserve oversized worst-case slots unless capped.

Frequently asked questions

How much VRAM does --kv-cache-dtype fp8 save in vLLM?

Moving the KV cache from 16-bit (BF16/FP16) to 8-bit FP8 cuts KV cache memory per token by 50%, roughly doubling token capacity or concurrent batch size on the same GPU.

Which NVIDIA GPUs support FP8 KV cache in vLLM?

Ada Lovelace (L4, L40S, RTX 4090), Hopper (H100, H200), and Blackwell (B200, RTX 5090) provide native hardware FP8 support. Older Ampere (A100) GPUs have narrower kernel support depending on the selected attention backend.

What is the difference between weight quantization and KV cache quantization?

Weight quantization (FP8/INT4/AWQ) shrinks static model parameters in HBM. KV cache quantization shrinks dynamic per-token attention keys and values that grow with context length and concurrency.

When should I use KV cache offloading instead of more GPUs?

Use CPU offloading or prefix caching when batch throughput or offline processing can tolerate PCIe transfer latency, and scale tensor/data parallelism when strict interactive TTFT and ITL SLOs apply.

Live diagnosis, no signup

Upload your GPU log. Find what happened first.

Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.

Before uploading, review cloud data handling and local options.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

Try Denpex for 30 days. FREE.

No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.

Start your free 30-day Team evaluation

Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.

Use your company email, for example alex@yourcompany.com.

Who qualifies?

Company email domains activate the free 30-day Team evaluation (up to 50 diagnoses a day) after an email and domain check, whatever mail provider you use. If we cannot verify your domain automatically, support reviews it: write to support@denpex.com. Free local diagnosis in the editor extension needs no account.

Using a personal email (Gmail, Outlook, Naver, QQ) or solo cluster? Create a free $0 account (no work email required) to save 7-day history and unlock AI fallback, or send a cluster crash log for a live walkthrough.

Apply the method to your incident

Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.

Diagnose your incident