A fork of llama.cpp for MoE models larger than your VRAM. The free VRAM of every GPU becomes a cache of the experts that are in use, the CPU computes the rest in parallel, and long prompts stream the missing experts to the GPUs in large passes. On the same machine with the same request: up to 45x the prompt speed and 7.8x the decode speed of stock llama.cpp.
llama-server -m MiMo-V2.6-Flash-RL-GSQ-RCO-3bit.ggufNo -c, -ub, -ngl or --moe flags: the context, the micro-batch, the expert placement and the threads are sized per request.
Download: the latest release has one package per OS with CPU, CUDA, Vulkan and HIP backends (Linux tar.gz, Windows zip). NVIDIA cards also need the cudart- archive if CUDA 13 is not installed.
One row per model and machine: our best valid run against the official stock binary, on the same machine and with the same request, each build on its own defaults (-np 1 only). i/s = prompt tokens per second, o/s = generated tokens per second. Both answers are linked (ours, then stock). Sorted by the bigger of the two gains.
| model | machine | test | prompt i/s: stock → ours | decode o/s: stock → ours | ours | stock | answers |
|---|---|---|---|---|---|---|---|
| Kimi K3.1 Pro IQ1_S | TR | 13k/1k | 1.5 → 67.9 (45x) | 0.31 → 2.41 (7.8x) | b15843 | b12426 | 31918, 29437s |
| MiMo 2.6 Flash 3-bit | R7 | 12k/1k | 49.4 → 1241.1 (25.1x) | 13.99 → 25.71 (1.8x) | b14965 | b11829 | 24369, 18221s |
| DeepSeek 4.1 Flash IQ2_XXS | R7 | short/1k | - | 1.47 → 32.95 (22.4x) | b14939 | b11887 | 24094, 19818s |
| MiMo 2.6 Flash 3-bit | 5090 | 12k/1k | 141.3 → 3016.3 (21.3x) | 6.83 → 36.13 (5.3x) | b13348 | b11799 | 14701, 14700s |
| GLM 5.3 Flash 3-bit | R7 | 16k/1k† | 41.7 → 869.6 (20.9x) | 12.53 → 19.56 (1.6x†) | b14939 | b11887 | 24065, 19572s |
| GLM 5.3 Flash 3.5-bit | R7 | 12k/1k | 34.3 → 614.9 (17.9x) | 10.72 → 15.18 (1.4x) | b14954 | b11829 | 24296, 18275s |
| MiMo 2.6 Flash 3-bit | TR | 12k/1k | 115.6 → 1699.9 (14.7x) | 30.01 → 33.58 (1.1x) | b15463 | b12317 | 28397, 26475s |
| Qwen3.8 Flash Next IQ4_XS | R7 | 15k/1k | 176.8 → 1934.1 (10.9x) | 29.14 → 52.31 (1.8x) | b13845, b14705 | b12131 | 23477, 23510, 23452s |
| DeepSeek 4.1 Flash IQ2_XXS | TR | 2k/1k | 81.0 → 371.5 (4.6x) | 5.02 → 38.97 (7.8x) | b15065 | b12317 | 26851, 26797s |
| Inkling 2 Mini IQ4_XS | 4060L | 12k/1k | 196.7 → 447.9 (2.3x) | 3.78 → 24.71 (6.5x) | b17211 | b12833 | 37380, 37377s |
| Qwen3.8 Flash Next IQ4_XS | TR | 14k/1k | 443.2 → 2714.9 (6.1x) | 50.42 → 55.71 (1.1x) | b15862 | b12499 | 30944, 30903s |
| Qwen3.8 Flash Next IQ3_S | R7 | 3k/1k | 387.2 → 1777.2 (4.6x) | 44.59 → 56.18 (1.3x) | b14939 | b11829 | 24122, 18270s |
| ERNIE 5.5 Flash IQ3_XXS/IQ4_XS | TR | 12k/1k | 116.3 → 453.7 (3.9x) | 18.05 → 20.18 (1.1x) | b16934 | stock + PR‡ | 36667, 36687s |
| Qwen3.8 Flash Next IQ3_S | TR | 14k/1k | 754.5 → 2631.2 (3.5x) | 58.22 → 57.05 (1.0x) | b15781 | b12499 | 30408, 30905s |
| Hy4 Flash IQ2_AH | TR | 4k edit | 329.4 → 1055.9 (3.2x) | 28.2 → 39.37 (1.4x) | b16923 | b12804 | 36465, 36475s |
| Qwen3.6 35B-A3B 2-bit | 4060L | 12k/1k | 874.6 → 2112.0 (2.4x) | 42.84 → 59.46 (1.4x) | b17211 | b12833 | 37354, 37351s |
Tests: 12k/1k = 12.4k-13.8k-token code-review prompt, 1024 tokens out (13k-16k: the same review, longer); 2k/1k and 3k/1k = a 2k-3k-token source file to review or edit; 4k edit = a 4k-token source file plus an edit instruction; short/1k = one-line prompt, 1024 tokens out (too short to time the prompt). Machines: TR = Threadripper PRO 3975WX (32 cores), 256 GB DDR4-3200 in 8 channels, 2x RTX 3090 (both PCIe 4.0 x16); R7 = Ryzen 7 3700X, 128 GB DDR4-3200, 2x RTX 3090 (x16 + x4); 5090 = a rented server with one RTX 5090 (PCIe 5.0 x16); 4060L = laptop, Ryzen 9 8945HS (8 cores), 32 GB RAM, RTX 4060 Laptop 8 GB, Windows 10. † stock was asked for 64 tokens there, so that decode gain is for information. ‡ stock has no ERNIE 5.5 support yet: stock b12220 plus upstream PR #31925 and our model loader. Models that fit in VRAM, and dense models, run at stock speed and are left out. Older tables, the per-feature gains and perplexity: fork/docs/perf-history.md, fork/docs/features.md.
- Wins: MoE models that do not fit in VRAM. The less of the model fits, the bigger the gain, down to models larger than RAM (Kimi K3.1, DeepSeek), which run partly from the SSD.
- Same as stock: models that fit in VRAM, and dense models.
- 8 GB cards: Qwen3.8 Flash Next and Inkling 2 Mini run on 8 GB GPUs from b17211 (on b17220 both failed there).
llama-server -m MODEL.gguf # OpenAI-compatible server, everything automatic
llama-cli -m MODEL.gguf -p "hello"The fork's defaults apply only when a MoE model is larger than the free VRAM of all GPUs; other models, and every setting you pass yourself, behave as in upstream. The chosen values are printed at startup (-lv 5 prints all of them).
| switch | effect |
|---|---|
--fork off |
upstream behaviour for everything |
-at off |
no automatic tuning (the fork's other defaults stay) |
--moe fixed=1 |
repeatable output for benchmarks |
--moe dense-split=0 / =1 |
force one card / the dense split over the cards |
--moe-expert-cache 0 |
expert cache off |
GET /status |
server phase (loading, prefill, generation) with live ms per token |
Every --moe key and its default: fork/docs/fork-knobs.md. How a row is reproduced: fork/docs/perf-history.md.
- Measured hardware: two machines with 2x RTX 3090, a rented RTX 5090, an RTX 4060 laptop (8 GB) and a Radeon 780M (Vulkan, HIP). 3+ GPUs and mixed vendors are untested.
- The first runs of a model are slower: the hot-expert map is learned from use and kept in
moe-state.ini; the release ships pre-learned maps inhotmaps/. - Output can differ between runs even at temperature 0: a cached expert runs on the GPU, a missed one on the CPU, and they round slightly differently (
--moe fixed=1fixes the placement). Perplexity matches stock within noise (table).
- Georgi Gerganov (ggerganov) and every contributor to llama.cpp and ggml: this fork is a small layer on a fantastic project that has given so much to so many people for so many years. Thank you.
- @csantiago78 and their pull request #27861 ("GPU-resident LRU cache for host-offloaded MoE expert weights"), the starting point of this fork's expert cache. It has since diverged (window and admission instead of LRU, one global pool instead of fixed slots per layer), but the idea and the first working version are theirs.
- People who tried this fork and reported back: @MichaelDietzel (tested on a 2080 Ti and asked for documentation of the
--moekeys and of multi-GPU use), @Volunteer-1 (Windows build report and the same documentation questions; every flag is now documented in fork/docs/fork-knobs.md), @homeofe (the small-VRAM data point where the cache was slower than stock, and the AVX2 dot products for IQ3_S and IQ3_XXS inggml-cpu, merged into this fork, MIT license) and @yuffx (the PCIe-bound explanation of that result). - Strata by @Niko1221 and the Strata contributors: ideas for a few of this fork's later decode tweaks, worth up to about a fifth more decode speed on some models, on top of the lead over stock shown in the table above: a dedicated per-core thread pool for the experts the CPU computes (the fork computed them through the CPU backend before), split kernels for the hyper-connection mix, and overlapping the parts of a decode token on the card. We reimplemented these ideas in our own code and carried some of them over to models Strata does not support yet, GLM 5.3 and MiMo 2.6, with Kimi K3.1 next; the gains there are still small. Strata's speeds are a benchmark target we measure against.
The original llama.cpp README follows below.
LLM inference in C/C++
v1.0.0 / ggml / ops / maintainer PRs / dev stats / lib llama API / llama-server REST API
The main goal of llama.cpp is to enable LLM (and MLLM) inference with minimal setup and state-of-the-art performance on a wide range of hardware - locally and in the cloud.
The llama.cpp project is built on top of the ggml library.
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- 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
|
Llama Chat, the built-in chat app, against llama serve
|
- 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

