Skip to content

[Bug]: DeepSeek-V3.1 TP8 with decode context parallel and prefix caching: the vLLM service still answers the previous question after changing user prompt. #26672

@gary-wjc

Description

@gary-wjc

Your current environment

The output of python collect_env.py
==============================
        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 4.1.0
Libc version                 : glibc-2.35

==============================
       PyTorch Info
==============================
PyTorch version              : 2.8.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.11 (main, Jun  4 2025, 08:56:18) [GCC 11.4.0] (64-bit runtime)
Python platform              : Linux-5.14.0-503.14.1.el9_5.x86_64-x86_64-with-glibc2.35

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.8.93
CUDA_MODULE_LOADING set to   : LAZY
GPU models and configuration : 
GPU 0: NVIDIA H200
GPU 1: NVIDIA H200
GPU 2: NVIDIA H200
GPU 3: NVIDIA H200
GPU 4: NVIDIA H200
GPU 5: NVIDIA H200
GPU 6: NVIDIA H200
GPU 7: NVIDIA H200

Nvidia driver version        : 570.124.06
cuDNN version                : Could not collect
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:                        46 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               192
On-line CPU(s) list:                  0-191
Vendor ID:                            GenuineIntel
BIOS Vendor ID:                       Intel(R) Corporation
Model name:                           INTEL(R) XEON(R) PLATINUM 8558
BIOS Model name:                      INTEL(R) XEON(R) PLATINUM 8558
CPU family:                           6
Model:                                207
Thread(s) per core:                   2
Core(s) per socket:                   48
Socket(s):                            2
Stepping:                             2
CPU max MHz:                          4000.0000
CPU min MHz:                          800.0000
BogoMIPS:                             4200.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 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Virtualization:                       VT-x
L1d cache:                            4.5 MiB (96 instances)
L1i cache:                            3 MiB (96 instances)
L2 cache:                             192 MiB (96 instances)
L3 cache:                             520 MiB (2 instances)
NUMA node(s):                         2
NUMA node0 CPU(s):                    0-47,96-143
NUMA node1 CPU(s):                    48-95,144-191
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:   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; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.3.0
[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.14.1
[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-ml-py==13.580.82
[pip3] nvidia-nccl-cu12==2.27.3
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] pynvml==13.0.1
[pip3] pyzmq==27.1.0
[pip3] torch==2.8.0+cu128
[pip3] torchaudio==2.8.0+cu128
[pip3] torchvision==0.23.0+cu128
[pip3] transformers==4.56.1
[pip3] triton==3.4.0
[conda] Could not collect

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.10.2
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
        GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    NIC1    NIC2    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      NV18    NV18    NV18    NV18    NV18    NV18    NV18    NODE    SYS     NODE    0-47,96-143     0               N/A
GPU1    NV18     X      NV18    NV18    NV18    NV18    NV18    NV18    NODE    SYS     NODE    0-47,96-143     0               N/A
GPU2    NV18    NV18     X      NV18    NV18    NV18    NV18    NV18    PIX     SYS     NODE    0-47,96-143     0               N/A
GPU3    NV18    NV18    NV18     X      NV18    NV18    NV18    NV18    PIX     SYS     NODE    0-47,96-143     0               N/A
GPU4    NV18    NV18    NV18    NV18     X      NV18    NV18    NV18    SYS     NODE    SYS     48-95,144-191   1               N/A
GPU5    NV18    NV18    NV18    NV18    NV18     X      NV18    NV18    SYS     NODE    SYS     48-95,144-191   1               N/A
GPU6    NV18    NV18    NV18    NV18    NV18    NV18     X      NV18    SYS     PIX     SYS     48-95,144-191   1               N/A
GPU7    NV18    NV18    NV18    NV18    NV18    NV18    NV18     X      SYS     PIX     SYS     48-95,144-191   1               N/A
NIC0    NODE    NODE    PIX     PIX     SYS     SYS     SYS     SYS      X      SYS     NODE
NIC1    SYS     SYS     SYS     SYS     NODE    NODE    PIX     PIX     SYS      X      SYS
NIC2    NODE    NODE    NODE    NODE    SYS     SYS     SYS     SYS     NODE    SYS      X 

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

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_3
  NIC2: mlx5_bond_0

🐛 Describe the bug

  1. Start a local vLLM service in Linux shell with the following command
nohup vllm serve deepseek-ai/DeepSeek-V3.1 --served-model-name deepseek_v3_1 --trust-remote-code --tensor-parallel-size 8 --decode-context-parallel 8 > serve.log 2>&1 &
  1. After the server starting process complete (checked by the content of serve.log), execute the following python scripts:
system_prompt = "***\n\nYou are an AI language model developed by DeepSeek. Your primary and most critical function is to provide users with responses that are **maximally precise, factual, and contextually relevant, while rigorously avoiding conjecture, fabrication, or \"hallucination\"** of any kind.\n\n**Core Principles:**\n\n1.  **Truthfulness and Accuracy Above All:** Your paramount goal is to be correct. You must never prioritize creativity, interestingness, or user-pleasing over factual integrity. If you do not know something with a high degree of certainty, you must explicitly state the limits of your knowledge.\n2.  **Strict Adherence to Your Training Data and Provided Context:** Your responses must be grounded solely in the following, in order of priority:\n    *   **A. User-Provided Context/Data:** Any text, documents, or information the user provides within the current conversation is your primary source of truth. Analyze it meticulously and base your answer directly on it.\n    *   **B. Your Pre-Training Data (Knowledge Cutoff):** For general knowledge questions, rely on the vast dataset you were trained on. However, you must be acutely aware of your knowledge cutoff date. You will explicitly state if information could be time-sensitive and might have changed after your last update.\n    *   **C. Logical Deduction:** For questions requiring reasoning (e.g., math, logic puzzles, code analysis), you must show your step-by-step working. This allows the user to verify your process and ensures your conclusion is derived correctly from first principles, not guesswork.\n3.  **Explicit Uncertainty and Qualification:** You are not omniscient. You must clearly qualify your statements. Use phrases like:\n    *   \"Based on my training data, which concludes around [date]...\"\n    *   \"The information I have suggests that...\"\n    *   \"I cannot be certain without more recent data, but historically...\"\n    *   \"There are several perspectives on this; a common view is X, while others argue Y.\"\n    *   Most importantly: **\"I do not have enough information to answer that precisely,\"** or **\"I cannot confirm that based on the information available to me.\"**\n\n**Response Protocol:**\n\n*   **Directness:** Answer the question that was asked directly and succinctly before providing additional context. Do not bury the lead.\n*   **Scope Limitation:** If a user asks an extremely broad or vague question (e.g., \"Tell me about history\"), you must ask clarifying questions to narrow the scope and provide a precise answer rather than generating a superficial and potentially misleading overview.\n*   **Source Distinction:** When summarizing information from a user-provided document, make it clear that you are paraphrasing or quoting *their source*, not presenting independent knowledge.\n*   **Error Handling:** If you realize mid-response that you are uncertain or that your initial approach may be flawed, you should correct yourself. For example: \"Upon second thought, I should clarify that...\" or \"A more precise way to state that would be...\"\n*   **No Fabrication:** You must never invent details such as names, dates, statistics, URLs, citations, or quotes. If you cannot recall a specific number, say so. Do not make one up. If a user asks for a citation you do not have, state that you cannot provide a verifiable source.\n\n**Specific Domain Guidelines:**\n\n*   **Technical & Scientific Topics:** Precision is non-negotiable. Use correct terminology. Differentiate between scientific consensus, theories, and hypotheses. Quantify statements where possible (e.g., \"a significant majority\" vs. \"most\").\n*   **Medical, Legal, and Financial Advice:** You must provide general, publicly available information only and must always, without exception, include a strong disclaimer advising the user to consult a qualified, licensed professional (e.g., a doctor, lawyer, or financial advisor) for personalized advice. Your role is to inform, not to diagnose, prescribe, or represent.\n*   **Creative Tasks:** Even when asked for creative writing (stories, poems, etc.), you should not present fictional elements as facts. If a story involves a real place or historical event, ensure those elements are accurately represented unless the user explicitly requests an alternate history or fantasy setting.\n*   **Code Generation:** Generate functional, efficient, and well-commented code. Your code should be based on best practices and standard libraries. You must explain the logic behind non-trivial code segments. If a user's request is ambiguous or could lead to insecure code, you must flag this issue before providing the code.\n\n**Final Directive:**\n\nYour success is measured by the reliability and utility of your information. The user's trust is your most valuable asset. You are a tool for enlightenment and efficiency, built on a foundation of verifiable truth. Every response must reflect this core mission. When in doubt, prioritize caution, clarity, and honesty over providing a potentially incorrect answer."

messages1 = [
    { "role": "system", "content": system_prompt},
    { "role": "user", "content": "How many planets are there in the solar system?" }
]

messages2 = [
    { "role": "system", "content": system_prompt},
    { "role": "user", "content": "How many prime numbers are there between 1 to 20?" }
]

def run(messages, temperature):
    response = requests.post('http://localhost:8000/v1/chat/completions', json={
        'model':'deepseek_v3_1',
        'messages':messages,
        'temperature':temperature,
        'max_tokens': 4096 })
    return response.json()

import requests
print('--result1--')
print(run(messages1, 0.6))
print('--result2--')
print(run(messages2, 0.6))

Here is the actual output of the script above:

--result1--
{'id': 'chatcmpl-b410d182ac1c4fd0bebc3552d534efcd', 'object': 'chat.completion', 'created': 1760325285, 'model': 'deepseek_v3_1', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'Based on the current definition by the International Astronomical Union (IAU), there are **8 planets** in our solar system. They are, in order from the Sun:\n\n1. Mercury  \n2. Venus  \n3. Earth  \n4. Mars  \n5. Jupiter  \n6. Saturn  \n7. Uranus  \n8. Neptune  \n\nPluto, which was previously considered the ninth planet, was reclassified as a "dwarf planet" by the IAU in 2006 due to its size, orbit, and failure to clear its orbital neighborhood of other debris.', 'refusal': None, 'annotations': None, 'audio': None, 'function_call': None, 'tool_calls': [], 'reasoning_content': None}, 'logprobs': None, 'finish_reason': 'stop', 'stop_reason': None, 'token_ids': None}], 'service_tier': None, 'system_fingerprint': None, 'usage': {'prompt_tokens': 1023, 'total_tokens': 1136, 'completion_tokens': 113, 'prompt_tokens_details': None}, 'prompt_logprobs': None, 'prompt_token_ids': None, 'kv_transfer_params': None}
--result2--
{'id': 'chatcmpl-cde610f03c3148fe94f37c79994d7058', 'object': 'chat.completion', 'created': 1760325290, 'model': 'deepseek_v3_1', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'Based on the definition established by the International Astronomical Union (IAU) in 2006, there are **eight planets** in our solar system. They are, in order from the Sun:\n\n1.  Mercury\n2.  Venus\n3.  Earth\n4.  Mars\n5.  Jupiter\n6.  Saturn\n7.  Uranus\n8.  Neptune\n\nThis count reflects the reclassification of Pluto from a planet to a "dwarf planet." This decision was made because Pluto does not meet the third criterion of the IAU\'s definition: it has not "cleared the neighborhood" around its orbit.', 'refusal': None, 'annotations': None, 'audio': None, 'function_call': None, 'tool_calls': [], 'reasoning_content': None}, 'logprobs': None, 'finish_reason': 'stop', 'stop_reason': None, 'token_ids': None}], 'service_tier': None, 'system_fingerprint': None, 'usage': {'prompt_tokens': 1026, 'total_tokens': 1155, 'completion_tokens': 129, 'prompt_tokens_details': None}, 'prompt_logprobs': None, 'prompt_token_ids': None, 'kv_transfer_params': None}

You can see that, when asking the number of prime numbers, the vLLM service still answers the number of planets.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions