Running open-weights models on your own hardware has moved from hobby to standard practice, driven by data privacy, predictable cost, and independence from API rate limits. This local LLM inference in Ollama vs vLLM vs llama cpp benchmark guide takes a deliberately different approach from most comparison pages: it publishes no tokens-per-second figures at all. Numbers measured on someone else’s GPU, driver, and quantization tell you almost nothing about your machine. Instead, this guide explains what each engine is built for, which factors actually move performance, and how to measure honestly on your own hardware.
Local LLM inference in Ollama vs vLLM vs llama.cpp: benchmark guide to three different engines
All three engines run the same generation of open-weights artificial intelligence models (Llama, Qwen, Mistral, and their relatives), but they optimise for different things. llama.cpp is the low-level engine written in C and C++, built around the GGUF format and aggressive quantization, and able to split work between CPU and GPU. Ollama is a packaging and developer-experience layer on top of llama.cpp: it adds a model library, a daemon, and an OpenAI-compatible API so a model is one command away. vLLM comes from the serving side. It is a Python inference server built for throughput under concurrent load, using PagedAttention to manage attention memory and continuous batching to keep the GPU busy across many simultaneous requests.
That difference in purpose explains nearly every benchmark result you will ever see. An engine tuned for one interactive user looks mediocre in a 64-request load test, and an engine tuned for fleets of requests looks wasteful on a laptop. Neither result is a lie; they are answers to different questions.
The factors that actually decide your throughput
Flip through any local LLM inference Ollama vLLM llama cpp benchmark guide and the tables usually omit the settings that matter most. Five variables dominate real-world speed, and any comparison that does not pin them down is decoration.
Quantization. Running a model at 4-bit instead of 16-bit shrinks it to roughly a quarter of the memory and usually speeds generation up, because inference is often limited by how fast weights can be read from memory. The trade is output quality, which degrades gracefully at moderate quantization and badly at the extreme low end. GGUF quant levels such as Q4_K_M exist precisely because they sit at a widely used balance point.
Context length and the KV cache. Every token of conversation history is stored as key-value data in GPU memory. Long contexts inflate that cache until it competes with the model weights themselves, and the cache grows linearly with concurrent requests. Our explainer on how the KV cache makes LLM inference memory-bound walks through the arithmetic. A benchmark run at 2,048 tokens of context and one run at 32,768 are measuring different workloads.
Batching and concurrency. A single request leaves most of a modern GPU idle. Continuous batching, vLLM’s core technique, slots new requests into the gaps as others finish, which is why serving engines pull away from single-stream tools as concurrency rises. Techniques layered on top, such as the draft-model approach covered in our guide to speculative decoding, shift results again.
Memory bandwidth. Token generation reads the full set of active weights for every token, so generation speed tracks memory bandwidth more than raw compute. This is why the same model feels fast on a high-bandwidth card and sluggish on a compute-strong but bandwidth-poor one.
CPU offload. llama.cpp and Ollama can spill layers into system RAM. It works, and it lets oversized models run at all, but every offloaded layer crosses the PCIe bus per token. Treat offload as a capacity feature, not a performance one.
Side-by-side comparison
The honest comparison is about design and fit, not invented scores. Prices do not enter into it: all three engines are free and open source, though the hardware to run them is not, so check current pricing on any GPU you plan to buy.
| Engine | Design goal | Model formats | Batching model | Best fit |
|---|---|---|---|---|
| llama.cpp | Minimal footprint, maximal control | GGUF | Configurable slots, manual tuning | Edge devices, CPU or mixed offload, embedded serving |
| Ollama | Fastest path from zero to a running model | GGUF via its model library | Automatic, limited knobs | Local development, prototypes, single-user assistants |
| vLLM | Throughput for many simultaneous users | Hugging Face weights, AWQ, GPTQ, FP8 | Continuous batching with PagedAttention | Production APIs, shared internal endpoints, batch jobs |
Two rows deserve emphasis. Ollama’s limited knobs are a feature for its audience: there is very little to misconfigure. vLLM’s format support is the mirror image: it expects datacenter-style deployments, needs a suitable GPU, and does not target CPU-only machines.
Sizing memory without a spreadsheet
Memory planning has three parts. First, the weights: a Q4_K_M build of an 8B model is roughly a 5 GB file, a 32B model roughly 20 GB, and a 70B model roughly 40 GB. Treat those as approximations that vary by model and quant, and check the exact file size on the model page before you buy hardware. Second, the KV cache, which scales with context length and concurrency and can exceed the weights on long-context workloads. Third, runtime overhead: leave headroom rather than planning to the last megabyte, because a server that swaps or refuses requests under load is worse than one with idle memory. If the totals do not fit your card, your realistic options are a smaller model, a lower quant, CPU offload with the speed penalty described above, or a hosted API for that workload.
A worked example shows why the second part surprises people. Take the 32B model above: the weights ask for roughly 20 GB, which sounds comfortable on a 24 GB card. Now serve four users at once with a long context window each. The KV cache for those four sessions grows with every token of history, and it is allocated from the same 24 GB. The setup that looked roomy on paper now either refuses new requests, truncates context, or spills into system RAM and slows down for everyone. This is the most common reason a local deployment that benchmarked well in a single-user test disappoints in production, and it is a sizing error, not an engine flaw. Plan the cache for the concurrency you actually expect, then pick the model that still fits.
How to benchmark on your own hardware
A useful benchmark fixes the model, quantization, context length, and prompt set, then measures both prompt processing and generation separately. Each engine can do this with its own tooling.
llama.cpp ships a dedicated utility, llama-bench, which reports prompt-processing and token-generation rates for a given model file:
llama-bench -m ./model-q4_k_m.gguf -p 512 -n 128
Ollama prints timing details after a run if you ask for them, which makes quick comparisons between two models on the same machine painless:
ollama run llama3.1 --verbose "Summarise this release note in three bullets"
vLLM exposes an OpenAI-compatible server, so the meaningful test is concurrent load from a separate client rather than a single prompt:
vllm serve meta-llama/Llama-3.1-8B-Instruct
Whichever engine you test, write down the GPU, driver version, quant, context length, and concurrency next to any number you keep. A figure without those five facts cannot be reproduced, including by you in three months. It also cannot be compared with the figures in our vLLM vs TGI vs TensorRT-LLM comparison, which applies the same discipline to the wider field of inference servers.
A template for recording your own results
Benchmarks you run yourself are only useful later if you record the conditions alongside the outcome. Keep a small table per model and engine, with one row per setting that can change the result. The cells below describe what to write down, not results: fill them in from your own runs, because the same model on a different card, driver, or quant is effectively a different benchmark.
| Setting | What to record | Why it matters |
|---|---|---|
| Hardware | GPU model and VRAM, CPU, system RAM | Sets the ceiling for both speed and model size |
| Software | Engine and version, GPU driver version | Engine releases change batching and kernel choices |
| Model | Exact model name and quantization level | A Q4 and a Q8 build of one model are different workloads |
| Workload | Context length, prompt length, concurrent requests | Drives KV cache size and batching behaviour |
| Outcome | Prompt-processing rate and generation rate, recorded separately | The two phases stress different parts of the system |
Two habits make these records trustworthy. Change one variable at a time, so a difference in the outcome has exactly one candidate cause. And rerun the same test after engine or driver upgrades before believing an improvement is real, because a faster number after an update sometimes just means the workload quietly changed, for example a shorter default context. A page of notes kept this way will outperform any generic ranking table the next time you choose an engine for new hardware.
Which engine for which job
For a developer workstation or a small team’s internal assistant, start with Ollama. The install-to-answer path is minutes, the API is familiar, and our head-to-head of Ollama vs LM Studio vs llama.cpp covers the desktop end of this choice in more depth. For anything resembling a product (many users, an uptime expectation, a need to squeeze a costly GPU) skip straight to vLLM and containerise it; the walkthrough on serving a Llama model with vLLM and Docker is the practical route. Reach for raw llama.cpp when the target is unusual: a CPU-only VPS, a mixed CPU and GPU box, an embedded deployment, or any situation where you need direct control over threads, context, and offload.
The engine decision is rarely permanent. Models move between these tools with an export or a download, so the expensive mistake is not picking the “wrong” one. It is sizing hardware from a stranger’s benchmark table. Measure on the machine you own, with the model you will actually run, and the right choice usually becomes obvious.