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]: get the degree of the outlines FSM compilation progress from vlllm0.5.0 engine (via a route) #5436

Closed
syGOAT opened this issue Jun 12, 2024 · 17 comments · Fixed by #6203
Labels
bug Something isn't working

Comments

@syGOAT
Copy link

syGOAT commented Jun 12, 2024

Your current environment

PyTorch version: 2.3.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.5 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.29.2
Libc version: glibc-2.31

Python version: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-91-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 12.2.140
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA L20
GPU 1: NVIDIA L20
GPU 2: NVIDIA L20
GPU 3: NVIDIA L20
GPU 4: NVIDIA L20
GPU 5: NVIDIA L20
GPU 6: NVIDIA L20
GPU 7: NVIDIA L20

Nvidia driver version: 550.54.14
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.6.0
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:                      52 bits physical, 57 bits virtual
CPU(s):                             180
On-line CPU(s) list:                0-179
Thread(s) per core:                 2
Core(s) per socket:                 45
Socket(s):                          2
NUMA node(s):                       2
Vendor ID:                          GenuineIntel
CPU family:                         6
Model:                              143
Model name:                         Intel(R) Xeon(R) Platinum 8457C
Stepping:                           8
CPU MHz:                            2600.000
BogoMIPS:                           5200.00
Hypervisor vendor:                  KVM
Virtualization type:                full
L1d cache:                          4.2 MiB
L1i cache:                          2.8 MiB
L2 cache:                           180 MiB
L3 cache:                           195 MiB
NUMA node0 CPU(s):                  0-89
NUMA node1 CPU(s):                  90-179
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:      Unknown: No mitigations
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 IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Mitigation; TSX disabled
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 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 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 avx_vnni avx512_bf16 wbnoinvd arat 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 arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] torch==2.3.0
[pip3] triton==2.3.0
[pip3] vllm_nccl_cu12==2.18.1.0.4.0
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-nccl-cu12          2.20.5                   pypi_0    pypi
[conda] torch                     2.3.0                    pypi_0    pypi
[conda] triton                    2.3.0                    pypi_0    pypi
[conda] vllm-nccl-cu12            2.18.1.0.4.0             pypi_0    pypiROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.5.0
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     0-89    0               N/A
GPU1    SYS      X      SYS     SYS     SYS     SYS     SYS     SYS     SYS     0-89    0               N/A
GPU2    SYS     SYS      X      SYS     SYS     SYS     SYS     SYS     SYS     0-89    0               N/A
GPU3    SYS     SYS     SYS      X      SYS     SYS     SYS     SYS     SYS     0-89    0               N/A
GPU4    SYS     SYS     SYS     SYS      X      SYS     SYS     SYS     SYS     90-179  1               N/A
GPU5    SYS     SYS     SYS     SYS     SYS      X      SYS     SYS     SYS     90-179  1               N/A
GPU6    SYS     SYS     SYS     SYS     SYS     SYS      X      SYS     SYS     90-179  1               N/A
GPU7    SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      SYS     90-179  1               N/A
NIC0    SYS     SYS     SYS     SYS     SYS     SYS     SYS     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

🐛 Describe the bug

According to https://github.com/vllm-project/vllm/releases/tag/v0.5.0, vllm update Outlines Integration from FSM to Guide.
But when I used this command to start the engine:

python -m vllm.entrypoints.openai.api_server --model /root/autodl-tmp/model/Meta-Llama-3-70B-Instruct --tensor-parallel-size 8 --port 8000 --served-model-name gpt-4 --enable-chunked-prefill --distributed-executor-backend mp 

and posted a guided json request, I found the output below from the vllm server:

Compiling FSM index for all state transitions:   3%|██▏                                                                              | 145/5479 [00:07<04:22, 20.36it/s]

Why did vllm compile FSM? Wasn't it replaced by Guide?

@syGOAT syGOAT added the bug Something isn't working label Jun 12, 2024
@syGOAT syGOAT changed the title [Bug]: [Bug]: vllm0.5.0 still use FSM instead of Guide for Outlines Jun 12, 2024
@simon-mo
Copy link
Collaborator

