vllm - ✅(Solved) Fix [Bug]: `kv_cache_dtype="fp8_e5m2"` silently corrupts output on Qwen-VL models (Qwen2-VL, Qwen2.5-VL) with default scaling [1 pull requests, 3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#41343Fetched 2026-05-01 05:34:04
View on GitHub
Comments
3
Participants
2
Timeline
13
Reactions
0
Author
Timeline (top)
subscribed ×5commented ×3mentioned ×3cross-referenced ×1

Fix Action

Fix / Workaround

============================== CPU Info

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Vendor ID: AuthenticAMD Model name: AMD EPYC 9554 64-Core Processor CPU family: 25 Model: 17 Thread(s) per core: 2 Core(s) per socket: 64 Socket(s): 1 Stepping: 1 Frequency boost: enabled CPU max MHz: 3762.9880 CPU min MHz: 1500.0000 BogoMIPS: 6190.81 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d Virtualization: AMD-V L1d cache: 2 MiB (64 instances) L1i cache: 2 MiB (64 instances) L2 cache: 64 MiB (64 instances) L3 cache: 256 MiB (8 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-127 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected

Two workarounds fully fix it: switch to fp8_e4m3, or pass calculate_kv_scales=True.

run("auto") # fp16 baseline run("fp8_e5m2", calc_scales=False) # the bug run("fp8_e4m3", calc_scales=False) # workaround A run("fp8_e5m2", calc_scales=True) # workaround B

PR fix notes

PR #41408: [codex] Guard Qwen-VL fp8_e5m2 default KV scales

Description (problem / solution / changelog)

Fixes #41343.

What changed

  • Adds a post-load attention guard for Qwen2-VL and Qwen2.5-VL when kv_cache_dtype="fp8_e5m2" would run with default KV cache scales (k_scale=v_scale=1.0) and calculate_kv_scales=False.
  • Detects Qwen-VL from both the outer HF config (qwen2_vl / qwen2_5_vl) and architecture names, so the guard still applies when the inner language model presents as Qwen2ForCausalLM.
  • Keeps non-Qwen-VL models, fp8_e4m3, runtime scale calculation, and calibrated non-default checkpoint scales on the existing path.
  • Adds focused tests for Qwen-VL detection, fail-fast behavior, and safe states.

Why

The issue reports silent incorrect output for Qwen-VL models using fp8_e5m2 KV cache with default scales. Failing after weights are loaded preserves calibrated checkpoints while preventing the known unsafe default-scale runtime case.

Before / after proof

I ran the same deterministic smoke script at the attention post-load boundary on origin/main and this PR branch. The script constructs a Qwen-VL attention layer with kv_cache_dtype="fp8_e5m2", calculate_kv_scales=False, and default scale tensors.

Before, on origin/main (b4806c8), the unsafe state proceeds with default scales:

RESULT: completed without error
SCALES: k_scale=1.0, v_scale=1.0

After, on this PR branch (ec69fb3), the same state fails fast:

RESULT: raised ValueError
ERROR: kv_cache_dtype="fp8_e5m2" with default KV cache scales (k_scale=v_scale=1.0) is known to produce incorrect outputs for Qwen2-VL and Qwen2.5-VL models. Use kv_cache_dtype="fp8_e4m3", set calculate_kv_scales=True, or provide calibrated k_scale/v_scale values in the checkpoint.

Duplicate check

  • gh issue view 41343 --repo vllm-project/vllm --comments
  • gh pr list --repo vllm-project/vllm --state open --search "41343 in:body"
  • gh pr list --repo vllm-project/vllm --state open --search "Qwen VL fp8 e5m2 calculate_kv_scales"
  • gh pr list --repo vllm-project/vllm --state open --search "kv_cache_dtype fp8_e5m2 Qwen2"

No open PR was found for this fix. The issue thread has a commenter offering to take the task, but no linked PR was present when checked.

Testing

  • .venv/bin/ruff check vllm/model_executor/layers/attention/attention.py tests/quantization/test_fp8.py
  • .venv/bin/ruff format --check vllm/model_executor/layers/attention/attention.py tests/quantization/test_fp8.py
  • .venv/bin/python -m py_compile vllm/model_executor/layers/attention/attention.py tests/quantization/test_fp8.py
  • .venv/bin/python -m pytest tests/quantization/test_fp8.py -q -k 'qwen_vl and kv_cache' (13 passed, 18 deselected)
  • Direct runtime smoke of Attention.process_weights_after_loading showing the expected ValueError for Qwen-VL + fp8_e5m2 + default scales.

Full Qwen2.5-VL inference on Google Cloud G2/L4 was not run from this local environment.

AI assistance

This change was developed with AI assistance and reviewed locally before submission.

Changed files

  • tests/quantization/test_fp8.py (modified, +111/-0)
  • vllm/model_executor/layers/attention/attention.py (modified, +67/-0)

Code Example

Collecting environment information...
==============================
        System Info
==============================
OS                           : Ubuntu 22.04.5 LTS (x86_64)
GCC version                  : (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version                : Could not collect
CMake version                : version 3.22.1
Libc version                 : glibc-2.35

==============================
       PyTorch Info
==============================
PyTorch version              : 2.10.0+cu128
Is debug build               : False
CUDA used to build PyTorch   : 12.8
ROCM used to build PyTorch   : N/A
XPU used to build PyTorch    : N/A

==============================
      Python Environment
==============================
Python version               : 3.11.15 (main, Mar 11 2026, 17:20:07) [GCC 14.3.0] (64-bit runtime)
Python platform              : Linux-5.15.0-122-generic-x86_64-with-glibc2.35
    
==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.1.105
CUDA_MODULE_LOADING set to   : 
GPU models and configuration : 
GPU 0: NVIDIA L40S
GPU 1: NVIDIA L40S
GPU 2: NVIDIA L40S
GPU 3: NVIDIA L40S

Nvidia driver version        : 560.35.03
cuDNN version                : Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7
HIP runtime version          : N/A
MIOpen runtime version       : N/A
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        52 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               128
On-line CPU(s) list:                  0-127
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 9554 64-Core Processor
CPU family:                           25
Model:                                17
Thread(s) per core:                   2
Core(s) per socket:                   64
Socket(s):                            1
Stepping:                             1
Frequency boost:                      enabled
CPU max MHz:                          3762.9880
CPU min MHz:                          1500.0000
BogoMIPS:                             6190.81
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                       AMD-V
L1d cache:                            2 MiB (64 instances)
L1i cache:                            2 MiB (64 instances)
L2 cache:                             64 MiB (64 instances)
L3 cache:                             256 MiB (8 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-127
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Mitigation; safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.6
[pip3] numpy==2.2.6
[pip3] nvidia-cublas==13.1.0.3
[pip3] nvidia-cublas-cu12==12.8.4.1
[pip3] nvidia-cuda-cupti==13.0.85
[pip3] nvidia-cuda-cupti-cu12==12.8.90
[pip3] nvidia-cuda-nvrtc==13.0.88
[pip3] nvidia-cuda-nvrtc-cu12==12.8.93
[pip3] nvidia-cuda-runtime==13.0.96
[pip3] nvidia-cuda-runtime-cu12==12.8.90
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cudnn-cu13==9.19.0.56
[pip3] nvidia-cudnn-frontend==1.18.0
[pip3] nvidia-cufft==12.0.0.61
[pip3] nvidia-cufft-cu12==11.3.3.83
[pip3] nvidia-cufile==1.15.1.6
[pip3] nvidia-cufile-cu12==1.13.1.3
[pip3] nvidia-curand==10.4.0.35
[pip3] nvidia-curand-cu12==10.3.9.90
[pip3] nvidia-cusolver==12.0.4.66
[pip3] nvidia-cusolver-cu12==11.7.3.90
[pip3] nvidia-cusparse==12.6.3.3
[pip3] nvidia-cusparse-cu12==12.5.8.93
[pip3] nvidia-cusparselt-cu12==0.7.1
[pip3] nvidia-cusparselt-cu13==0.8.0
[pip3] nvidia-cutlass-dsl==4.4.2
[pip3] nvidia-cutlass-dsl-libs-base==4.4.2
[pip3] nvidia-ml-py==13.595.45
[pip3] nvidia-nccl-cu12==2.27.5
[pip3] nvidia-nccl-cu13==2.28.9
[pip3] nvidia-nvjitlink==13.0.88
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvshmem-cu13==3.4.5
[pip3] nvidia-nvtx==13.0.85
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] onnxruntime==1.25.0
[pip3] pyzmq==27.1.0
[pip3] torch==2.10.0
[pip3] torch_c_dlpack_ext==0.1.5
[pip3] torch-einops-utils==0.0.30
[pip3] torchaudio==2.10.0
[pip3] torchsde==0.2.6
[pip3] torchvision==0.25.0
[pip3] transformers==4.57.6
[pip3] triton==3.6.0
[pip3] x-transformers==2.18.9
[conda] flashinfer-python                           0.6.6                        pypi_0           pypi
[conda] numpy                                       2.2.6                        pypi_0           pypi
[conda] nvidia-cublas                               13.1.0.3                     pypi_0           pypi
[conda] nvidia-cublas-cu12                          12.8.4.1                     pypi_0           pypi
[conda] nvidia-cuda-cupti                           13.0.85                      pypi_0           pypi
[conda] nvidia-cuda-cupti-cu12                      12.8.90                      pypi_0           pypi
[conda] nvidia-cuda-nvrtc                           13.0.88                      pypi_0           pypi
[conda] nvidia-cuda-nvrtc-cu12                      12.8.93                      pypi_0           pypi
[conda] nvidia-cuda-runtime                         13.0.96                      pypi_0           pypi
[conda] nvidia-cuda-runtime-cu12                    12.8.90                      pypi_0           pypi
[conda] nvidia-cudnn-cu12                           9.10.2.21                    pypi_0           pypi
[conda] nvidia-cudnn-cu13                           9.19.0.56                    pypi_0           pypi
[conda] nvidia-cudnn-frontend                       1.18.0                       pypi_0           pypi
[conda] nvidia-cufft                                12.0.0.61                    pypi_0           pypi
[conda] nvidia-cufft-cu12                           11.3.3.83                    pypi_0           pypi
[conda] nvidia-cufile                               1.15.1.6                     pypi_0           pypi
[conda] nvidia-cufile-cu12                          1.13.1.3                     pypi_0           pypi
[conda] nvidia-curand                               10.4.0.35                    pypi_0           pypi
[conda] nvidia-curand-cu12                          10.3.9.90                    pypi_0           pypi
[conda] nvidia-cusolver                             12.0.4.66                    pypi_0           pypi
[conda] nvidia-cusolver-cu12                        11.7.3.90                    pypi_0           pypi
[conda] nvidia-cusparse                             12.6.3.3                     pypi_0           pypi
[conda] nvidia-cusparse-cu12                        12.5.8.93                    pypi_0           pypi
[conda] nvidia-cusparselt-cu12                      0.7.1                        pypi_0           pypi
[conda] nvidia-cusparselt-cu13                      0.8.0                        pypi_0           pypi
[conda] nvidia-cutlass-dsl                          4.4.2                        pypi_0           pypi
[conda] nvidia-cutlass-dsl-libs-base                4.4.2                        pypi_0           pypi
[conda] nvidia-ml-py                                13.595.45                    pypi_0           pypi
[conda] nvidia-nccl-cu12                            2.27.5                       pypi_0           pypi
[conda] nvidia-nccl-cu13                            2.28.9                       pypi_0           pypi
[conda] nvidia-nvjitlink                            13.0.88                      pypi_0           pypi
[conda] nvidia-nvjitlink-cu12                       12.8.93                      pypi_0           pypi
[conda] nvidia-nvshmem-cu12                         3.4.5                        pypi_0           pypi
[conda] nvidia-nvshmem-cu13                         3.4.5                        pypi_0           pypi
[conda] nvidia-nvtx                                 13.0.85                      pypi_0           pypi
[conda] nvidia-nvtx-cu12                            12.8.90                      pypi_0           pypi
[conda] pyzmq                                       27.1.0                       pypi_0           pypi
[conda] torch                                       2.10.0                       pypi_0           pypi
[conda] torch-c-dlpack-ext                          0.1.5                        pypi_0           pypi
[conda] torch-einops-utils                          0.0.30                       pypi_0           pypi
[conda] torchaudio                                  2.10.0                       pypi_0           pypi
[conda] torchsde                                    0.2.6                        pypi_0           pypi
[conda] torchvision                                 0.25.0                       pypi_0           pypi
[conda] transformers                                4.57.6                       pypi_0           pypi
[conda] triton                                      3.6.0                        pypi_0           pypi
[conda] x-transformers                              2.18.9                       pypi_0           pypi

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.19.0
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled; XPU: Disabled
GPU Topology:
        GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     NODE    NODE    0-127   0               N/A
GPU1    PHB      X      NODE    NODE    0-127   0               N/A
GPU2    NODE    NODE     X      PHB     0-127   0               N/A
GPU3    NODE    NODE    PHB      X      0-127   0               N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

==============================
     Environment Variables
==============================
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_ningke

---

from PIL import Image
from vllm import LLM, SamplingParams

Image.new("RGB", (224, 224), (128, 128, 128)).save("/tmp/uniform_gray.png")

def run(kv_dtype, calc_scales=False):
    llm = LLM(
        model="Qwen/Qwen2.5-VL-3B-Instruct",
        enforce_eager=True, dtype="float16",
        kv_cache_dtype=kv_dtype,
        calculate_kv_scales=calc_scales,
        max_model_len=2048,
        limit_mm_per_prompt={"image": 1},
        trust_remote_code=True,
    )
    tok = llm.get_tokenizer()
    prompt = tok.apply_chat_template(
        [{"role": "user", "content": [
            {"type": "image"},
            {"type": "text", "text": "Describe what you see in this image."}]}],
        tokenize=False, add_generation_prompt=True,
    )
    img = Image.open("/tmp/uniform_gray.png").convert("RGB")
    out = llm.generate(
        [{"prompt": prompt, "multi_modal_data": {"image": img}}],
        SamplingParams(temperature=0, top_p=1, max_tokens=64, seed=42),
    )
    print(f"  kv_cache_dtype={kv_dtype} calc_kv_scales={calc_scales}")
    print(f"  -> {out[0].outputs[0].text!r}")

run("auto")                          # fp16 baseline
run("fp8_e5m2", calc_scales=False)   # the bug
run("fp8_e4m3", calc_scales=False)   # workaround A
run("fp8_e5m2", calc_scales=True)    # workaround B
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>
Collecting environment information...
==============================
        System Info
==============================
OS                           : Ubuntu 22.04.5 LTS (x86_64)
GCC version                  : (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version                : Could not collect
CMake version                : version 3.22.1
Libc version                 : glibc-2.35

==============================
       PyTorch Info
==============================
PyTorch version              : 2.10.0+cu128
Is debug build               : False
CUDA used to build PyTorch   : 12.8
ROCM used to build PyTorch   : N/A
XPU used to build PyTorch    : N/A

==============================
      Python Environment
==============================
Python version               : 3.11.15 (main, Mar 11 2026, 17:20:07) [GCC 14.3.0] (64-bit runtime)
Python platform              : Linux-5.15.0-122-generic-x86_64-with-glibc2.35
    
==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.1.105
CUDA_MODULE_LOADING set to   : 
GPU models and configuration : 
GPU 0: NVIDIA L40S
GPU 1: NVIDIA L40S
GPU 2: NVIDIA L40S
GPU 3: NVIDIA L40S

Nvidia driver version        : 560.35.03
cuDNN version                : Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7
HIP runtime version          : N/A
MIOpen runtime version       : N/A
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        52 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               128
On-line CPU(s) list:                  0-127
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 9554 64-Core Processor
CPU family:                           25
Model:                                17
Thread(s) per core:                   2
Core(s) per socket:                   64
Socket(s):                            1
Stepping:                             1
Frequency boost:                      enabled
CPU max MHz:                          3762.9880
CPU min MHz:                          1500.0000
BogoMIPS:                             6190.81
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                       AMD-V
L1d cache:                            2 MiB (64 instances)
L1i cache:                            2 MiB (64 instances)
L2 cache:                             64 MiB (64 instances)
L3 cache:                             256 MiB (8 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-127
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Mitigation; safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.6
[pip3] numpy==2.2.6
[pip3] nvidia-cublas==13.1.0.3
[pip3] nvidia-cublas-cu12==12.8.4.1
[pip3] nvidia-cuda-cupti==13.0.85
[pip3] nvidia-cuda-cupti-cu12==12.8.90
[pip3] nvidia-cuda-nvrtc==13.0.88
[pip3] nvidia-cuda-nvrtc-cu12==12.8.93
[pip3] nvidia-cuda-runtime==13.0.96
[pip3] nvidia-cuda-runtime-cu12==12.8.90
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cudnn-cu13==9.19.0.56
[pip3] nvidia-cudnn-frontend==1.18.0
[pip3] nvidia-cufft==12.0.0.61
[pip3] nvidia-cufft-cu12==11.3.3.83
[pip3] nvidia-cufile==1.15.1.6
[pip3] nvidia-cufile-cu12==1.13.1.3
[pip3] nvidia-curand==10.4.0.35
[pip3] nvidia-curand-cu12==10.3.9.90
[pip3] nvidia-cusolver==12.0.4.66
[pip3] nvidia-cusolver-cu12==11.7.3.90
[pip3] nvidia-cusparse==12.6.3.3
[pip3] nvidia-cusparse-cu12==12.5.8.93
[pip3] nvidia-cusparselt-cu12==0.7.1
[pip3] nvidia-cusparselt-cu13==0.8.0
[pip3] nvidia-cutlass-dsl==4.4.2
[pip3] nvidia-cutlass-dsl-libs-base==4.4.2
[pip3] nvidia-ml-py==13.595.45
[pip3] nvidia-nccl-cu12==2.27.5
[pip3] nvidia-nccl-cu13==2.28.9
[pip3] nvidia-nvjitlink==13.0.88
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvshmem-cu13==3.4.5
[pip3] nvidia-nvtx==13.0.85
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] onnxruntime==1.25.0
[pip3] pyzmq==27.1.0
[pip3] torch==2.10.0
[pip3] torch_c_dlpack_ext==0.1.5
[pip3] torch-einops-utils==0.0.30
[pip3] torchaudio==2.10.0
[pip3] torchsde==0.2.6
[pip3] torchvision==0.25.0
[pip3] transformers==4.57.6
[pip3] triton==3.6.0
[pip3] x-transformers==2.18.9
[conda] flashinfer-python                           0.6.6                        pypi_0           pypi
[conda] numpy                                       2.2.6                        pypi_0           pypi
[conda] nvidia-cublas                               13.1.0.3                     pypi_0           pypi
[conda] nvidia-cublas-cu12                          12.8.4.1                     pypi_0           pypi
[conda] nvidia-cuda-cupti                           13.0.85                      pypi_0           pypi
[conda] nvidia-cuda-cupti-cu12                      12.8.90                      pypi_0           pypi
[conda] nvidia-cuda-nvrtc                           13.0.88                      pypi_0           pypi
[conda] nvidia-cuda-nvrtc-cu12                      12.8.93                      pypi_0           pypi
[conda] nvidia-cuda-runtime                         13.0.96                      pypi_0           pypi
[conda] nvidia-cuda-runtime-cu12                    12.8.90                      pypi_0           pypi
[conda] nvidia-cudnn-cu12                           9.10.2.21                    pypi_0           pypi
[conda] nvidia-cudnn-cu13                           9.19.0.56                    pypi_0           pypi
[conda] nvidia-cudnn-frontend                       1.18.0                       pypi_0           pypi
[conda] nvidia-cufft                                12.0.0.61                    pypi_0           pypi
[conda] nvidia-cufft-cu12                           11.3.3.83                    pypi_0           pypi
[conda] nvidia-cufile                               1.15.1.6                     pypi_0           pypi
[conda] nvidia-cufile-cu12                          1.13.1.3                     pypi_0           pypi
[conda] nvidia-curand                               10.4.0.35                    pypi_0           pypi
[conda] nvidia-curand-cu12                          10.3.9.90                    pypi_0           pypi
[conda] nvidia-cusolver                             12.0.4.66                    pypi_0           pypi
[conda] nvidia-cusolver-cu12                        11.7.3.90                    pypi_0           pypi
[conda] nvidia-cusparse                             12.6.3.3                     pypi_0           pypi
[conda] nvidia-cusparse-cu12                        12.5.8.93                    pypi_0           pypi
[conda] nvidia-cusparselt-cu12                      0.7.1                        pypi_0           pypi
[conda] nvidia-cusparselt-cu13                      0.8.0                        pypi_0           pypi
[conda] nvidia-cutlass-dsl                          4.4.2                        pypi_0           pypi
[conda] nvidia-cutlass-dsl-libs-base                4.4.2                        pypi_0           pypi
[conda] nvidia-ml-py                                13.595.45                    pypi_0           pypi
[conda] nvidia-nccl-cu12                            2.27.5                       pypi_0           pypi
[conda] nvidia-nccl-cu13                            2.28.9                       pypi_0           pypi
[conda] nvidia-nvjitlink                            13.0.88                      pypi_0           pypi
[conda] nvidia-nvjitlink-cu12                       12.8.93                      pypi_0           pypi
[conda] nvidia-nvshmem-cu12                         3.4.5                        pypi_0           pypi
[conda] nvidia-nvshmem-cu13                         3.4.5                        pypi_0           pypi
[conda] nvidia-nvtx                                 13.0.85                      pypi_0           pypi
[conda] nvidia-nvtx-cu12                            12.8.90                      pypi_0           pypi
[conda] pyzmq                                       27.1.0                       pypi_0           pypi
[conda] torch                                       2.10.0                       pypi_0           pypi
[conda] torch-c-dlpack-ext                          0.1.5                        pypi_0           pypi
[conda] torch-einops-utils                          0.0.30                       pypi_0           pypi
[conda] torchaudio                                  2.10.0                       pypi_0           pypi
[conda] torchsde                                    0.2.6                        pypi_0           pypi
[conda] torchvision                                 0.25.0                       pypi_0           pypi
[conda] transformers                                4.57.6                       pypi_0           pypi
[conda] triton                                      3.6.0                        pypi_0           pypi
[conda] x-transformers                              2.18.9                       pypi_0           pypi

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.19.0
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled; XPU: Disabled
GPU Topology:
        GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     NODE    NODE    0-127   0               N/A
GPU1    PHB      X      NODE    NODE    0-127   0               N/A
GPU2    NODE    NODE     X      PHB     0-127   0               N/A
GPU3    NODE    NODE    PHB      X      0-127   0               N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

==============================
     Environment Variables
==============================
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_ningke
</details>

🐛 Describe the bug

In vLLM 0.19.0, when testing on Qwen2-VL-2B and Qwen2.5-VL-3B, kv_cache_dtype="fp8_e5m2" with the default calculate_kv_scales=False silently produces degenerate or hallucinated output. Failure rate scales with input pixel variance: uniform-color images fail frequently, natural images mostly survive. OpenGVLab/InternVL3-1B under the same code path shows 0% failure, so this is specific to Qwen-family weight distributions, not a generic FP8 KV cache issue.

Two workarounds fully fix it: switch to fp8_e4m3, or pass calculate_kv_scales=True.

Reproducer

from PIL import Image
from vllm import LLM, SamplingParams

Image.new("RGB", (224, 224), (128, 128, 128)).save("/tmp/uniform_gray.png")

def run(kv_dtype, calc_scales=False):
    llm = LLM(
        model="Qwen/Qwen2.5-VL-3B-Instruct",
        enforce_eager=True, dtype="float16",
        kv_cache_dtype=kv_dtype,
        calculate_kv_scales=calc_scales,
        max_model_len=2048,
        limit_mm_per_prompt={"image": 1},
        trust_remote_code=True,
    )
    tok = llm.get_tokenizer()
    prompt = tok.apply_chat_template(
        [{"role": "user", "content": [
            {"type": "image"},
            {"type": "text", "text": "Describe what you see in this image."}]}],
        tokenize=False, add_generation_prompt=True,
    )
    img = Image.open("/tmp/uniform_gray.png").convert("RGB")
    out = llm.generate(
        [{"prompt": prompt, "multi_modal_data": {"image": img}}],
        SamplingParams(temperature=0, top_p=1, max_tokens=64, seed=42),
    )
    print(f"  kv_cache_dtype={kv_dtype} calc_kv_scales={calc_scales}")
    print(f"  -> {out[0].outputs[0].text!r}")

run("auto")                          # fp16 baseline
run("fp8_e5m2", calc_scales=False)   # the bug
run("fp8_e4m3", calc_scales=False)   # workaround A
run("fp8_e5m2", calc_scales=True)    # workaround B
configoutput
fp16 baseline'The image is a solid light gray color.'
fp8_e5m2, calc=False'II' ← degenerate
fp8_e4m3, calc=False'The image is a solid light gray color.'
fp8_e5m2, calc=True'The image is a pure gray image'

Full log with VLLM_LOGGING_LEVEL=DEBUG can be seen here:

debug.log

Beyond the minimal repro: silent label-flip on Qwen2-VL-2B

The reproducer above shows the most visible failure mode — output collapses to 'I' or 'II'. After seeing that, we ran the same kv_cache_dtype="fp8_e5m2" config across a small batch of uniform-color images on Qwen/Qwen2-VL-2B-Instruct (prompt: "What color is this image?", same sampling settings). The 3B model degenerates loudly; the 2B model fails silently :

Image (224×224 solid color)fp16 KV (baseline)fp8_e5m2 KV
white"White" ✓"red" ✗
black"Black" ✓"Blue"
red"I cannot see images…" (refusal)"blue and green hues"
blue"I cannot see images…" (refusal)"blue and green hues"
green"I cannot see images…" (refusal)"blue"

Two things worth noting:

  1. On solid_white the fp16 baseline is correct and fp8 is categorically wrong (same prompt, same model, same seed, only kv_cache_dtype differs).
  2. On the refusal cases the fp8 path doesn't produce noise; it produces a fluent, confident hallucinated color. The phrase "blue and green hues" recurs across distinct inputs, suggesting fp8 is collapsing different image-token KVs onto the same code.

OpenGVLab/InternVL3-1B under the same flag and prompts shows neither degeneracy nor label-flip, so this is specific to the Qwen-family + e5m2 + default-scale combination, not generic fp8 KV loss.

The similar symptom was reported in #10411 against text-only Qwen2.5-7B GGUF.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

TL;DR

The issue can be fixed by switching to fp8_e4m3 or passing calculate_kv_scales=True when using kv_cache_dtype="fp8_e5m2" in vLLM 0.19.0.

Guidance

  • The problem is specific to the Qwen-family models and fp8_e5m2 cache dtype, suggesting a potential issue with the quantization scheme.
  • To fix the issue, try switching to fp8_e4m3 or pass calculate_kv_scales=True when using fp8_e5m2.
  • Verify the fix by running the reproducer code with the suggested changes and checking the output for correctness.
  • Be aware that the issue may be related to the specific weight distribution of the Qwen-family models, so the fix may not be applicable to other models.

Example

llm = LLM(
    model="Qwen/Qwen2.5-VL-3B-Instruct",
    enforce_eager=True, dtype="float16",
    kv_cache_dtype="fp8_e4m3",  # or "fp8_e5m2" with calculate_kv_scales=True
    calculate_kv_scales=True,
    max_model_len=2048,
    limit_mm_per_prompt={"image": 1},
    trust_remote_code=True,
)

Notes

The issue is specific to the Qwen-family models and fp8_e5m2 cache dtype, and the fix may not be applicable to other models. The root cause of the issue is not fully understood and may require further investigation.

Recommendation

Apply the workaround by switching to fp8_e4m3 or passing calculate_kv_scales=True when using fp8_e5m2, as this has been shown to fix the issue in the provided reproducer code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - ✅(Solved) Fix [Bug]: `kv_cache_dtype="fp8_e5m2"` silently corrupts output on Qwen-VL models (Qwen2-VL, Qwen2.5-VL) with default scaling [1 pull requests, 3 comments, 2 participants]