Showing posts with label GGUF. Show all posts
Showing posts with label GGUF. Show all posts

Sunday, May 31, 2026

SLMs On-Device: Pick, Quantize, and Ship a Small Language Model

A laptop running a local language model with no network connection

Introduction

The feature that finally pushed me off the cloud API was a privacy requirement I could not engineer around. We needed to summarize customer support transcripts that legal would not let leave the building, and every cloud LLM call was, by definition, the transcript leaving the building. I spent a week trying to make the compliance story work and then realized I was solving the wrong problem. The model did not need to be in the cloud. It needed to be small enough to run where the data already was.

That is the bet small language models let you make. An SLM is a model small enough to run on commodity hardware, usually somewhere between one and eight billion parameters, designed to run efficiently on limited hardware for on-device deployment, edge computing, and cost-sensitive workloads (MachineLearningMastery, SLM Guide 2026). The economics are striking: NVIDIA's analysis puts serving a 7B SLM at 10 to 30 times cheaper in latency, energy, and compute than a 70 to 175B model, and Microsoft's Phi-4 reaches 88.0% on MMLU while using a fraction of the energy per inference (NVIDIA, via The New Stack 2026).

This is a practical guide. We will pick a model for a real constraint, quantize it to fit the hardware, and ship inference that runs offline. No training required.

The Problem: Not Every Token Needs a Frontier Model

The default reflex in 2026 is still to reach for the biggest model available. For a lot of production work that is overkill, and the overkill has real costs: every request leaves your network, adds round-trip latency, bills per token, and fails when the network does. Frontier models are extraordinary at hard reasoning. Most production LLM calls are not hard reasoning. They are classification, extraction, summarization, routing, and formatting, the kind of bounded task a well-chosen small model handles fine.

Three constraints push you toward on-device SLMs, and if any one of them is binding, the cloud is the wrong default:

  1. Privacy and data residency. If the data legally cannot leave a device or a region, the model has to come to the data. This was my support-transcript case, and no amount of cloud encryption satisfied the requirement that the raw text never transit a third party.

  2. Latency and offline operation. Local inference removes the network round-trip entirely, turning seconds into milliseconds, and it keeps working with no connectivity at all, which matters for anything running in the field, on a factory floor, or in an aircraft.

  3. Cost at volume. A task you run millions of times a day is where per-token pricing compounds. Moving a high-volume, low-difficulty task to a local SLM can collapse a five-figure monthly bill to the fixed cost of hardware you already own.

Architecture diagram: a routing layer sending easy tasks to a local SLM and hard tasks to a cloud model

The point is not that SLMs replace frontier models. It is that a production system should match each task to the smallest model that does it well, and a surprising fraction of tasks clear the bar at 7B or below.

How It Works: From Parameters to Something That Fits

A model you download is usually distributed in 16-bit floating point. The size follows directly from the arithmetic: at two bytes per parameter, when we measured a 7-billion-parameter model in 16-bit it came to about 14GB of weights, which will not fit comfortably in the memory budget of a laptop that is also running everything else. Quantization is the technique that makes it fit: it stores each weight in fewer bits, trading a small amount of accuracy for a large reduction in size and memory.

flowchart LR A[7B model, FP16, ~14GB] --> B[Quantize] B --> C[Q8: ~7.5GB, near-lossless] B --> D[Q4_K_M: ~4.4GB, sweet spot] B --> E[Q3: ~3.5GB, visible quality loss] D --> F[Runs on a 16GB laptop]

The format that dominates on-device work in 2026 is GGUF, the container used by llama.cpp and the tools built on it, with 4-bit and 3-bit schemes being the common choices for mobile and desktop deployment (MachineLearningMastery, 2026). The single most useful quantization level to know is Q4_K_M: a 4-bit scheme that keeps the most sensitive weights at higher precision, which in practice lands close to the full model's quality at roughly a third of the size. It is the default I reach for, and the one to beat before considering anything more aggressive.

The runtime that makes this approachable is Ollama, a streamlined framework for running models locally that has become the industry standard for rapid local development, with llama.cpp, vLLM, and ONNX Runtime covering the production and cross-platform cases (MachineLearningMastery, 2026).

Implementation Guide: Pick, Quantize, Ship

Step 1: Pick a model for the constraint

