Tech Digest

Head to head

Ollama vs LocalAI

If you just want a local chat model, install Ollama and stop reading. LocalAI earns its extra complexity only when you need transcription, speech or images behind the same endpoint.

Last reviewed 2 tools compared

Should you run Ollama or LocalAI for a local LLM?

Install Ollama if you want a local chat or coding model, which is what almost everyone asking this actually wants. It is one process, one command to pull a model, and one image tag to choose. LocalAI is a broader thing: an OpenAI-compatible gateway that dispatches chat, embeddings, transcription, speech synthesis, image generation and reranking to dozens of backends, at the cost of a per-model YAML file, a backend gallery, and seven container image variants ranging from about 280 MB to over 4 GB depending on your accelerator. Pair either one with Open WebUI for the chat interface.

The comparison people expect is "which one is faster". It is the wrong axis, because underneath both of these sits llama.cpp doing the same arithmetic on the same weights. On identical hardware with an identical quantization you will not measure a difference worth choosing on.

The real axis is scope. Ollama is a curated single-purpose model runner: pull a model by name, get an HTTP API, done. LocalAI is a gateway that presents the OpenAI API surface and dispatches each request to whichever of dozens of backends serves that model, covering chat, embeddings, audio transcription, speech synthesis, image generation and reranking.

If you just want a local chat model, install Ollama. That is the recommendation, and the rest of this page is about when it is wrong.

What the spec table is actually deciding#

Idle RAM (150 MB against 300 MB) is noise, because both numbers are dwarfed by model weights the moment you load anything: budget 6 GB or more of typical usage for either with a single 8B model resident. The rows that matter are ops load, 2 against 3, and default port, 11434 against 8080, which collides with rather a lot of other software. Everything else that distinguishes them is not a specification, it is a shape.

SpecificationOllamaLocalAI
LicenceMIT (Permissive)MIT (Permissive)
Written inGo / C++Go / C++ / Python
First release20232023
MaturityStableStable
DatastoreNone; a content-addressed blob store on diskNone; model files and per-model YAML on disk
Services to run11
Idle memory150 MB300 MB
Memory in use6000 MB6500 MB
Operational load2 / 5, Light3 / 5, Moderate
IdentityNot applicableNot applicable
arm64 buildsYesYes
Default ports114348080
Backup shapeFile copyFile copy

The complexity difference, quantified#

Ollama's setup, end to end:

bash
docker run -d -v ollama:/root/.ollama -p 127.0.0.1:11434:11434 --name ollama ollama/ollama
docker exec -it ollama ollama pull llama3.1:8b
curl http://127.0.0.1:11434/api/generate -d '{"model":"llama3.1:8b","prompt":"hello"}'

One image tag for CPU and NVIDIA, plus a ROCm variant for AMD. Models land in a content-addressed blob store under /usr/share/ollama/.ollama/models on Linux, and OLLAMA_MODELS moves that directory when the weights belong on a separate disk.

LocalAI's setup involves three decisions Ollama does not ask you to make:

  1. Which image variant. Plain CPU, CUDA 12, CUDA 13, ROCm, Intel oneAPI, Vulkan or Jetson L4T. Compressed sizes span an order of magnitude: about 280 MB for CPU, roughly 260 MB on arm64, about 3.5 GB for CUDA 12, over 4 GB for the Intel GPU build.
  2. Which backends to install. Recent LocalAI moved backends out of the image into a runtime gallery, which is why the base image is small. Mount /backends as a volume or every container recreation re-downloads them, and on an air-gapped host the model simply fails with a missing-backend error.
  3. The per-model YAML. Each model gets a file naming its backend, prompt template, context size and parameters.

You need four volumes rather than one: /models, /backends, /configuration and /data.

