Running a MoE LLM on an 8GB GPU: Measured Speed and Practical Takeaways

    A hands-on test of running a ~35B-parameter MoE model (with ~3B active parameters) on an RTX 4060 with 8GB VRAM using llama.cpp. This article covers why MoE models suit edge deployment, the test environment and observed generation speed, how to estimate VRAM and RAM requirements, and how to reproduce the results with llama-bench. All figures come from manual observation, not standardized benchmarks.

    Why MoE Models Are a Good Fit for Edge Deployment

    The open-source community recently released a mixture-of-experts (MoE) model with roughly 35B total parameters and about 3B active parameters. An MoE model distributes its parameters across multiple expert networks. For each token processed, a router selects only a small subset of experts to participate in the computation. As a result, the model’s knowledge capacity is determined by its total parameter count, while the compute cost per inference step is determined by the active parameters.

    This architecture is appealing to individual developers. A consumer GPU with 8GB of VRAM cannot directly run a dense 35B model. But if the weights are quantized and the portion that doesn’t fit in VRAM is offloaded to system memory and the CPU, the model can plausibly run on a local machine. Getting a model to run and getting it to run well are two different things; this article focuses on the latter.

    One caveat: this article documents a single personal test, not a standardized benchmark. The speed figures below come from manual observation and should not be treated as official performance claims for the model. For quality comparisons between models, refer to the official model cards or public evaluation reports.

    Test Environment and Setup

    • GPU: RTX 4060, 8GB VRAM
    • RAM: 16GB system memory
    • Model: the open-source MoE model mentioned above (~35B total parameters, ~3B active), using a community-provided Q4_K_M quantized GGUF file. For the exact model name and file source, refer to the version you actually download.
    • Inference framework: llama.cpp
    • Context settings: ctx-size of 32768, gradually filled to about 23,000 tokens through multi-turn conversation

    The test consisted of 4 consecutive rounds of dialogue, with generation speed observed manually. Under these conditions, generation speed stabilized at roughly 16 tokens/second. This number comes from manual observation rather than precise timing, and it only reflects a single-user scenario with batch size 1.

    To reproduce these measurements, you can use the llama-bench tool bundled with llama.cpp:

    1. ./build/bin/llama-bench -m model.Q4_K_M.gguf -ngl 20 -p 4096 -n 256 -r 3

    This command measures prompt processing speed for 4,096 tokens and generation speed for 256 tokens, repeating each run 3 times and averaging the results. Parameter names may differ across versions, so check --help for the options supported by your build before running.

    How to Estimate VRAM and RAM Requirements

    Start by estimating the weight footprint. Storing 35B parameters in FP16 requires about 70GB (35B × 2 bytes). The theoretical size after 4-bit quantization is about 17.5GB (35B × 0.5 bytes). In practice, the file is slightly larger due to overhead such as scaling factors in the quantization blocks, typically landing between 18 and 20GB.

    From this, three conclusions follow:

    • 8GB of VRAM plus 16GB of RAM gives 24GB in total. After accounting for the operating system and other programs, the available headroom is tight.
    • The weights cannot all fit in VRAM, so most layers must remain in system memory.
    • Even 16GB of RAM cannot hold all the weights on its own. llama.cpp uses memory mapping (mmap) to read data from disk on demand, which slows down the initial load and adds latency when memory is under pressure.

    KV Cache usage can be estimated with the following formula:

    KV Cache bytes = 2 × number of layers × number of KV heads × head dimension × context length × bytes per element

    Here is a hypothetical example. Suppose