How to Run AI Models Locally: Ollama, llama.cpp and vLLM

In short: you can run some AI models on your own computer instead of using them through a company's website. These are open-weight models, whose trained files can be downloaded. Doing so needs inference software, and three open-source projects cover most of it: Ollama, a single app that downloads and runs a model with one command; llama.cpp, the lightweight engine that runs models on ordinary laptops, including Macs; and vLLM, built for serving a model to many users at once from a GPU server. All three can offer the model through an API shaped like OpenAI's. Everything below comes from each project's own documentation.
What does it mean to run an AI model locally?
Running a model locally means the model's files sit on your machine and it answers without sending your text to anyone else's servers. When you use ChatGPT or Claude, the model runs in the company's data centre. A local model runs on your own laptop, desktop or server instead.
That is only possible with an open-weight model - one whose trained weights (the billions of numbers learned during training) are published for download. Each model's page in our AI models directory shows its licence and whether it can be self-hosted. For what weights and parameters are, see how LLMs work.
Why do people run models locally?
- Privacy: prompts and documents never leave the machine.
- Offline use: it works without an internet connection once downloaded.
- No per-token charges: the cost is your own hardware and electricity.
- Control: you choose the exact model version, and it does not change underneath you.
The trade-offs: the largest frontier models are not published as open weights, and the models that fit on a home computer are generally smaller, so results depend on the model and your hardware.
What is Ollama?
Ollama is an app for macOS, Windows and Linux that downloads open models and runs them with a single command. Its README describes it as a way to "get up and running" with models including Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen and Gemma.
- Use. One command downloads a model and opens a chat; the README's example is
ollama run gemma4. - API. It runs a REST API on your own machine at
localhost:11434, with a chat endpoint at/api/chat, alongside an OpenAI-compatible API. - Platforms. macOS, Windows and Linux, plus an official
ollama/ollamaDocker image. - Licence. MIT.
What is llama.cpp?
llama.cpp is a lightweight engine that runs language models on a wide range of hardware, from laptops to servers. Its README describes it as a "plain C/C++ implementation without any dependencies", aiming for "minimal setup and state-of-the-art performance on a wide range of hardware".
- Hardware. The README calls Apple silicon "a first-class citizen", optimised through ARM NEON, Accelerate and Metal. It has custom CUDA kernels for NVIDIA GPUs and lists Vulkan, SYCL, HIP (for AMD) and MUSA (for Moore Threads) support.
- Quantisation. It supports 1.5-bit, 2-bit, 3-bit, 4-bit, 5-bit, 6-bit and 8-bit integer quantisation - see below.
- File format. Models use the GGUF format; the repository includes a
convert_hf_to_gguf.pyscript for converting models published on Hugging Face. - Use. The README's quick start downloads and runs a model straight from Hugging Face with
llama cli -hf <model>, and starts an OpenAI-compatible API server, with a built-in web interface, withllama serve -hf <model>.
What is vLLM?
vLLM is a serving engine for running a model for many users at once, usually on GPU servers. Its README says it was "originally developed in the Sky Computing Lab at UC Berkeley" and is now maintained by a large community.
- PagedAttention. Its core technique stores the model's attention memory (the key-value cache) in fixed-size blocks, borrowing the idea of memory paging from operating systems, so memory is not reserved for the longest possible reply. It was published in Efficient Memory Management for Large Language Model Serving with PagedAttention.
- Throughput features. Continuous batching of incoming requests, chunked prefill and prefix caching.
- APIs. An OpenAI-compatible API server, plus Anthropic Messages API and gRPC support.
- Hardware. NVIDIA, AMD and Intel GPUs and x86, ARM and PowerPC CPUs, with hardware plugins for others including Google TPUs and Apple silicon.
How do Ollama, llama.cpp and vLLM differ?
| Ollama | llama.cpp | vLLM | |
|---|---|---|---|
| What it is | An app that manages and runs models | A C/C++ inference engine | A serving engine for many users |
| Typical setting | A personal computer | Laptops, desktops, servers | GPU servers |
| Start a model | ollama run <model> | llama cli -hf <model> | Its API server |
| API | REST on port 11434, plus OpenAI-compatible | OpenAI-compatible (llama serve) | OpenAI-compatible, Anthropic Messages, gRPC |
What is quantisation, and why does it matter?
Quantisation stores a model's numbers with fewer bits, so it takes less memory and fits on smaller hardware. A model's weights are normally stored at 16 bits each; at 4 bits each the same model needs roughly a quarter of the memory. That is what lets larger models run on consumer laptops and graphics cards. The cost is some loss of output quality, which grows as the bit count falls.
What hardware do you need?
The main limit is memory: the model has to fit in your graphics card's memory, or in your computer's RAM. Larger models, longer context windows and higher-precision quantisation all need more. Apple silicon Macs share one pool of memory between the processor and graphics, which llama.cpp is optimised for; on Windows and Linux, an NVIDIA or AMD graphics card speeds things up. Each tool's documentation lists its supported hardware.
Why does an "OpenAI-compatible API" matter?
It means software written for a hosted AI service can often be pointed at a local model by changing two settings: the server address and the model name. All three tools can expose a model through an API shaped like OpenAI's, which is why they appear in coding assistants, agent setups and chat apps as well as on their own. For how AI apps connect to tools and data, see what is MCP.
Words to know
- Open-weight model: a model whose trained weights can be downloaded and run by anyone.
- Weights: the numbers a model learned in training; the model's files.
- Inference: running a trained model to get answers.
- Quantisation: storing weights with fewer bits to save memory.
- GGUF: the model file format llama.cpp uses.
- Key-value (KV) cache: memory a model keeps of the text so far while generating.
- OpenAI-compatible API: an interface shaped like OpenAI's, so existing code works with it.
- Self-hosting: running a model on hardware you control.
Related guides
Frequently asked questions
Can I run an AI model on my own computer?+
Yes, if the model is open-weight, meaning its files are published for download. Tools such as Ollama and llama.cpp download and run these models on ordinary computers, including laptops; how large a model you can run depends mainly on your memory.
What is Ollama?+
Ollama is an MIT-licensed app for macOS, Windows and Linux that downloads open models and runs them with one command, such as ollama run gemma4. It serves the model through a REST API on your computer at port 11434.
What is the difference between Ollama and llama.cpp?+
llama.cpp is a C/C++ engine that runs models in the GGUF format on a wide range of hardware. Ollama is an application that packages model downloading, running and an API into a single tool for personal computers.
What is vLLM used for?+
vLLM is used to serve a model to many users at once, usually on GPU servers. Its PagedAttention technique manages memory in fixed-size blocks, and it adds continuous batching and prefix caching to handle many requests efficiently.
Is running AI locally private?+
The model runs on your own hardware, so prompts and documents are processed on your machine rather than sent to an AI company's servers. Privacy then depends on how your own computer and any connected tools are set up.
What is quantisation in AI models?+
Quantisation stores a model's weights with fewer bits, such as 4 instead of 16, so it needs less memory and can run on smaller hardware. llama.cpp supports quantisation from 1.5-bit to 8-bit, with some loss of quality as the bit count falls.
Do local AI models need the internet?+
Only to download the model. Once its files are on your machine, tools such as Ollama and llama.cpp can run it offline.
Enjoyed this? Get more in your inbox.
Up to ten of the week's AI news stories, by email once a week.