vLLM vs llama.cpp: which inference engine fits your workload
One is built to serve many users from datacenter GPUs, the other to run a quantized model almost anywhere. Here is how to tell which one your workload needs.
- Type
- Comparison
- Last reviewed
- November 15, 2026
- Sources cited
- 7 sources ↓
What this covers
The short answer
vLLM and llama.cpp are both open-source engines that load an open-weight model and serve it behind an OpenAI-compatible API. They were built for different jobs, and most of the choice follows from how many people will hit the server at once and what hardware it runs on.
- Choose vLLM when you serve many concurrent requests from GPUs that can hold the model (in 16-bit, FP8, or a GPU-oriented 4-bit format such as AWQ or GPTQ) and aggregate throughput per GPU is the number you are paid on.
- Choose llama.cpp when the model runs on a laptop, an Apple Silicon Mac, a CPU-only server, a consumer GPU that cannot hold the whole model, or an edge device, and when traffic is one user or a handful.
- Use both when you prototype locally and serve in production: llama.cpp on the developer machine, vLLM on the GPU fleet. Just evaluate the production quantization, not the local one (see the last section).
vLLM and llama.cpp at a glance
| vLLM | llama.cpp | |
|---|---|---|
| Written in | Python, with C++/CUDA and Triton kernels | C/C++ on its own tensor library, ggml |
| Built for | High-throughput serving to many users | Efficient local and on-device inference |
| Model format | Hugging Face checkpoints (safetensors) | GGUF files, converted from Hugging Face with convert_hf_to_gguf.py |
| Quantization | FP8, AWQ, GPTQ, bitsandbytes, compressed-tensors and more; GGUF only as an experimental plugin | GGUF quant types from 1.5 to 8 bits (for example Q4_K_M, Q5_K_M, Q8_0 and the IQ types) |
| Hardware | NVIDIA GPUs first; also AMD, Intel, TPU, Arm and x86 CPUs, and more through hardware plugins | CPUs (x86 and Arm), Apple Metal, CUDA, HIP, Vulkan, SYCL and others; layers can be split between CPU and GPU |
| Concurrency | Continuous batching over a paged KV cache (PagedAttention) | llama-server runs a fixed number of parallel slots (four by default) with continuous batching |
| Multiple GPUs | Tensor, pipeline, data and expert parallelism, across nodes | Layers or rows split across GPUs; an RPC backend spreads work over machines |
| Server | vllm serve, OpenAI-compatible | llama-server, OpenAI-compatible, with a built-in web UI |
| Install | pip or Docker, with a matching PyTorch and GPU driver stack | Prebuilt binaries, package managers, or a CMake build |
| License | Apache 2.0 | MIT |
Hardware and quantization support in both projects changes from release to release. Check the vLLM installation docs and the llama.cpp README for the version you plan to run.
How each one spends memory
On startup vLLM claims a fixed share of GPU memory (the --gpu-memory-utilization setting, 0.9 by default), loads the weights, and turns what is left into a pool of KV-cache blocks. PagedAttention hands those blocks to requests as they grow, so memory is not reserved for tokens a request never produces, and more requests fit in one batch. Our vLLM architecture and PagedAttention internals piece walks through the block tables and scheduler.
llama.cpp allocates a KV cache sized by the context you ask for (-c), and llama-server shares it between its slots. In recent builds the default is four slots drawing on one unified pool; set -np explicitly and the context is divided evenly instead, so -c 16384 -np 4 caps each request at about 4,096 tokens. The -ngl flag sets how many layers go to the GPU; the rest stay in system RAM and run on the CPU. That partial offload is the reason a model larger than your VRAM can still run, more slowly, on llama.cpp.
Both can shrink the KV cache itself: vLLM with --kv-cache-dtype fp8, llama.cpp with --cache-type-k and --cache-type-v (for example q8_0; a quantized V cache needs flash attention enabled). On long contexts the cache, not the weights, is often what runs out first.
Throughput, latency and concurrency
Generating a token is usually limited by how fast the GPU can read the model's weights, not by arithmetic. Batching many requests into one forward pass reads the weights once for all of them, which is why total throughput rises with concurrency. vLLM's scheduler is built around that: it keeps the batch full by admitting new requests as others finish, mixes prefill and decode work (chunked prefill), and reuses the KV cache of shared prompt prefixes.
llama.cpp batches across its slots too, and caches prompts per slot, but its design centres on a small footprint and a single fast stream. For one user, the gap between the two is often small and can go either way depending on hardware and quantization. As concurrent requests climb into the dozens, vLLM on a capable GPU is the engine designed for that load.
Published head-to-head numbers vary widely with GPU, model, quantization, context length and engine version, and many are out of date within months. Treat any single benchmark as a hint and measure your own workload (see below).
Quantization: the format decides a lot
The two engines mostly read different files. llama.cpp runs GGUF, and its k-quants and i-quants let you pick a size that fits the memory you have, down to very low bit widths. vLLM is fastest with formats that have optimized GPU kernels: FP8 on recent NVIDIA and AMD GPUs, and 4-bit AWQ or GPTQ weights. Our GPTQ vs AWQ comparison covers how those two differ in accuracy and why both depend on fast kernels.
vLLM can load GGUF, but its docs call that support highly experimental and under-optimized, and it has moved to a separate plugin. If you want vLLM in production, start from a Hugging Face checkpoint or an AWQ, GPTQ or FP8 build of it rather than a GGUF file.
Which to pick for your hardware
| Where it runs | Start with | Why |
|---|---|---|
| MacBook or Mac Studio (Apple Silicon) | llama.cpp | Metal support is first-class; vLLM's Apple Silicon support is experimental or comes through a community plugin |
| CPU-only server or laptop | llama.cpp | Its quantized CPU kernels are the focus of the project; vLLM's CPU backend covers basic inference and serving |
| One consumer GPU, model larger than its VRAM | llama.cpp | Partial offload with -ngl runs the remaining layers on the CPU |
| One consumer GPU, model fits with room for KV cache | Either; benchmark both | For one user they are close; vLLM pulls ahead as concurrency grows |
| Datacenter GPUs serving an application or API | vLLM | Continuous batching, paged KV cache, prefix caching and multi-GPU parallelism are built for this |
| Phones, single-board computers, embedded | llama.cpp | A single C/C++ library with no Python runtime |
How to benchmark both on your hardware
Use the model, quantization, prompt lengths and concurrency you expect in production. Record time to first token, time per output token, total output tokens per second, and peak memory at several concurrency levels (for example 1, 4, 16 and 64 simultaneous requests).
vLLM ships its own load generator. Start the server, then drive it from a second shell:
vllm serve <model>
vllm bench serve --model <model> \
--dataset-name random \
--random-input-len 1024 --random-output-len 256 \
--request-rate 8 --num-prompts 200For llama.cpp, llama-bench measures raw prompt-processing and generation speed for one stream, and llama-server is what you load-test for concurrency:
llama-bench -m model.gguf -p 1024 -n 256
llama-server -m model.gguf -c 16384 -ngl 99Because both servers speak the OpenAI API, point the same load generator at each one so the request pattern is identical. Flags change between releases; check vllm bench serve --help and the llama-server README for your version.
Running both: local prototype, GPU production
A common setup is llama.cpp (or a local runner such as Ollama; see Ollama vs llama.cpp) for development and vLLM for the deployed service. It works, with one catch: a Q4_K_M GGUF on your laptop and an AWQ or FP8 checkpoint on the server are different approximations of the same model, and their outputs will not match token for token. Run your evaluation set against the exact build you deploy.
If latency for a single stream matters more than throughput, look at speculative decoding, which both engines support in some form. Our speculative decoding piece explains when it helps and when it slows things down.