vllm-project / vllm

A high-throughput and memory-efficient inference and serving engine for LLMs
https://docs.vllm.ai
Apache License 2.0
28.48k stars 4.22k forks source link

[Bug]: QLoRA inference returns alternating output #8681

Open rafvasq opened 3 weeks ago

rafvasq commented 3 weeks ago

Your current environment

The output of `python collect_env.py` ``` PyTorch version: 2.4.0+cu121 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A OS: Red Hat Enterprise Linux 9.4 (Plow) (x86_64) GCC version: (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3) Clang version: Could not collect CMake version: Could not collect Libc version: glibc-2.34 Python version: 3.11.7 (main, Aug 23 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (64-bit runtime) Python platform: Linux-4.18.0-372.46.1.el8_6.x86_64-x86_64-with-glibc2.34 Is CUDA available: True CUDA runtime version: Could not collect CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA A100-SXM4-80GB Nvidia driver version: 535.104.12 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, 57 bits virtual Byte Order: Little Endian CPU(s): 80 On-line CPU(s) list: 0-79 Vendor ID: GenuineIntel Model name: Intel Xeon Processor (Icelake) CPU family: 6 Model: 134 Thread(s) per core: 2 Core(s) per socket: 20 Socket(s): 2 Stepping: 0 BogoMIPS: 5600.03 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault 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 avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd arat avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid fsrm md_clear arch_capabilities Virtualization: VT-x Hypervisor vendor: KVM Virtualization type: full L1d cache: 2.5 MiB (80 instances) L1i cache: 2.5 MiB (80 instances) L2 cache: 160 MiB (40 instances) L3 cache: 32 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-39 NUMA node1 CPU(s): 40-79 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown Vulnerability Retbleed: 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 IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Versions of relevant libraries: [pip3] flashinfer==0.1.2+cu121torch2.4 [pip3] numpy==1.26.4 [pip3] nvidia-cublas-cu12==12.1.3.1 [pip3] nvidia-cuda-cupti-cu12==12.1.105 [pip3] nvidia-cuda-nvrtc-cu12==12.1.105 [pip3] nvidia-cuda-runtime-cu12==12.1.105 [pip3] nvidia-cudnn-cu12==9.1.0.70 [pip3] nvidia-cufft-cu12==11.0.2.54 [pip3] nvidia-curand-cu12==10.3.2.106 [pip3] nvidia-cusolver-cu12==11.4.5.107 [pip3] nvidia-cusparse-cu12==12.1.0.106 [pip3] nvidia-ml-py==12.560.30 [pip3] nvidia-nccl-cu12==2.20.5 [pip3] nvidia-nvjitlink-cu12==12.6.68 [pip3] nvidia-nvtx-cu12==12.1.105 [pip3] pyzmq==26.2.0 [pip3] torch==2.4.0 [pip3] torchvision==0.19.0 [pip3] transformers==4.44.2 [pip3] triton==3.0.0 [conda] Could not collect ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: 0.5.5@881aababdb03fb27b7c284a0ff8f9731aeb900cf vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 NIC0 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X NODE 0-39 0 N/A NIC0 NODE 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 ```

Model Input Dumps

Our waitress seemed less than happy about the prix fixe dinner choices and at one point said, Do you really need to hear the specials?\n\n### Response:

🐛 Describe the bug

It was recently noted that QLoRA inferencing on some internal models is consistently producing alternating results. We've noticed that the alternating result is the same as output that not using the adapter would produce. Including some example output below while we continue to try to reproduce it using a public QLoRA model.

Two separate adapters, returning waitress: negative, prix fixe d..:

INFO 09-20 19:00:46 logs.py:155] generate{input=[b'Input:\\\\nOur waitress seemed less...'] prefix_id= correlation_id=None adapter_id=llama-sentiment input_chars=[159] params=stopping { max_new_tokens: 10 } tokenization_time=585.34ms queue_time=281.77ms inference_time=1663.15ms time_per_token=166.32ms total_time=2530.26ms input_toks=37}: Request generated 10 tokens before MAX_TOKENS, output 46 chars: b' waitress: negative, prix fixe d...'
INFO 09-20 19:00:46 logs.py:155] generate{input=[b'Input:\\\\nOur waitress seemed less...'] prefix_id= correlation_id=None adapter_id=llama-tone input_chars=[159] params=stopping { max_new_tokens: 10 } tokenization_time=1295.94ms queue_time=650.13ms inference_time=583.46ms time_per_token=58.35ms total_time=2529.53ms input_toks=37}: Request generated 10 tokens before MAX_TOKENS, output 46 chars: b' waitress: negative, prix fixe d...'

With two separate adapters, returning I am sorry to hear that:

INFO 09-19 20:39:23 logs.py:155] generate{input=[b'Input:\\\\nOur waitress seemed less...'] prefix_id= correlation_id=None adapter_id=llama-qlora/tone input_chars=[159] params=stopping { max_new_tokens: 10 } tokenization_time=602.39ms queue_time=375.74ms inference_time=1748.66ms time_per_token=174.87ms total_time=2726.78ms input_toks=37}: Request generated 10 tokens before MAX_TOKENS, output 30 chars: b'###\\\\n\\\\nI am sorry to hear that'
INFO 09-19 20:39:23 logs.py:155] generate{input=[b'Input:\\\\nOur waitress seemed less...'] prefix_id= correlation_id=None adapter_id=llama-qlora/sentiment input_chars=[159] params=stopping { max_new_tokens: 10 } tokenization_time=978.39ms queue_time=1167.27ms inference_time=580.27ms time_per_token=58.03ms total_time=2725.93ms input_toks=37}: Request generated 10 tokens before MAX_TOKENS, output 30 chars: b'###\\\\n\\\\nI am sorry to hear that'

Without an adapter, returning I am sorry to hear that and with the adapter: waitress: negative, prix fixe d...

INFO 09-20 16:08:53 logs.py:155] generate{input=[b'Input:\\\\nOur waitress seemed less...'] prefix_id= correlation_id=None adapter_id= input_chars=[159] params=stopping { max_new_tokens: 10 } tokenization_time=2.36ms queue_time=0.47ms inference_time=397.80ms time_per_token=39.78ms total_time=400.64ms input_toks=37}: Request generated 10 tokens before MAX_TOKENS, output 30 chars: b'###\\\\n\\\\nI am sorry to hear that'
INFO 09-20 16:08:55 logs.py:155] generate{input=[b'Input:\\\\nOur waitress seemed less...'] prefix_id= correlation_id=None adapter_id=llama-qlora/tone input_chars=[159] params=stopping { max_new_tokens: 10 } tokenization_time=582.70ms queue_time=266.40ms inference_time=1507.88ms time_per_token=150.79ms total_time=2356.99ms input_toks=37}: Request generated 10 tokens before MAX_TOKENS, output 46 chars: b' waitress: negative, prix fixe d...'

Before submitting a new issue...

prashantgupta24 commented 3 weeks ago

Sometimes vllm server instances load such that the adapter doesn't have an effect on the output, in other words, output is the same as if no adapter was applied - happens like 1/10 times?