GGUF is a single-file container format for AI language model weights.
It bundles the model's billions of parameters, tokenizer vocabulary, and architecture config
into one portable file — and through quantization, shrinks a 280GB model
to as small as 4GB so it runs on a laptop CPU. It's why you can pull a model with
ollama pull llama3
and be running AI locally in minutes, with no GPU, no cloud, no API key.
One file. Everything inside. Runs anywhere.
GGUF is a binary container format for AI language models, created by Georgi Gerganov — the author of llama.cpp. It replaced its predecessor GGML in August 2023 and became the standard for local AI within months.
The billions of numbers that ARE the model's knowledge. This is 98% of the file by size.
~32k entries mapping text fragments to the integer IDs the model actually processes.
Layer counts, attention head sizes, context window length — no separate config.json needed.
Model name, author, license, quantization type, and any custom fields the creator added.
Think of it like an .exe for an AI brain — one file, drag and drop, run anywhere. No framework install, no config file hunt, no GPU required.
What local AI looked like before GGUF existed
model-00001-of-00014.bin
model-00002-of-00014.bin
model-00003-of-00014.bin
… (14 files)
Meta-Llama-3-70B-Q4.gguf
One file. Done.
pip install torch transformers
accelerate sentencepiece
protobuf bitsandbytes…
./llama-cli \
-m model.gguf \
-p "Hello"
Required: NVIDIA A100 80GB
Cost: $10,000–$30,000
FP32 Llama-70B: 280GB VRAM
16GB laptop RAM runs
a capable 7B model.
Q4 Llama-70B: 40GB RAM.
tokenizer_config.json
config.json
special_tokens_map.json
generation_config.json
All embedded in the
.gguf file header.
Self-contained.
The core unlock: GGUF made running AI locally as simple as running any other program — no PhD required, no cloud dependency, no recurring API cost.
How GGUF shrinks a 280GB model into something you can actually run
A model's weights are stored as numbers. At full precision, each is a 32-bit float (4 bytes). Quantization rounds them down to fewer bits — trading a tiny amount of accuracy for a massive size reduction. The math is brutal:
70,000,000,000 params × 32 bits = 280 GB
70,000,000,000 params × 4 bits = 35 GB
+ overhead → Q4_K_M: ~40 GB
| Level | Bits | Size (Llama 3 70B) | Quality | Bar | Notes |
|---|---|---|---|---|---|
| FP32 (full) | 32 | 280 GB | 100% | Research only. $10k+ GPU. | |
| FP16 | 16 | 140 GB | 99% | Still needs a huge GPU. | |
| Q8_0 | 8 | 70 GB | 97% | Near-perfect. High RAM req. | |
| Q5_K_M | 5 | 49 GB | 94% | Great quality/size balance. | |
| Q4_K_M ★ | 4 | 40 GB | 91% | Community sweet spot. | |
| Q3_K_M | 3 | 29 GB | 85% | Noticeable degradation. | |
| Q2_K | 2 | 20 GB | 71% | Emergency / hobbyist only. |
Q4_K_M — 4-bit quantized with K-means optimization on important weight clusters. 91% of the original quality at 14% of the original size. A Q4_K_M Llama-3-70B outperforms a full-precision Llama-3-8B on most benchmarks. You're compressing the representation, not the intelligence.
Every format compared — and when you'd actually reach for something else
| Format | Single file | CPU / RAM | Quantized | Metadata | Verdict |
|---|---|---|---|---|---|
| PyTorch .bin | ✗ | ✗ | ✗ | ✗ | ❌ Fragmented, GPU-gated |
| SafeTensors | ✓ | ✗ | ✗ | ✗ | ⚠ Safer loading, still GPU-only |
| GGML (old) | ✓ | ✓ | ✓ | ✗ | ⚠ GGUF's predecessor, abandoned |
| ONNX | ✗ | ✓ | ✗ | ✗ | ⚠ Production deploy, not local LLMs |
| EXL2 | ✓ | ✗ | ✓ | ✓ | ⚠ Better quality, GPU required |
| GGUF | ✓ | ✓ | ✓ | ✓ | ✅ The standard |
The real reason GGUF won isn't purely technical — it arrived at the exact moment LLaMA models leaked/released and millions of people wanted to run AI locally. The ecosystem (Ollama, LM Studio, Jan, llama.cpp) formed around it fast, and network effects did the rest.
You have a good GPU → use EXL2. ExLlamaV2 gets better quality at the same file size and runs 2–3× faster on a 3090/4090. GGUF's CPU advantage is irrelevant when you have VRAM.
You're deploying to production → use ONNX or TensorRT. GGUF is optimized for local single-user inference. Production serving at scale needs different tradeoffs: batching, hardware-specific kernels, memory layout.
You're fine-tuning → stay in SafeTensors / PyTorch. GGUF is read-only for inference. Training still happens at full precision. You convert to GGUF after for distribution.
The disk holds the brain. There's no compression trick that makes that cheap.
A GGUF file IS the model. Not a reference to it — the actual numbers encoding billions of learned associations. It has to be big because intelligence is big.
Where the bytes go in a typical Q4_K_M file:
The disk is just storage. When you run the model, it loads into RAM (or VRAM):
Holds the file at rest.
Needs: just the file size
Loads model to run it. This is the real constraint.
Needs: file size + ~20% overhead
Optionally offloads layers for speed.
Optional, but 10–20× faster inference
| Model | Q4_K_M size | RAM needed | Runs on |
|---|---|---|---|
| Llama 3.2 3B | ~2 GB | 4 GB+ | Any modern laptop |
| Llama 3.1 8B | ~5 GB | 8 GB+ | Most laptops |
| Mistral 7B | ~4.5 GB | 8 GB+ | Most laptops |
| Llama 3 70B | ~40 GB | 48 GB+ | Mac Studio / workstation |
| Llama 3 405B | ~230 GB | 256 GB+ | Server-class machine |
Bottom line: disk is cheap. 40GB on a 2TB SSD is 2% of your drive. Always check RAM first before downloading a model — that's the spec that actually matters.
The things people actually wonder about after learning GGUF
The quantized file size is just the weights at rest. When the model runs, it needs several additional memory regions:
The "20%" rule is a rough minimum for short context windows. In practice, if you set --ctx-size 8192, that KV cache alone can double your actual RAM usage over the file size.
Practical rule: always check --ctx-size settings in Ollama / LM Studio. The default context length is where most people get surprised by RAM usage.
The file is compact on disk, but running a model isn't like playing a video file — it's live computation. Two things happen the moment you load it:
So the memory footprint is: file weights (mmap'd) + dequant buffer + kv cache + activations. The file itself often isn't fully copied into RAM — the OS maps it and loads pages on demand — but everything else is freshly allocated.
GGUF's performance story is: unmatched on CPU, mid-tier on GPU. Here's the landscape:
| Format / Runtime | Hardware | Tokens/sec vs GGUF | Why |
|---|---|---|---|
| EXL2 + ExLlamaV2 | GPU only | 2–3× faster | Custom CUDA kernels, fused ops |
| GPTQ + AutoGPTQ | GPU only | 1.5–2× faster | GPU-native quantized matmul |
| AWQ | GPU only | 1.5–2× faster | Activation-aware, less accuracy loss |
| vLLM (FP16) | GPU, multi-user | 5–10× throughput | Continuous batching, PagedAttention |
| MLX (Apple) | Apple Silicon only | 1.3–1.8× faster | Unified memory, Metal GPU ops |
| GGUF + llama.cpp | CPU / any GPU | Baseline | Best CPU perf, ok GPU perf |
The catch: none of those alternatives run on CPU-only. If you don't have a discrete GPU, GGUF is the only viable option. If you do have a GPU, EXL2 is the performance leader for interactive single-user inference.
vLLM's "5–10× throughput" is measuring something different — it's about serving many users simultaneously via batching, not single-token latency. For one person chatting, it's closer to parity with GGUF on GPU.
At the same nominal bit-width, quantized model files are roughly the same size across formats — they're all storing the same number of parameters. The bit-depth determines the floor.
But there are meaningful differences in practice:
| Format | Llama 3 70B approx. | Notes |
|---|---|---|
| SafeTensors (FP16) | ~140 GB | No quantization |
| GPTQ 4-bit | ~38 GB | Separate tokenizer files |
| AWQ 4-bit | ~38 GB | Separate tokenizer files |
| GGUF Q4_K_M | ~40 GB | Tokenizer bundled in |
| EXL2 4-bit avg | ~36–38 GB | Better quality, GPU only |
GGUF is not smaller than GPU-based 4-bit formats. What makes it distinctive is CPU compatibility and self-contained bundling — not compression ratio.