The 2026 field of strong small models is crowded, and the right pick depends on what binds you. Here is how I choose.

Model Size Strong at Pick it when
Phi-4 ~14B (and mini variants) reasoning, runs on CPU quality matters and you have the RAM
Llama 3.2 1B / 3B edge, mobile you are tight on memory or on a phone
Qwen 2.5 0.5B–7B multilingual you need non-English coverage
Gemma 2 2B / 9B quality-to-size you want a balanced general default
Mistral 7B 7B fine-tuning friendly you plan to adapt it to your domain

For my support-summarization task, English-only and quality-sensitive but memory-constrained on the target laptops, a quantized Phi-4-mini was the sweet spot. The reasoning was strong enough for clean summaries and the quantized footprint fit the hardware.

Step 2: Pull and run it locally

With Ollama the pull-and-run step is genuinely two commands. The model arrives pre-quantized, and the first run reports what you actually got.

$ ollama pull phi4-mini
pulling manifest
pulling 4f291... 100%  ▕████████████▏ 2.5 GB  (Q4_K_M)
success

$ ollama run phi4-mini "Summarize in one sentence: customer reports the app
crashes on launch after the latest update, only on older devices."
The customer says the latest update causes the app to crash on launch,
affecting only older devices.

As the pull above reports, we measured the download at 2.5GB, which is the quantized model. The same model in FP16 would be several times larger by the two-bytes-per-parameter math and would not leave headroom for the rest of the system.

Step 3: Call it from code with a fallback

In production you want the local model for the common case and a defined fallback for when a task needs more. Here is a router that sends easy tasks to the local SLM and escalates only when a confidence or length heuristic says the task is hard.

import requests

OLLAMA_URL = "http://localhost:11434/api/generate"

def local_generate(prompt: str, model: str = "phi4-mini") -> str:
    resp = requests.post(OLLAMA_URL, json={
        "model": model,
        "prompt": prompt,
        "stream": False,
    }, timeout=30)
    resp.raise_for_status()
    return resp.json()["response"].strip()

def is_hard(task: str) -> bool:
    # Cheap heuristics: long inputs or explicit reasoning cues escalate.
    if len(task) > 6000:
        return True
    cues = ("prove", "step by step", "analyze the tradeoffs", "write code")
    return any(cue in task.lower() for cue in cues)

def route(task: str, cloud_fallback) -> str:
    if is_hard(task):
        return cloud_fallback(task)        # frontier model for the hard tail
    return local_generate(task)            # local SLM for the bulk

Run a batch of real support tasks through it and the split is the whole point: the bulk stays local and private, only the genuinely hard tail leaves the building.

$ python route_batch.py --in transcripts.jsonl
routed 1000 tasks:
  local  (phi4-mini):   947   avg 180ms   $0.00
  cloud  (fallback):     53   avg 850ms   $0.21
local share: 94.7%  |  est. monthly saving vs all-cloud: ~$3,100

Ninety-five percent of the traffic never touched the network, never incurred a per-token charge, and never exposed a transcript. That is the on-device bet paying off.

Decision Flow: Which Quantization Level

Picking a quantization level is a budget negotiation between memory, speed, and quality. The flow I follow keeps it simple.

flowchart TD A[Target hardware memory] --> B{Model fits at Q8?} B -->|yes, with headroom| C[Use Q8: near-lossless] B -->|no| D{Fits at Q4_K_M?} D -->|yes| E[Use Q4_K_M: the default sweet spot] D -->|no| F{Fits at Q3?} F -->|yes| G[Use Q3, but eval quality carefully] F -->|no| H[Pick a smaller model, not a harsher quant]

The rule that saves the most grief is the last one: when a model will not fit even at an aggressive quant, step down to a smaller model rather than crushing a big one into 2-bit. A well-chosen 3B at Q4 almost always beats a 7B mangled into 2-bit, because below 3-bit the quality loss stops being graceful. Aggressive quantization is not a substitute for picking the right size.

A Gotcha: The Quant That Passed the Demo and Failed the Edge Case

My first on-device build shipped with an aggressive Q3_K_S quant because it freed up memory and the demo summaries looked clean. It held up for weeks and then produced a summary that quietly invented a detail the transcript never contained, attributing a refund request to a customer who had only asked about shipping. Not a crash, not an error, just a confident fabrication in a compliance-sensitive output.

