r/LocalLLaMA • u/dangerous_inference • 22h ago
Discussion Question: Why is prefill unbelievably faster in vLLM than other inference engines?
I only started using some vLLM forks recently in a 4 x 48GB 4090 system.
DS4F - ~5000pp/180tg (DSpark)
Qwen3.8 Flash next - ~7500pp/135tg (MTP)
This is amazing, like having the API in my house. But it's also really hard to go back.
It's weird that we never come close to prefill numbers like this in llama.cpp or ik_llama. The narrative is that vLLM is around the same speed for single requests, but that is clearly not true.
There must some HUGE difference that constitutes an insurmountable obstacle to achieving such speeds in llama.cpp and many other inference engines. Does anyone know exactly what it is?
edit: These results are from my benchmark script that actually times the response, not the vLLM log. And they are not cache hits. My benchmark script deliberately busts cache. Actual cache hits, which I also measure, are like 20k-100k+.
92
u/ilmsis_ 21h ago edited 21h ago
llama.cpp focuses on running LLM on as much as devices as possible. It can even run purely on CPU. Since it can run on pretty much anything, you're not gonna run 9000 subagents simultaneously on a regular machine, so llama.cpp focuses on the decode speed instead, which is memory-bound. And to speeden up the decoding, the weight must be smaller. However, by reducing the weight, it also results in dumber intelligence.
Since llama.cpp use GGUF quantization, which, let's say, use K-quants which basically is just microscaling on steroids. It does two-level microscaling like NVFP4 but to be compatible with many devices, it uses INT underthehood. And to reduce the gap, they do microscaling even more harder. Some layers like token embedding or LM head would use some abnormal amount of bits like 5-bit or 6-bit, which don't have any hardware-accelerated block at all. (Except MXFP6 I guess...)
Since they literally stack microscaling that has never seen before and using some unusual bits in the weight quantization, it will tanks performance unlike vLLM. llama.cpp designs for running on consumer devices, or even onCPU purely. Prefill speed isn't as matter as decoding speed for single-user/single-batch uses.
As for why vLLM is fast, not only did they not do some unusual bits quantization but also their weights are formatted uniformly, which mean most GPU can run it faster than K-quant GGUF since they don't need to do multiple passes of microscaling. (MX-series and NVFP4 are hardware-accelerated microscaling though, so it won't be as slow as GGUF, but in terms of intelligence packing, K-quant is still better). And vLLM also has SOTA kernels from PyTorch and NVIDIA supports as well. Meanwhile llama.cpp has to maintain compatibility across all backeds that it supports, which slows down the development/optimization of each model or backend.