EN

Language

Our editions

Written for each audience, not translated word for word.

Ollama vs llama.cpp: the same engine underneath, different control on top

ComparisonBy Lucas Matías García TorresUpdated Data checked 6 min read

Reviewed by Lucas Matías García Torres on . How we work.

Leer en español

Exploded view of a graphics card: fans, heat pipes, heatsink fins and the circuit board with the GPU glowing orange

Short answer

Ollama vs llama.cpp is a choice of layer: Ollama's README lists llama.cpp as its backend and adds a model library, a background service and a simple API on port 11434. llama.cpp gives you the engine and its own server with every setting exposed. Most speed differences come from defaults: Ollama uses a 4,096-token context and one request at a time per model unless you change them, while llama-server reads the context from the model and batches requests. For many users on server GPUs, vLLM is the better fit.

Prices and limits change often: check the vendor's page before you pay. How we make money.

Ollama vs llama.cpp is less a contest than a choice of layer. Ollama's own README lists llama.cpp as its supported backend: llama.cpp is the C/C++ inference engine that runs the model on your CPU or GPU, and Ollama wraps an engine like it in a model library, a background service and a simple API. So the useful question is not which one is faster in the abstract, but whether you want the convenience of Ollama or the direct control of llama.cpp. This guide compares the two from their documentation as of October 10, 2026, shows the defaults that explain most "Ollama is slower" reports, and says when a third option, vLLM, makes more sense.

Ollama vs llama.cpp at a glance

Table: Ollama and llama.cpp compared from their own documentation (October 10, 2026)

Item Ollama llama.cpp
What it is App and server that downloads, runs and manages models C/C++ inference library with command-line tools and a server
Install One-line script for macOS and Linux, PowerShell or installer on Windows, Docker image One-line script from llama.app, prebuilt binaries, Docker, or build from source
Getting a model ollama pull from the Ollama library, or import GGUF and Safetensors Any GGUF file, or -hf to download from Hugging Face (Q4_K_M by default)
Local API Port 11434, native API plus OpenAI- and Anthropic-compatible routes llama-server, default port 9931, OpenAI- and Anthropic-compatible routes and a web UI
Several models Loads and unloads on demand; keeps each loaded 5 minutes by default Router mode loads and unloads on demand; up to 4 at once by default
Default context 4,096 tokens unless you raise it Taken from the model file
Parallel requests 1 per model by default Automatic number of slots, continuous batching on
Licence MIT MIT

Both run the same GGUF model files, and both can split a model between GPU and CPU when it does not fit in video memory. If you have not run a local model before, start with our guide to running an LLM locally.

llama.cpp describes its goal as running LLMs "with minimal setup and state-of-the-art performance on a wide range of hardware". It is plain C/C++ without dependencies, built on the ggml library, and ships backends for NVIDIA (CUDA), AMD (HIP), Apple silicon (Metal), Vulkan, Intel GPUs (SYCL) and more, with Intel NPU support through OpenVINO marked as in progress. It also brings its own tools: a chat in the terminal, a server and a quantizer.

Ollama sits one level up. Its README says "Start building with open models", lists llama.cpp under "Supported backends", and adds what llama.cpp leaves to you: a curated library of models with tags, a background service that loads a model when a request arrives and unloads it later, a Modelfile format for custom settings, a desktop app, and one-command connections to coding tools such as Claude Code, Codex and Copilot. Our Ollama commands guide covers the everyday commands.

Two practical consequences. First, a model that works in one usually works in the other, because both read GGUF. Ollama's import guide even sends you to llama.cpp's llama-quantize to prepare a GGUF file, since Ollama does not quantize GGUF files on import. Second, the two projects release separately, so on a given day they may not run the same version of the underlying code.

Is llama.cpp faster than Ollama?

We have not benchmarked them, and the third-party numbers online disagree with each other. What the documentation does show is that most speed and memory differences people report come from defaults, not from a different engine:

  • Context length. Ollama uses a 4,096-token context window unless you set OLLAMA_CONTEXT_LENGTH or num_ctx. llama-server takes the context length from the model file, which for recent models can be hundreds of thousands of tokens and needs far more memory. A small context is faster and lighter but silently cuts long prompts; a large one can push layers off the GPU. Our VRAM guide explains why the context costs memory.
  • Parallel requests. Ollama processes one request at a time per model by default (OLLAMA_NUM_PARALLEL=1), and its FAQ notes that memory grows with parallel requests times context length. llama-server picks the number of slots automatically and keeps continuous batching on, which helps when several clients call it at once.
  • GPU layers and flash attention. llama.cpp decides how many layers go to the GPU by default (-ngl auto) and sets flash attention to auto; Ollama makes the split itself and shows it in ollama ps. If a model ends up partly on the CPU, generation slows sharply in either tool; Ollama not using your GPU shows how to check with ollama ps.
  • Quantization. Comparing a Q4 file in one tool with a Q8 file in the other measures the files, not the tools. Our explainer on quantization covers what each level costs in quality and memory.

