Skip to content

How-ToCPU

How to Run ik_llama.cpp for Big MoE Models on a Gaming PC

How to build and run ik_llama.cpp, the CPU-focused llama.cpp fork, on Linux or Windows with an NVIDIA GPU, and use it to run big mixture-of-experts models with the experts kept in system RAM.

By , Systems & Technical Editor

5 min read

How to Run ik_llama.cpp for Big MoE Models on a Gaming PC

cpp on its own hardware, so this guide has no measured speed or memory figures. The steps and options come from the project's GitHub README and build guide, read on 2 December 2026. The project changes quickly, so check those pages for your version.

ik_llama.cpp is a free, MIT-licensed fork of llama.cpp. Its README describes it as a "llama.cpp fork with better CPU performance": it was started in June 2024, last synced with upstream in August 2024, and has "diverged substantially" since. It adds its own quantisation types and focuses on two backends: the CPU and NVIDIA CUDA.

That focus is why it's popular with people trying to run large mixture-of-experts (MoE) models on a home PC. In an MoE model only some of the "experts" run for each token, so a common trick is to keep the attention layers and shared weights in VRAM and leave the bulky expert weights in system RAM for the CPU to handle. If you've already tried this in mainline llama.cpp with --n-cpu-moe, our guide to running MoE models on low VRAM covers that route.

What you need

  • A CPU with AVX2 or better (or an Arm chip with NEON). The README says CPU and CUDA are "the only fully functional and performant compute backends". Not sure about AVX2? See how to check AVX2 support.

  • An NVIDIA GPU, ideally Turing (RTX 20-series) or newer. Pascal and Volta cards work, but the README says some flash-attention steps fall back to the CPU on them.

  • Plenty of system RAM if you plan to keep experts on the CPU. The model's expert weights have to fit there, and memory bandwidth matters a lot for CPU-side speed.

  • Build tools: the build guide lists cmake, a C++17 compiler and, for GPU support, the NVIDIA CUDA Toolkit.

AMD and Intel GPU owners: the README asks people not to file issues about ROCm, Vulkan, Metal, old NVIDIA GPUs or AVX-only CPUs, because the maintainers don't have time to support them. If you have a Radeon or Arc card, stick with mainline llama.cpp.

Step 1: Get the code

ik_llama.cpp is built from source. The README's quickstart starts with:

git clone https://github.com/ikawrakow/ik_llama.cpp
cd ik_llama.cpp

On Debian or Ubuntu, the README installs the build packages with:

apt-get update && apt-get install build-essential git libcurl4-openssl-dev curl libgomp1 cmake

On Windows, the build guide has a separate step-by-step section using the CUDA Toolkit and Visual Studio Build Tools 2022 with the clang tools. The README's Linux commands are written for Debian and Ubuntu. The ik_llama.cpp docs we read don't cover WSL2 specifically, but if you'd rather use a Linux environment on Windows, our WSL2 GPU set-up guide covers the general set-up.

Step 2: Build for CPU or for an NVIDIA GPU

For a CPU-only build, the README gives:

cmake -B build -DGGML_NATIVE=ON
cmake --build build --config Release -j$(nproc)

For NVIDIA GPU support, install the NVIDIA driver and CUDA Toolkit, then add -DGGML_CUDA=ON:

cmake -B build -DGGML_NATIVE=ON -DGGML_CUDA=ON
cmake --build build --config Release -j$(nproc)

AVX-512 CPUs: the README warns that on AMD Zen 4 and Intel Sapphire Rapids or newer, a plain Release build "silently falls back to the AVX2 path" unless you add the extra flags in the build guide's "CPU build flags for AVX-512" section. If your processor supports AVX-512, read that section before building.

Step 3: Download a GGUF model and start the server

ik_llama.cpp loads GGUF files, the same model format as llama.cpp. Our GGUF quantisation explainer covers what the Q4, Q5 and IQ labels mean.

The README's example starts the server like this on the CPU:

./build/bin/llama-server --model /my_local_files/gguf/Qwen_Qwen3-0.6B-IQ4_NL.gguf --ctx-size 4096

and like this with every layer on the GPU:

./build/bin/llama-server --model /my_local_files/gguf/Qwen_Qwen3-0.6B-IQ4_NL.gguf --ctx-size 4096 -ngl 999