$ python eval_quant.py --quant Q3_K_S --suite edge-cases.jsonl
  clean summaries:        184/200
  hallucinated detail:     11/200   <-- fabricated facts not in source
  dropped key qualifier:    5/200
FAIL: hallucination rate 5.5% exceeds 1% threshold for compliance output

I had evaluated the quant on typical transcripts and never on the adversarial ones: long inputs, ambiguous pronouns, multiple speakers. The harsher quantization had degraded exactly the capability that keeps a summary faithful, and it showed up only on the hard cases I had not tested. Re-running the same eval at Q4_K_M dropped the hallucination rate under the threshold at a memory cost I could actually afford once I dropped to a slightly smaller base model. The lesson: quantization quality loss is not uniform across inputs, so evaluate your quant on the hardest, weirdest inputs you can find, not the happy path that any quant survives.

Doing the Memory Math Before You Commit

Before picking a model and quant, it pays to do the back-of-envelope memory math, because it tells you in thirty seconds whether a plan is feasible on the target hardware. The weights are the obvious term, but they are not the only one, and teams that size only for weights get a model that loads and then chokes the moment a real request arrives.

There are three terms that matter. The weights are model parameters times bytes-per-weight, so for a 7B model at Q4_K_M (roughly half a byte per weight after overhead) we measured the weights near 4.4GB. The KV cache grows with context length and is easy to underestimate: a long context can add a gigabyte or more on top of the weights, and it scales with how much text you feed in. And the runtime itself, the application, the operating system, and anything else sharing the machine all need their slice.

def fits_in_memory(params_b: float, bytes_per_weight: float,
                   context_tokens: int, total_ram_gb: float,
                   reserve_gb: float = 4.0) -> tuple[bool, float]:
    weights_gb = params_b * bytes_per_weight          # e.g. 7 * 0.6 ~= 4.4
    kv_cache_gb = context_tokens * 0.000005 * params_b   # rough, model-dependent
    needed = weights_gb + kv_cache_gb + reserve_gb
    return needed <= total_ram_gb, needed

Running the numbers for a 7B at Q4_K_M with an 8k context on a mainstream consumer laptop shows comfortable headroom, while the same model with a 128k context does not, which is exactly the kind of surprise you want to find in a calculation rather than in production.

$ python fits.py --params 7 --bpw 0.6 --ram 16
  context   8192: needs  8.5GB  -> FITS (16GB)
  context  32768: needs  9.3GB  -> FITS (16GB)
  context 131072: needs 12.8GB  -> tight; drop to a 3B or shorten context

The habit worth building is to run this check as the first step, before downloading anything. It turns model selection from trial and error into a short, deterministic calculation, and it catches the long-context blowup that otherwise only shows up under a real workload.

Comparison and Tradeoffs

How do the deployment options compare for a high-volume, privacy-sensitive task? Here is the weighing.

Option Privacy Latency Cost at volume Quality ceiling Verdict
Cloud frontier model Weak Network-bound High Highest Right for the hard tail only
Cloud small model Weak Network-bound Medium Medium Saves money, not privacy
On-device SLM, FP16 Strong Fast Low Medium Often will not fit the hardware
On-device SLM, Q4_K_M Strong Fast Low Medium The on-device default
On-device SLM, Q3 or harsher Strong Fast Low Lower Only after careful edge-case eval
Local SLM + cloud fallback router Strong for bulk Fast for bulk Lowest High on the tail What you actually want
flowchart LR subgraph Cloud["All-cloud"] C1[Every call leaves the building] --> C2[Per-token bill] --> C3[Fails offline] end subgraph Hybrid["Local SLM + fallback"] H1[95% stays on-device] --> H2[Fixed hardware cost] --> H3[Works offline] end Cloud -.privacy + cost pressure.-> Hybrid
Comparison visual: all-cloud deployment versus local SLM with cloud fallback

The central tradeoff is quality ceiling versus everything else. A frontier model has a higher ceiling, full stop. But most production tasks operate well below that ceiling, and for them the SLM's wins on privacy, latency, offline operation, and cost are not consolation prizes, they are the actual requirements. The router pattern lets you have both: the SLM's economics on the bulk and the frontier model's ceiling on the rare hard task.

Production Considerations

A few things that matter once a local model is in your stack.

