How to run GGUF models locally: the pre-flight, from download to serving
Fastest path: ollama run hf.co/<repo>:Q4_K_M. The five-check pre-flight, the -ngl dial, the quant ladder and four load errors — download to serving.
How to run GGUF models locally comes down to a five-check pre-flight. Fastest path: ollama run hf.co/<repo>:Q4_K_M — Ollama pulls the GGUF from Hugging Face and serves it. Want the -ngl dial? llama-server -m file.gguf -ngl 99. Default quant Q4_K_M: file size plus ~1–2 GB context overhead must fit VRAM.
How to run GGUF models locally: the pre-flight
- Pick the runner. Boot + forget → Ollama · day-one flags → llama.cpp · desktop GUI → LM Studio · one model, many users → vLLM.
- Pull it.
ollama run hf.co/bartowski/gemma-2-9b-it-GGUF:Q4_K_M— the tag after the colon picks the file inside the repo. - Check where it landed.
ollama ps→ the PROCESSOR column:100% GPUor a split. - Fit check. File size in GB + ~1–2 GB context overhead ≤ VRAM. Tight? Drop a quant rung or shorten context before blaming the model.
- Confirm serving.
curl http://localhost:11434→Ollama is running.
Download the weights once — the KV cache bills for every session you actually run.
The file, and its name
GGUF (GGML Universal File) packs weights, tokenizer and metadata in one file — no config soup. A 9B drops from ~18 GB at full precision to ~5.5 GB as Q4: gaming GPU or even CPU.
bartowski / gemma-2-9b-it -GGUF : Q4_K_M — org · base model · export · quant tag. Two things matter: the base and how hard the weights were squeezed.
Two ways to fly it
# Ollama — pulls a GGUF quant straight from Hugging Face ollama run hf.co/bartowski/gemma-2-9b-it-GGUF:Q4_K_M # or wrap a file you already have — Modelfile, one line: # FROM ./gemma-2-9b-it-Q4_K_M.gguf ollama create gemma9b -f Modelfile ollama run gemma9b # llama.cpp — where GGUF comes from; chat UI + OpenAI-compatible endpoint llama-server -hf ggml-org/gemma-3-4b-it-GGUF --port 8080 llama-server -m ./gemma-2-9b-it-Q4_K_M.gguf -ngl 99 --port 8080
Ollama: native GGUF since 2024, set-and-forget, no GPU-layer choice. llama.cpp: deepest support and partial offload — 20 of 48 layers on a 6 GB card runs fine, just slower; full offload prints n_gpu_layers = 48. One-shot: swap llama-server for llama-cli, same -m. LM Studio is the same engine behind a GUI: drop in a .gguf, click load.
Which quant in the tank?
Q4_K_M is the default: within a percent or two of full precision at roughly a quarter of the size; quality-per-GB peaks for 7–14B.
| Rung, largest to smallest | What it buys |
|---|---|
| Q8_0 | near-lossless; 8.5 bits per weight |
| Q6_K / Q5_K_M | a step down in size, still excellent for 30B+ |
| Q4_K_M | the default |
| IQ4_XS / Q3_K_M | big model on a small card; quality loss noticeable |
| Q2_K and below | last resort; degrades into nonsense mid-sentence |
The overhead is the KV cache: it scales with context, not model size — budget for your longest real session. Prefer a smaller model at a higher quant: a Q8 4B usually beats a Q2 9B. safetensors is the unquantised archive (training, fine-tuning, transformers, ComfyUI); GGUF is the quantised, runnable one. You can't fine-tune a GGUF, and can't run safetensors in Ollama or llama.cpp without converting — convert_hf_to_gguf.py is the bridge.
Why won't my GGUF model load?
Four aborts cover most load failures:
the four aborts, verbatim
unknown model architecture— the GGUF uses an architecture your runtime predates; new MoE and vision models land constantly. Update Ollama or rebuild llama.cpp; no other fix exists.- Out of memory at load — quant too big for VRAM plus context. Drop one rung (Q4_K_M → Q3_K_M), lower
-ngl, or shrink context with-c 4096. - Download truncated / corrupt — magic-number or metadata error. Re-download and compare the SHA256 on the Hugging Face page.
ollama run ./model.ggufrefuses —runtakes model names, not file paths. Use the Modelfile route.
a 9B at Q4 that needed ~18 GB at full precision — the whole reason it fits a gaming GPU or even CPU.
A local GGUF endpoint pairs with agentic coding tools — point an OpenAI-compatible client at it; completions cost only electricity.
- tested on ollama · llama.cpp builds · LM Studio · vLLM · GGUF Q4_K_M
- first published 2026-09-07; record refreshed 2026-10-06
- the 5.5 GB Q4 / ~18 GB fp16 sizes, the 6 GB card with 20 of 48 layers, and the four aborts are the original record's tested numbers — no new benches were run