vllm-project / vllm

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

[Usage]: Execution speed of non-Lora requests #8368

Open Pavloveuge opened 2 months ago

Pavloveuge commented 2 months ago

Your current environment

Collecting environment information...
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: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.10.14 (main, Apr  6 2024, 18:45:05) [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-116-generic-x86_64-with-glibc2.31
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.183.01
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
Byte Order:                           Little Endian
Address sizes:                        46 bits physical, 57 bits virtual
CPU(s):                               80
On-line CPU(s) list:                  0-79
Thread(s) per core:                   2
Core(s) per socket:                   20
Socket(s):                            2
NUMA node(s):                         2
Vendor ID:                            GenuineIntel
CPU family:                           6
Model:                                106
Model name:                           Intel(R) Xeon(R) Gold 5320T CPU @ 2.30GHz
Stepping:                             6
CPU MHz:                              800.000
CPU max MHz:                          3500.0000
CPU min MHz:                          800.0000
BogoMIPS:                             4600.00
Virtualization:                       VT-x
L1d cache:                            1.9 MiB
L1i cache:                            1.3 MiB
L2 cache:                             50 MiB
L3 cache:                             60 MiB
NUMA node0 CPU(s):                    0-19,40-59
NUMA node1 CPU(s):                    20-39,60-79
Vulnerability Gather data sampling:   Mitigation; Microcode
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT vulnerable
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 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 SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected
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 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 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi 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 wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] No relevant packages
[conda] Could not collect
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.6.0@
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    NIC0    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X  SYS 20-39,60-79 1       N/A
NIC0    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_bond_0

I'm using vllm/vllm-openai:v0.6.0

How would you like to use vllm

I already use vllm for inference of some models and everything is fine. Also, I have some load tests for my scenario of usage. Recently I wanted to add some LoRA models. After running my load tests (which make requests to the base model, not to Lora) on an instance with LoRA, I noticed that latency increased by about 5 -10% (vs instance without LoRA).

My base model - openchat3.6 (finetune of llama2), LoRA with r=16 on ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"] layers.

I run vllm (for only base model) with:

python3 -m vllm.entrypoints.openai.api_server --model /vllm-workspace/openchat-3.6-8b-20240522/ --dtype float16

for LoRA

python3 -m vllm.entrypoints.openai.api_server --model /vllm-workspace/openchat-3.6-8b-20240522/ --dtype float16 --enable-lora --lora-modules title_model=/vllm-workspace/openchat-3.6-8b-20240522/title_model

I understand that using LoRA consumes additional GPU memory, which may affect amount of available memory for KV-cache, but my GPU KV cache usage: so far from 100%.

I found issue, which was fixed. But I didn’t understand from PR with fix, is it expected that non-LoRa requests to a vllm instance with LoRA will slow down now?

Is it normal that I facing with slowdown in this scenario?

Before submitting a new issue...

jeejeelee commented 2 months ago

I haven't done precise testing, but I think your scenario is as expected.

Pavloveuge commented 2 months ago

Oh, thank you. But do you have any hypotheses why this is so? What could be causing the slowdown? After all, these are requests that do not use adapters and I still have enough free memory for caches

k4rth33k commented 2 months ago

It could be that there is an overhead that comes with un-applying the lora adapter to the model before processing the request. I could be wrong. Maybe @robertgshaw2-neuralmagic or others can clarify.

jeejeelee commented 2 months ago

Oh, thank you. But do you have any hypotheses why this is so? What could be causing the slowdown? After all, these are requests that do not use adapters and I still have enough free memory for caches

Sorry for the delay feedback. Even if none of your requests use adapters, the LoRA-related code will still execute, such as calling LoRA kernels, which can introduce additional overhead. PS: You can verify this using profiler-related functions.

Pavloveuge commented 2 months ago

You can verify this using profiler-related functions.

You are talking about some settings through vllm debug? Or about arbitrary profilers?

jeejeelee commented 2 months ago

See: https://docs.vllm.ai/en/latest/dev/profiling/profiling_index.html