---
title: "Q4_K_M vs Q5_K_M (q4km vs q5km): Which to Download? (2026)"
excerpt: "Stuck between q4km and q5km? Verdict: start with Q4_K_M on 8–24GB cards; move to Q5_K_M only if it still fits with KV-cache headroom. The 5-minute VRAM check inside."
author: "Patrick Hughes"
published_at: 2026-07-14T17:59:30.093+00:00
read_time_min: 7
tags: ["local-llm", "gguf", "quantization", "llama-cpp", "5090-reports"]
canonical: https://bmdpat.com/blog/q4km-vs-q5km-q4-k-m-vs-q5-k-m-2026
---

# Q4_K_M vs Q5_K_M (q4km vs q5km): Which to Download? (2026)

**Short answer:** Q4_K_M is the llama.cpp 4-bit K-quant, Medium preset. `q4km` and `q5km` are informal spellings of `Q4_K_M` and `Q5_K_M`. For most local LLM loads on a single consumer GPU, start with Q4_K_M. Move to Q5_K_M only when you still have VRAM after weights plus KV cache.

![Key decisions from What Does Q4_K_M Mean? GGUF Quantization Decoded](/blog-assets/what-does-q4-k-m-mean-gguf-quantization-decoded-2026.png)

## What does Q4_K_M mean?

Read the name left to right. Q is quantization. 4 is the base bit width. K is the K-quant block format. M is the Medium preset, between Small (S) and Large (L).

In the [llama.cpp source](https://raw.githubusercontent.com/ggml-org/llama.cpp/f2f667b02dc76d675395ae3b14546c8108d26387/src/llama-quant.cpp), `LLAMA_FTYPE_MOSTLY_Q4_K_M` maps to `Q4_K - Medium` and `LLAMA_FTYPE_MOSTLY_Q4_K_S` maps to `Q4_K - Small`.

The name describes a file-level preset, not one tensor type. A Q4_K_M file uses Q4_K for most tensors and puts the higher-precision Q6_K on selected attention-value and feed-forward-down tensors. Model architecture, tensor shapes, and quantizer flags change that mix, so the filename signals intent and the file itself tells the truth.

## How does a Q4_K tensor store weights?

A Q4_K tensor stores weights in super-blocks of 8 blocks, 32 weights per block. Scales and minimums are 6-bit values. That makes a Q4_K tensor cost exactly 4.5 bits per weight, as the [Hugging Face GGUF documentation](https://huggingface.co/docs/hub/gguf) lists.

That 4.5 figure applies to one Q4_K tensor, not the whole file. Because a Q4_K_M file mixes in Q6_K tensors, its average sits a little higher. You can open any GGUF on Hugging Face and see each tensor's name, shape and precision before you download it.

## Can two Q4_K_M files differ?

Yes. Quantizer flags change which tensors get which type:

| Flag or preset | Effect |
| :--- | :--- |
| `Q4_K_M` | Mostly Q4_K, plus Q6_K on selected attn_v and ffn_down tensors |
| `Q4_K_S` | Smaller file: Q4_K on a different tensor selection |
| `--pure` | Turns off the mixed strategy and quantizes uniformly |
| `--tensor-type` | Overrides the type of specific tensors by hand |
| `--imatrix` | Uses an importance matrix from calibration data to guide precision |

So two files that both say `Q4_K_M` can carry different tensor layouts and different quality. Compare files from the same uploader and revision. The Q4_K_M vs Q4_K_S trade is covered in [q4km vs q4ks](/blog/q4km-vs-q4ks-2026).

## When should you pick Q4_K_M?

Pick Q4_K_M when:

1. You want the model to load fully without CPU fallback.
2. You still need context headroom for the KV cache.
3. You care more about tokens/sec than the last few quality points.

Q4_K_M is the default local quant for a reason: it is usually the best balance of file size and usable quality on 8-24 GB cards.

One dated reference point: on an RTX 5090 with Ollama 0.31.2, a single-request run on 2026-09-21 measured Qwen3.8-27B at Q4_K_M generating 62.1 tokens per second on a codegen prompt at 4096 context, with 19,707 MiB peak VRAM. That is one card, one prompt and one model, not a guarantee for yours.

## When should you pick Q5_K_M?

Pick Q5_K_M when:

1. Q4_K_M already fits with clear headroom.
2. You see quality issues on coding or long-form tasks at Q4.
3. You measured that Q5 still keeps full GPU offload at your context length.

If Q5 forces layers back to CPU, you often lose more quality (and speed) than you gain from the higher quant.

## How do you decide in five minutes?

1. Note GPU VRAM and target context length.
2. Open [quant compare](https://bmdpat.com/tools/quant-compare) and [VRAM calculator](https://bmdpat.com/tools/vram-calculator).
3. Check weight size for Q4_K_M and Q5_K_M against free VRAM after OS and cache.
4. Prefer the smaller quant that stays fully on GPU.

If you are weighing Q4_K_M against Q8_0 instead, read [Q4_K_M vs Q8_0: which GGUF quant to pick](/blog/gguf-quantization-q4-q5-q8-explained-2026). For offload flags once the file fits, see [llama.cpp --n-gpu-layers](/blog/llama-cpp-n-gpu-layers-explained-2026).

### Accompanying prompt

**What the prompt does:** It turns your GPU VRAM, context length, and two GGUF file sizes into a Q4_K_M vs Q5_K_M pick with a hard pass/fail.

Copy/paste this prompt:

```text
Role:
You are a local LLM quant picker.

Context:
GPU VRAM (GB): [ ]
Target context length: [ ]
Model: [ ]
Q4_K_M file size (GB): [ ]
Q5_K_M file size (GB): [ ]
Need full GPU offload: yes/no

Task:
1. Estimate free VRAM after OS and KV cache.
2. Say whether Q4_K_M and Q5_K_M fit fully on GPU.
3. Pick one quant and one fallback if load fails.
4. List the single next measurement to run.

Output:
- Pick: Q4_K_M or Q5_K_M
- Fit: full GPU / mixed / no
- Fallback plan
- Next command or check

Constraints:
- Prefer full GPU offload over a higher quant with CPU fallback.
- Do not invent sizes I did not provide.
- Keep the answer under 12 lines.
```

Copy the block above.

Weekly measured local runs: https://bmdpat.com/5090-reports

---

Get the local AI lab notes (benchmark rows, VRAM fit, quant choices, what runs on consumer GPUs), M-F only when there is something worth sending: https://bmdpat.com/newsletter?utm_source=blog_md&utm_medium=aeo&utm_campaign=q4km-vs-q5km-q4-k-m-vs-q5-k-m-2026