To compare fairly, run the same GGUF file with the same context length, number of GPU layers and parallel setting, and measure tokens per second on your own prompts.

API, models and the commands side by side

Starting a model. In Ollama, ollama run downloads a model from its library if needed and opens a chat. In llama.cpp, the README's quick start is llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF for a chat and llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF to launch an OpenAI-compatible server, both pulling the model straight from Hugging Face.

The API. Ollama listens on http://localhost:11434 with its own API and OpenAI-compatible routes for chat completions, responses, embeddings and models, plus an Anthropic-compatible one. llama-server offers OpenAI-compatible chat completions, responses and embeddings, Anthropic Messages compatibility, reranking, schema-constrained JSON, function calling "for ~any model", speculative decoding and a built-in web UI. Note the port: the server's current documentation gives 9931 as the default, while many older guides and its own Docker examples use 8080, so set --port explicitly if a client expects one or the other.

Several models. Ollama loads up to three models per GPU by default (three on CPU) if they fit in memory, and unloads each after five minutes without use. Started without a model, llama-server runs in router mode: it finds models in its cache or in a folder you pass with --models-dir, loads them on demand and keeps up to four at once by default.

Security. Both listen only on your own machine by default (127.0.0.1); Ollama changes that with OLLAMA_HOST and llama.cpp with --host. llama-server can require API keys with --api-key; if you expose either tool to a network, put authentication in front of it.

Which one to use, and when vLLM is the better choice

  • Choose Ollama if you want models running in minutes, switch between them often, or connect local models to apps and coding tools that already speak its API. Compare it with the desktop alternative in Ollama vs LM Studio.
  • Choose llama.cpp if you want every setting in your hands (context, batch sizes, GPU layers, speculative decoding), more hardware backends (its README lists 17, from CUDA and Metal to SYCL and Snapdragon), a server that handles several users with continuous batching, or a single binary without a background service.
  • Choose vLLM if you serve many users from one or more data-center GPUs. Its README lists "state-of-the-art serving throughput" with PagedAttention memory management, continuous batching and prefix caching, an OpenAI-compatible server with Anthropic Messages support, and support for NVIDIA, AMD and Intel GPUs and CPUs, with Apple silicon through a plugin. It is built for throughput on servers, not for a single person on a laptop.

Whatever you pick, the hardware decides more than the software: see our best GPU for local LLMs guide before buying anything.

What we checked

  • Ollama README: install with a script on macOS and Linux and with PowerShell or an installer on Windows; official Docker image ollama/ollama; running ollama prompts to run a model or connect it to tools such as Claude Code, OpenClaw, OpenCode, Codex and Copilot; Supported backends: llama.cpp, project founded by Georgi Gerganov; documentation for the CLI, REST API, importing models and the Modelfile. License: MIT. (Ollama (GitHub), )
  • Ollama FAQ: default context window of 4,096 tokens, changed with OLLAMA_CONTEXT_LENGTH or num_ctx; models stay in memory 5 minutes by default (keep_alive); OLLAMA_MAX_LOADED_MODELS defaults to 3 times the number of GPUs or 3 for CPU inference; OLLAMA_NUM_PARALLEL defaults to 1 and required RAM scales with OLLAMA_NUM_PARALLEL times OLLAMA_CONTEXT_LENGTH; Ollama binds 127.0.0.1 port 11434 by default, changed with OLLAMA_HOST; ollama ps shows loaded models and processor. (Ollama, )
  • Ollama imports Safetensors and GGUF models through a Modelfile; it does not quantize GGUF models during import and recommends preparing them with a GGUF tool such as llama.cpp's llama-quantize. (Ollama, )
  • Ollama's OpenAI compatibility covers /v1/chat/completions, /v1/responses, /v1/embeddings and /v1/models. (Ollama, )
  • Ollama's Anthropic compatibility exposes the /v1/messages route. (Ollama, )
  • llama.cpp README: LLM inference in C/C++, MIT license; install with a one-line script from llama.app, Docker, prebuilt binaries or from source; quick start llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF and llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF for an OpenAI-compatible server; goal of minimal setup and state-of-the-art performance on a wide range of hardware; plain C/C++ without dependencies, built on ggml; 1.5-bit to 8-bit quantization; CPU+GPU hybrid inference; 17 backends listed including CUDA, HIP, Metal, Vulkan, SYCL, Hexagon (Snapdragon) and OpenVINO (in progress) for Intel CPUs, GPUs and NPUs. (ggml-org / llama.cpp, )
  • llama-server: OpenAI-compatible chat completions, responses and embeddings routes; Anthropic Messages API compatibility; reranking; parallel decoding; continuous batching (enabled by default); multimodal; schema-constrained JSON; function calling for about any model; speculative decoding; web UI (enabled by default). Defaults: context size 0 = loaded from model, GPU layers auto, flash attention auto, parallel slots auto, host 127.0.0.1, port 9931; --api-key for authentication; -hf downloads from Hugging Face defaulting to Q4_K_M; router mode when started without a model, with models from the cache or --models-dir and up to 4 loaded at once by default (--models-max). Docker examples use port 8080. (ggml-org / llama.cpp, )
  • vLLM README: easy, fast and cheap LLM serving; state-of-the-art serving throughput; PagedAttention; continuous batching, chunked prefill and prefix caching; quantization including GGUF; OpenAI-compatible API server plus Anthropic Messages API and gRPC; support for NVIDIA, AMD and Intel GPUs and x86, ARM and PowerPC CPUs, with hardware plugins including Apple Silicon. (vLLM (GitHub), )

