llama: install it with irm https://llama.app/install.ps1 | iex on Windows (or curl -LsSf https://llama.app/install.sh | sh on Mac and Linux), then run llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF to chat or llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF for an OpenAI-compatible server and chat page at http://127.0.0.1:9931. Use -c to set the context size.
What is llama.cpp?
llama.cpp is an LLM inference engine written in C and C++, built on the ggml tensor library and maintained by the ggml-org team at Hugging Face. It loads models in the GGUF file format, usually quantised to 4 to 8 bits so they fit in ordinary RAM or VRAM, and runs them on CPUs and on NVIDIA (CUDA), AMD (ROCm or Vulkan), Intel and Apple Silicon (Metal) hardware. The project says it supports more than 150 model architecture variants.
Two things changed recently, and many older guides have not caught up:
- Version numbers. On 13 November 2026 the team released llama.cpp v1.0.0 and moved to semantic versioning (major.minor.patch). v1.1.0 followed on 26 November 2026. The old
bNNNNNbuilds still come out several times a day as nightly builds. - One program instead of many. The official installer now gives you a single
llamaprogram with sub-commands (llama serve,llama cli,llama download). The separatellama-serverandllama-cliprograms still exist in the winget, Homebrew and release-zip packages and take the same options. - The server’s default port is 9931. Tools and tutorials that expect
8080need--port 8080. The official Docker examples still pass--port 8080explicitly.
How to install llama.cpp
The README lists four ways. In order of how easy they are:
| Method | Command | Good for |
|---|---|---|
| Official installer (Windows) | irm https://llama.app/install.ps1 | iex | Most Windows users. Picks the right GPU build for you. |
| Official installer (Mac, Linux) | curl -LsSf https://llama.app/install.sh | sh | Most Mac and Linux users. |
| Package manager | winget install llama.cpp, brew install llama.cpp, conda install -c conda-forge llama.cpp | People who update everything through one tool. |
| Docker | ghcr.io/ggml-org/llama.cpp:server (plus -cuda, -rocm, -vulkan variants) | Servers and homelabs. |
| Build from source | cmake -B build then cmake --build build --config Release | Custom GPU flags or the very latest code. |
Install llama.cpp on Windows
Open PowerShell (no admin needed) and run:
irm https://llama.app/install.ps1 | iex
The script checks for a CUDA GPU first, then ROCm, then Vulkan, then falls back to a CPU build, and downloads the matching single llama.exe. It installs it to %LOCALAPPDATA%\Microsoft\WindowsApps\llama.exe, which is already on the PATH, so llama works in any new terminal. On the test PC it found no CUDA or ROCm, picked the Vulkan build, and finished with Installation completed successfully. The file was 53 MB and signed by Hugging Face.
Check it worked:
PS> llama version
version: 1.1.0-dev (build 12826, commit 8e23278c7)
built with Clang 22.1.8 for Windows x86_64
PS> llama serve --list-devices
Available devices:
Vulkan0: Radeon RX 580 Series (8192 MiB, 7402 MiB free)
If you have an NVIDIA card but the script says NVIDIA GPU detected, but the CUDA Toolkit is not installed, install the CUDA Toolkit (the script suggests winget install Nvidia.CUDA) and run the installer again. Otherwise you get the Vulkan or CPU build.
winget instead? winget install llama.cpp works and installs llama.exe, llama-server.exe, llama-cli.exe, llama-bench.exe, llama-quantize.exe and the other tools, with CPU and Vulkan back ends (the package tested had no CUDA DLLs). But read the Smart App Control section below first: on the test PC every winget program was blocked.
Install llama.cpp on Mac or Linux
# official installer
curl -LsSf https://llama.app/install.sh | sh
# or Homebrew (Mac and Linux)
brew install llama.cpp
Apple Silicon Macs use the Metal GPU back end. Linux users with NVIDIA cards who want to build it themselves add -DGGML_CUDA=ON to the cmake step.
Run llama.cpp in Docker
The official images are full, light and server, each with -cuda, -cuda13, -rocm, -vulkan, -intel, -musa and -openvino variants. This is the example from the server README:
docker run -p 8080:8080 -v /path/to/models:/models --gpus all \
ghcr.io/ggml-org/llama.cpp:server-cuda \
-m /models/your-model.gguf -c 4096 --host 0.0.0.0 --port 8080 --n-gpu-layers 99
Build llama.cpp from source
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
cmake -B build # add -DGGML_CUDA=ON for NVIDIA, -DGGML_VULKAN=ON for Vulkan
cmake --build build --config Release -j 8
On Windows the build guide uses Visual Studio 2022 with the C++ CMake tools and the Clang components. Most people do not need to build it: the installers above already include GPU support.
llama.cpp commands
This is what llama help all printed on the test PC (build 12826):
| Command | What it does | Old separate program |
|---|---|---|
llama serve | HTTP API server plus the Llama Chat web page | llama-server |
llama cli | Interactive chat in the terminal | llama-cli |
llama download | Downloads a model without running it | none |
llama update | Updates to the latest release (installer builds only) | none |
llama completion | Plain text completion, no chat template | llama-completion |
llama bench | Measures prompt and generation speed | llama-bench |
llama fit-params | Works out settings that fit a model in your memory | llama-fit-params |
llama quantize | Makes a smaller quantised GGUF from a bigger one | llama-quantize |
llama perplexity | Measures model quality (perplexity, KL divergence) | llama-perplexity |
llama version | Shows the version and build | --version |
Every command takes --help. llama server and llama client also work as aliases for serve and cli.
How to download models for llama.cpp
llama.cpp runs GGUF files. You can point it at a file you already have with -m, or let it fetch one from Hugging Face with -hf:
# download only
llama download -hf ggml-org/Qwen3.5-0.8B-GGUF
# pick a quantisation with :TAG
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF:Q8_0
# a file on disk
llama serve -m C:\models\my-model-Q4_K_M.gguf
# list what is already downloaded
llama cli -cl
Without a tag, llama.cpp looks for Q4_K_M and falls back to another file in the repository if there is none. The test repository had no Q4_K_M, and llama.cpp chose the Q8_0 file (795 MB). It also downloaded the 111 MB vision projector (mmproj) on its own, because the model can read images; add --no-mmproj if you do not want it. The download took 22 seconds.
Where the models go. Current builds store -hf downloads in the standard Hugging Face cache, so they are shared with other Hugging Face tools:
- Windows:
%USERPROFILE%\.cache\huggingface\hub(on the test PC:C:\Users\NAME\.cache\huggingface\hub\models--ggml-org--Qwen3.5-0.8B-GGUF) - Mac and Linux:
~/.cache/huggingface/hub - To move it, set
LLAMA_CACHE(orHF_HUB_CACHEorHF_HOME) before you run llama.cpp.
Gated models need a Hugging Face token: set the HF_TOKEN environment variable or pass --hf-token. Not sure which size fits your card? Check the LLM VRAM calculator and the quantisation guide (Q4_K_M, Q8_0 and the rest explained).
How to run llama.cpp as a server (llama serve)
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF:Q8_0
On the test PC the server answered /health with 503 while the model loaded and {"status":"ok"} after 10 seconds. The log ended with listening on http://127.0.0.1:9931. Open that address in a browser for Llama Chat, the built-in chat page (turn it off with --no-ui).
The server speaks the OpenAI API (/v1/chat/completions, /v1/completions, /v1/responses, /v1/embeddings, /v1/models) and the Anthropic Messages API (/v1/messages), so most apps that let you set a “base URL” can use it. A test request:
curl http://127.0.0.1:9931/v1/chat/completions -H "Content-Type: application/json" -d "{\"messages\":[{\"role\":\"user\",\"content\":\"In one sentence, what is llama.cpp?\"}],\"max_tokens\":300}"
Each reply includes a timings block. On the RX 580 test card, the 0.8B model generated about 31 to 33 tokens per second. A model that small is only good for checking that everything works: its one-sentence answer about llama.cpp was wrong. Use a bigger model for real work.
Useful server options
| Option | What it does | Default |
|---|---|---|
--port 8080 | Port to listen on | 9931 |
--host 0.0.0.0 | Listen on your network, not only this PC | 127.0.0.1 |
--api-key KEY | Require a key on API calls (do this before opening it to the network) | none |
-c 8192 | Context size in tokens | 0 = the model’s own maximum |
-ngl N | Layers to put on the GPU: a number, auto or all | auto |
-np 2 | Parallel request slots | 4 slots on the test PC |
--reasoning off | Turn off thinking for models that support it | auto |
--models-dir PATH | Router mode: serve every GGUF in a folder and load them on demand | off |
--no-ui | Turn off the built-in chat page | on |
Several models in one server. Start llama serve with no model (it then lists your downloaded models), or with --models-dir pointing at a folder of GGUF files. The server becomes a router: each request picks a model with its "model" field, and up to 4 models stay loaded by default (--models-max). Put multi-file models (vision projectors, split files) in their own sub-folder.
How to increase the context size in llama.cpp
Use -c (or --ctx-size) with a number of tokens:
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF:Q8_0 -c 8192
The default is 0, which means “use the model’s own maximum”. For the test model that was 262,144 tokens, and the /props endpoint showed n_ctx=262144. With -c 8192 it showed n_ctx=8192. A bigger context needs more memory for the KV cache, so on a small GPU a lower number can be faster. The --fit option (on by default) adjusts settings you did not set so the model fits in device memory, and it will not push the context below 4,096 tokens (--fit-ctx). To save memory on long contexts, the KV cache can be stored at lower precision with -ctk q8_0 -ctv q8_0.
Best llama.cpp settings
Current builds pick sensible values for most options, so start with no flags and change one thing at a time:
- GPU layers:
-ngldefaults toauto. Set-ngl allif the whole model fits in VRAM. - Flash attention:
-fadefaults toauto. On the RX 580 the log said Flash Attention was not supported there and turned it off by itself. - Threads: the performance guide warns that too many CPU threads can slow generation. If speed is poor, set
-tto the number of physical cores. - Mixture-of-experts models:
--cpu-moeor--n-cpu-moe Nkeep expert weights in system RAM so large MoE models run on smaller GPUs. - Sampling defaults: temperature 0.80, top-k 40, top-p 0.95, min-p 0.05. Model cards often recommend their own values; pass them with
--temp,--top-pand so on. - Measure, do not guess:
llama bench -m model.ggufprints prompt and generation speed, so you can compare settings.
How to update llama.cpp
- Installed from llama.app:
llama update. On the test PC it re-ran the installer and printed Already up to date. To force a reinstall:$env:FORCE_UPDATE = '1'then the install command again. - winget:
winget upgrade llama.cpp. Homebrew:brew upgrade llama.cpp. - Docker:
docker pullthe image again. - Source:
git pull, then build again.
On other installs, llama update only says Updates are available only when installed from https://llama.app.
llama.cpp vs Ollama vs LM Studio
| llama.cpp | Ollama | LM Studio | |
|---|---|---|---|
| What it is | The engine itself, command line plus a small chat page | A background service with its own model library | A desktop app with a model browser |
| Models | Any GGUF file, straight from Hugging Face | ollama pull names from its library, or imported GGUF | Downloads models from inside the app |
| Default API port | 9931 | 11434 | Local server started from the app |
| Control | Every flag exposed | Fewer options, simpler | Settings in menus |
| Best for | The newest models and full control | “Just works” use and apps built for Ollama | People who prefer a GUI |
If you already use Ollama, the Ollama commands cheat sheet covers its equivalents (pull, run, ps, context length, model folder). For more local AI guides, see the local LLMs hub.
When llama.cpp breaks: common errors
“An Application Control policy has blocked this file” (Windows)
This was the first thing that went wrong on the test PC. With Smart App Control switched on, every program from the winget package (build 12855) was blocked. PowerShell showed An Application Control policy has blocked this file. llama.exe printed nothing at all and exited with code 0xC0E90002. The Code Integrity event log listed “Smart App Control” blocks (event IDs 3033, 3077 and 3118) when llama.exe tried to load its own DLLs. Get-AuthenticodeSignature showed the winget files as NotSigned.
Microsoft says Smart App Control blocks unsigned apps it cannot vouch for, and “there is currently no way to bypass” it for single apps. What worked on the test PC, without changing any Windows setting: use the llama.app installer instead. Its llama.exe carries a valid Hugging Face signature and ran normally with Smart App Control still on. The other option is to turn Smart App Control off in the Windows Security app. Microsoft’s page says recent Windows updates let you turn it back on later without reinstalling Windows.
To check whether Smart App Control is on: (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy').VerifiedAndReputablePolicyState returns 1 when it is on (it was on the test PC).
Empty reply: “content” is blank
With a thinking model, a request with "max_tokens":120 came back with "content": "". All 120 tokens went into reasoning_content (the model’s thinking) and it never reached the answer. Fixes, both tested:
- Give it more room: raise
max_tokens, or leave it out. - Turn thinking off for that request with
"chat_template_kwargs":{"enable_thinking":false}. The same 120-token request then gave a normal answer in 13 tokens. For the whole server, start it with--reasoning offor cap thinking with--reasoning-budget N.
Cloud APIs have the same trap. See why the Claude API returns an empty response when thinking uses up max_tokens.
App cannot connect, or “Loading model”
- Wrong port: the default is 9931, not 8080. Start with
--port 8080or change the app’s base URL tohttp://127.0.0.1:9931/v1. - Another PC cannot reach it: it listens on 127.0.0.1 only. Add
--host 0.0.0.0, allow the port in the firewall, and set--api-key. - 503 “Loading model”: the model is still loading. Wait for
/healthto return{"status":"ok"}. - Two servers on one port: on the test PC a second
llama serve --port 8080did not fail with an error; it also reportedlistening on http://127.0.0.1:8080. If replies come from the wrong model, check for old llama processes (Get-Process llama*) and stop them. - PowerShell error “gzip is not supported by this browser”: Windows PowerShell 5.1’s
Invoke-WebRequestcannot load the chat page itself. Open the address in a real browser; the API endpoints work fine from PowerShell.
Slow, or running on the CPU instead of the GPU
- Run
llama serve --list-devices. If no GPU is listed, you have a CPU-only build: reinstall with the llama.app installer, or install the CUDA Toolkit first on NVIDIA. - Read the start-up log for which device each part of the model went to, and lower
-cor use a smaller quantisation if it does not fit. - Try fewer threads (
-t), as the official performance guide suggests.
“unknown model architecture” or a new model will not load
New model families need a newer llama.cpp. Update first (see above): release notes list newly supported models, for example v1.1.0 added the Inkling 2 family and several speech models.
FAQ
Is llama.cpp free?
Yes. It is open source under the MIT licence, on GitHub at ggml-org/llama.cpp.
Does llama.cpp need a GPU?
No. It runs on the CPU alone, with builds for many CPU generations. A GPU makes it much faster: NVIDIA through CUDA, AMD through ROCm or Vulkan, Intel through SYCL, OpenVINO or Vulkan, and Apple Silicon through Metal. The test PC used an AMD Radeon RX 580 through Vulkan.
How do I use llama.cpp, step by step?
Install it (one command), run llama serve -hf USER/MODEL-GGUF, open http://127.0.0.1:9931 in your browser and chat. Or run llama cli -hf USER/MODEL-GGUF to chat in the terminal.
What happened to llama-server and llama-cli?
They still exist in the winget, Homebrew and release packages. The llama.app installer gives you only the single llama program, where llama serve and llama cli do the same jobs with the same options.
Can llama.cpp run models from Ollama or LM Studio?
It runs any GGUF file with -m path\to\file.gguf, so a GGUF you downloaded for LM Studio works directly. Hugging Face repositories are the simplest source with -hf.
Sources
- llama.cpp on GitHub (README and quick start)
- llama.cpp v1.0.0 announcement, Hugging Face blog, 13 November 2026
- llama.cpp releases (v1.1.0 notes and nightly builds)
- llama-server documentation (options, API, router mode)
- llama-cli options
- Install pre-built versions (winget, Homebrew, conda, Nix)
- Build guide and Docker images
- Performance troubleshooting
- llama.app Windows installer script
- Microsoft: What is Smart App Control?
Updated 1 December 2026 (llama.cpp v1.1.0, nightly build 12887). Written with AI help from the sources listed; the Windows tests were run on the test PC described at the top.