Small Models,
Big Impact

Quantization, distillation, and the local AI revolution

agent37.club

The Thesis

“The question is no longer ‘can I run AI locally?’ but ‘what’s the right mix of local and API?’”
  • A $2,000 GPU can run models matching GPT-3.5 quality
  • Distilled 7B models rival GPT-4 on specific tasks
  • GPT-4-equivalent API cost: $0.40/M tokens (was $20 in 2022)
  • The gap between local and frontier closes every quarter

Golden age of small models

Quantization makes 7B models fit in 4GB. Distillation transfers frontier reasoning to pocket-sized models. Local inference is fast, private, and nearly free at scale.

Quantization

Making models smaller without making them dumber

What Is Quantization?

  • Models are trained in FP16 (16-bit floating point) — each weight uses 2 bytes
  • A 7B param model = 14 GB in FP16
  • Quantization reduces precision: 16-bit → 8-bit → 4-bit → 2-bit
  • Each halving of bits ≈ halves the model size
  • Key insight: most weights don’t need full precision — the important ones are sparse
PrecisionSize (7B)Quality
FP16 (baseline)14 GB100%
INT8~7 GB~99.96%
INT4 (Q4_K_M)~3.8 GB~98.1%
2-bit (Q2_K)~2.7 GB~85-90%
1.58-bit (BitNet)~1.5 GBComparable at 2B

The Big Two: GPTQ & AWQ

GPTQ

How: Layer-by-layer quantization using the inverse Hessian to understand weight sensitivity. When a weight is quantized, the error is redistributed across remaining weights.

  • Can quantize 175B models in ~4 GPU hours
  • ~90% quality retention at INT4
  • Best for: GPU inference via AutoGPTQ, ExLlamaV2

AWQ (Activation-Aware)

How: Observes activations to find salient weights (<1% of all weights have outsized impact). Scales these up before quantization to protect them.

  • ~95% quality retention (vs GPTQ ~90%)
  • Faster calibration (single pass vs iterative)
  • Best for: GPU deployment where quality is paramount

GGUF — The Universal Format

  • Created August 2023 by Georgi Gerganov (llama.cpp)
  • Single binary file: model weights + tokenizer + architecture + quant params
  • Runs on everything: CPUs, GPUs, Apple Silicon, ARM
  • Memory-mapped (mmap): OS loads only what’s needed
  • Native format for Ollama, LM Studio, GPT4All

Quantization levels (7B model)

QuantBitsSizeSweet Spot
Q2_K22.7 GBExtreme constraints
Q4_K_M43.8 GBBest default
Q5_K_M54.3 GBQuality-sensitive
Q8_087.2 GBNear-lossless
# That's it. One command.
ollama run llama3.2

# Downloads the GGUF, loads it,
# starts chatting. Q4_K_M by default.
# Works on Mac, Linux, Windows.

# Or pick your quant:
ollama run llama3.2:8b-q5_K_M

# API compatible with OpenAI:
curl http://localhost:11434/v1/chat/completions \
  -d '{"model":"llama3.2","messages":[...]}'

BitNet b1.58 — 1-Bit LLMs

What 1.58 bits means

  • Weights are ternary: {-1, 0, +1}
  • Each weight needs log2(3) = 1.58 bits
  • Multiplications become simple additions/subtractions
  • No floating-point multiply needed

Microsoft’s BitNet b1.58 2B4T

  • 2 billion params, trained on 4 trillion tokens
  • Comparable to leading FP16 2B models
  • Released April 2025 as first open 1-bit LLM

Efficiency gains

PlatformSpeedupEnergy Saved
ARM CPUs1.37–5.07×55–70%
x86 CPUs2.37–6.17×72–82%

The headline number

A 100B parameter BitNet model running on a single CPU at 5–7 tokens/sec (human reading speed). No GPU needed.

Distillation

Teaching small models to think like big ones

Knowledge Distillation

