Skip to content

How-ToRAM

How to Run Big MoE Models on a Low-VRAM GPU with llama.cpp

How to run large Mixture of Experts models on a graphics card with limited VRAM in llama.cpp, using --fit, --cpu-moe, --n-cpu-moe and the MoE expert cache, plus the system RAM you'll need.

By , Systems & Technical Editor

4 min read

How to Run Big MoE Models on a Low-VRAM GPU with llama.cpp

The options and defaults below come from the official llama.cpp server documentation (the llama-server README on GitHub), read on 23 November 2026. llama.cpp changes quickly, so run llama-server --help to check the options in your build.

Mixture of Experts (MoE) models are often far bigger on disk than they are in use, because only a few "experts" are active for each token. As we explain in MoE vs dense AI models, that makes them better than dense models at coping when they don't fit entirely in VRAM. llama.cpp has dedicated options to take advantage of this. They keep the bulky expert weights in system RAM and leave the rest of the model on the graphics card. If you haven't set llama.cpp up yet, start with how to run llama.cpp on Windows.

The options that matter

These are the relevant llama-server options and how the documentation describes them:

Option

What it does (per llama.cpp docs)

-cmoe, --cpu-moe

Keeps all MoE weights on the CPU (in system RAM)

-ncmoe N, --n-cpu-moe N

Keeps the MoE weights of the first N layers on the CPU

-ngl N, --n-gpu-layers N

Maximum number of layers to store in VRAM: a number, auto or all (default: auto)

-fit, --fit on/off

Adjusts unset arguments to fit in device memory (default: on)

-fitt, --fit-target MiB

Memory margin to leave free on each device for --fit (default: 1024)

-fitc, --fit-ctx N

Smallest context size --fit may choose (default: 4096)

--moe-cache-mib N

GPU cache size in MiB for MoE experts kept on the CPU (default: 0, disabled)

-ncffn N, --n-cpu-ffn N

Keeps dense FFN weights of the first N layers on the CPU, for dense models

Each of these options also has an environment variable, such as LLAMA_ARG_N_CPU_MOE, which is handy if you launch llama.cpp from a script.

Step 1: Let --fit try first

The --fit option is on by default, so recent builds already try to adjust any settings you haven't specified to fit in your device memory. The simplest starting point is to load the model with nothing extra:

llama-server -m C:\models\your-moe-model.gguf

By default, --fit leaves a 1,024MiB margin on each device. If you also game, stream or run other GPU apps at the same time, raise the margin, for example --fit-target 2048. If you need a longer context, --fit-ctx sets the minimum context size it may choose.

Step 2: Put all the experts in system RAM

If loading fails or the GPU runs out of memory, tell llama.cpp to keep every expert weight on the CPU:

llama-server -m C:\models\your-moe-model.gguf --cpu-moe

The model's remaining weights can then go on the graphics card as usual. This setting is the most cautious: it uses the least VRAM, but the most system RAM.

Step 3: Fine-tune with --n-cpu-moe

--cpu-moe can leave VRAM unused on a larger card. --n-cpu-moe N lets you keep only the experts from the first N layers on the CPU:

llama-server -m C:\models\your-moe-model.gguf --n-cpu-moe 20

Start with a high number and lower it step by step. Each step puts more experts on the GPU, until you approach your VRAM limit. Watch dedicated GPU memory in Task Manager's Performance tab while the model loads. If a setting fails to load or leaves no headroom, go back up a step. The right number depends on the model, the quantisation, your context length and your card, so there isn't one figure that suits everyone.

Step 4: Try the MoE expert cache

Newer builds have --moe-cache-mib, which sets aside a GPU cache, in MiB, for the experts kept on the CPU. It's disabled by default (0). If you have some VRAM left over after Step 3, you can try a modest value, such as --moe-cache-mib 1024, and compare. On a multi-GPU system, the documentation says the cache is split between the cards in the same way as the layers.

Make sure you have the system RAM

Moving experts to the CPU only works if they fit in system RAM. As a rough guide, the model's GGUF file size has to fit across your VRAM and free RAM combined, with room left for Windows and your other apps. Our guide on how much RAM you need for local AI covers this in more detail. Speed also depends heavily on memory bandwidth, because experts kept in system RAM are processed from there; see memory bandwidth and local LLM speed explained.

Our verdict

With llama.cpp, a graphics card that's too small for a big MoE model can still run it. Start with the default --fit and nothing else, then add --cpu-moe if the model won't load. Once it works, lower --n-cpu-moe step by step to move experts back onto the GPU until VRAM is nearly full. Raise --fit-target if you need headroom for other apps, and make sure you have enough system RAM to hold the experts you move off the card. Expect your RAM's speed to matter more than usual. Options and defaults change between builds, so check llama-server --help before you start.

The bottom line

With llama.cpp, a graphics card that's too small for a big MoE model can still run it. Start with the default --fit and nothing else, then add --cpu-moe if the model won't load. Once it works, lower --n-cpu-moe step by step to move experts back onto the GPU until VRAM is nearly full. Raise --fit-target if you need headroom for other apps, and make sure you have enough system RAM to hold the experts you move off the card. Expect your RAM's speed to matter more than usual. Options and defaults change between builds, so check llama-server --help before you start.

Sources

  1. 01ggml-org, llama.cpp server documentation (llama-server README)

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 Set Up a UPS to Shut Down Your PC Automatically

How-To

How to Set Up a UPS to Shut Down Your PC Automatically

How to make a UPS shut your PC down automatically in a power cut: connect the UPS's USB data cable, install the maker's software (CyberPower PowerPanel Personal as the example), choose Keep Computer Running or Preserve Battery Power, pick shutdown or hibernation, then test it.

Marcus Thorne7 min

Clonezilla vs Rescuezilla: Which Free Disk Imaging Tool Should You Use?

Versus

Clonezilla vs Rescuezilla: Which Free Disk Imaging Tool Should You Use?

Clonezilla vs Rescuezilla: both are free bootable disk imaging and cloning tools that share an image format. Clonezilla adds network destinations, encryption, scripting and mass deployment; Rescuezilla offers a point-and-click desktop, image browsing and extra rescue tools.

Callum Reid6 min

ShareX vs Snipping Tool: Which Free Screenshot Tool Should You Use?

Versus

ShareX vs Snipping Tool: Which Free Screenshot Tool Should You Use?

ShareX vs Snipping Tool: Windows' built-in Snipping Tool is quick and now does local OCR and video snips, while free, open-source ShareX adds scrolling captures, richer annotation, automated after-capture tasks, uploads and many extra tools. Here's which suits you.

Callum Reid7 min

How to Set Up SillyTavern with a Local LLM Using KoboldCpp

How-To

How to Set Up SillyTavern with a Local LLM Using KoboldCpp

How to set up SillyTavern with a local LLM: installing it on Windows or Linux, loading a GGUF model in KoboldCpp, connecting the two, tuning GPU layers to fit your graphics card's VRAM, adjusting context settings and fixing common problems.

Marcus Thorne8 min