Start with Q4_K_M for local inference in LM Studio when memory is tight. Choose Q8_0 if both variants fit at the context length you need and preserving more weight precision matters. Try IQ4_XS if Q4_K_M leaves too little room for context.
What quantization actually changes
GGUF is the file format. Quantization reduces the precision of the model weights stored inside it, which shrinks the file and can affect the accuracy of the model’s answers. GGUF format specification · llama.cpp quantize README
Reading the naming scheme
In the llama.cpp example gemma-4-E2B-it-Q4_K_M.gguf, read the name from right to left.
.ggufis the file format.Q4_K_Mis the quantization.Q4indicates the four-bit class,Kidentifies the K-quant family, andMis the medium mix of tensor types. The llama.cpp model loader calls it “Q4_K - Medium.”gemma-4-E2B-itidentifies the instruction-tuned Gemma 4 E2B model. The E in E2B refers to effective parameters. Google’s Gemma 4 E2B model card
When a listing says “Q8 GGUF,” check for the exact Q8_0.gguf suffix before using the Q8_0 figures. Other suffixes, such as Q4_K_S.gguf and Q5_K_M.gguf, indicate different variants.
The llama.cpp quantize README lists these file sizes and effective bits per weight for Llama 3.1 8B. Use the file size of the specific build you plan to load.
| GGUF variant | File size (GiB) | Effective bits per weight |
|---|---|---|
Q4_K_M | 4.58 | 4.8944 |
Q8_0 | 7.95 | 8.5008 |
IQ4_XS | 4.17 | 4.4597 |
Fitting it to your hardware
Start with available memory after leaving room for the operating system and other apps. Use the GGUF file size as a rough estimate for the weights, then add room for the key-value (KV) cache and other runtime allocations. Longer contexts can require more cache memory. Hugging Face Transformers cache guide
Say you have 8 GiB available and set aside a hypothetical 1 GiB for context and the runtime. The same-model comparison comes out like this.
- Q4_K_M comes to 4.58 + 1 = 5.58 GiB, within budget. Start here if the load estimate fits at the context you need.
- Q8_0 comes to 7.95 + 1 = 8.95 GiB, over budget. Choose it when the higher weight precision is worth the extra memory and the load estimate still fits.
- IQ4_XS comes to 4.17 + 1 = 5.17 GiB, saving 0.41 GiB over Q4_K_M in this example. Try it when that extra room could let you keep the context you need.
Use the example to pick a candidate, then check the actual settings in LM Studio.
- Open My Models and click the gear beside the downloaded variant.
- Set the context size you need and how much of the model to offload to the GPU. These defaults apply on the next load. LM Studio Per-model Defaults
- If the model is still running, run
lms unloadand select the loaded model. In Chat, open the model loader and select the variant again. LM Studio CLI unload instructions · LM Studio model loader - Review the memory estimate in the load settings before loading. If GPU memory is tight, try less offload and recheck. If the estimate fits, load the model. LM Studio resource estimates
- To compare variants, load them one at a time. Use the same model release, context size, GPU offload, Flash Attention setting, and prompt. If a variant exceeds the memory budget at those settings, start with the smaller one.
Use the VRAM and GGUF sizer for an initial estimate or the LM Studio system requirements guide for hardware compatibility.
Common mistakes
Check that your download is a supported GGUF model before choosing a quantization suffix. See GGUF vs MLX vs safetensors for format compatibility and how to load a model in LM Studio for download and import steps.
Where the model runs
If LM Studio runs on a server, use that machine’s available memory for the budget. For setup, see running LM Studio headless on Unraid.
Evidence and limits. File sizes are from the llama.cpp quantize README on master. The load steps are based on LM Studio’s Per-model Defaults guide and its 0.3.27 resource-estimate notes. The load steps were not run.