vllm - ✅(Solved) Fix [Bug]: Garbled output Qwen3.5-122B-A10B VLLM 0.17.0 [1 pull requests, 5 comments, 4 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#36656Fetched 2026-04-08 00:35:37
View on GitHub
Comments
5
Participants
4
Timeline
9
Reactions
0
Author
Timeline (top)
commented ×5subscribed ×2cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #36760: Fix(Offline Inference): Enable reasoning parser support in LLM class …

Description (problem / solution / changelog)

…(#36656)

<!-- markdownlint-disable -->

Purpose

Test Plan

Test Result


<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

  • vllm/entrypoints/llm.py (modified, +21/-0)
  • vllm/outputs.py (modified, +3/-1)

Code Example

==============================
        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                : Could not collect
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

==============================
      Python Environment
==============================
Python version               : 3.12.1 (main, Jan  8 2024, 04:46:10) [Clang 17.0.6 ] (64-bit runtime)
Python platform              : Linux-4.4.0-x86_64-with-glibc2.35

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.8.61
CUDA_MODULE_LOADING set to   :
GPU models and configuration : GPU 0: NVIDIA B200
Nvidia driver version        : 580.95.05
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, 48 bits virtual
Byte Order:          Little Endian
CPU(s):              17
On-line CPU(s) list: 0-16
Vendor ID:           GenuineIntel
Model name:          unknown
CPU family:          6
Model:               207
Thread(s) per core:  1
Core(s) per socket:  17
Socket(s):           1
Stepping:            unknown
BogoMIPS:            2100.00
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm pni pclmulqdq dtes64 ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid cldemote movdiri movdir64b fsrm md_clear serialize tsxldtrk amx_bf16 avx512_fp16 amx_tile amx_int8 arch_capabilities

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.4
[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.19.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.1
[pip3] nvidia-cutlass-dsl-libs-base==4.4.1
[pip3] nvidia-ml-py==13.590.48
[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.17.0
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
        GPU0 CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X                              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
==============================
NVIDIA_VISIBLE_DEVICES=GPU-fd135ca1-4787-63e6-81e3-cc35e883789b
NVIDIA_REQUIRE_CUDA=cuda>=12.8 brand=unknown,driver>=470,driver<471 brand=grid,driver>=470,driver<471 brand=tesla,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=vapps,driver>=470,driver<471 brand=vpc,driver>=470,driver<471 brand=vcs,driver>=470,driver<471 brand=vws,driver>=470,driver<471 brand=cloudgaming,driver>=470,driver<471 brand=unknown,driver>=535,driver<536 brand=grid,driver>=535,driver<536 brand=tesla,driver>=535,driver<536 brand=nvidia,driver>=535,driver<536 brand=quadro,driver>=535,driver<536 brand=quadrortx,driver>=535,driver<536 brand=nvidiartx,driver>=535,driver<536 brand=vapps,driver>=535,driver<536 brand=vpc,driver>=535,driver<536 brand=vcs,driver>=535,driver<536 brand=vws,driver>=535,driver<536 brand=cloudgaming,driver>=535,driver<536 brand=unknown,driver>=550,driver<551 brand=grid,driver>=550,driver<551 brand=tesla,driver>=550,driver<551 brand=nvidia,driver>=550,driver<551 brand=quadro,driver>=550,driver<551 brand=quadrortx,driver>=550,driver<551 brand=nvidiartx,driver>=550,driver<551 brand=vapps,driver>=550,driver<551 brand=vpc,driver>=550,driver<551 brand=vcs,driver>=550,driver<551 brand=vws,driver>=550,driver<551 brand=cloudgaming,driver>=550,driver<551 brand=unknown,driver>=560,driver<561 brand=grid,driver>=560,driver<561 brand=tesla,driver>=560,driver<561 brand=nvidia,driver>=560,driver<561 brand=quadro,driver>=560,driver<561 brand=quadrortx,driver>=560,driver<561 brand=nvidiartx,driver>=560,driver<561 brand=vapps,driver>=560,driver<561 brand=vpc,driver>=560,driver<561 brand=vcs,driver>=560,driver<561 brand=vws,driver>=560,driver<561 brand=cloudgaming,driver>=560,driver<561 brand=unknown,driver>=565,driver<566 brand=grid,driver>=565,driver<566 brand=tesla,driver>=565,driver<566 brand=nvidia,driver>=565,driver<566 brand=quadro,driver>=565,driver<566 brand=quadrortx,driver>=565,driver<566 brand=nvidiartx,driver>=565,driver<566 brand=vapps,driver>=565,driver<566 brand=vpc,driver>=565,driver<566 brand=vcs,driver>=565,driver<566 brand=vws,driver>=565,driver<566 brand=cloudgaming,driver>=565,driver<566
NCCL_VERSION=2.25.1-1
NVIDIA_DRIVER_CAPABILITIES=all
NVIDIA_PRODUCT_NAME=CUDA
CUDA_VERSION=12.8.0
LD_LIBRARY_PATH=/usr/local/lib/python3.12/site-packages/cv2/../../lib64:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
OMP_NUM_THREADS=1
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
MKL_NUM_THREADS=1
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_root

---

def build_messages(items: list[dict]) -> list[list[dict]]:
    """Build chat messages for each item. vLLM's llm.chat() handles the template."""
    return [
        [{"role": "user", "content": PROMPT_TEMPLATE.format(text=item["text"])}]
        for item in items
    ]
    import shutil
    import time
    from vllm import LLM, SamplingParams

    llm = LLM(
        model=MODEL,
        tensor_parallel_size=1,
        gpu_memory_utilization=0.95,
        max_model_len=2048,
        enable_prefix_caching=True,
        trust_remote_code=True,
        language_model_only=True,
        reasoning_parser="qwen3",
        performance_mode="throughput",
    )

    # --- Sampling params ---
    sampling_params = SamplingParams(
    temperature=1.0, 
    top_p=0.95, 
    top_k=20, 
    min_p=0.0, 
    presence_penalty=1.5, 
    repetition_penalty=1.0
    max_tokens=1024,
    )
    messages_list = build_messages(items)

    # --- Run inference via chat() — lets vLLM handle the template ---
    print(f"Starting generation for {len(messages_list)} messages...")
    t0 = time.time()

    outputs = llm.chat(messages_list, sampling_params=sampling_params)

    elapsed = time.time() - t0
    print(f"Generation complete: {elapsed:.1f}s ({len(outputs)/elapsed:.1f} items/sec)")

    # --- Dump full response objects for debugging ---
    import json

    debug_results = []
    for i, (item, output) in enumerate(zip(items, outputs)):
        debug_results.append({
            "item": item,
            "response": str(output),
        })

    with open("/tmp/debug_outputs.json", "w") as f:
        json.dump(debug_results, f, indent=2, default=str)
    print("Wrote full response objects to /tmp/debug_outputs.json")

---

{
    "item": {
      "id": 2,
      "text": "pyrexin 80 mg supp (10 suppos/box)"
    },
    "response": "RequestOutput(request_id=2, prompt='<|im_start|>user\\nClassify whether the following string refers to
 a medicine (pharmaceutical drug for human health \u2014 includes tablets, capsules, injections, topical creams, eye
drops, syrups, etc.). Exclude supplements, diagnostics, traditional/herbal medicines, and non-medicine items (medical
devices, consumables). Reply only \"yes\" or \"no\".\\n\\nThis is the string to classify: pyrexin 80 mg supp (10
suppos/box)<|im_end|>\\n<|im_start|>assistant\\n<think>\\n', prompt_token_ids=[248045, 846, 198, 1890, 1386, 3315, 279,
 2614, 886, 18675, 310, 264, 15251, 318, 734, 2109, 24338, 5333, 364, 3611, 2730, 1892, 5469, 27646, 11, 62587, 11,
61979, 11, 63072, 77451, 11, 7662, 20382, 11, 225113, 8339, 11, 4831, 34163, 95074, 31514, 11, 47756, 11, 8343, 36656,
12928, 37273, 11, 321, 2397, 1395, 87770, 3470, 318, 65817, 7370, 11, 4510, 4635, 553, 17308, 1132, 328, 9405, 1, 466,
328, 2083, 3158, 271, 1919, 369, 279, 886, 310, 46522, 25, 4362, 36296, 258, 220, 23, 15, 13348, 86938, 318, 16, 15,
991, 936, 14, 1944, 8, 248046, 198, 248045, 74455, 198, 248068, 198], encoder_prompt=None,
encoder_prompt_token_ids=None, prompt_logprobs=None, outputs=[CompletionOutput(index=0, text='with\\n0:',
token_ids=[4058, 198, 15, 25, 248046], routed_experts=None, cumulative_logprob=None, logprobs=None, finish_reason=stop,
 stop_reason=None)], finished=True, metrics=None, lora_request=None, num_cached_tokens=0)"
  }
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>
==============================
        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                : Could not collect
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

==============================
      Python Environment
==============================
Python version               : 3.12.1 (main, Jan  8 2024, 04:46:10) [Clang 17.0.6 ] (64-bit runtime)
Python platform              : Linux-4.4.0-x86_64-with-glibc2.35

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.8.61
CUDA_MODULE_LOADING set to   :
GPU models and configuration : GPU 0: NVIDIA B200
Nvidia driver version        : 580.95.05
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, 48 bits virtual
Byte Order:          Little Endian
CPU(s):              17
On-line CPU(s) list: 0-16
Vendor ID:           GenuineIntel
Model name:          unknown
CPU family:          6
Model:               207
Thread(s) per core:  1
Core(s) per socket:  17
Socket(s):           1
Stepping:            unknown
BogoMIPS:            2100.00
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm pni pclmulqdq dtes64 ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid cldemote movdiri movdir64b fsrm md_clear serialize tsxldtrk amx_bf16 avx512_fp16 amx_tile amx_int8 arch_capabilities

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.4
[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.19.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.1
[pip3] nvidia-cutlass-dsl-libs-base==4.4.1
[pip3] nvidia-ml-py==13.590.48
[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.17.0
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
        GPU0 CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X                              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
==============================
NVIDIA_VISIBLE_DEVICES=GPU-fd135ca1-4787-63e6-81e3-cc35e883789b
NVIDIA_REQUIRE_CUDA=cuda>=12.8 brand=unknown,driver>=470,driver<471 brand=grid,driver>=470,driver<471 brand=tesla,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=vapps,driver>=470,driver<471 brand=vpc,driver>=470,driver<471 brand=vcs,driver>=470,driver<471 brand=vws,driver>=470,driver<471 brand=cloudgaming,driver>=470,driver<471 brand=unknown,driver>=535,driver<536 brand=grid,driver>=535,driver<536 brand=tesla,driver>=535,driver<536 brand=nvidia,driver>=535,driver<536 brand=quadro,driver>=535,driver<536 brand=quadrortx,driver>=535,driver<536 brand=nvidiartx,driver>=535,driver<536 brand=vapps,driver>=535,driver<536 brand=vpc,driver>=535,driver<536 brand=vcs,driver>=535,driver<536 brand=vws,driver>=535,driver<536 brand=cloudgaming,driver>=535,driver<536 brand=unknown,driver>=550,driver<551 brand=grid,driver>=550,driver<551 brand=tesla,driver>=550,driver<551 brand=nvidia,driver>=550,driver<551 brand=quadro,driver>=550,driver<551 brand=quadrortx,driver>=550,driver<551 brand=nvidiartx,driver>=550,driver<551 brand=vapps,driver>=550,driver<551 brand=vpc,driver>=550,driver<551 brand=vcs,driver>=550,driver<551 brand=vws,driver>=550,driver<551 brand=cloudgaming,driver>=550,driver<551 brand=unknown,driver>=560,driver<561 brand=grid,driver>=560,driver<561 brand=tesla,driver>=560,driver<561 brand=nvidia,driver>=560,driver<561 brand=quadro,driver>=560,driver<561 brand=quadrortx,driver>=560,driver<561 brand=nvidiartx,driver>=560,driver<561 brand=vapps,driver>=560,driver<561 brand=vpc,driver>=560,driver<561 brand=vcs,driver>=560,driver<561 brand=vws,driver>=560,driver<561 brand=cloudgaming,driver>=560,driver<561 brand=unknown,driver>=565,driver<566 brand=grid,driver>=565,driver<566 brand=tesla,driver>=565,driver<566 brand=nvidia,driver>=565,driver<566 brand=quadro,driver>=565,driver<566 brand=quadrortx,driver>=565,driver<566 brand=nvidiartx,driver>=565,driver<566 brand=vapps,driver>=565,driver<566 brand=vpc,driver>=565,driver<566 brand=vcs,driver>=565,driver<566 brand=vws,driver>=565,driver<566 brand=cloudgaming,driver>=565,driver<566
NCCL_VERSION=2.25.1-1
NVIDIA_DRIVER_CAPABILITIES=all
NVIDIA_PRODUCT_NAME=CUDA
CUDA_VERSION=12.8.0
LD_LIBRARY_PATH=/usr/local/lib/python3.12/site-packages/cv2/../../lib64:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
OMP_NUM_THREADS=1
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
MKL_NUM_THREADS=1
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_root
</details>

🐛 Describe the bug

Hi there,

I am trying to do offline inference with the new qwen model and vllm 0.17.0. below is the core of my code. Despite changing much of the different variables (changed max_model_len, removed/added prefix caching/chunking, tried mtp, different sampling params, installed nightly version of vllm and used llm.generate with the tokenizer, and apply_chat_template), no matter what i do the output is garbled, also see below (output:text='with\n0:'). I have tried to follow the guide on vllm and info on huggingface page. Thanks for any help.

def build_messages(items: list[dict]) -> list[list[dict]]:
    """Build chat messages for each item. vLLM's llm.chat() handles the template."""
    return [
        [{"role": "user", "content": PROMPT_TEMPLATE.format(text=item["text"])}]
        for item in items
    ]
    import shutil
    import time
    from vllm import LLM, SamplingParams

    llm = LLM(
        model=MODEL,
        tensor_parallel_size=1,
        gpu_memory_utilization=0.95,
        max_model_len=2048,
        enable_prefix_caching=True,
        trust_remote_code=True,
        language_model_only=True,
        reasoning_parser="qwen3",
        performance_mode="throughput",
    )

    # --- Sampling params ---
    sampling_params = SamplingParams(
    temperature=1.0, 
    top_p=0.95, 
    top_k=20, 
    min_p=0.0, 
    presence_penalty=1.5, 
    repetition_penalty=1.0
    max_tokens=1024,
    )
    messages_list = build_messages(items)

    # --- Run inference via chat() — lets vLLM handle the template ---
    print(f"Starting generation for {len(messages_list)} messages...")
    t0 = time.time()

    outputs = llm.chat(messages_list, sampling_params=sampling_params)

    elapsed = time.time() - t0
    print(f"Generation complete: {elapsed:.1f}s ({len(outputs)/elapsed:.1f} items/sec)")

    # --- Dump full response objects for debugging ---
    import json

    debug_results = []
    for i, (item, output) in enumerate(zip(items, outputs)):
        debug_results.append({
            "item": item,
            "response": str(output),
        })

    with open("/tmp/debug_outputs.json", "w") as f:
        json.dump(debug_results, f, indent=2, default=str)
    print("Wrote full response objects to /tmp/debug_outputs.json")
  {
    "item": {
      "id": 2,
      "text": "pyrexin 80 mg supp (10 suppos/box)"
    },
    "response": "RequestOutput(request_id=2, prompt='<|im_start|>user\\nClassify whether the following string refers to
 a medicine (pharmaceutical drug for human health \u2014 includes tablets, capsules, injections, topical creams, eye
drops, syrups, etc.). Exclude supplements, diagnostics, traditional/herbal medicines, and non-medicine items (medical
devices, consumables). Reply only \"yes\" or \"no\".\\n\\nThis is the string to classify: pyrexin 80 mg supp (10
suppos/box)<|im_end|>\\n<|im_start|>assistant\\n<think>\\n', prompt_token_ids=[248045, 846, 198, 1890, 1386, 3315, 279,
 2614, 886, 18675, 310, 264, 15251, 318, 734, 2109, 24338, 5333, 364, 3611, 2730, 1892, 5469, 27646, 11, 62587, 11,
61979, 11, 63072, 77451, 11, 7662, 20382, 11, 225113, 8339, 11, 4831, 34163, 95074, 31514, 11, 47756, 11, 8343, 36656,
12928, 37273, 11, 321, 2397, 1395, 87770, 3470, 318, 65817, 7370, 11, 4510, 4635, 553, 17308, 1132, 328, 9405, 1, 466,
328, 2083, 3158, 271, 1919, 369, 279, 886, 310, 46522, 25, 4362, 36296, 258, 220, 23, 15, 13348, 86938, 318, 16, 15,
991, 936, 14, 1944, 8, 248046, 198, 248045, 74455, 198, 248068, 198], encoder_prompt=None,
encoder_prompt_token_ids=None, prompt_logprobs=None, outputs=[CompletionOutput(index=0, text='with\\n0:',
token_ids=[4058, 198, 15, 25, 248046], routed_experts=None, cumulative_logprob=None, logprobs=None, finish_reason=stop,
 stop_reason=None)], finished=True, metrics=None, lora_request=None, num_cached_tokens=0)"
  }

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

Fix Plan

To address the issue of garbled output, we need to adjust the sampling_params and ensure proper usage of the llm.chat() function. Here are the steps:

  • Adjust sampling_params:
    • Decrease temperature to reduce randomness: temperature=0.7
    • Adjust top_p and top_k for better token selection: top_p=0.9, top_k=10
  • Verify llm.chat() usage:
    • Ensure messages_list is correctly formatted
    • Check the MODEL and reasoning_parser for compatibility

Example code adjustments:

sampling_params = SamplingParams(
    temperature=0.7, 
    top_p=0.9, 
    top_k=10, 
    min_p=0.0, 
    presence_penalty=1.5, 
    repetition_penalty=1.0,
    max_tokens=1024,
)

Verification

To verify the fix, run the adjusted code and check the output for coherence. Compare the generated text with the expected response.

Extra Tips

  • Consult the vLLM documentation for guidance on sampling_params and llm.chat() usage.
  • Experiment with different sampling_params combinations to find the optimal settings for your specific use case.
  • Ensure the MODEL and reasoning_parser are compatible and suitable for your task.

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