16GB GPU Setup: Choosing Between a 9B Dense Model and a 35B MoE Model
This guide estimates VRAM use and decode speed limits for a 16GB consumer GPU. It compares Q8 and Q4 quantization for a 9B dense model, explains expert offloading for a 35B MoE model, and walks through llama.cpp Vulkan setup, benchmarking, power logging, and common troubleshooting steps.
1. The Short Answer
A 16GB consumer GPU can run the Q8 (8-bit quantized) version of a 9B dense model smoothly. A 35B total-parameter MoE model can also be loaded, but part of its weights must be placed in system memory. Speed and stability both drop in that case. Before choosing a model, use the formulas below to estimate the VRAM requirement and the speed ceiling, then decide whether to deploy.
If your main goal is answer quality and stability, choose the 9B Q8 model. If you want to try the larger MoE model, expect a speed penalty from offloading and reserve enough system memory.
2. Estimating Limits With Two Formulas
Formula 1: Weight size.
Weight size is approximately the parameter count multiplied by the number of bits per weight, divided by 8. The result is in bytes. A Q8 quantized 9B model needs about 9 to 10 GB. A Q4 quantized 9B model needs about 5 GB. The actual file also includes quantization metadata and some unquantized layers, so the file size will vary somewhat.
Formula 2: Generation speed ceiling.
During the generation stage (decode), the inference engine reads the weights involved in computation from VRAM once for each output token. The speed ceiling is therefore approximately the memory bandwidth divided by the amount of data read per token:
Speed ceiling (tokens/s) ≈ Memory bandwidth (GB/s) ÷ Data read per token (GB)
At 600 GB/s, a 9B Q8 model reads about 9.6 GB per token, so the theoretical ceiling is about 62 tokens/s. Real speed is usually lower because kernel launches, attention computation, and other memory access take time.
Use the bandwidth figure from the GPU manufacturer’s specification sheet. Different models within the same product generation can have very different bandwidth, which changes the result.
VRAM used by the KV cache.
The context window also uses VRAM through the KV cache. Its size is:
KV cache bytes ≈ 2 × number of layers × number of KV heads × head dimension × context length × bytes per element
For example, assume a model has 36 layers, 8 KV heads, a head dimension of 128, a context length of 8192, and FP16 elements (2 bytes each). The KV cache then uses about 1.2 GB. The longer the context, the larger this share becomes. Take the layer count, head count, and other parameters from your model’s configuration file.
3. Preparing the Software and Hardware
1. Confirm that the driver and Vulkan work.
The llama.cpp Vulkan backend requires a graphics driver with Vulkan support. After installing the Vulkan tools, run:
vulkaninfo —summary
The output should show your GPU name and driver version. If only a CPU device appears, or the GPU name is wrong, the driver or Vulkan configuration is usually not installed correctly.
2. Install the Vulkan SDK.
Building llama.cpp requires glslc, the shader compiler included in the Vulkan SDK. Download the SDK from your GPU vendor or from the official Khronos channels. Then confirm that you can run glslc --version directly in your terminal.
3. Build llama.cpp.
From the llama.cpp source directory, run:
cmake -B build -DGGML_VULKAN=1
cmake —build build —config Release -j
After the build finishes, record the llama.cpp git commit hash and your driver version. Without these two details, others cannot reproduce your numbers.
4. Get the model file.
Download a GGUF quantized file from a trusted model repository. Choose a version that fits your VRAM, such as Q8_0 or Q4_K_M. After downloading, verify the file’s hash. An incomplete file can cause loading failures or abnormal output.
5. Run a benchmark.
The llama-bench tool included with llama.cpp measures speed for both prompt processing and generation:
./build/bin/llama-bench -m models/your-model-Q8_0.gguf -p 512 -n 128 -ngl 99
Parameter meanings and available options change between versions. Check the --help output for your version.
4. Quantization Choices for the 9B Dense Model
Quantization compresses weights into fewer bits. This reduces memory use but also lowers precision. The table below compares estimated file sizes. Confirm the actual values on your own machine.
| Quantization | Estimated weight size | Headroom on 16GB VRAM | Best for |
|---|---|---|---|
| Q8 | 9 to 10 GB | After KV cache and runtime overhead, context length must be balanced | Quality first, everyday chat and writing |
| Q4 | About 5 GB | Ample headroom for longer context | Long-document processing, or running other programs at the same time |
To choose a quantization, work through these steps in order:
- Calculate the weight size with Formula 1.
- Choose a target context length and calculate the KV cache with its formula.
- Reserve 1 to 2 GB for the runtime and system display output.
- After loading the model, read the actual VRAM usage with nvidia-smi or your vendor’s tool, and compare it with your estimate.
Speed numbers circulating online often omit test conditions, such as GPU model, driver, engine version, context length, and batch size. Treat these numbers as rough references, not targets to copy. Changing any of these conditions changes the result.
5. Speculative Decoding and Multi-Token Prediction
Speculative decoding uses a smaller draft model to propose several candidate tokens. The main model then verifies all of them in a single forward pass. If most candidates are accepted, the main model produces multiple tokens per forward pass, which reduces the number of times it must read the weights. The benefit depends on the acceptance rate. A draft model that is closer to the main model usually achieves a higher acceptance rate.
The draft model also uses VRAM. On a 16GB GPU, add up the weights and KV cache of both models carefully. Otherwise, you may run out of memory.
Multi-token prediction (MTP) is a different approach. Some models are trained to predict several subsequent tokens during training. At inference time, these extra prediction heads propose candidates directly, so no separate draft model needs to be loaded. This approach requires that the model supports MTP and that the inference engine supports it too. The parameter names for enabling a draft model change between llama.cpp versions, so check the help output for your version.
6. MoE Models and Expert Offloading
A 35B total-parameter MoE model activates only some of its experts for each token. As a result, the computation and the weights read per token are much smaller than the full parameter size would suggest. This is why MoE models have a speed advantage.
However, all of the weights still need to be stored somewhere. Using Q4 quantization, the 35B model needs about 20 GB, which exceeds 16 GB of VRAM.
A common solution is expert offloading. The expert weights are kept in system memory, and only frequently used parts, such as attention layers and shared layers, stay in VRAM. During inference, the experts needed for each token must be transferred across the bus between system memory and VRAM, which slows down generation. The more layers you offload, the slower it typically runs.
Offloading also introduces stability risks:
- If system memory runs low, the program may be terminated by the operating system or suffer severe stuttering.
- When memory usage nears its limit, the system relies heavily on swap space, and responsiveness drops noticeably.
- During long runs, memory pressure can cause the program to crash.
In llama.cpp, the -ot option assigns matching expert tensors to the CPU. For example:
./build/bin/llama-server -m models/your-moe-model.gguf -ngl 99 -ot “.ffn_.*_exps.=CPU”
Tensor-name matching rules differ between models. Check the startup log first to confirm which layers were placed on the CPU.
7. Measurement Steps and Power Logging
Follow these steps so your results can be compared with others:
- Record your hardware and software details: GPU model, driver version, OS kernel version, llama.cpp commit hash, and the model file name and hash.
- Fix the test conditions: context length, number of generated tokens, batch size, and temperature. Change only one variable at a time.
- Run llama-bench at least three times and use the median.
- Log power draw and VRAM usage in a separate terminal during the run. For NVIDIA GPUs, use:
nvidia-smi —query-gpu=timestamp,power.draw,memory.used,temperature.gpu,clocks.sm —format=csv -l 1 > power.csv
For AMD GPUs, read power data with rocm-smi or the sysfs interface provided by the kernel.
- Record the results in the following table:
| Time | Power (W) | VRAM (MB) | Temperature (°C) | Generation speed (tokens/s) | Context length |
|---|---|---|---|---|---|
| After startup | |||||
| Mid-generation | |||||
| After 10 minutes |
If speed drops noticeably later in a run, the GPU is likely throttling due to high temperature. Check your cooling.
8. Troubleshooting Checklist
- vulkaninfo shows only a CPU device: Check that the GPU driver is installed and that the Vulkan ICD configuration file exists. Reinstall the driver if necessary.
- Build fails with glslc not found: Confirm that the Vulkan SDK is installed and that glslc is in your PATH.
- Out of memory (OOM) when loading: Reduce the context length, switch to a lower quantization, or reduce the number of GPU layers.
- MoE model hangs after loading: Reduce the number of offloaded experts, check your available system memory, and close other memory-heavy programs.
- Speed is far below expectations: Confirm that the GPU is actually being used by checking the log to see which device each layer was assigned to. Check whether temperature and power draw look abnormal.
- Garbled or poor-quality output: Verify the model file hash to confirm the download is complete. Re-download any corrupted file.
Working through this checklist in order will locate most problems within a single launch.
