Skip to content

vLLM vs Ollama vs llama.cpp for self-hosted LLMs

vLLM vs Ollama vs llama.cpp: what each self-hosted LLM tool is built for, how they differ on concurrency, hardware, and quantization, and which to run where.

Published
Reading time
11 min read

In short

  • vLLM vs Ollama compares tools built for different jobs. Ollama and llama.cpp run models on one machine for one person or a small team, while vLLM serves many concurrent users from GPU servers.
  • Ollama processes one request per model at a time by default, and each extra parallel slot multiplies the memory it reserves for context. vLLM's paged KV cache and continuous batching are built for high concurrency.
  • llama.cpp and Ollama run quantized GGUF models on CPUs, Apple Silicon, and consumer GPUs. vLLM runs natively only on Linux and needs a supported accelerator, such as an NVIDIA GPU with compute capability 7.5 or higher.
  • All three expose an OpenAI-compatible API, so code written against Ollama on a laptop can move to a vLLM cluster behind the same gateway with a configuration change.

vLLM vs Ollama is a comparison of two tools built for different jobs. Ollama runs open-weight models on one machine with one command, for one developer or a small team. vLLM is a GPU inference server built to answer many concurrent users at once. llama.cpp, the C/C++ engine that Ollama has long built on, sits underneath much of the local side.

So the useful question is not which one is better. It is which job you are doing: trying a model on a laptop, running a shared service on one GPU box, or serving production traffic. Each job has a clear default, and the boundary between them is concurrency.

Three tools for three jobs

Ollama is a model runner with a built-in model library, aimed at local use. llama.cpp is a lightweight inference engine and server that runs quantized models on almost any hardware. vLLM is a server for GPU clusters that keeps throughput high when hundreds of requests arrive together. They overlap at the edges, but each is built around a different user.

Ollamallama.cppvLLM
Built forRunning models locally with minimal setupFast inference on varied hardware, embedded or servedServing many concurrent users on accelerators
How you start itollama run <model>llama-server with a GGUF filevllm serve <model>
Model formatGGUF, or Safetensors imported through a ModelfileGGUFHugging Face weights, plus many quantized formats
Default concurrencyOne request per model at a timeParallel slots, set automaticallyContinuous batching across all requests
Operating systemsmacOS, Windows, LinuxmacOS, Windows, LinuxLinux only, natively
LicenseMITMITApache-2.0

The table explains most vLLM vs Ollama arguments online. People who compare them on a laptop find Ollama easier and fast enough. People who compare them under load find vLLM far ahead. Both are right about their own job.

How Ollama and llama.cpp relate

Ollama and llama.cpp share foundations: the GGML tensor library and the GGUF model format. Ollama's README lists llama.cpp among its supported backends, and Ollama has built its own engine for multimodal models on top of GGML. The difference between them is packaging: Ollama adds a model library, model management, and a desktop experience.

Ollama's own announcement of its new engine in May 2025 is direct about the history: Ollama had relied on the llama.cpp project for model support, and moved model-specific handling into self-contained model code so each multimodal model can define its own pieces. The same post credits GGML as the tensor library behind Ollama's inference.

What Ollama adds on top:

  • A model library you pull from by name, so ollama run downloads and starts a model in one step.
  • Modelfiles to import your own GGUF or Safetensors weights and set parameters.
  • Automatic hardware detection and model loading and unloading. By default it keeps up to three times as many models loaded as there are GPUs, or three for CPU inference, if they fit in memory.
  • A local REST API on port 11434, installers for macOS, Windows, and Linux, and an official Docker image.

What llama.cpp gives you instead is control. Its llama-server exposes every setting as a flag, runs continuous batching by default, sets the number of parallel slots automatically, and supports speculative decoding and schema-constrained JSON. llama.cpp itself is a C/C++ project, so you can build the engine into a desktop or edge application.

The ollama vs llama.cpp choice comes down to who manages the details. If you want a model running in a minute and do not care which flags it uses, use Ollama. If you need a specific quantization, a specific context size, or the engine inside your own binary, use llama.cpp directly.

Concurrency: where vLLM vs Ollama really differ

The real difference between vLLM and Ollama is what happens when many requests arrive at once. Ollama handles one request per model at a time by default and queues the rest. vLLM batches every active request into each GPU step and allocates KV cache memory as tokens arrive, so throughput grows with load until the GPU is full.

Ollama's FAQ states the defaults. OLLAMA_NUM_PARALLEL, the number of requests each model processes at the same time, defaults to 1. Requests beyond that wait in a queue of up to 512, set by OLLAMA_MAX_QUEUE, and further requests get a 503. Raising the parallel count has a memory cost: required RAM scales with the number of parallel requests times the context length, because each slot reserves a full context.

vLLM was designed around the opposite assumption. The PagedAttention paper that introduced it stores each request's attention state in small blocks allocated on demand, instead of reserving memory for the longest possible output. Continuous batching then adds and removes requests at every decode step. The result is that a vLLM server's throughput rises as concurrency rises, and time to first token stays steady until the GPU is saturated.