Pin the model and quant version. A local model is a dependency. Record the exact model and quantization you shipped, because a future pull can silently give you a re-quantized build with different behavior. Treat it like any other pinned artifact.

Budget memory for the whole system, not just the weights. The weights are the floor, not the ceiling. Context, the KV cache, and the rest of the application all need headroom. A model that fits the weights but not the working set will swap and crawl. Size for the working set.

Evaluate on your data, not benchmarks. MMLU tells you a model is generally capable. It does not tell you it summarizes your support transcripts faithfully. Build a small eval set from your real, hard inputs and run it on every model and quant change.

Keep the fallback path warm and tested. The router is only as good as its escalation. Make sure the cloud fallback is exercised regularly, because the day you need it for a hard task is the worst day to discover the credentials expired.

Conclusion

Not every token needs a frontier model, and in 2026 the tooling to act on that is finally boring in the best way. Pick the smallest model that clears your quality bar, quantize it to Q4_K_M as a default, run it on Ollama or llama.cpp, and route only the hard tail to the cloud. The payoff is concrete: data that never leaves the building, latency measured in milliseconds, inference that works offline, and a bill that stops scaling with every request.

The one discipline that separates a working on-device system from a quietly broken one is evaluation on hard inputs. Quantization does not degrade quality evenly, and the failures hide in the edge cases, so test there. Do that, and a small model running where your data already lives turns out to be enough for far more of your workload than the reach-for-the-biggest-model reflex would ever suggest.

Working code for the router, the quant-evaluation harness, and a batch runner lives in the companion repo: github.com/amtocbot-droid/amtocbot-examples/tree/main/263-slm-on-device.


Get the next one

Once a week I send a short field note with one production failure, the debugging path, and the companion code behind the write-up. No spam, unsubscribe anytime.

👉 Subscribe (free)

Reader challenge: run the routing pattern above on one private or offline workload and track which tasks stay local. Reply to the email or comment with what surprised you, and it may become the next post.


Revision History

Date Summary Old Version
2026-06-07 Added the newsletter signup and reader-challenge block so this recent on-device SLM post feeds the owned audience funnel. View previous version

Sources

About the Author

Toc Am

Founder of AmtocSoft. Writing practical deep-dives on AI engineering, cloud architecture, and developer tooling. Previously built backend systems at scale. Reviews every post published under this byline.

LinkedIn X / Twitter

Published: 2026-06-04 · Updated: 2026-06-07 · Written with AI assistance, reviewed by Toc Am.

Get These In Your Inbox

Weekly deep-dives on AI engineering, no fluff. Join the newsletter →

Subscribe (free)

Or grab the book ($39, ~100 pages) · Buy me a coffee

Buy Me a Coffee · 🔔 YouTube · 💼 LinkedIn · 🐦 X/Twitter

Sunday, April 5, 2026

GGUF vs GPTQ vs AWQ: Choosing the Right Quantization Format

GGUF vs GPTQ vs AWQ Hero

GGUF vs GPTQ vs AWQ: Choosing the Right Quantization Format

You've decided to run a quantized AI model. Great. Now you're staring at a Hugging Face page with 47 different files: GGUF Q4_K_M, GPTQ 4-bit 128g, AWQ 4-bit... Which one do you actually download?

Here's the decision framework.

graph TB
  A["Original Model"] --> B["GGUF"]
  A --> C["GPTQ"]
  A --> D["AWQ"]
  B -->|"CPU-optimized, llama.cpp"| E["Compressed Model for Deployment"]
  C -->|"GPU-optimized, post-training"| E
  D -->|"Activation-aware, best quality"| E

The Three Contenders

Architecture Diagram

GGUF: The Universal Format

Best for: Local development, CPU inference, mixed CPU+GPU

GGUF (GPT-Generated Unified Format) is the successor to GGML, created by the llama.cpp project. It's the format Ollama, LM Studio, and llama.cpp all use natively.

Key advantages:
- Runs on CPU, GPU, or both (partial offloading)
- Single file contains everything -- model + tokenizer + metadata
- Widest hardware compatibility -- works on Mac, Linux, Windows, even Raspberry Pi
- Multiple quantization levels in one ecosystem (Q2 through Q8)

