Skip to content

Verify an FP8 KV-cache change (vLLM, CUDA)

This profile (local_vllm_kv_cache_precision.v1) compares a reference that uses the model's automatic KV-cache dtype with a candidate that uses an FP8 cache (fp8, fp8_e4m3 or fp8_e5m2). Everything else is identical: model files, tokenizer, runtime settings, workload, generation and trial schedule.

FP8 is a lossy change, so this profile always requires declared task checks on the workload and an explicit acceptance policy. A completed comparison therefore ends in PASS or FAIL, never just VERIFIED.

Requirements

  • Linux with an NVIDIA GPU of compute capability 8.9 or newer (Ada, Hopper or later). Older GPUs cannot run the pinned engine's FP8 cache path; see hardware boundary.
  • The pinned vllm==0.30.0+cu129 wheel with PyTorch 2.13.0+cu129, prepared as for prefix-cache verification.
  • A local model directory with a trusted file-to-SHA-256 descriptor.
  • A JSONL workload whose prompts declare task checks, and a policy JSON file.

Prepare and verify

metria recipe prepare-vllm \
  --model /path/to/local/model \
  --descriptor trusted-model-files.json \
  --workload tasks.jsonl \
  --policy policy.json \
  --kv-cache-dtype fp8 \
  --output fp8-study.json

metria verify fp8-study.json --output fp8-verification --json

Preparation refuses a recipe without a policy or without task checks.

STAGED: trajectory KL divergence. Add --staged-kld to also capture vLLM's raw top-20 logprobs on every call and score how far the FP8 cache moved the next-token distributions, before any sampled token changes. The policy can then bound behavior.trajectory_kld_mean or behavior.trajectory_kld_max in nats:

{"target": "behavior.trajectory_kld_mean", "version": "0.1.0", "max": 0.05}

The recipe records the metria.staged_captures override in both runs' trial policy, declares the metria.trajectory_kld analysis, and treats missing distributions or a non-raw logprobs_mode as an evidence gap. No native L4 run of this option is retained yet, so choose thresholds from your own reference runs.

What the verifier checks

  • Requested → resolved → observed. Each run requests one vllm.kv_cache treatment. The resolved KV-cache dtype and the engine's own cache.cache_dtype (from both the applied-state and identity readbacks) must equal the request. An engine that reports a different dtype is rejected before measurement (EXECUTION_FAILED); one that does not report it at all leaves an evidence gap (INSUFFICIENT_EVIDENCE).
  • Only the cache dtype differs. The comparison may vary exactly five paths: treatments, resolved.kv_cache.dtype, observed.configured.kv_cache.dtype, observed.applied.fields.cache.cache_dtype and observed.identity.applied.fields.cache.cache_dtype. Prefix caching is off in both runs.
  • Pinned content. Model/tokenizer files and the runtime installation are verified after launch, as in the prefix-cache profile.
  • Decision. Trajectory agreement, task-check pass rates, reference repeatability and loaded-engine latency feed the policy. Pass rates for both runs are reported, so a workload the model cannot solve fails visibly in the reference as well as the candidate.

Retained evidence

artifacts/qualification/fp8-kv-cache-verify-l4/ is a complete run on an NVIDIA L4 with SmolLM2-360M-Instruct and the public representative pilot workload. FP8 applied, trajectories were identical, and the policy failed because the reference and candidate each passed 6 of 12 checks. Separate L4 observations show FP8 changing SmolLM2-135M trajectories substantially (agreement 48.4).

Hardware boundary

On a GTX 1650 (compute capability 7.5) the pinned wheel's Triton attention backend rejects an FP8 KV cache because it requires SM89 or newer. The adapter now recognizes that runtime/device combination in preflight and returns an actionable unsupported result before building the engine; automatic-cache workflows are unaffected. The preflight result, native failure log and content index are retained. The guard does not infer support for other GPUs, wheel builds, attention backends or cache formats. vLLM's CPU backend also refuses an FP8 cache unless the CPU has AVX-512 or AMX.

tools/qualification/staged/setup_vllm_cuda.sh and observe_vllm_gpu.py reproduce the L4 observations on another SM89+ host.

Limits

Qualification covers the pinned wheel on observed SM89 hardware. It is not a quality claim for FP8 on other models, attention backends, scaling methods or devices; the result applies to your workload and criteria only.