cc @br3no do you have suggestion here?

@syGOAT
Copy link
Author

syGOAT commented Jun 12, 2024

Maybe Guide is a part of FSM in outlines?

Another question: FSM is compiled every time the engine starts and receives a guided json request. Could we precompile it before starting engine or before receiving a guided json request?

@br3no
Copy link
Contributor

br3no commented Jun 12, 2024

There are still FSMs in Outlines underneath the Guide API.

The FSMs are dependent on the tokenizer’s vocabulary and the guide rule. Therefore, precomputing them is not really possible, since you would need to know ahead of time, what guide rules the requests will contain.

Outlines uses a file system cache to avoid recomputing FSMs across different runs. Are you running vLLM on Docker?

@syGOAT
Copy link
Author

syGOAT commented Jun 12, 2024

Thanks for your reply!

Are you running vLLM on Docker?

@br3no No, I installed vLLM locally. Can I use the cache?

@simon-mo @br3no Could we get the degree of the compilation progress from vlllm engine (via a route)? Or, more simply, just get whether the compilation is complete.

@m0g1cian
Copy link

I found the same issue, and it seems that the output is completely messed up due this. I fallacked to vllm==0.4.3 and now everything works as expected

@syGOAT syGOAT changed the title [Bug]: vllm0.5.0 still use FSM instead of Guide for Outlines [Bug]: get the degree of the outlines FSM compilation progress from vlllm0.5.0 engine (via a route) Jun 12, 2024
@br3no
Copy link
Contributor

br3no commented Jun 12, 2024

@m0g1cian can you give more details about what you mean with “output is completely messed up”?

We have just updated to the latest Outlines version, so there should be no problems in generation quality, only improvements due to bug fixes in the latest Outlines version.

@m0g1cian
Copy link

@m0g1cian can you give more details about what you mean with “output is completely messed up”?

We have just updated to the latest Outlines version, so there should be no problems in generation quality, only improvements due to bug fixes in the latest Outlines version.

@m0g1cian can you give more details about what you mean with “output is completely messed up”?

We have just updated to the latest Outlines version, so there should be no problems in generation quality, only improvements due to bug fixes in the latest Outlines version.

I am not sure if the problem comes from vLLM or SGLang. I am going to make a minimum reproducable demo to find this out. However, I guess it might be SGLang's issue after all.

@br3no
Copy link
Contributor

br3no commented Jun 12, 2024

@syGOAT the cache is used by Outlines automatically. You can see here that the cache location defaults to ~/.cache/outlines and can be overwritten by the env var OUTLINES_CACHE_DIR.

@br3no
Copy link
Contributor

br3no commented Jun 12, 2024

@syGOAT it would not be economical to create an extra API for checking the state of compilation of a particular guide. As I said, the guides are dependent on the request parameters.

As a pragmatic solution to your use-case it might help to add a warm-up routine to your system, by sending requests to vLLM with the guides you expect to get. That way, once the requests arrive, they will be served swiftly.

If you don't know a priori what guides to expect, there is unfortunately nothing to do to improve things using the Outlines engine at the moment. You can try using lm-format-enforcer instead. AFAIK lm-format-enforcer keeps two data-structures; one for the tokenizer vocabulary and one for the guide. Chances are it will be faster than Outlines compiling short-lived guides.

This will not work with CFG guides though, as they are not supported by lm-format-enforcer.

@syGOAT
Copy link
Author

syGOAT commented Jun 16, 2024

As a pragmatic solution to your use-case it might help to add a warm-up routine to your system, by sending requests to vLLM with the guides you expect to get.

It's really a good idea! Thanks for your suggestion.

@syGOAT
Copy link
Author

syGOAT commented Jun 19, 2024

Outlines uses a file system cache to avoid recomputing FSMs across different runs.

@br3no I posted a request with one json schema. Then I shut down vllm engine. And I restarted the engine and posted a request with the same json schema. But FSM was compiled again. Why the outlines cache didn't work?

@ericperfect
Copy link
Contributor

@syGOAT i have same issue, how to use cache when I restarted the engine and posted a request with the same json schema

@ericperfect
Copy link
Contributor

@syGOAT i try outline.get_cache, but it not work

@syGOAT
Copy link
Author

syGOAT commented Jun 24, 2024

@ericperfect me 2

@eByteTheDust
Copy link

When I use --engine-use-ray with v0.5.0.post1 I get the "Compiling FSM index" message all the time, and the inference performance gets really slow.

Without --engine-use-ray is a bit better, but still getting Compiling FSM index from time to time, not just at startup.

this is with --engine-use-ray argument (it never stops):

INFO: 127.0.0.1:39166 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 65/65 [00:02<00:00, 26.24it/s]
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 51/51 [00:02<00:00, 24.55it/s]
INFO: 127.0.0.1:39170 - "POST /v1/chat/completions HTTP/1.1" 200 OK
INFO: 127.0.0.1:39170 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 65/65 [00:02<00:00, 21.97it/s]
Compiling FSM index for all state transitions: 75%|███████████████████████████████████████████████████▍ | 38/51 [00:01<00:00, 37.19it/s]INFO: 127.0.0.1:45134 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 51/51 [00:01<00:00, 25.76it/s]
INFO: 127.0.0.1:49272 - "POST /v1/chat/completions HTTP/1.1" 200 OK
INFO: 127.0.0.1:45134 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 65/65 [00:03<00:00, 17.53it/s]
INFO: 127.0.0.1:49272 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 51/51 [00:01<00:00, 25.73it/s]
INFO: 127.0.0.1:55074 - "POST /v1/chat/completions HTTP/1.1" 200 OK
INFO: 127.0.0.1:49272 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 65/65 [00:02<00:00, 27.45it/s]
INFO: 127.0.0.1:55074 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 91/91 [00:02<00:00, 30.66it/s]
INFO: 127.0.0.1:55074 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 51/51 [00:01<00:00, 26.06it/s]
INFO: 127.0.0.1:47216 - "POST /v1/chat/completions HTTP/1.1" 200 OK
INFO: 127.0.0.1:47216 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 65/65 [00:02<00:00, 27.78it/s]
INFO: 127.0.0.1:52748 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 51/51 [00:01<00:00, 26.21it/s]
INFO: 127.0.0.1:53556 - "POST /v1/chat/completions HTTP/1.1" 200 OK
INFO: 127.0.0.1:53556 - "POST /v1/chat/completions HTTP/1.1" 200 OK
Compiling FSM index for all state transitions: 100%|█████████████████████████████████████████████████████████████████████| 65/65 [00:02<00:00, 27.94it/s]
INFO: 127.0.0.1:48624 - "POST /v1/chat/completions HTTP/1.1" 200 OK

@br3no
Copy link
Contributor

br3no commented Jun 26, 2024

I’ll try to have a look in the coming days! I have been pretty busy the last weeks.

ericperfect added a commit to ericperfect/vllm that referenced this issue Jul 8, 2024
…with the same json schema. But FSM was compiled again, outlines cache didn't work
ericperfect added a commit to ericperfect/vllm that referenced this issue Jul 8, 2024
…with the same json schema. But FSM was compiled again, outlines cache didn't work
ericperfect added a commit to ericperfect/vllm that referenced this issue Jul 8, 2024
…with the same json schema. But FSM was compiled again, outlines cache didn't work
ericperfect added a commit to ericperfect/vllm that referenced this issue Jul 8, 2024
…with the same json schema. But FSM was compiled again, outlines cache didn't work
@ericperfect
Copy link
Contributor

I’ll try to have a look in the coming days! I have been pretty busy the last weeks.

I have fixed the issue #6203

Alvant pushed a commit to compressa-ai/vllm that referenced this issue Oct 26, 2024
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
Development

Successfully merging a pull request may close this issue.

6 participants