The one genuinely irreplaceable thing in a LocalAI install is that YAML. Weights are re-downloadable and backends are re-installable, so backing up /models/*.yaml plus /configuration covers the work you actually did.

VRAM, system RAM and quantization: get this right first#

This is the part that determines whether local inference is pleasant or pointless, and it applies identically to both tools.

Model weights have to live somewhere. With a GPU, they live in VRAM and the GPU does the arithmetic. With no GPU, the same weights come out of system RAM and the CPU does it, roughly an order of magnitude slower. Apple Silicon blurs this: unified memory means a 32 GB Mac holds models a 12 GB discrete card cannot.

Quantization is how you make weights smaller. The default tags in Ollama's library are typically Q4_K_M, a four-bit quantization that uses roughly half the memory of Q8 and gives up measurable quality on reasoning and code. Pulling :latest gets you that compromise, not the model as published. If you have VRAM to spare, the Q6 and Q8 tags are noticeably better; if you are memory-starved, Q3 variants exist and degrade badly.

Rough arithmetic to size a card, about 0.6 GB per billion parameters at Q4, plus KV cache for the context window:

Model sizeQ4 weightsQ8 weightsFits comfortably in
8B~5 GB~9 GB8 GB card at Q4, 12 GB at Q8
14B~9 GB~15 GB12 GB card at Q4
32B~20 GB~35 GB24 GB card at Q4
70B~40 GB~70 GBTwo 24 GB cards, or a 64 GB Mac

The rule that matters more than any of these numbers: the whole model must fit. Ollama offloads as many layers as VRAM allows and runs the remainder on CPU, and missing the fit by a small margin does not cost a small amount of speed. Throughput typically drops several times over, because every token now crosses the PCIe bus. Watch the layer count in the server log, and drop to a smaller quantization or a shorter context rather than accepting a partial offload. LocalAI has the same failure with a quieter symptom: the wrong image variant against your driver starts fine, loads the model and runs entirely on CPU.

Two Ollama defaults that consume VRAM without telling you: OLLAMA_MAX_LOADED_MODELS is 3, so three different models can quietly fill a card, and models unload after 5 minutes idle, so an always-on assistant needs OLLAMA_KEEP_ALIVE set long or negative to avoid paying tens of seconds of load time on every request.

Honest speed expectations without a GPU#

These are approximations that scale with memory bandwidth, not guarantees, and they are bound by bandwidth rather than core count. A 16-core server on dual-channel DDR4 is barely faster than an 8-core one.

  • 8B at Q4_K_M on a modern desktop CPU: roughly 5 to 15 tokens per second. Slower than you read. Fine for batch work: summarizing a folder of documents overnight, tagging a bookmark archive, generating draft text you will edit.
  • 70B at Q4 on the same CPU: roughly 1 to 3 tokens per second. Not usable interactively. A paragraph takes minutes.
  • Under 8 GB of RAM with no GPU: you are running 1 to 3B models, and they are not good enough for real work. Do not buy hardware on the assumption this will feel like a hosted model.

That last point is the uncomfortable one. A 70B quantized local model is not equivalent to a current hosted flagship, and no amount of runtime choice changes that. Local inference buys you privacy, offline operation and no per-token bill. It does not buy you frontier quality. GPUs, transcoding and local AI covers what hardware actually moves the needle, and What a home server costs to run covers what leaving a GPU resident costs per month.

Neither one is safe on a network#

Ollama has no authentication of any kind. LocalAI has a list of static API keys checked against the Authorization header, with no rotation and no per-key scoping. Both are designed to sit on localhost.

The correct pattern for either: bind to loopback, then front it with a reverse proxy that requires a credential, or expose it only on a WireGuard or Tailscale interface. Reverse proxy and TLS has the Caddy configuration, Remote access without port forwarding covers the VPN route, and A security baseline for a home server is worth a read before you set OLLAMA_HOST=0.0.0.0 on anything with a public IP.

The front end is not part of this decision#

Open WebUI talks to Ollama's native API and to any OpenAI-compatible endpoint, which includes LocalAI. So the chat interface is orthogonal, and you should size it separately: it idles around 600 MB, four times the Ollama server process. On a box that also has to hold model weights, that is a real allocation. Other consumers of these endpoints, such as the LLM tagging in Karakeep, point at whichever URL you give them.

The verdict, by situation#

Your situationPickWhy
You want a local chat or coding modelOllamaOne command, one tag, no YAML, and it is the whole job
You need transcription, speech or images tooLocalAIOne endpoint fronting whisper.cpp, diffusers and more
An app is already written against the OpenAI SDKLocalAIChanging the base URL is the entire migration
Apple Silicon laptop or Mac miniOllamaMetal support with no image variant to choose
You want per-model prompt templates and context tuningLocalAIThe YAML you resent is also the control you asked for
A developer endpoint at localhost for scriptsOllamalocalhost:11434 and a two-line curl
Air-gapped or bandwidth-restricted hostLocalAI, carefullyOne service for everything, but persist /backends first
Unusual accelerator (Intel Arc, Jetson)LocalAIDedicated oneAPI, Vulkan and L4T image variants exist
Under 8 GB RAM and no GPUNeitherModels that fit are not good enough to be worth the disk

If you are unsure, the decision is easy: Ollama takes ten minutes and roughly 5 GB of disk to prove out. If you later need transcription or image generation, adding LocalAI beside it is fine, and running both is common. What is not fine is choosing LocalAI first, spending an afternoon on the CUDA variant and the prompt template, and only then discovering that all you wanted was a chat box.

What to do next#

Start by checking what will actually fit: nvidia-smi for VRAM, or free -g if you have no GPU, then pick a model from the table above rather than pulling the biggest thing available. Bind to localhost, put Open WebUI in front, and raise OLLAMA_CONTEXT_LENGTH before you feed it anything long. Then size the whole thing against your hardware in Stack planner, and see Replacing ChatGPT for what a local setup does and does not replace. The rest of the category is in Local AI, including SearXNG if private search is the other half of what you are building.

Questions#

How much VRAM do I need for a local LLM?

Roughly 0.6 GB per billion parameters at four-bit quantization, plus KV cache for your context window. An 8B model at Q4_K_M is about 5 GB, so it fits an 8 GB card with a modest context; a 70B at Q4 is around 40 GB and needs two 24 GB cards or a large unified-memory Mac. The number that matters is whether the whole model fits, because partial GPU offload is a cliff and not a slope: missing the fit by two layers typically costs several times the throughput, since every token then crosses the PCIe bus.

Is VRAM different from system RAM here?

Yes, and it is the most consequential distinction in local inference. With a GPU, the model weights live in VRAM and inference runs on the GPU. With no GPU, the same weights come out of system RAM and the CPU does the work, roughly an order of magnitude slower. Apple Silicon is the exception: unified memory means a 32 GB Mac can hold models a 12 GB discrete card cannot, and Metal does the compute. Both Ollama and LocalAI will silently fall back to CPU if the GPU path fails, so check the startup log rather than assuming.

How fast is CPU-only inference, really?

Approximate orders of magnitude, because it is bound by memory bandwidth rather than core count: an 8B model at Q4_K_M generates on the order of 5 to 15 tokens per second on a modern desktop CPU, which is slower than you read but fine for batch work like summarizing a document pile overnight. A 70B at Q4 drops to roughly 1 to 3 tokens per second, which is not usable interactively. Adding cores barely helps; a 16-core server on dual-channel DDR4 is only marginally faster than an 8-core one.

Which LocalAI image do I pull?

The one matching your accelerator, and getting it wrong is quiet rather than loud. There are plain CPU, CUDA 12, CUDA 13, ROCm, Intel oneAPI, Vulkan and Jetson L4T builds. Compressed sizes span an order of magnitude: around 280 MB for CPU (about 260 MB on arm64) against roughly 3.5 GB for CUDA 12 and over 4 GB for the Intel GPU build. Run the CUDA 12 image against a driver that only supports an older runtime and it starts, loads the model and falls back to CPU, so the only symptom is that everything is slow.

Does Ollama have any authentication?

None at all. The API is designed for localhost, and setting OLLAMA_HOST=0.0.0.0 exposes an unauthenticated endpoint that will pull models, run inference and delete models for anyone who can reach port 11434. Internet-wide scans for open 11434 have been running for a while. Keep it bound to loopback and reach it through a reverse proxy that requires a token, or bind it to a WireGuard interface. LocalAI is barely better: its access control is a list of static API keys with no rotation or per-key scoping.

Why does my model ignore half of a long document?

Ollama's OLLAMA_CONTEXT_LENGTH defaults to 4096 tokens regardless of what the model supports. Feed 20,000 tokens into a model advertised as 128k and the front is silently dropped, producing answers that confidently ignore the input. Raise it per request with num_ctx or globally with the environment variable, and remember that a larger context allocates a proportionally larger KV cache in VRAM, which can push a model that previously fit into partial offload.

Can I use Open WebUI with both?

Yes. Open WebUI connects to Ollama's native API and to any OpenAI-compatible endpoint, which covers LocalAI, so the chat interface is not a reason to pick either backend. Budget for it separately: Open WebUI idles around 600 MB, which is four times the Ollama server process itself. If you are RAM-constrained on a box that also has to hold model weights, that is not a rounding error.

Sources#

Published . Last reviewed . Found something out of date? Tell us and we will fix it and log the change.