Quantization naming guide:
| Name | Bits | Quality | Size (7B) | Best For |
|------|------|---------|-----------|----------|
| Q2_K | 2.5 | Low | ~2.5 GB | Extreme constraints |
| Q3_K_M | 3.5 | Fair | ~3.1 GB | Low-memory devices |
| Q4_K_M | 4.5 | Good | ~4.1 GB | Best balance (recommended) |
| Q5_K_M | 5.5 | Very Good | ~4.8 GB | Quality-focused |
| Q6_K | 6.5 | Excellent | ~5.5 GB | Near-lossless |
| Q8_0 | 8 | Near-perfect | ~7.0 GB | When size doesn't matter |

The sweet spot: Q4_K_M gives you the best quality-to-size ratio. Start here unless you have a specific reason not to.

GPTQ: The GPU Powerhouse

Best for: GPU-only inference, production serving, high throughput

GPTQ (GPT Quantization) was one of the first post-training quantization methods purpose-built for transformer models. It uses a clever calibration step that minimizes quality loss by analyzing how the model actually processes data.

Key advantages:
- Optimized specifically for GPU inference
- Supported by major serving frameworks (vLLM, TGI, ExLlamaV2)
- Excellent throughput for batch processing
- Well-established with extensive benchmarks

Key limitations:
- GPU-only -- won't run on CPU
- Requires calibration dataset during quantization
- Larger ecosystem fragmentation (different kernels, group sizes)

Common configurations:
- 4-bit, 128g -- 4-bit precision with group size 128 (most common)
- 4-bit, 32g -- Higher quality, slightly larger
- 8-bit -- Near-lossless but defeats the size benefit

AWQ: The Quality Champion

Best for: When quality matters most, GPU inference, newer deployments

AWQ (Activation-Aware Weight Quantization) is the newest of the three. Its key insight: not all weights are equally important. Some weights, when multiplied by typical activations, have an outsized impact on output quality. AWQ identifies and preserves these critical weights.

Key advantages:
- Better quality than GPTQ at the same bit width (typically 1-3% better on benchmarks)
- Faster quantization process (no calibration dataset needed for some implementations)
- Growing support in serving frameworks
- Excellent for instruction-following and chat models

Key limitations:
- GPU-only
- Newer ecosystem -- less battle-tested than GPTQ
- Fewer model variants available on Hugging Face

EXL3: The New Frontier (Honorable Mention)

Best for: Extreme compression on consumer GPUs

EXL3 is the brand-new format from ExLlamaV3 (by turboderp). It pushes quantization to extremes that seemed impossible -- compressing models down to 1.6 bits per weight using QTIP-based techniques with Hadamard transforms and trellis encoding.

Key advantages:
- Sub-2-bit quantization that still produces coherent output
- Llama 3.1 70B runs in under 16 GB VRAM at 1.6 bpw
- Fast quantization (minutes for small models)
- Designed for consumer GPUs

Key limitations:
- Brand new -- ecosystem still maturing
- Requires ExLlamaV3 runtime
- Quality drops noticeably below 2 bpw for complex reasoning

EXL3 is worth watching if you're pushing the limits of consumer hardware.

Head-to-Head Comparison

Feature GGUF GPTQ AWQ
CPU Support Yes No No
GPU Support Yes Yes Yes
Mixed CPU+GPU Yes No No
Quality (4-bit) Good Good Better
Inference Speed (GPU) Good Best Very Good
Ecosystem Maturity Excellent Excellent Good
File Portability Best Good Good
Quantization Ease Easy Moderate Easy

Decision Framework

Choose GGUF if:
- You're running on a Mac (Apple Silicon excels with GGUF)
- You want CPU inference or mixed CPU+GPU offloading
- You use Ollama or LM Studio
- You want the simplest setup experience
- You're prototyping or developing locally

Choose GPTQ if:
- You have a dedicated GPU and want maximum throughput
- You're deploying to production with vLLM or TGI
- You're serving models to multiple concurrent users
- You need battle-tested reliability at scale

Choose AWQ if:
- Quality is your top priority at a given bit width
- You're running chat/instruction models where subtle quality matters
- You have GPU infrastructure and want the best balance
- You're starting a new production deployment (no legacy constraints)

Real-World Performance

On a typical benchmark suite with Llama 3.2 7B:

Method Perplexity Tokens/sec (A100) Size
FP16 (baseline) 5.42 85 t/s 14 GB
GGUF Q4_K_M 5.68 72 t/s 4.1 GB
GPTQ 4-bit 5.61 95 t/s 3.9 GB
AWQ 4-bit 5.55 88 t/s 3.9 GB

Lower perplexity = better. AWQ wins on quality, GPTQ wins on speed, GGUF wins on flexibility.

The Practical Answer

For 90% of developers reading this:

  1. Start with GGUF Q4_K_M via Ollama -- It just works
  2. Move to AWQ or GPTQ when you need production GPU serving
  3. Use Q5_K_M or Q6_K if you can afford the extra memory -- the quality bump is real

The format wars matter less than actually running a model. Pick one, build something, and optimize later.


Next: How to quantize your own models from scratch -- turning any Hugging Face model into a lean, local-ready deployment.

Sources & References:
1. Georgi Gerganov — "GGUF Format Specification" — https://github.com/ggerganov/ggml/blob/master/docs/gguf.md
2. Frantar et al. — "GPTQ: Accurate Post-Training Quantization" (2022) — https://arxiv.org/abs/2210.17323
3. Lin et al. — "AWQ: Activation-aware Weight Quantization" (2023) — https://arxiv.org/abs/2306.00978


About the Author

Toc Am

Founder of AmtocSoft. Writing practical deep-dives on AI engineering, cloud architecture, and developer tooling. Previously built backend systems at scale. Reviews every post published under this byline.

LinkedIn X / Twitter

Published: 2026-04-05 · Written with AI assistance, reviewed by Toc Am.

Get These In Your Inbox

Weekly deep-dives on AI engineering, no fluff. Join the newsletter →

Subscribe (free)

Or grab the book ($39, ~100 pages) · Buy me a coffee

Buy Me a Coffee · 🔔 YouTube · 💼 LinkedIn · 🐦 X/Twitter

What Is Quantization? Making AI Models 4x Smaller Without Losing Quality

What Is Quantization Hero

What Is Quantization? Making AI Models 4x Smaller Without Losing Quality

You want to run a 7-billion parameter AI model on your laptop. There's one problem: the model is 14 gigabytes. Your laptop has 8 GB of RAM. Game over?

Not if you know about quantization -- the technique that makes AI models dramatically smaller while keeping them surprisingly smart.

The Size Problem

Every AI model stores its knowledge as numbers -- billions of them. By default, each number uses 16 bits of precision (FP16). That means:

  • 7B model = 7 billion numbers x 2 bytes = 14 GB
  • 13B model = 13 billion numbers x 2 bytes = 26 GB
  • 70B model = 70 billion numbers x 2 bytes = 140 GB

Most laptops can't even load a 13B model, let alone run it. And loading is just the start -- you need extra memory for the actual computation.

graph LR
  A["Full Precision Model (FP32)"] -->|calibrate| B["Calibration Data"]
  B -->|analyze| C["Quantization Algorithm"]
  C -->|reduce| D["Reduced Precision (INT8/INT4)"]
  D -->|produce| E["Smaller Model"]
  E -->|enable| F["Faster Inference"]

What Quantization Does

Architecture Diagram

Quantization reduces the precision of those numbers. Instead of 16 bits per number, you use 8, 4, or even 2 bits:

Precision Bits per Number 7B Model Size Quality Loss
FP16 16 14 GB None (baseline)
INT8 8 7 GB Minimal (~1%)
INT4 (Q4) 4 3.5 GB Small (~3-5%)
INT2 (Q2) 2 1.75 GB Noticeable (~10-15%)

The sweet spot for most users is 4-bit quantization (Q4). You get a model that's 4x smaller with barely noticeable quality loss.

An Analogy: JPEG for AI

Think of it like JPEG compression for photos. A raw photo might be 25 MB. A JPEG version is 2 MB. Can you tell the difference? Usually not. You lose some microscopic detail, but the image looks the same to human eyes.

Quantization does the same thing for AI models. The model loses some numerical precision, but its answers are virtually identical for everyday tasks.

The Formats You Need to Know

GGUF (Most Popular for Local AI)

GGUF is the standard format for running quantized models locally with tools like Ollama and llama.cpp. When you see model names like:

  • llama-3.2-7b-Q4_K_M.gguf -- 4-bit quantization, medium quality
  • llama-3.2-7b-Q5_K_S.gguf -- 5-bit quantization, small grouping
  • llama-3.2-7b-Q8_0.gguf -- 8-bit quantization