OLLAMA · DEFAULT SETTINGSVLLM · ANY LOADSlot 1RUNNING R1FULL CONTEXT RESERVED, MOSTLY EMPTYR2R3R4R5QUEUED UNTIL THE SLOT IS FREEOne batch, every stepR1 · R2 · R3 · R4 · R5 · R6 · R7 · R8JOIN AND LEAVE AT ANY STEPKV BLOCKS, ALLOCATED AS TOKENS ARRIVE
Ollama on a workstation gives each parallel slot a fixed context and queues everything else. vLLM pools KV cache memory across all active requests and batches them into each GPU step.

The clearest public measurement is Red Hat's August 2025 benchmark. It ran vLLM 0.9.1 and Ollama 0.9.2 with Llama 3.1 8B on one A100 40 GB GPU, sweeping concurrency from 1 to 256 with GuideLLM. vLLM peaked at 793 output tokens per second against Ollama's 41. Even with OLLAMA_NUM_PARALLEL raised to 32, Ollama's throughput plateaued well below vLLM's and its time to first token climbed as requests queued.

Two caveats keep that number honest. Red Hat sells products built on vLLM, and both projects have shipped many releases since. The benchmark also found that above a concurrency of 16, vLLM's inter-token latency started to rise as it packed more requests into each batch, while default Ollama's stayed low, because Ollama was running so few requests at a time. vLLM trades a little per-user speed for far more total throughput. For a shared service, that is the right trade.

Hardware and operating systems

llama.cpp and Ollama run almost anywhere: CPUs, Apple Silicon through Metal, NVIDIA and AMD GPUs, and other GPUs through Vulkan, on macOS, Windows, and Linux. vLLM targets data center accelerators on Linux. The hardware you already have often makes the self-hosted LLM decision before any benchmark does.

Ollamallama.cppvLLM
NVIDIACompute capability 5.0 or higher, driver 550 or newerCUDACompute capability 7.5 or higher, such as T4, A100, L4, H100, B200
AMDROCm v7 driversHIPROCm 6.3 or higher
Apple SiliconMetalMetalOnly through the community vLLM-Metal plugin, which runs on MLX
OtherVulkan on Windows and LinuxVulkan, SYCL, CPU, and moreIntel GPUs, CPUs, and plugins for TPU, Gaudi, Ascend
Operating systemsmacOS, Windows, LinuxmacOS, Windows, LinuxLinux; Windows through WSL

The practical reading: if your hardware is a MacBook or a gaming PC, vLLM is not the tool for it, and that is fine. If your hardware is a rack of data center GPUs, Ollama and llama.cpp leave most of it idle under real traffic. vLLM can also split one model across GPUs with --tensor-parallel-size and across nodes with pipeline parallelism and Ray, which matters once a model no longer fits on one card.

Model formats and quantization

Ollama and llama.cpp run GGUF files, a format built for quantized models that fit in limited memory. vLLM loads standard Hugging Face weights and supports GPU-oriented quantization formats. The format you choose decides which hardware a model fits on and how fast it decodes, often more than the engine does.

llama.cpp supports integer quantization from 1.5-bit to 8-bit, which is how a model with billions of parameters fits on a laptop at all. Ollama's model library ships models already quantized. When you bring your own weights, Ollama imports a GGUF file or a directory of Safetensors through a Modelfile, but it does not quantize GGUF models during import: you prepare them first with a GGUF tool such as llama.cpp's quantizer.

vLLM accepts FP8, INT8, INT4, GPTQ, AWQ, and several newer formats, and it can load GGUF too. On GPUs, start from the Hugging Face weights in BF16, or FP8 if your GPU supports it, and treat GGUF as a convenience for models that only exist in that format.

Quality changes with quantization. A heavily quantized model answers faster and fits in less memory, and it can also answer worse on your task. Evaluate the exact quantized file you will deploy, not the full-precision model it came from. LLM evaluation covers how to build that check.

APIs: the part that stays the same

All three tools serve an OpenAI-compatible API, which is what makes moving between them cheap. Ollama serves one on port 11434 under /v1. vLLM serves one on port 8000 by default. llama-server serves chat completions, responses, and embeddings routes. Your client code can stay the same while the server behind it changes.

client.py
import os
from openai import OpenAI
 
# Ollama on a laptop:  http://localhost:11434/v1
# vLLM on a GPU host:  http://localhost:8000/v1
client = OpenAI(
    base_url=os.environ["LLM_BASE_URL"],
    api_key=os.environ.get("LLM_API_KEY", "EMPTY"),
)

Ollama's compatibility layer covers chat completions, completions, models, embeddings, and a non-stateful Responses API. vLLM adds an Anthropic Messages API and gRPC on top of its OpenAI-compatible server. The details differ at the edges. Model names are the most common break: Ollama uses its own library tags, while vLLM uses the Hugging Face model ID you started it with.

A gateway removes that last difference. Bifrost, an open-source AI gateway by Maxim AI, lists both Ollama and vLLM among its supported providers. Applications call one endpoint with one model name, and whether that request reaches a developer's Ollama or a production vLLM cluster becomes a routing rule rather than a code change. What an LLM gateway does covers the rest of that layer.

