vLLM vs Ollama: Which One Should You Use to Serve Open Models?
Posted on Thu 26 November 2026 in Tutorial
The Moment Ollama Stopped Being Enough
In the earlier post on running a local LLM, I set up Ollama in about fifteen minutes and plugged it into a FastAPI chatbot. It felt great. One model, one laptop, one user: me.
Then I imagined what happens when ten people use that chatbot at the same time. Requests start queueing, responses slow down, and the "instant" local model suddenly feels like a dial-up connection. That's when a question that sounds like trivia becomes practical: should I keep using Ollama, or move to something like vLLM?
The short answer is that these tools solve different problems. This post explains how, so you can pick the right one on purpose instead of copying whatever a tutorial used.
What Each Tool Actually Is
Ollama is a tool that makes it easy to download and run open models on your own machine. You type one command, it fetches the model, loads it, and exposes a local API. It's designed around simplicity: laptops, desktops, quick experiments.
vLLM is a high-performance inference engine and server for running LLMs efficiently, especially for many users at once. It's designed around throughput and GPU efficiency, the kind of thing you'd run on a GPU server behind a production API.
A simple analogy: Ollama is a car, vLLM is a bus. The car is quick to start, easy for one person, and goes wherever you want. The bus takes more setup, but once it's running it moves a lot more people for the same amount of fuel.
Why vLLM Handles Many Users So Well
Several techniques explain the gap. You don't need to master them, but knowing the names helps you read the docs.
Continuous batching. A simple server handles requests one after another, or waits to batch them in rigid groups. vLLM continuously adds new requests into the batch the GPU is already processing, so the GPU stays busy and new users don't wait for old ones to fully finish.
PagedAttention. While generating text, a model stores intermediate data for the conversation so far (the KV cache, which also explains why the first token is slower than the rest). This cache can eat lots of GPU memory, and naive handling wastes a lot of it. PagedAttention manages that memory in small blocks, much like an operating system manages RAM, which lets the server fit more simultaneous requests on the same GPU.
Prefix caching. If many requests start with the same text (such as a long system prompt), the server can reuse the work already done for that shared beginning. It's the self-hosted cousin of the provider-side prompt caching described in the earlier post.
Extras for serious deployments. vLLM's documentation also lists features like quantization support, splitting a model across multiple GPUs (tensor parallelism), speculative decoding, multi-LoRA serving, structured output generation, and tool calling support, along with an OpenAI-compatible API server. It runs on NVIDIA GPUs, AMD GPUs, and CPUs, with plugins for other hardware, though NVIDIA on Linux tends to be the smoothest path.
Why Ollama Is So Pleasant to Use
Ollama's strengths are about convenience:
- One-command setup:
ollama run <model>downloads and starts a model - Model management: pull, list, and delete models easily, and switch between them
- Runs almost anywhere: macOS, Windows, and Linux, on CPU, Apple Silicon, and many consumer GPUs
- Compressed models by default: it commonly runs quantized versions that fit in modest memory
- A friendly local API, including an OpenAI-compatible endpoint
- Customization through a simple model file for things like a default system prompt and parameters
- Automatic loading and unloading of models, which frees memory when a model sits idle for a while
For learning, prototyping, personal tools, and demos, that simplicity is a real advantage, not a limitation.
Comparing Them Side by Side
Setup effort - Ollama: install an app, run a command - vLLM: install a Python package, choose a model, and configure GPU memory, context length, and similar settings. Gated models also need a Hugging Face access token.
Hardware - Ollama: comfortable on laptops and desktops, including without a big GPU - vLLM: shines on a GPU server, and you'll want enough GPU memory to hold the model plus the cache
Concurrent users - Ollama: fine for one person or a few, and it can be configured for some parallelism, but it isn't built for heavy traffic - vLLM: built for it, with throughput that keeps growing as more requests arrive
Switching between many models - Ollama: easy and quick, designed for trying different models - vLLM: typically one model (or a deliberately configured setup) per server, so it suits stable production more than constant experimentation
Model formats - Ollama: usually quantized model files in a compact format - vLLM: mainly models from the Hugging Face ecosystem, with support for several quantization methods
Operations and monitoring - Ollama: minimal, mostly logs - vLLM: more knobs, plus metrics you can feed into monitoring systems, which matters in production
Both expose an OpenAI-style HTTP API, which is the most important compatibility fact for what comes next.
What the Benchmarks Say (And Why to Be Careful)
Published comparisons consistently show the same shape: at low concurrency the two are closer, and as more requests arrive at once, vLLM pulls far ahead. In one Red Hat benchmark, vLLM's throughput kept scaling with the number of concurrent users while Ollama's stayed roughly flat, and vLLM kept a lower tail latency across the tested range, even when Ollama was tuned for parallelism. A separate GPU hosting provider's test found a similar pattern, with Ollama's waiting time for the first token growing dramatically as concurrent requests increased.
But take specific numbers with caution:
- The authors have an interest. Those tests came from companies that sell products around one of these tools or around GPU hosting, so the setups may favor certain configurations
- Defaults were often untuned. Real deployments can be tuned differently
- Hardware, model, quantization, and prompt length all change the results. A number from someone else's GPU doesn't transfer to yours
- Throughput isn't everything. The Red Hat test also noted that at very high concurrency, per-token latency behaved differently between the two, a reminder that "faster" depends on what you measure
So treat the benchmarks as evidence for the direction (vLLM scales better under load), not as numbers to quote. To know what happens in your case, test it yourself.
Run Your Own Load Test
Both tools expose an OpenAI-compatible endpoint, so one script can test either. This measures total throughput and request latency at different concurrency levels:
import asyncio
import statistics
import time
import httpx
async def one_request(client: httpx.AsyncClient, base_url: str, model: str, prompt: str):
start = time.perf_counter()
response = await client.post(
f"{base_url}/v1/chat/completions",
json={
"model": model,
"messages": [{"role": "user", "content": prompt}],
"max_tokens": 200,
"temperature": 0.2,
},
timeout=300,
)
response.raise_for_status()
elapsed = time.perf_counter() - start
tokens = response.json()["usage"]["completion_tokens"]
return elapsed, tokens
async def load_test(base_url: str, model: str, concurrency: int, total_requests: int = 32):
prompt = "Explain what an API rate limit is in three sentences."
gate = asyncio.Semaphore(concurrency) # at most N requests in flight
async with httpx.AsyncClient() as client:
async def bounded():
async with gate:
return await one_request(client, base_url, model, prompt)
start = time.perf_counter()
results = await asyncio.gather(*[bounded() for _ in range(total_requests)])
wall_time = time.perf_counter() - start
latencies = sorted(r[0] for r in results)
total_tokens = sum(r[1] for r in results)
p95 = latencies[max(0, int(len(latencies) * 0.95) - 1)]
print(
f"concurrency={concurrency:3} | "
f"{total_tokens / wall_time:7.1f} tokens/s | "
f"median latency {statistics.median(latencies):5.1f}s | "
f"p95 latency {p95:5.1f}s"
)
async def main():
# Ollama: base_url="http://localhost:11434", model="llama3.2"
# vLLM: base_url="http://localhost:8000", model="<the model name you served>"
for concurrency in (1, 4, 8, 16):
await load_test("http://localhost:11434", "llama3.2", concurrency)
asyncio.run(main())
Run it against each setup on the same hardware, with prompts that look like your real traffic (including your real prompt lengths). A few honest notes:
- This measures total request latency, not time to first token. For that, you'd stream the response and time the first chunk, as discussed in the streaming post.
- Use the same model and a similar quantization if you can, otherwise you're comparing two different things
- Watch p95 latency, not only the average, as in the observability post
- Check output quality too, not just speed
How to Try vLLM
On a Linux machine with a suitable GPU, the basic flow looks like this (check the current docs, since flags and defaults change between versions):
pip install vllm # or: uv pip install vllm
vllm serve <model-name-from-huggingface>
That starts an OpenAI-compatible server, by default on port 8000. Then any OpenAI client works:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
reply = client.chat.completions.create(
model="<model-name-from-huggingface>",
messages=[{"role": "user", "content": "What is FastAPI?"}],
)
print(reply.choices[0].message.content)
(The api_key can be a dummy value unless you start the server with an API key requirement, which you should do for anything reachable by others.)
The Best Part: Swap Servers With a Config Change
Because Ollama, vLLM, and the major cloud providers all speak the same OpenAI-style API, your FastAPI app doesn't need to care which one it's talking to, as long as the provider details live in configuration. Using the settings pattern from the environment variables post:
# config.py
class Settings(BaseSettings):
llm_base_url: str = "http://localhost:11434/v1" # Ollama by default
llm_api_key: str = "ollama"
llm_model: str = "llama3.2"
model_config = SettingsConfigDict(env_file=".env")
# rag.py (or wherever you create the client)
from openai import OpenAI
llm_client = OpenAI(base_url=settings.llm_base_url, api_key=settings.llm_api_key)
Now moving from Ollama on your laptop to vLLM on a GPU server (or to a hosted API) is a change to three lines in .env, not a rewrite. That's a big argument for building on the common API from the start.
Don't Skip the Eval When You Switch
Here's a trap: the same model name doesn't guarantee the same behavior across servers. Common reasons:
- Different quantization. Ollama often serves a 4-bit compressed version, while vLLM may serve full or half precision unless you choose otherwise. Compression can change quality slightly.
- Different chat templates, tokenization details, and defaults such as default sampling settings
- Different support for structured outputs and tool calling features
So, as with any model change (a point from the prompt versioning post), re-run your eval set after switching servers and compare. Don't assume it's a pure infrastructure swap.
Sizing the GPU: A Rough Rule
When planning vLLM, memory is the main constraint. A rough guide:
- Model weights: roughly the number of parameters times the bytes per parameter. A 7-billion-parameter model in 16-bit precision is about 14 GB. In 4-bit form it's roughly 4 GB.
- KV cache: extra memory that grows with context length times the number of concurrent requests. Long prompts plus many users need a lot more memory.
- Overhead: runtime memory and some headroom. vLLM typically reserves a large fraction of GPU memory up front, which is configurable.
That's why "can the model fit?" and "can it serve 20 people with long prompts?" are different questions. It's also another reason prompt caching, shorter prompts, and good context engineering matter when you host yourself.
Cost: Self-Hosting Isn't Automatically Cheaper
It's tempting to assume that running your own model beats paying per token. Be careful:
- A GPU costs money even when idle. If your traffic is low or spiky, a rented GPU sits unused most of the time.
- Per-token API pricing scales to zero. No requests, no bill.
- Self-hosting wins when utilization is high and steady, or when privacy, control, or customization requirements justify it.
- Open models aren't always equal to the best hosted models on hard tasks, so quality matters in the comparison too.
- Operating costs count: monitoring, updates, scaling, and on-call time.
A fair comparison uses your real traffic and your real quality needs, not a per-token price versus a GPU's hourly rate in isolation.
Security: Don't Expose These Servers Carelessly
A local model server often has no login by default, and it's easy to accidentally make it reachable from the network:
- Keep it on localhost or a private network unless you really need otherwise
- Require an API key or put it behind a reverse proxy (like Nginx or Caddy) with authentication, TLS, and rate limiting, in line with the very first post on this blog about ports and reverse proxies
- Never expose the raw port directly to the internet. Unprotected model servers are commonly found online, and anyone can burn your GPU time or probe the server
- Apply the same safeguards as any LLM backend: input limits, request timeouts, rate limiting, and logging
So, Which Should You Use?
Choose Ollama when: - You're learning or prototyping - It's a personal tool, a demo, or an internal experiment - You're on a laptop or desktop, especially without a big GPU - You have one user or a handful - You want to try many models quickly - Simplicity matters more than peak performance
Choose vLLM when: - Many users will hit the model at the same time - You have a GPU server and care about throughput and latency under load - You need a production-grade API with metrics and tuning options - You want to run big batch jobs efficiently - You need advanced features like multi-GPU, multi-LoRA, or speculative decoding
Consider neither (a managed API) when: - Traffic is low or unpredictable - You don't want to operate GPUs - You need the strongest model quality available - Self-hosting isn't required by privacy or compliance
And remember other options exist, such as the llama.cpp server, SGLang, and Hugging Face's text generation server, plus hosted open-model providers. The landscape changes quickly, so check current options before committing.
A Sensible Path
For most developers, a good progression looks like this:
- Start with Ollama while you're learning and building
- Build against the OpenAI-compatible API and keep base URL, key, and model in config
- Build an eval set, and measure quality on your real tasks
- Load test with realistic traffic when you approach production
- Move to vLLM (or a managed provider) if concurrency or latency demands it, then re-run your evals
- Add monitoring and security before real users arrive
Quick Checklist
- Ollama is for ease and local use, vLLM is for throughput and many users
- vLLM's advantages come from continuous batching, efficient KV cache memory, and prefix caching
- Benchmarks show the direction, but run your own load test
- Keep the base URL, API key, and model in configuration
- Re-run your eval set after changing servers or quantization
- Plan GPU memory for weights plus KV cache
- Compare costs using real utilization, not per-token versus per-hour guesses
- Never expose model servers directly, and add authentication and rate limits
- Check current docs, since flags and defaults change
Closing Thought
Asking "vLLM or Ollama?" is a bit like asking "car or bus?" The right answer depends on how many people you're carrying and where you're going. Ollama is the best way to start, learn, and experiment. vLLM is what you reach for when many people depend on the same model at once. If you build on a common API and keep your configuration flexible, you don't have to choose forever: you can begin with the car, and switch to the bus when the crowd shows up.