Then open http://127.0.0.1:8080 in your browser to chat, or point another app at the server's API.

One warning from the README: don't use Unsloth quantised models with _XL in the name if they contain f16 tensors, because they're "likely to not work" with ik_llama.cpp. Other Unsloth files are fine.

Step 4: Keep the MoE experts on the CPU

For a big MoE model that won't fit in VRAM, the idea is to offload everything to the GPU with -ngl 999, then send the expert tensors back to system RAM. The README mentions three ways to do that: --cpu-moe (all experts on the CPU), --n-cpu-moe (experts of the first N layers on the CPU), or a tensor override such as:

-ot 'ffn_.*_exps=CPU'

According to the README's latest news, a recent change runs the MoE combine step on the CPU when experts are kept there with that override, which the project says cuts CPU-to-GPU copies by about nine times.

Two settings to avoid while you're doing this:

  • Don't add -rtr. The README says that if you run hybrid CPU/GPU inference with some experts on the CPU, you shouldn't use -rtr "unless you know what you are doing". It repacks the tensors left in RAM, and not every repacked type has a CUDA path.

  • If you use split mode graph with partial offload and get gibberish, the README suggests adding -cuda graphs=0.

Start with a small context, check how much VRAM is in use (see how to check VRAM usage on Windows), then lower the --n-cpu-moe number to move more layers' experts onto the GPU until VRAM is nearly full.

Optional: Run it in Docker

If you'd rather not compile anything, the README lists container images on ghcr.io for CPU, CUDA 12 and CUDA 13, each in swap, server and full versions, for example:

docker pull ghcr.io/ikawrakow/ik-llama-cpp:cu12-server

Our Ollama in Docker guide covers the basics of running GPU containers.

Which hardware makes sense

Because ik_llama.cpp only accelerates NVIDIA GPUs, a GeForce card is the obvious pairing. A 12 GB card such as the ASUS RTX 3060 12GB Dual Gaming OC V2 can hold a big MoE model's attention layers and some of its experts. At the top end, the NVIDIA GeForce RTX 5090 Founders Edition is a Blackwell card, and the README lists native NVFP4 and MXFP4 paths on the FP4 tensor cores of Blackwell (sm_120/sm_121) GPUs. For the CPU side, see our best CPUs for local AI.

The bottom line

ik_llama.cpp is worth a try if you have an NVIDIA GPU and a lot of system RAM and want to run MoE models that are too big for your VRAM. Build it with CUDA (adding the AVX-512 flags if your CPU supports them), start llama-server with -ngl 999, then push the expert tensors to the CPU with --n-cpu-moe or -ot and leave -rtr off. AMD and Intel GPU owners should stay with mainline llama.cpp. Forge PC hasn't tested it, so check the README for your version.

In this article

Sources

  1. 01ikawrakow, ik_llama.cpp GitHub README
  2. 02ikawrakow, ik_llama.cpp build guide (docs/build.md)

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Fix ATTEMPTED_WRITE_TO_READONLY_MEMORY on Windows 11

How-To

How to Fix ATTEMPTED_WRITE_TO_READONLY_MEMORY on Windows 11

ATTEMPTED_WRITE_TO_READONLY_MEMORY (0xBE) means a driver tried to write to protected memory. Here's how to find the driver from the blue screen or minidump, update, roll back or remove it, use safe mode and Driver Verifier, and rule out RAM, system files and malware.

Marcus Thorne5 min

How to Fix UNMOUNTABLE_BOOT_VOLUME on Windows 11

How-To

How to Fix UNMOUNTABLE_BOOT_VOLUME on Windows 11

UNMOUNTABLE_BOOT_VOLUME (0xED) means Windows couldn't mount the drive it boots from. Here's how to check the drive and its connection, get into the recovery environment, and run Microsoft's fixes: Startup Repair, chkdsk /r and bootrec, plus what to do if the drive itself has failed.

Marcus Thorne5 min

Best Free CD Ripping Software for Windows (2026)

Best Picks

Best Free CD Ripping Software for Windows (2026)

The best free CD ripping software for Windows, ranked: Exact Audio Copy, fre:ac, CUERipper, foobar2000 and MusicBee. We explain which ones verify rips with AccurateRip, which are easiest, and who each one suits.

Hannah Vance5 min