What you take on when you self-host

Self-hosting an LLM moves work from a provider to you. On one machine, Ollama handles most of it: downloads, loading, unloading, and a local API. On a server, you own the rest: drivers, capacity, health checks, upgrades, access control, and monitoring. That operating cost, more than the engine, is what decides whether self-hosting pays off.

The list grows quickly once more than one person depends on the service:

  • Access. Ollama listens on 127.0.0.1 by default. Exposing it to a network with OLLAMA_HOST exposes the API to everyone who can reach the port, so put a gateway with per-user keys in front of it.
  • Capacity. A vllm serve process serves the model you start it with on the GPUs you give it. More models or more traffic means more processes and something to route between them.
  • Observability. You need time to first token, queue depth, and GPU memory per model, not just whether the process is up.
  • Upgrades. Engines ship often, and a new release can change throughput or output. Pin versions and test before you roll forward.

If you reach the point where one vLLM server is not enough, the next questions are about engines and orchestration, which vLLM vs SGLang covers, and about the attention memory that limits every engine, covered in the KV cache.

Which one to run where

The vLLM vs Ollama decision follows the job. Use Ollama on laptops and for prototypes, llama.cpp when you need control or want the engine inside your own application, and vLLM for anything that serves many users at once. A common pattern uses two of them: Ollama during development and vLLM in production, with the same OpenAI-compatible client and a gateway in between.

JobRunWhy
Trying models on a laptopOllamaOne command, model library, runs on Apple Silicon and consumer GPUs
Offline or embedded in a desktop or edge appllama.cppEvery setting exposed, and it runs on CPUs and most consumer GPUs
A shared tool for a handful of colleaguesOllama with OLLAMA_NUM_PARALLEL raised, or llama-serverEnough for light concurrency on one box
An internal API many services callvLLMThroughput grows with concurrency instead of queueing
Production traffic with latency targetsvLLM, or another server engineBatching, paged KV cache, and multi-GPU parallelism

The line between the third and fourth rows is the one to watch. When users start to notice queueing, or when a second team wants to call the model, move the workload to vLLM rather than raising Ollama's parallel count and its memory reservation further.

Frequently asked questions

Is vLLM faster than Ollama?

In a vLLM vs Ollama test with many concurrent users, vLLM wins by a wide margin. vLLM batches all active requests and allocates KV cache memory on demand, so its throughput grows with load. Ollama processes one request per model at a time by default. For a single user on a laptop, the difference is small, and Ollama is easier to run. Measure on your own hardware and model.

Does Ollama use llama.cpp?

Ollama has long relied on llama.cpp and lists it among its supported backends. In 2025 it introduced its own engine for multimodal models, built on the GGML tensor library that llama.cpp also uses. Both run GGUF models. Ollama adds a model library, model management, and a simple local API on top of that shared foundation.

Can Ollama be used in production?

For a small internal tool with light traffic, yes. For a production API with many concurrent users, it is the wrong fit. Its default of one request per model at a time means requests queue under load, and raising parallelism multiplies the memory reserved for context. A server engine such as vLLM is built for that job.

Can vLLM run on a Mac?

Not natively. vLLM supports Linux only, and it targets data center accelerators such as NVIDIA and AMD GPUs. Apple Silicon support comes through vLLM-Metal, a community-maintained plugin that uses MLX as its compute backend. On a Mac, Ollama or llama.cpp, which both use Apple's Metal API, are the usual choices for running models locally.

Do Ollama and vLLM support the OpenAI API?

Yes. Ollama serves an OpenAI-compatible API at http://localhost:11434/v1, covering chat completions, completions, models, embeddings, and a non-stateful Responses API. vLLM serves one at http://localhost:8000/v1 by default and also offers an Anthropic Messages API. llama.cpp's llama-server provides OpenAI-compatible chat completions, responses, and embeddings routes.

What is the best way to self-host an LLM?

Match the tool to the job. For personal use and prototypes, Ollama is the quickest start. For embedded or unusual hardware, llama.cpp gives the most control. For a service many people or applications call, run vLLM or a similar server engine on GPUs, and put a gateway in front of it for keys, budgets, logs, and failover.

Sources

  1. 01FAQOllama docs
  2. 02OpenAI compatibilityOllama docs
  3. 03Hardware supportOllama docs
  4. 04Importing a modelOllama docs
  5. 05Ollama's new engine for multimodal modelsOllama blog
  6. 06OllamaGitHub
  7. 07llama.cppGitHub
  8. 08llama-serverGitHub, llama.cpp
  9. 09QuickstartvLLM docs
  10. 10GPU installationvLLM docs
  11. 11Parallelism and scalingvLLM docs
  12. 12Efficient Memory Management for Large Language Model Serving with PagedAttentionarXiv:2309.06180
  13. 13Ollama vs. vLLM: A deep dive into performance benchmarkingRed Hat Developer
  14. 14Supported providersBifrost docs