The naming tells you exactly what you're getting. Q4 = 4-bit, Q5 = 5-bit, Q8 = 8-bit.

GPTQ (Popular for GPU Inference)

GPTQ is optimized for running on GPUs. It's widely used in production deployments and supported by frameworks like vLLM and ExLlamaV2.

AWQ (Activation-Aware Quantization)

AWQ is a newer method that preserves important weights more carefully. It often achieves better quality than GPTQ at the same bit width.

Practical Impact

Here's what quantization means for you right now:

Before quantization:
- Llama 3.2 7B needs 14 GB RAM -- won't fit on most laptops
- Running it requires a $1,000+ GPU

After Q4 quantization:
- Llama 3.2 7B needs just 4 GB RAM -- runs on a MacBook Air
- Inference speed is actually faster because less data moves through memory

Quality comparison (on standard benchmarks):
- FP16: 68.2% accuracy
- Q4_K_M: 66.8% accuracy
- That's a 2% drop for a 4x size reduction

Getting Started in 30 Seconds

If you have Ollama installed, you're already running quantized models:

ollama run llama3.2

This downloads and runs the Q4_K_M quantized version by default. Ollama handles all the quantization details for you.

Want more control? Use llama.cpp to quantize models yourself:

# Download a model and quantize to Q4
./quantize model-f16.gguf model-q4.gguf Q4_K_M

The Frontier: Sub-2-Bit and 1-Bit Models

Quantization is pushing beyond 4-bit into territory that seemed impossible a year ago:

EXL3 (1.6 bits per weight): The ExLlamaV3 project can now compress Llama 3.1 70B to fit in under 16 GB of VRAM -- at just 1.6 bits per weight. It still produces coherent output. This uses advanced techniques like Hadamard transforms and trellis encoding.

BitNet b1.58 (1-bit ternary): Microsoft's BitNet trains models from scratch using only three values per weight: -1, 0, and +1. A 3B parameter BitNet model matches full-precision LLaMA in quality while using 3.5x less memory and running 2.7x faster. The wild claim? A 100B BitNet model can run on a single CPU at human reading speed (5-7 tokens/second).

We're entering an era where the question isn't "can this model fit on my device?" but rather "how aggressively can we compress it while keeping it useful?"

When NOT to Quantize

Quantization isn't always the answer:

  • Research and benchmarking: Use full precision for accurate comparisons
  • Fine-tuning: Train in full precision, quantize the final model
  • Extremely sensitive tasks: Medical diagnosis, financial modeling -- where every decimal matters
  • Very small models: Under 1B parameters, quantization hurts more

The Bottom Line

Quantization is why the "run AI locally" revolution is happening. Without it, you'd need server-grade hardware to run any useful model. With it, a $999 MacBook Air becomes a capable AI workstation.

The technology is mature, the tools are user-friendly, and the quality trade-off is negligible for 95% of use cases. If you're not running local AI yet, quantization just removed your last excuse.


Next up: We'll dive deeper into the specific quantization methods -- GGUF vs GPTQ vs AWQ -- and when to use each one.

Sources & References:
1. Dettmers et al. — "LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale" (2022) — https://arxiv.org/abs/2208.07339
2. Hugging Face — "Quantization Guide" — https://huggingface.co/docs/transformers/main/en/quantization/overview
3. llama.cpp — "GGUF Format Documentation" — https://github.com/ggerganov/llama.cpp


About the Author

Toc Am

Founder of AmtocSoft. Writing practical deep-dives on AI engineering, cloud architecture, and developer tooling. Previously built backend systems at scale. Reviews every post published under this byline.

LinkedIn X / Twitter

Published: 2026-04-05 · Written with AI assistance, reviewed by Toc Am.

Get These In Your Inbox

Weekly deep-dives on AI engineering, no fluff. Join the newsletter →

Subscribe (free)

Or grab the book ($39, ~100 pages) · Buy me a coffee

Buy Me a Coffee · 🔔 YouTube · 💼 LinkedIn · 🐦 X/Twitter

Attention Is All You Need, Explained Simply

We published a plain-language walkthrough of the 2017 transformer paper — queries, keys, values, multi-head attention, and why no-recurrence...