Teacher → Student

  • Large “teacher” model generates training signals
  • Small “student” learns to replicate not just answers but probability distributions
  • Transfers “dark knowledge” — nuanced relationships, reasoning patterns, confidence

Two approaches

  • Output distillation: match teacher’s logits/probabilities
  • Data distillation: teacher generates high-quality synthetic training data

Modern LLM distillation mostly uses approach #2: generate massive reasoning datasets, fine-tune student.

# Modern distillation pipeline

# 1. Teacher generates reasoning
teacher = DeepSeekR1("671B")
for problem in dataset:
    trace = teacher.generate(
        problem,
        show_reasoning=True
    )
    training_data.append({
        "input": problem,
        "output": trace
    })

# 2. Student learns from traces
student = Qwen2_5("7B")
student.finetune(training_data)

# Result: 7B model with 671B reasoning

Distillation Results — The Numbers

DeepSeek-R1 Distilled Models

ModelAIME 2024MATH-500
R1-Distill-Qwen-7B55.5%92.8%
R1-Distill-Qwen-32B72.6%94.3%
OpenAI o1-mini63.6%90.0%

A 32B distilled model outperforms OpenAI o1-mini. And it’s open-weight.

Microsoft Phi Series

  • Phi-1 (1.3B): outperformed 13B models on coding with “textbook quality” synthetic data
  • Phi-4 (14B): 84.8% MMLU. Beat GPT-4o on MATH and GPQA
  • Phi-4-reasoning-plus: 77.7% on AIME 2025, beating DeepSeek-R1-Distill-70B (5× its size)

Berkeley researchers recreated OpenAI’s reasoning capabilities via distillation for $450 in 19 hours.

The Open Model Ecosystem (2025)

Family Company Key Models Standout
Llama 4 Meta Scout (109B MoE), Maverick (400B MoE) 87.3% MATH-500, 10M context (Scout)
Qwen 2.5 Alibaba 0.5B to 72B, 18T tokens training 7B: best overall at 7B class. 72B: #1 OpenCompass
Gemma 3 Google 1B to 27B, multimodal, 128K context 27B in top 10 on LMArena including closed models
Mistral/Ministral Mistral AI 3B to 24B, vision, 256K context All Ministral 3 models run on single GPU
Phi-4 Microsoft 14B, distilled from synthetic data Beat GPT-4o on MATH. 84.8% MMLU

The 7B–14B range in 2025 is where 70B was in 2023. Performance doubles every year at the same model size.

Running Models Locally

Ollama

“Docker for LLMs.” One command: ollama run llama3.2. OpenAI-compatible API. 100+ models. 108M+ Llama downloads.

llama.cpp

Pure C/C++ inference engine. GGUF native. CPU-first, GPU optional. The foundation most local tools are built on. By Georgi Gerganov.

vLLM

High-throughput serving engine. PagedAttention for 2–24× throughput. Tensor/pipeline parallelism. For production multi-user serving.

MLX (Apple Silicon)

Apple’s native framework. 21–87% higher throughput than llama.cpp on M-series. Up to 525 tok/s on M4 Max.

Hardware: What Can Run What?

Apple Silicon

ChipBW8B Q4Can Run
M2 Ultra (192GB)800 GB/s~75 t/s70B quantized
M4 Max (128GB)546 GB/s~100 t/s70B quantized
M4 Pro (24GB)273 GB/s~45 t/s13B quantized

Memory bandwidth is the limiting factor, not compute.

NVIDIA Consumer GPUs

GPUVRAM8B Q4Price
RTX 309024 GB~90 t/s~$800
RTX 409024 GB~128 t/s~$1,800
RTX 509032 GB~213 t/s~$2,600

Critical rule: Model must fit entirely in VRAM. Partial CPU offload devastates speed.

When Local Beats API

