vllm - ✅(Solved) Fix [Bug]: `attention_backend='FLASH_ATTN_DIFFKV'` crashes init on standard models with "too many values to unpack" [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#39339Fetched 2026-04-09 07:51:47
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×1renamed ×1

Error Message

File ".../vllm/v1/attention/backends/flash_attn.py", line 808, in do_kv_cache_update key_cache, value_cache = kv_cache.unbind(0) ^^^^^^^^^^^^^^^^^^^^^^ ValueError: too many values to unpack (expected 2)

Fix Action

Fix / Workaround

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

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 39 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 24 On-line CPU(s) list: 0-23 Vendor ID: GenuineIntel Model name: 13th Gen Intel(R) Core(TM) i7-13700F CPU family: 6 Model: 183 Thread(s) per core: 2 Core(s) per socket: 16 Socket(s): 1 Stepping: 1 CPU(s) scaling MHz: 43% CPU max MHz: 5200.0000 CPU min MHz: 800.0000 BogoMIPS: 4224.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities Virtualization: VT-x L1d cache: 640 KiB (16 instances) L1i cache: 768 KiB (16 instances) L2 cache: 24 MiB (10 instances) L3 cache: 30 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0-23 Vulnerability Gather data sampling: Not affected Vulnerability Ghostwrite: Not affected Vulnerability Indirect target selection: 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: Mitigation; Clear Register File Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

PR fix notes

PR #39417: [Attention] Validate DIFFKV via backend selection

Description (problem / solution / changelog)

Fixes #39339.

Purpose

Reject attention_backend="FLASH_ATTN_DIFFKV" through normal backend validation instead of letting initialization continue until it crashes.

Test Plan

.venv-py312-tests/bin/python -m pytest -s -v tests/engine/test_arg_utils.py tests/kernels/attention/test_attention_selector.py

Test Result

73 passed, 10 skipped


<details> <summary> Essential Elements of an Effective PR Description Checklist </summary>
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.
</details>

Changed files

  • tests/engine/test_arg_utils.py (modified, +23/-0)
  • tests/kernels/attention/test_attention_selector.py (modified, +25/-0)
  • vllm/v1/attention/backends/flash_attn_diffkv.py (modified, +18/-0)

Code Example

Collecting environment information...
  ==============================
          System Info
  ==============================
  OS                           : Ubuntu 24.04.4 LTS (x86_64)
  GCC version                  : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
  Clang version                : 15.0.0 (git@github.com:llvm/llvm-project.git 4ba6a9c9f65bbc8bd06e3652cb20fd4dfc846137)
  CMake version                : version 3.28.3
  Libc version                 : glibc-2.39

  ==============================
        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

  ==============================
        Python Environment
  ==============================
  Python version               : 3.12.13 | packaged by conda-forge | (main, Mar  5 2026, 16:50:00) [GCC 14.3.0] (64-bit runtime)
  Python platform              : Linux-6.14.0-37-generic-x86_64-with-glibc2.39

  ==============================
        CUDA / GPU Info
  ==============================
  Is CUDA available            : True
  CUDA runtime version         : Could not collect
  CUDA_MODULE_LOADING set to   : 
  GPU models and configuration : GPU 0: NVIDIA GeForce RTX 4070
  Nvidia driver version        : 575.57.08
  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:                           39 bits physical, 48 bits virtual
  Byte Order:                              Little Endian
  CPU(s):                                  24
  On-line CPU(s) list:                     0-23
  Vendor ID:                               GenuineIntel
  Model name:                              13th Gen Intel(R) Core(TM) i7-13700F
  CPU family:                              6
  Model:                                   183
  Thread(s) per core:                      2
  Core(s) per socket:                      16
  Socket(s):                               1
  Stepping:                                1
  CPU(s) scaling MHz:                      43%
  CPU max MHz:                             5200.0000
  CPU min MHz:                             800.0000
  BogoMIPS:                                4224.00
  Flags:                                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
  Virtualization:                          VT-x
  L1d cache:                               640 KiB (16 instances)
  L1i cache:                               768 KiB (16 instances)
  L2 cache:                                24 MiB (10 instances)
  L3 cache:                                30 MiB (1 instance)
  NUMA node(s):                            1
  NUMA node0 CPU(s):                       0-23
  Vulnerability Gather data sampling:      Not affected
  Vulnerability Ghostwrite:                Not affected
  Vulnerability Indirect target selection: 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:    Mitigation; Clear Register File
  Vulnerability Retbleed:                  Not affected
  Vulnerability Spec rstack overflow:      Not affected
  Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
  Vulnerability Spectre v1:                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Vulnerability Spectre v2:                Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
  Vulnerability Srbds:                     Not affected
  Vulnerability Tsa:                       Not affected
  Vulnerability Tsx async abort:           Not affected
  Vulnerability Vmscape:                   Mitigation; IBPB before exit to userspace

  ==============================
  Versions of relevant libraries
  ==============================
  [pip3] flashinfer-python==0.6.6
  [pip3] numpy==2.2.6
  [pip3] nvidia-cublas-cu12==12.8.4.1
  [pip3] nvidia-cuda-cupti-cu12==12.8.90
  [pip3] nvidia-cuda-nvrtc-cu12==12.8.93
  [pip3] nvidia-cuda-runtime-cu12==12.8.90
  [pip3] nvidia-cudnn-cu12==9.10.2.21
  [pip3] nvidia-cudnn-frontend==1.18.0
  [pip3] nvidia-cufft-cu12==11.3.3.83
  [pip3] nvidia-cufile-cu12==1.13.1.3
  [pip3] nvidia-curand-cu12==10.3.9.90
  [pip3] nvidia-cusolver-cu12==11.7.3.90
  [pip3] nvidia-cusparse-cu12==12.5.8.93
  [pip3] nvidia-cusparselt-cu12==0.7.1
  [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-nvjitlink-cu12==12.8.93
  [pip3] nvidia-nvshmem-cu12==3.4.5
  [pip3] nvidia-nvtx-cu12==12.8.90
  [pip3] pyzmq==27.1.0
  [pip3] torch==2.10.0+cu128
  [pip3] torch_c_dlpack_ext==0.1.5
  [pip3] torchaudio==2.10.0+cu128
  [pip3] torchvision==0.25.0+cu128
  [pip3] transformers==4.57.6
  [pip3] triton==3.6.0
  [conda] Could not collect

  ==============================
          vLLM Info
  ==============================
  ROCM Version                 : Could not collect
  vLLM Version                 : 0.19.0
  vLLM Build Flags:
    CUDA Archs: Not Set; ROCm: Disabled
  GPU Topology:
      GPU0	CPU Affinity	NUMA Affinity	GPU NUMA ID
  GPU0	 X 	0-23	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
  ==============================
  PYTORCH_NVML_BASED_CUDA_CHECK=1
  TORCHINDUCTOR_COMPILE_THREADS=1
  TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_fqin2

---

import vllm

vllm.LLM(
    model="Qwen/Qwen3-0.6B",
    max_model_len=512,
    attention_backend="FLASH_ATTN_DIFFKV",
)

---

File ".../vllm/v1/attention/backends/flash_attn.py", line 808, in do_kv_cache_update
    key_cache, value_cache = kv_cache.unbind(0)
    ^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
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 24.04.4 LTS (x86_64)
  GCC version                  : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
  Clang version                : 15.0.0 ([email protected]:llvm/llvm-project.git 4ba6a9c9f65bbc8bd06e3652cb20fd4dfc846137)
  CMake version                : version 3.28.3
  Libc version                 : glibc-2.39

  ==============================
        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

  ==============================
        Python Environment
  ==============================
  Python version               : 3.12.13 | packaged by conda-forge | (main, Mar  5 2026, 16:50:00) [GCC 14.3.0] (64-bit runtime)
  Python platform              : Linux-6.14.0-37-generic-x86_64-with-glibc2.39

  ==============================
        CUDA / GPU Info
  ==============================
  Is CUDA available            : True
  CUDA runtime version         : Could not collect
  CUDA_MODULE_LOADING set to   : 
  GPU models and configuration : GPU 0: NVIDIA GeForce RTX 4070
  Nvidia driver version        : 575.57.08
  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:                           39 bits physical, 48 bits virtual
  Byte Order:                              Little Endian
  CPU(s):                                  24
  On-line CPU(s) list:                     0-23
  Vendor ID:                               GenuineIntel
  Model name:                              13th Gen Intel(R) Core(TM) i7-13700F
  CPU family:                              6
  Model:                                   183
  Thread(s) per core:                      2
  Core(s) per socket:                      16
  Socket(s):                               1
  Stepping:                                1
  CPU(s) scaling MHz:                      43%
  CPU max MHz:                             5200.0000
  CPU min MHz:                             800.0000
  BogoMIPS:                                4224.00
  Flags:                                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
  Virtualization:                          VT-x
  L1d cache:                               640 KiB (16 instances)
  L1i cache:                               768 KiB (16 instances)
  L2 cache:                                24 MiB (10 instances)
  L3 cache:                                30 MiB (1 instance)
  NUMA node(s):                            1
  NUMA node0 CPU(s):                       0-23
  Vulnerability Gather data sampling:      Not affected
  Vulnerability Ghostwrite:                Not affected
  Vulnerability Indirect target selection: 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:    Mitigation; Clear Register File
  Vulnerability Retbleed:                  Not affected
  Vulnerability Spec rstack overflow:      Not affected
  Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
  Vulnerability Spectre v1:                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Vulnerability Spectre v2:                Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
  Vulnerability Srbds:                     Not affected
  Vulnerability Tsa:                       Not affected
  Vulnerability Tsx async abort:           Not affected
  Vulnerability Vmscape:                   Mitigation; IBPB before exit to userspace

  ==============================
  Versions of relevant libraries
  ==============================
  [pip3] flashinfer-python==0.6.6
  [pip3] numpy==2.2.6
  [pip3] nvidia-cublas-cu12==12.8.4.1
  [pip3] nvidia-cuda-cupti-cu12==12.8.90
  [pip3] nvidia-cuda-nvrtc-cu12==12.8.93
  [pip3] nvidia-cuda-runtime-cu12==12.8.90
  [pip3] nvidia-cudnn-cu12==9.10.2.21
  [pip3] nvidia-cudnn-frontend==1.18.0
  [pip3] nvidia-cufft-cu12==11.3.3.83
  [pip3] nvidia-cufile-cu12==1.13.1.3
  [pip3] nvidia-curand-cu12==10.3.9.90
  [pip3] nvidia-cusolver-cu12==11.7.3.90
  [pip3] nvidia-cusparse-cu12==12.5.8.93
  [pip3] nvidia-cusparselt-cu12==0.7.1
  [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-nvjitlink-cu12==12.8.93
  [pip3] nvidia-nvshmem-cu12==3.4.5
  [pip3] nvidia-nvtx-cu12==12.8.90
  [pip3] pyzmq==27.1.0
  [pip3] torch==2.10.0+cu128
  [pip3] torch_c_dlpack_ext==0.1.5
  [pip3] torchaudio==2.10.0+cu128
  [pip3] torchvision==0.25.0+cu128
  [pip3] transformers==4.57.6
  [pip3] triton==3.6.0
  [conda] Could not collect

  ==============================
          vLLM Info
  ==============================
  ROCM Version                 : Could not collect
  vLLM Version                 : 0.19.0
  vLLM Build Flags:
    CUDA Archs: Not Set; ROCm: Disabled
  GPU Topology:
      GPU0	CPU Affinity	NUMA Affinity	GPU NUMA ID
  GPU0	 X 	0-23	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
  ==============================
  PYTORCH_NVML_BASED_CUDA_CHECK=1
  TORCHINDUCTOR_COMPILE_THREADS=1
  TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_fqin2
</details>

🐛 Describe the bug

The DIFFKV backend assumes the KV cache is a 2-tensor stack (key_cache, value_cache = kv_cache.unbind(0)), but on models with uniform K/V heads it has a different shape. There is no upfront compatibility check.

Reproduce

import vllm

vllm.LLM(
    model="Qwen/Qwen3-0.6B",
    max_model_len=512,
    attention_backend="FLASH_ATTN_DIFFKV",
)

EngineCore stderr:

File ".../vllm/v1/attention/backends/flash_attn.py", line 808, in do_kv_cache_update
    key_cache, value_cache = kv_cache.unbind(0)
    ^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

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 DIFFKV backend in the vLLM library assumes a 2-tensor stack for the KV cache, but models with uniform K/V heads have a different shape, causing a ValueError when trying to unbind the cache.

Guidance

  • Check the shape of the KV cache before attempting to unbind it to ensure compatibility with the DIFFKV backend.
  • Modify the do_kv_cache_update function in flash_attn.py to handle cases where the KV cache is not a 2-tensor stack.
  • Consider adding an upfront compatibility check to handle models with uniform K/V heads.
  • Verify that the attention_backend parameter is set correctly and that the model being used is compatible with the DIFFKV backend.

Example

def do_kv_cache_update(self, kv_cache):
    if len(kv_cache) != 2:
        # Handle cases where KV cache is not a 2-tensor stack
        # ...
    else:
        key_cache, value_cache = kv_cache.unbind(0)
        # ...

Notes

The provided code snippet only shows the error message and the line of code that caused it. Without more context or information about the vllm library and the flash_attn.py file, it's difficult to provide a more specific solution.

Recommendation

Apply a workaround by modifying the do_kv_cache_update function to handle cases where the KV cache is not a 2-tensor stack, as shown in the example above. This will allow the code to run without errors, but may not provide the desired functionality for models with uniform K/V heads.

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]: `attention_backend='FLASH_ATTN_DIFFKV'` crashes init on standard models with "too many values to unpack" [1 pull requests, 1 participants]