n4nAI

Ollama vs vLLM: latency benchmark for local deployment

A head-to-head benchmark of Ollama and vLLM for local LLM serving: latency, throughput, cost, and ergonomics to help you choose the right stack.

n4n Team4 min read985 words

Audio narration

Coming soon — every post will get a voice note here.

Picking a local inference server is a trade-off between throughput under load and the friction of getting it running. The debate around ollama vs vllm latency local deployment usually ignores that Ollama targets single-developer workflows while vLLM targets datacenter-class batching. Below we break down where each stack wins when you run it on your own hardware, using the same model and a fixed load profile.

Capabilities

Ollama wraps llama.cpp and distributes pre-quantized GGUF models through a native REST API and CLI. It handles model pulling, local caching, and basic concurrent requests without external dependencies. You can run embedding models, small vision models like Llava, and instruct models from one binary.

Model Support

Ollama’s library is GGUF-centric. Community maintainers convert HF weights to quantized formats; support for a new architecture lags upstream by days or weeks. Speculative decoding exists but is limited to paired drafts.

vLLM implements continuous batching, paged attention, and tensor parallelism over PyTorch. It speaks the OpenAI API shape and supports GPTQ, AWQ, FP8, and FP16 weights directly from HuggingFace. It also offers guided decoding via Outlines and prefix caching for repeated system prompts.

If you need to serve many users from one node, vLLM’s scheduler is the differentiator. Ollama’s strength is running a 7B model on a laptop with one command.

Price / Cost Model

Both projects are open-source and free to run. Your only bill is hardware and engineering time.

Ollama has no service cost. It runs on consumer GPUs, integrated graphics, or CPU. A $0 local machine or a cheap VPS with no GPU works for low-QPS testing.

vLLM delivers its latency advantages only on a CUDA-capable GPU. On a 24GB RTX 4090 you can serve a 13B model at high QPS, but any cloud GPU hour costs real money. Operational cost also includes tuning --max-num-seqs, worker counts, and memory fractions.

Neither charges per token. The economic decision is whether your traffic justifies a dedicated GPU or can live on shared CPU cycles.

Latency and Throughput

The ollama vs vllm latency local deployment question lives or dies in the concurrency curve. We tested both on a single A100 80GB with Llama-3-8B-Instruct (FP16 for vLLM, Q4_K_M GGUF for Ollama). Prompt: 120 tokens. Generation: 256 tokens. Load: 1, 8, 32 concurrent streams.

Test Setup

# Ollama server + single request
ollama serve &
curl http://localhost:11434/api/generate -d '{
  "model": "llama3:8b-instruct-q4_K_M",
  "prompt": "Explain paged attention in one sentence.",
  "stream": false
}'
# vLLM OpenAI-compatible server
python -m vllm.entrypoints.openai.api_server \
  --model meta-llama/Llama-3-8B-Instruct \
  --tensor-parallel-size 1 \
  --gpu-memory-utilization 0.9 &
# Minimal concurrent load test against vLLM
import asyncio, aiohttp, time

async def hit(session, prompt):
    async with session.post("http://localhost:8000/v1/completions",
        json={"model":"meta-llama/Llama-3-8B-Instruct","prompt":prompt,
              "max_tokens":256}) as r:
        return await r.json()

async def main(n):
    async with aiohttp.ClientSession() as s:
        t=time.time()
        await asyncio.gather(*[hit(s,"Benchmark prompt") for _ in range(n)])
        print(f"{n} concurrent: {time.time()-t:.2f}s")

asyncio.run(main(32))

Time to First Token

Ollama’s TTFT at concurrency 1 is in the sub-100ms class on GPU because there is no batching machinery. At 32 streams its TTFT degrades sharply: requests queue in a single worker and the scheduler swaps context.

vLLM’s TTFT at concurrency 1 is slightly higher due to worker init and batching overhead. At 32 streams, continuous batching keeps TTFT within a small multiple of the single-stream case. The gap widens as batch size grows.

Throughput Under Load

Ollama’s inter-token latency (TPOT) climbs almost linearly with concurrency because it processes streams with limited parallelism. vLLM’s tokens/sec scales near-linearly up to VRAM limits thanks to paged attention.

The qualitative conclusion: Ollama wins for isolated low-QPS calls; vLLM wins once you have more than a handful of simultaneous users.

Ergonomics

Ollama feels like docker pull for models. ollama run llama3 drops you into a REPL. A Modelfile bakes system prompts and parameters:

FROM llama3
SYSTEM "You are a terse senior engineer."
PARAMETER temperature 0.2

vLLM is a Python library and server. You supply a HF model id and CUDA environment. There is no interactive shell; you read startup logs and watch GPU stats. For a quick prototype on a dev machine, Ollama is unbeatable. For a service behind a load balancer, vLLM’s API parity with OpenAI reduces client code to a base URL swap.

Ecosystem

Ollama’s community maintains a model library of GGUF conversions. Tools like Open WebUI target it directly. It lags upstream architecture support because each new model needs a quantize-and-upload cycle.

vLLM tracks HuggingFace transformers closely. It is the default backend for many serving projects and accepts PRs for new models within days of release. If you later need to unify local vLLM with hosted models behind one OpenAI-compatible endpoint, a gateway like n4n.ai will forward provider cache-control hints and handle fallback without code changes.

For teams needing a brand-new model the day it drops, vLLM usually supports it first.

Limits

Ollama’s GGUF-centric approach sacrifices some kernel optimizations available to PyTorch. Multi-GPU splitting exists but lacks efficient tensor parallelism. It is the only realistic option for CPU-only or edge devices.

vLLM assumes GPU residency. CPU offload is experimental and slow. It will not run on a Raspberry Pi. Both cap at the VRAM you provide; vLLM’s pager uses memory more efficiently, so you fit larger batches per dollar.

Head-to-Head Comparison

Dimension Ollama vLLM
Primary use Single-user local dev Multi-user serving
Scheduler Single-queue, llama.cpp Continuous batching
Hardware CPU/GPU, consumer friendly CUDA GPU required for speed
API Native REST + CLI OpenAI-compatible
New model support Delayed GGUF conversions Near-upstream HF
Concurrency Degrades past ~8 streams Scales to VRAM limit
Setup time Minutes 15–30 min + env
Cost Free, runs on laptop Free, needs GPU hour

Which to Choose

Solo developer on a laptop: Use Ollama. The ollama vs vllm latency local deployment gap is irrelevant at QPS 1, and you avoid CUDA dependency hell.

Internal tool with <10 daily users: Ollama on a single RTX 3060 still gives snappy responses. Put it behind a reverse proxy with a request queue.

Production API with variable load: vLLM. Its batching holds tail latency flat when traffic spikes. Use the OpenAI endpoint to swap or aggregate providers later.

Edge or CPU-only box: Ollama with quantized GGUF is the only realistic option; vLLM will crawl on CPU.

Research needing latest models: vLLM, because the ecosystem mirrors HF mainline and supports new architectures within days.

Batch evaluation jobs: vLLM’s throughput per GPU hour beats Ollama by a wide margin when you fire thousands of prompts at once.

Pick based on concurrency, not on headline token speed. The framework that matches your request pattern will beat the “faster” one on the metrics you actually feel.

Tagsollamavllmlocal-deploymentlatency-benchmark

Written by

n4n Team

The team building n4n — a single OpenAI-compatible API in front of 240+ models, with automatic fallback, load balancing and pay-per-token metering.

More from n4n Team →

All serving framework benchmarks posts →