Local wins when

  • Privacy: Data never leaves device (HIPAA, legal, finance)
  • Latency: Zero network round-trip (sub-ms vs 200–500ms)
  • Cost at scale: >2M tokens/day, hardware amortizes fast
  • Offline: Airplanes, air-gapped networks, rural areas
  • No rate limits: As fast as your hardware allows
  • Customization: Fine-tune freely, no ToS restrictions

API wins when

  • Quality: Frontier models still significantly better on hard reasoning
  • Ease: One API key vs managing hardware
  • Low volume: <100K tokens/day = API is cheaper
  • Always current: Provider handles updates
  • Multimodal: Latest vision/audio ships to APIs first
  • Scale elasticity: Handle traffic spikes

The Economics

API pricing (2025)

ModelInput / 1M tokensOutput / 1M tokens
GPT-4o$2.50$10.00
Claude Sonnet 4$3.00$15.00
Claude Haiku$0.80$4.00
GPT-4o mini$0.15$0.60
Gemini 2.0 Flash$0.10$0.40
DeepSeek V3$0.27$1.10

GPT-4-equivalent performance: $0.40/M tokens today vs $20 in late 2022. 50× reduction in 2 years.

Break-Even: Local vs API

At 5M tokens/day (team usage)

Claude Sonnet API
~$98K/year
Local 14B (Phi-4)
~$5K
Hybrid (80/20)
~$25K/year

Hybrid approach: local for 80% routine tasks, API for 20% complex. Typical savings: 60–70%.

Break-even thresholds

VolumeWinner
<100K tok/dayAPI (always)
100K–2M tok/dayDepends on quality needs
>2M tok/dayLocal (decisively)

At 2M tokens/day: API ~$9,125/yr. RTX 4090 setup: ~$1,400/yr amortized. 84% savings.

Speed: Local vs API

Tokens per second (8B Q4 model)

RTX 5090
213 tok/s
RTX 4090
128 tok/s
M4 Max
~100 tok/s
RTX 3090
~90 tok/s
M4 Pro
~45 tok/s

Why bandwidth matters more than FLOPS

LLM inference is memory-bandwidth-bound. Each token reads every weight once but does very few FLOPs per weight. The GPU with more bandwidth wins, not more cores.

RTX 5090: 1,790 GB/s bandwidth (77% more than 4090). That’s why it’s 67% faster despite fewer FLOPS gains.

Get Started in 5 Minutes

# Install Ollama
brew install ollama   # macOS
# or: curl -fsSL https://ollama.com/install.sh | sh

# Run a model
ollama run llama3.2       # 8B, general
ollama run deepseek-r1:8b  # reasoning
ollama run qwen2.5-coder   # coding
ollama run gemma3:12b      # multimodal

# Use as API (OpenAI-compatible)
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"llama3.2",
       "messages":[{"role":"user",
       "content":"Hello!"}]}'

Recommended starter setups

MacBook (16GB+)

Ollama + Qwen2.5-7B Q4. Good for coding assistance, writing, chat. ~30–45 tok/s.

Desktop (RTX 4090)

Ollama + DeepSeek-R1-Distill-32B Q4. Reasoning on par with o1-mini. ~40 tok/s.

Mac Studio (M4 Max 128GB)

Full 70B models. Production-quality inference for personal/team use. ~20–30 tok/s on 70B.

Key Takeaways

  • Quantization is nearly free — INT4 retains 98% quality at 25% the size
  • GGUF + Ollama = running AI locally is trivial — one command, any hardware
  • BitNet points to the future — 100B models on CPUs at reading speed
  • Distillation transfers reasoning — 32B model beats o1-mini, costs $450 to create
  • The 7B–14B range is the sweet spot — runs on any GPU, quality improving fast
  • Bandwidth > FLOPS for inference — buy the chip with more memory bandwidth
  • Hybrid is the answer — local for 80% of tasks, API for the hard 20%
  • Cost drops 50× in 2 years — and still falling

3.8 GB.
98% quality.
Runs on your laptop.

The future of AI is small, fast, and local.

agent37.club