What may change

  • Both projects release often; defaults such as the server port, context length and number of parallel requests have changed before and can change again. This page is reviewed quarterly.
  • We have not measured speed or memory use ourselves; differences depend on hardware, model file, versions and settings.

Frequently asked questions

Is Ollama built on llama.cpp?

Ollama's README lists llama.cpp, the project founded by Georgi Gerganov, under its supported backends. Ollama adds a model library, a background service that loads and unloads models, the Modelfile format, a desktop app and its own API on top. Both read the same GGUF model files.

Is llama.cpp faster than Ollama?

We have not benchmarked them, and third-party numbers disagree. Most reported differences come from defaults: Ollama uses a 4,096-token context and one request at a time per model, while llama-server takes the context from the model and batches requests. Compare the same file with the same settings.

Does llama.cpp have an OpenAI-compatible API?

Yes. llama-server offers OpenAI-compatible chat completions, responses and embeddings, Anthropic Messages compatibility, a web UI and function calling. Its documentation gives 9931 as the default port, while older guides and its Docker examples use 8080, so set the port explicitly.

When should I use vLLM instead of Ollama or llama.cpp?

When you serve many users from data-center GPUs. vLLM's README focuses on serving throughput, with PagedAttention memory management, continuous batching and prefix caching, an OpenAI-compatible server and support for NVIDIA, AMD and Intel GPUs. For one person on a laptop, Ollama or llama.cpp are simpler.

Can I use Ollama models in llama.cpp?

Both use GGUF files, so a GGUF model runs in either. llama.cpp can also download GGUF files straight from Hugging Face with the -hf option, and Ollama can import GGUF and Safetensors models; Ollama does not quantize GGUF files on import and points to llama.cpp's llama-quantize for that.

Sources

  1. ollama/ollama: README (install, get started, supported backends) and MIT license, Ollama (GitHub). Accessed October 10, 2026.
  2. Ollama FAQ: context window, keep-alive, concurrency, Flash Attention, K/V cache quantization, multiple GPUs and GPU check, Ollama. Accessed October 10, 2026.
  3. Importing a model into Ollama (Safetensors and GGUF; no quantization of GGUF on import), Ollama. Accessed October 10, 2026.
  4. Ollama: OpenAI compatibility (chat completions, responses, embeddings, models), Ollama. Accessed October 10, 2026.
  5. Ollama: Anthropic compatibility (Messages API), Ollama. Accessed October 10, 2026.
  6. ggml-org/llama.cpp: README (quick start, description, supported backends) and MIT license, ggml-org / llama.cpp. Accessed October 10, 2026.
  7. llama.cpp HTTP server: features, defaults (context, port, slots, GPU layers) and router mode, ggml-org / llama.cpp. Accessed October 10, 2026.
  8. vllm-project/vllm: README (serving throughput, PagedAttention, OpenAI-compatible server, hardware support), vLLM (GitHub). Accessed October 10, 2026.

Spotted an error or an outdated price? Tell us and we will fix it.

Change history

  • : First published. Checked against the Ollama and llama.cpp READMEs, the Ollama FAQ, import and compatibility pages, the llama-server documentation and the vLLM README on October 10, 2026.

Next review: .

Part of our Local Models & Hardware guide.

Other topics