Skip to content
This repository was archived by the owner on Nov 1, 2026. It is now read-only.
jsaigouPublic archive
forked from ggml-org/llama.cpp

About

LLM inference in C/C++

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

11,838 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llama.cpp

llama

This fork (jsaigou/llama.cpp)

OBSOLETE (2026-11-01). The two patches described below were retired. Plain upstream a91eab67 reuses the cross-turn KV cache on hybrid models exactly as this branch did (Qwen3.6 MTP, Ornith, Flash-Next, and a 187K-token prompt: 16-30 prompt tokens re-evaluated per follow-up turn on both), so production now runs unpatched upstream. This branch is kept as history only. Its final state is tagged archive/kintsugi-final-20261101, and the two commits are preserved as patch files in the forge repo (docs/history/kintsugi/, ADR-0019). Experiments live on branches off plain upstream, e.g. feature/clover-draft-self-r3. Do not base new work on this branch.

A working fork of upstream ggml-org/llama.cpp, maintained for Tohil, a self-hosted inference host (AMD Strix Halo, Ryzen AI Max+ 395, gfx1151, 128 GB unified memory). Branch kintsugi (merged 2026-10-23; tree identical to rebase/upstream-20261022) — upstream master at 7170cad4d (2026-10-22) plus two patches (below). The pre-rebase history (based on upstream 458681e1d, 2026-09-01) is the merge's first parent, so git show edfb0e840:README.md has the long-form notes.

Patches carried on top of upstream

  1. Kintsugi — cross-turn KV cache reuse for hybrid/recurrent architectures (tools/server/server-context.cpp, common/common.{h,cpp}). Lets hybrid/recurrent models (Qwen3.5/3.6 MoE, qwen4exp, ...) reuse cache across conversation turns instead of re-prefilling the whole conversation: a dedicated generation-end checkpoint per turn, preferred on restore, a GPU sync after partial-state restore, and checkpoints preserved across a forced position reset. Production, stable.
  2. MTP checkpoint loss past EOG (ggml-org/llama.cpp#28049). A speculative-decode round that ended generation never saved a Kintsugi checkpoint, so the next turn re-prefilled the entire answer just generated. Not specific to one model: it hits any hybrid/recurrent model served with --spec-type draft-mtp. The fix shares one save_generation_checkpoint() between the plain and speculative paths and forces the existing restore-and-replay path when an EOG lands mid-batch.

What changed in the 2026-10-22 rebase

  • The qwen4exp MTP patch set was dropped, not ported. Upstream merged qwen4exp MTP itself (#29761), so the 11 earlier community-PR commits (NextN head, converter, the detached-head loader, the follow-up correctness fixes) are obsolete. The detached MTP head GGUF (mtp-*.gguf via --spec-draft-model) loads unchanged on upstream.
  • --no-mmap no longer exists. Upstream removed --mmap/--no-mmap/--mlock/ --direct-io in favor of --load-mode {auto,none,mmap,mlock,mmap+mlock} (#28334). --no-mmap becomes --load-mode none. Builds from September 2026 onward already accept both spellings; builds from this rebase reject the old one.
  • preserve_reasoning is on by default for templates that support it (--no-reasoning-preserve to turn off).

Verification (Tohil, 2026-10-22/23, Qwen3.8-Flash-Next UD-Q3_K_XL + Q8_0 MTP head)

ROCm build (TheRock 10.1, gfx1151), 262144 context, --spec-type draft-mtp --spec-draft-n-max 3, q8_0 KV, vision projector attached, 8 long multi-turn exchanges:

previous kintsugi build this branch
cache reuse by turn 8 (cache_n) ~5,070 ~5,070
new prompt tokens per turn 24-35 24-35
decode 16-18 t/s 30-37 t/s
image question correct correct

No aborts, faults, or checkpoint-restore loops. Decode is roughly doubled; the cause was not isolated (upstream's ROCm and qwen4exp kernel work since September is the likely source).

Hardware notes that outlived the old README

  • GGML_CUDA_ENABLE_UNIFIED_MEMORY=ON is not needed on this true-APU host and, combined with HIP graph capture (any --spec-type draft-mtp config), causes a hard HSA_STATUS_ERROR_MEMORY_FAULT in k_get_rows_float. It — not HIP graphs alone — was the real trigger behind the old GGML_CUDA_DISABLE_GRAPHS=1 requirement, which is therefore unnecessary. GGML_HIP_UMA is a no-op CMake variable. A 90 GB model at full 262144 context loads on plain hipMalloc.
  • Run --parallel 1 for anything serving one long conversation at full context: --parallel N splits the configured context across N slots.

The full original write-up (diagnosis history, the 231K-token depth soak, the EOG-fix analysis) is in this README at commit edfb0e840 (the previous kintsugi tip).

Quick start

A few options to get llama.cpp installed on your machine:

# curl
curl -LsSf https://llama.app/install.sh | sh

# powershell
irm https://llama.app/install.ps1 | iex

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` VLM session with llama cli Built-in web UI against `llama serve` running Qwen 3.6 Built-in web UI against llama serve

Description

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.

Supported backends

Backend Target devices
BLAS All
BLIS All
CANN Ascend NPU
CUDA Nvidia GPU
HIP AMD GPU
Hexagon 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

Documentation

Tools

Development

Contributing

  • Contributors can open PRs
  • Collaborators will be invited based on contributions
  • Maintainers can push to branches in the llama.cpp repo and merge PRs into the master branch
  • Any help with managing issues, PRs and projects is very appreciated!
  • Read the CONTRIBUTING.md for more information

Acknowledgements

  • 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

About

LLM inference in C/C++

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages