Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Streaming w/ tool choice auto often truncates the final delta in the streamed arguments #10781

Closed
1 task done
cedonley opened this issue Nov 29, 2024 · 0 comments · Fixed by #10979
Closed
1 task done
Labels
bug Something isn't working

Comments

@cedonley
Copy link
Contributor

cedonley commented Nov 29, 2024

Your current environment

The output of `python collect_env.py`
PyTorch version: 2.5.1+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A

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

Python version: 3.11.10 (main, Oct  3 2024, 07:29:13) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-122-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.4.131
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA RTX A6000
GPU 1: NVIDIA RTX A6000
GPU 2: NVIDIA GeForce RTX 3090
GPU 3: NVIDIA GeForce RTX 3090

Nvidia driver version: 555.42.06
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
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):                               24
On-line CPU(s) list:                  0-23
Vendor ID:                            GenuineIntel
Model name:                           13th Gen Intel(R) Core(TM) i7-13700K
CPU family:                           6
Model:                                183
Thread(s) per core:                   2
Core(s) per socket:                   16
Socket(s):                            1
Stepping:                             1
CPU max MHz:                          5400.0000
CPU min MHz:                          800.0000
BogoMIPS:                             6835.20
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 smx 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 invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi 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 avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr 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 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 and seccomp
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] mypy==1.11.1
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-ml-py==12.560.30
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] pyzmq==26.2.0
[pip3] sentence-transformers==3.2.1
[pip3] torch==2.5.1
[pip3] torchvision==0.20.1
[pip3] transformers==4.46.2
[pip3] transformers-stream-generator==0.0.5
[pip3] triton==3.1.0
[conda] cuda                      12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-cccl                 12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-command-line-tools   12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-compiler             12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-cudart               12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-cudart-dev           12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-cudart-static        12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-cuobjdump            12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-cupti                12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-cupti-static         12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-cuxxfilt             12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-demo-suite           12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-documentation        12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-driver-dev           12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-gdb                  12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-libraries            12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-libraries-dev        12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-libraries-static     12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-nsight               12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nsight-compute       12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-nvcc                 12.4.131                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvdisasm             12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvml-dev             12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvprof               12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvprune              12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvrtc                12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvrtc-dev            12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvrtc-static         12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvtx                 12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-nvvp                 12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-opencl               12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-opencl-dev           12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-profiler-api         12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-sanitizer-api        12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] cuda-toolkit              12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-tools                12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] cuda-visual-tools         12.4.1                        0    nvidia/label/cuda-12.4.1
[conda] gds-tools                 1.9.1.3                       0    nvidia/label/cuda-12.4.1
[conda] libcublas                 12.4.5.8                      0    nvidia/label/cuda-12.4.1
[conda] libcublas-dev             12.4.5.8                      0    nvidia/label/cuda-12.4.1
[conda] libcublas-static          12.4.5.8                      0    nvidia/label/cuda-12.4.1
[conda] libcufft                  11.2.1.3                      0    nvidia/label/cuda-12.4.1
[conda] libcufft-dev              11.2.1.3                      0    nvidia/label/cuda-12.4.1
[conda] libcufft-static           11.2.1.3                      0    nvidia/label/cuda-12.4.1
[conda] libcufile                 1.9.1.3                       0    nvidia/label/cuda-12.4.1
[conda] libcufile-dev             1.9.1.3                       0    nvidia/label/cuda-12.4.1
[conda] libcufile-static          1.9.1.3                       0    nvidia/label/cuda-12.4.1
[conda] libcurand                 10.3.5.147                    0    nvidia/label/cuda-12.4.1
[conda] libcurand-dev             10.3.5.147                    0    nvidia/label/cuda-12.4.1
[conda] libcurand-static          10.3.5.147                    0    nvidia/label/cuda-12.4.1
[conda] libcusolver               11.6.1.9                      0    nvidia/label/cuda-12.4.1
[conda] libcusolver-dev           11.6.1.9                      0    nvidia/label/cuda-12.4.1
[conda] libcusolver-static        11.6.1.9                      0    nvidia/label/cuda-12.4.1
[conda] libcusparse               12.3.1.170                    0    nvidia/label/cuda-12.4.1
[conda] libcusparse-dev           12.3.1.170                    0    nvidia/label/cuda-12.4.1
[conda] libcusparse-static        12.3.1.170                    0    nvidia/label/cuda-12.4.1
[conda] libnpp                    12.2.5.30                     0    nvidia/label/cuda-12.4.1
[conda] libnpp-dev                12.2.5.30                     0    nvidia/label/cuda-12.4.1
[conda] libnpp-static             12.2.5.30                     0    nvidia/label/cuda-12.4.1
[conda] libnvfatbin               12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] libnvfatbin-dev           12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] libnvjitlink              12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] libnvjitlink-dev          12.4.127                      0    nvidia/label/cuda-12.4.1
[conda] libnvjpeg                 12.3.1.117                    0    nvidia/label/cuda-12.4.1
[conda] libnvjpeg-dev             12.3.1.117                    0    nvidia/label/cuda-12.4.1
[conda] libnvjpeg-static          12.3.1.117                    0    nvidia/label/cuda-12.4.1
[conda] nsight-compute            2024.1.1.4                    0    nvidia/label/cuda-12.4.1
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-cublas-cu12        12.4.5.8                 pypi_0    pypi
[conda] nvidia-cuda-cupti-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-runtime-cu12  12.4.127                 pypi_0    pypi
[conda] nvidia-cudnn-cu12         9.1.0.70                 pypi_0    pypi
[conda] nvidia-cufft-cu12         11.2.1.3                 pypi_0    pypi
[conda] nvidia-curand-cu12        10.3.5.147               pypi_0    pypi
[conda] nvidia-cusolver-cu12      11.6.1.9                 pypi_0    pypi
[conda] nvidia-cusparse-cu12      12.3.1.170               pypi_0    pypi
[conda] nvidia-ml-py              12.560.30                pypi_0    pypi
[conda] nvidia-nccl-cu12          2.21.5                   pypi_0    pypi
[conda] nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
[conda] nvidia-nvtx-cu12          12.4.127                 pypi_0    pypi
[conda] pyzmq                     26.2.0                   pypi_0    pypi
[conda] sentence-transformers     3.2.1                    pypi_0    pypi
[conda] torch                     2.5.1                    pypi_0    pypi
[conda] torchvision               0.20.1                   pypi_0    pypi
[conda] transformers              4.46.2                   pypi_0    pypi
[conda] transformers-stream-generator 0.0.5                    pypi_0    pypi
[conda] triton                    3.1.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.1.dev3628+ge7f76a2 (git sha: e7f76a2
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0	GPU1	GPU2	GPU3	CPU Affinity	NUMA Affinity	GPU NUMA ID
GPU0	 X 	NV4	PHB	PHB	0-23	0		N/A
GPU1	NV4	 X 	PHB	PHB	0-23	0		N/A
GPU2	PHB	PHB	 X 	PHB	0-23	0		N/A
GPU3	PHB	PHB	PHB	 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

LD_LIBRARY_PATH=/ai/miniconda3/envs/vllm/lib/python3.11/site-packages/cv2/../../lib64:/lib:/usr/lib:/usr/local/lib:/usr/local/cuda-12.3/lib64:/lib/x86_64-linux-gnu/
CUDA_DEVICE_ORDER=PCI_BUS_ID
CUDA_MODULE_LOADING=LAZY

Model Input Dumps

No response

🐛 Describe the bug

The current streaming implementation when using "auto" tool choice has multiple issues. I have validated that these issues exist with both the Hermes and Mistral tool parsers and have prepared a PR that I'll be submitting shortly to fix these issues.

  1. With all parsers, when a Delta is created in serving_chat.py, it is not sent until the end of the chat_completion_stream_generator function is reached. However, when the end of a tool is detected, a new
    delta that doesn't include the already-constructed delta is created and the original delta is not submitted.

For example: if arguments is
{"arguments": "{\"prompt\":\"Wicked Movie 2024\"}"
it is possible that depending on token return from the model, perhaps "2024" or even "vie 2024" would be dropped.

  1. Hermes parser has a similar issue where it doesn't even return the delta when it detects that the tool end token is detected. This is because when it detects that the tool end token is provided, it may still have part of an unset delta that it has not yet returned.

  2. Mistral parser may match the wrong part of the initial token if the argument name is short enough to fit in a single delta. This will result in broken JSON object being returned that is missing the name of the first argument and duplicates other parts of the string.

All of these are somewhat dependent on how the deltas come back from the model and except in case 3, the json object returned looks valid, but the final argument's value may be truncated.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant