跪拜 Guibai
← All articles
AI Programming

How a 700 GB Model Fits Into 8 GB of VRAM

By 咸鱼老弟 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Consumer GPUs remain the default hardware for most developers, yet model sizes have outraced them by a factor of 20× or more. Quantization and distillation are the only practical bridges — without them, a 4070 owner simply cannot run a 7B model at all, let alone fine-tune one.

Summary

A 70-billion-parameter model at FP16 occupies roughly 130 GB of weights alone, and inference pushes VRAM past 150 GB — two orders of magnitude beyond a typical 8 GB consumer card. Quantization attacks the problem by representing each weight in fewer bits: INT4 drops a 7B model from 14 GB to about 3.5 GB, making it comfortably runnable on 8 GB. The loss is smaller than intuition suggests because weight distributions cluster near zero, over-parameterized networks absorb individual errors, and modern algorithms use per-channel scaling, calibration, and outlier protection rather than naive rounding.

Four quantization ecosystems serve different needs. GPTQ uses second-order information for high-precision post-training quantization but is slow and GPU-bound. AWQ identifies and protects the critical 1% of outlier weights, yielding better precision at the same bit width with faster processing. GGUF packages models into single files with multi-tier quantization levels (Q4_K_M being the sweet spot) and runs on CPU plus optional GPU offloading via llama.cpp or Ollama. bitsandbytes performs runtime dynamic quantization; its NF4 format plus LoRA (QLoRA) lets an 8 GB GPU fine-tune a 7B model.

Distillation takes the opposite approach: a small student model learns to imitate a large teacher's output probability distributions, absorbing inter-class similarity structure that hard labels never convey. Modern variants include data distillation — generating synthetic training data from the teacher — and white-box distillation from open-weight models like DeepSeek-R1, which has produced surprisingly capable 7B–14B math-reasoning models. The two techniques stack well: distill first, then quantize the result.

Takeaways
A 70B FP16 model's weights alone are ~130 GB; inference adds KV cache, activations, and framework overhead, pushing past 150 GB.
INT4 quantization reduces a 7B model from 14 GB to ~3.5 GB, fitting comfortably into 8 GB VRAM with room for context.
Weight distributions in trained models concentrate near zero, so low-precision errors land on few extreme values that rarely affect outputs.
Over-parameterization provides redundancy: individual weight perturbations get averaged out across billions of parameters.
Modern quantization uses per-channel/per-group scaling, calibration on real data, and outlier protection — not naive round-to-nearest.
Quantization hurts most on small models and strict tasks (math, code, logic); large models on relaxed tasks (chat, summarization) barely notice INT4.
AWQ protects the ~1% of outlier weights that disproportionately affect outputs, scaling them up before quantization then compensating activations afterward.
GGUF is a single-file format with tiered quantization (Q4_K_M is the balanced sweet spot), designed for CPU inference with optional GPU offloading via llama.cpp or Ollama.
bitsandbytes' NF4 format plus LoRA (QLoRA) drops 7B fine-tuning from ~48 GB VRAM to runnable on 8 GB.
Distillation trains a small student model on the teacher's soft output distribution, not just correct answers — the student learns class similarity structure.
Data distillation uses a large model to generate synthetic training data for a smaller one; many 'small model beats large model' results come from this plus data cleaning.
White-box distillation from open models like DeepSeek-R1 yields 7B–14B models with strong math reasoning by accessing full logit distributions.
A practical decision stack: distill first for a smaller parameter count, then quantize the result for deployment efficiency.
Conclusions

The '700 GB into 8 GB' framing is rhetorical, not literal for a single 70B model — INT4 on a 70B still yields ~33 GB. The real win is making 7B–13B models run on consumer hardware, or bringing a full-precision 405B-class model into the realm of a single high-end server GPU.

Quantization safety scales with model size: a 70B model at INT4 is nearly lossless for most tasks, while a 1B model at INT4 can become unusable. This inverts the intuition that smaller models should be easier to compress.

AWQ's 'protect 1% of weights' strategy is a concrete instance of a broader principle: in over-parameterized networks, most parameters are negotiable, and identifying the non-negotiable ones is the whole game.

GGUF's dominance in the local-running community is as much about distribution ergonomics (single file, no shards, tiered options) as about technical quantization quality — deployment UX matters as much as the algorithm.

Distillation's real power is not compressing a specific model but transferring a 'worldview': the student learns which concepts are similar, a structural knowledge that one-hot labels erase. This explains why distilled small models can outperform same-sized models trained from scratch on hard labels.

The checklist reveals a pragmatic truth: most developers should start with Ollama + a Q4 GGUF and only reach for AWQ/GPTQ/distillation when that baseline proves insufficient. The tooling hierarchy is as important as the theory.

Concepts & terms
Post-Training Quantization (PTQ)
Quantizing an already-trained model without any retraining, using calibration data to minimize error. GPTQ and AWQ are PTQ methods.
KV Cache
The stored key and value tensors from earlier tokens in an attention mechanism, reused so the model doesn't recompute them for every new token. Memory consumption grows linearly with context length.
Per-Channel / Per-Group Quantization
Instead of applying one scaling factor to an entire weight tensor, scaling is computed per output channel or per small group of elements, drastically reducing quantization error compared to tensor-wide scaling.
AWQ (Activation-aware Weight Quantization)
A PTQ method that identifies the ~1% of weights with the largest impact on activations (outliers), scales them up before quantization to preserve them, then compensates in the activation computation afterward.
GGUF
A single-file model format from the llama.cpp ecosystem that bundles weights, config, and vocabulary with multiple quantization tiers (Q4_K_M, Q5_K_M, etc.), optimized for CPU inference and partial GPU offloading.
NF4 (4-bit NormalFloat)
An information-theoretically optimal 4-bit data type designed for normally-distributed weights, used by bitsandbytes. It assigns more quantization levels near zero where most weights concentrate, yielding lower loss than uniform INT4.
QLoRA
A fine-tuning technique combining NF4 quantization of the base model with Low-Rank Adaptation (LoRA) adapters, reducing VRAM requirements enough to fine-tune a 7B model on an 8 GB GPU.
Soft Labels / Hard Labels
Hard labels are one-hot correct answers (cat=1, all else 0). Soft labels are the full probability distribution from a teacher model (cat=0.85, tiger=0.12, etc.), encoding inter-class similarity structure that hard labels discard.
Data Distillation
Using a large teacher model to generate synthetic training data (e.g., millions of instruction-response pairs), then training a smaller student model on that data — the student learns from the teacher's outputs rather than imitating them in real time.
White-box Distillation
Distillation where the teacher model's full weights and output logits are accessible (open-source), giving the student access to complete, fine-grained probability distributions rather than just top predictions.
From the discussion
Featured comments
szp2005

The levers you can pull on the browser side are different. I have a pure front-end segmentation model, int8 weights 47MB. WebGPU runs at 768, fallback WASM runs at 512 — the weights are identical between the two, what's saved is entirely intermediate feature maps, not download size. On the web, you can only touch the activation value lever.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