LLM inference in C/C++
ggml / ops / maintainer PRs / dev stats / lib llama API / llama-server REST API
A few options to get llama.cpp installed on your machine:
- Visit https://llama.app and follow the instructions
- Run with Docker - see our Docker documentation
- Download pre-built binaries from the releases page
- Build from source by cloning this repository - check out our build guide
Once installed:
# Download and run a model directly from Hugging Face
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF
# Launch OpenAI-compatible API server
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF
VLM session with llama cli
|
Built-in web UI against llama serve
|
This profile is for Qwen3.8 Flash-Next Q2_K_XL and its shared Q4_K_M MTP
draft. Keep all three target GGUF shards in one directory, and pass
...-00001-of-00003.gguf to --model.
The values below describe this branch's Linux Vulkan shortcut for an
AMD Ryzen AI 9 HX 370. --threads and
LLAMA_QSA_GATHER=16384 are hardware-specific tuning values; measure them
before using them on another system.
Run this from the unpacked Linux Vulkan release directory. Replace the three path variables with local paths.
release_dir=/path/to/llama-unified-linux-vulkan
model=/path/to/Qwen3.8-Flash-Next-UD-Q2_K_XL-00001-of-00003.gguf
draft=/path/to/mtp-Qwen3.8-Flash-Next-shared-Q4_K_M.gguf
export LD_LIBRARY_PATH="$release_dir"
export LLAMA_ATTN_ROT_DISABLE=1
export LLAMA_QSA_GATHER=16384
"$release_dir/llama-server" \
--model "$model" \
--gpu-layers 99 --flash-attn on \
--fit off \
--ctx-size 100000 --parallel 1 --threads 10 \
--cache-ram 2048 --ctx-checkpoints 4 \
--cache-type-k q8_0 --cache-type-v q8_0 --kv-unified \
--reasoning on --reasoning-effort low --reasoning-preserve \
--temp 1.0 --top-k 20 --min-p 0.0 \
--alias qwen3.8-flash-next --metrics --host 0.0.0.0 --port 1234 \
--spec-type draft-mtp,ngram-mod --spec-draft-model "$draft" \
--spec-draft-p-min 0.75 \
--spec-draft-ngl all --spec-draft-type-k q8_0 --spec-draft-type-v q8_0Extract the Windows Vulkan archive and retain its DLLs beside
llama-server.exe. LD_LIBRARY_PATH is Linux-only.
$releaseDir = 'C:\path\to\llama-unified-windows-vulkan'
$model = 'C:\path\to\Qwen3.8-Flash-Next-UD-Q2_K_XL-00001-of-00003.gguf'
$draft = 'C:\path\to\mtp-Qwen3.8-Flash-Next-shared-Q4_K_M.gguf'
$env:LLAMA_ATTN_ROT_DISABLE = '1'
$env:LLAMA_QSA_GATHER = '16384'
& "$releaseDir\llama-server.exe" `
--model "$model" `
--gpu-layers 99 --flash-attn on `
--fit off `
--ctx-size 100000 --parallel 1 --threads 10 `
--cache-ram 2048 --ctx-checkpoints 4 `
--cache-type-k q8_0 --cache-type-v q8_0 --kv-unified `
--reasoning on --reasoning-effort low --reasoning-preserve `
--temp 1.0 --top-k 20 --min-p 0.0 `
--alias qwen3.8-flash-next --metrics --host 0.0.0.0 --port 1234 `
--spec-type draft-mtp,ngram-mod --spec-draft-model "$draft" `
--spec-draft-p-min 0.75 `
--spec-draft-ngl all --spec-draft-type-k q8_0 --spec-draft-type-v q8_0Warning
Windows supports this Flash-Next MTP and ngram-mod profile, but
the default loading mode uses memory-mapped I/O, not direct SSD I/O. This fork does
not explicitly release GPU-uploaded source-mapping pages or accessed PLE
pages on Windows, so system-memory use can grow during inference.
Leave sufficient system and shared-GPU memory headroom for long
contexts.
On Linux Vulkan integrated GPUs, this fork explicitly releases source-mapping pages after GPU upload. Sparse PLE mappings receive random-access advice automatically, with row prefetch during inference. This does not provide a Windows memory-residency limit.
The main goal of llama.cpp is to enable LLM (and VLM) inference with minimal setup and state-of-the-art performance on
a wide range of hardware - locally and in the cloud.
- Plain C/C++ implementation without any dependencies
- Apple silicon is a first-class citizen - optimized via ARM NEON, Accelerate and Metal frameworks
- AVX, AVX2, AVX512 and AMX support for x86 architectures
- RVV, ZVFH, ZFH, ZICBOP and ZIHINTPAUSE support for RISC-V architectures
- 1.5-bit, 2-bit, 3-bit, 4-bit, 5-bit, 6-bit, and 8-bit integer quantization for faster inference and reduced memory use
- Custom CUDA kernels for running LLMs on NVIDIA GPUs (support for AMD GPUs via HIP and Moore Threads GPUs via MUSA)
- Vulkan and SYCL backend support
- CPU+GPU hybrid inference to partially accelerate models larger than the total VRAM capacity
The llama.cpp project is build on top of the ggml library.
| Backend | Target devices |
|---|---|
| BLAS | All |
| BLIS | All |
| CANN | Ascend NPU |
| CUDA | Nvidia GPU |
| HIP | AMD GPU |
| Hexagon [In Progress] | Snapdragon |
| IBM zDNN | IBM Z & LinuxONE |
| MUSA | Moore Threads GPU |
| Metal | Apple Silicon |
| OpenCL | Adreno GPU |
| OpenVINO [In Progress] | Intel CPUs, GPUs, and NPUs |
| RPC | All |
| SYCL | Intel GPU |
| VirtGPU | VirtGPU APIR |
| Vulkan | GPU |
| WebGPU | All |
| ZenDNN | AMD CPU |
- How to build
- Running on Docker
- Build on Android
- Multi-GPU usage
- Performance troubleshooting
- GGML tips & tricks
- XCFramework
- Completions
- Models
- Release process
- Contributors can open PRs
- Collaborators will be invited based on contributions
- Maintainers can push to branches in the
llama.cpprepo and merge PRs into themasterbranch - Any help with managing issues, PRs and projects is very appreciated!
- Read the CONTRIBUTING.md for more information
- yhirose/cpp-httplib - Single-header HTTP server, used by
llama-server- MIT license - nothings/stb - Single-header image format decoder, used by multimodal subsystem - Public domain
- nlohmann/json - Single-header JSON library, used by various tools/examples - MIT License
- mackron/miniaudio - Single-header audio format decoder, used by multimodal subsystem - Public domain
- sheredom/subprocess.h - Single-header process launching solution for C and C++ - Public domain

