AI Model Quantization: How to Run Large Models on a Single GPU

🖥 Hardware 2026-07-19 · Updated 2026-11-26 3 min read

A 7B model at FP16 needs 14GB just for weights, so an 8GB card fails at load time. Quantization cuts that to about 4GB. Here is where the trade-off actually bites.

📜 Table of Contents

📖 Keep reading

Model Quantization: The Real Math Behind Running 7B on 8GB

A 7B model stores 2 bytes per parameter at FP16, so weights alone are 14GB. At 4-bit they drop to roughly 4GB. That is the whole trick.

Where Memory Goes

Item 7B approx. Note
Weights FP16 14GB 2 bytes x 7B params
Weights Q8_0 7.5GB 8.5 bits/weight
Weights Q4_K_M 4.4GB 4.8 bits/weight
KV cache Grows with context 1-3GB at 8K
Runtime A few hundred MB Framework overhead

People forget the KV cache, then the model falls back to CPU mid-conversation.

Pick the Right Format

Format Runs on Use when
GGUF CPU, Apple Silicon, consumer GPU via llama.cpp/Ollama Local use, low-end hardware
GPTQ NVIDIA GPU with vLLM/ExLlama Single-GPU batch inference
AWQ NVIDIA GPU with vLLM Serving with better accuracy
bitsandbytes NF4 GPU train/infer QLoRA fine-tuning

GGUF Levels

Level Bits/weight 7B size Verdict
Q2_K 2.6 2.7GB Emergency only; Chinese degrades
Q3_K_M 3.9 3.6GB Readable, not for writing
Q4_K_M 4.8 4.4GB Default sweet spot
Q5_K_M 5.7 5.2GB Prefer if VRAM allows
Q6_K 6.6 5.9GB Near-lossless baseline
Q8_0 8.5 7.5GB Worth it only on tiny models

IQ variants use an importance matrix for better quality at the same size, slightly slower. Below 3B parameters, prefer Q5/Q6.

Quantize It Yourself

git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
cmake -B build && cmake --build build --config Release -j

python convert_hf_to_gguf.py /path/to/model --outfile model-f16.gguf --outtype f16
./build/bin/llama-imatrix -m model-f16.gguf -f calibration.txt -o model.imatrix
./build/bin/llama-quantize --imatrix model.imatrix model-f16.gguf model-Q4_K_M.gguf Q4_K_M
./build/bin/llama-cli -m model-Q4_K_M.gguf -c 4096 -p "hello"

The binaries now carry the llama- prefix; old ./quantize tutorials are out of date. Build the calibration file from a few hundred samples of your real text.

Serve it:

./build/bin/llama-server -m model-Q4_K_M.gguf -c 8192 --port 8080

Or Download Pre-Quantized

Search Hugging Face for <model>-GGUF. Download all shards, check the repo is current, and prefer imatrix variants when offered.

Verify Quality, Do Not Guess

Run 20-30 real tasks through the original and the quantized build: task accuracy (can you parse the JSON?), coherence past 2000 characters, Chinese fluency, tokens/s and peak VRAM. Q4 is fine for classification and extraction, but customer-facing copy usually justifies Q5/Q6.

FAQ

Is 4-bit broken? No. On 7B+ models most people cannot tell Q4_K_M from FP16 for daily work. Small models and precise math are where it shows.

Re-quantize a quantized model? Technically possible, practically wrong. Errors compound; start from FP16.

Convert GPTQ to GGUF? No. They are different formats; export each from the original weights.

Fine-tune after quantizing? GGUF is for inference. Use QLoRA/bnb 4-bit for training, then export.

How big on 8GB? 7B Q4_K_M with 4K context is comfortable. 14B Q4 needs 10GB+ or partial offload with a big speed hit.

Related

Related Articles
2026-08-27
Intel's LPE cores + AMD's Zen 6LP: two teams go their separate ways in the x86 low-power battlefield
2026-07-20
llama.cpp Optimization Tips: Speed Up Local LLM Inference on CPU and GPU
2026-07-11
Hermes Desktop Rushes to Launch: GTC Debut Goes Live, Windows Support Still Half-Baked
2026-08-11
Run LLM on CPU 2026: Models, Speeds and Setup for Machines Without a GPU
2026-08-01
GPU Cloud Computing in 2026: What It Is, Pricing, and How to Choose
2026-08-03
AI Document Parsing 2026: MarkItDown (171k Stars) - Microsoft's Tool That Feeds Any File to LLMs

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.

💬 Comments (0)

No comments yet. Be the first!

Login to comment