Skip to main content
← CONCEPTS / AI & MACHINE LEARNING ENGINEERING
An end-to-end domain learning journey

LLM Quantization, GPTQ/AWQ
& Inference Performance.

LLM quantization compresses 16-bit model weights and KV caches into 8-bit or 4-bit representations (FP8, AWQ, GPTQ, GGUF) to slash VRAM usage by 2-4x and accelerate memory-bandwidth-bound token generation.
Start the journey7 sections· Last modified Oct 5, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When batching and tail latency compete for accelerator cycles, GPTQ/AWQ & Inference Performance, because autoregressive LLM decode is memory-bandwidth bound at low batch sizes, moving from FP16 to INT4/FP8 cuts HBM reads per token by 2-4x while keeping accuracy loss under ~1% when activation outliers are protected.

TL;DR30-second simplified summary
▾

Core Mechanics: Autoregressive LLM inference has two opposite regimes: Prefill (processes prompt tokens in parallel via large GEMMs -> compute-bound) and Decode (generates 1 token per step -> memory-bandwidth bound).

Visual & Structural Flow: Depicts HBM3 Bandwidth Bottleneck & Quantized Weight/KV-Cache Footprint (HBM3 (35 GB INT4) -> Tensor Core / Regs -> FP8 KV Cache -> Decode (~95 tok/s)); 3-Layer Calibration, Accuracy & Concurrency Benchmark Flow (Calibration Set -> AWQ / FP8 Pass -> Task Eval Gate -> vLLM Serving).

Trade-Offs & Production: Match the quantization scheme to your GPU architecture and concurrency regime. An ML platform calibrates AWQ (group_size=128) on 256 production prompts, gates the checkpoint against BF16 on JSON-schema + GSM8K evals, sweeps batch=1..64 latency, and deploys.

Failure Modes & Application: Explore PagedAttention KV-cache management, speculative decoding, and continuous batching.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Distributed & Application Caching
Caching keeps a reusable copy of data so an application can avoid repeating a database query, calculation, or network call. It can make responses faster and reduce database load. The trade-off: the copy may be out of date.
Full walkthrough · 7 stages
01
STAGE 01 · WHAT IT ISL4 · FUNDAMENTALS

What is LLM Quantization (Prefill vs. Decode).

Why this matters: The mechanism: understand how LLM Quantization (Prefill vs. Decode) works from first principles.

Autoregressive LLM inference has two opposite regimes: Prefill (processes prompt tokens in parallel via large GEMMs -> compute-bound) and Decode (generates 1 token per step -> memory-bandwidth bound).

A 70B model in FP16 consumes 140 GB of weights—requiring 2x 80 GB H100s—and batch-1 decode on an H100 (3.35 TB/s HBM3) is capped near ~24 tok/s. Quantizing weights to INT4 (W4A16) shrinks weights to ~35 GB (fitting on 1x GPU) and lifts the bandwidth ceiling near ~95 tok/s; FP8 (W8A8) uses Hopper Tensor Cores to accelerate both prefill and high-batch decode.

GPU Memory Hierarchy

HBM3 Bandwidth Bottleneck & Quantized Weight/KV-Cache Footprint

HBM3 (35 GB INT4)vs 140 GB FP16Tensor Core / RegsMarlin / FP8 GEMMFP8 KV Cache4x context…Decode (~95 tok/s)HBM read / tokenE4M3 KV read

1.1. Weight Compression: INT4 (AWQ/GPTQ) cuts 70B weights from 140 GB to ~35 GB, fitting on a single 80 GB GPU.

2.2. Outlier Protection: AWQ scales salient ~1% activation outlier channels before group-wise (128) quantization.

3.3. KV-Cache FP8: At 32k-128k contexts, quantizing KV cache to FP8 prevents VRAM OOM under concurrency.

Shrinking bytes read from HBM per token directly multiplies low-batch decode speed.

02
STAGE 02 · WHY WE NEED ITL4 · FUNDAMENTALS

Why Naive Rounding Fails (Activation Outliers).

Why this matters: The problem: see what breaks without Why Naive Rounding Fails under real concurrency or scale.

Think of Why Naive Rounding Fails (Activation Outliers) as the intuition layer for LLM Quantization, GPTQ/AWQ & Inference Performance: The problem: see what breaks without Why Naive Rounding Fails under real concurrency or scale.

Transformer activations in models >6B parameters exhibit systematic outlier features: ~0.1%–1% of hidden channels reach magnitudes 10x–100x larger than the median. Naive Round-To-Nearest (RTN) stretches the quantization grid to fit one outlier, crushing normal weights into 1–2 bits and destroying reasoning and JSON tool calling.

Engineering Decision Framework
Problem
How to implement LLM Quantization, GPTQ/AWQ & Inference Performance without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
When batching and tail latency compete for accelerator cycles, GPTQ/AWQ & Inference Performance, because autoregressive LLM decode is memory-bandwidth bound at low batch sizes, moving from FP16 to INT4/FP8 cuts HBM reads per token by 2-4x while keeping accuracy loss under ~1% when activation outliers are protected.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When LLM Quantization, GPTQ/AWQ & Inference Performance experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

AWQ, GPTQ & SmoothQuant

AWQ protects salient weight channels identified by activation magnitude; GPTQ uses second-order Hessian error compensation; SmoothQuant migrates outlier difficulty from activations into weights.

High-Batch W4A16 Inversion

At batch > 32, W4A16 register dequantization ALU overhead saturates compute—making FP8 W8A8 faster on H100/L40S.

03
STAGE 03 · WHERE IT IS USEDL5 · APPLIED DESIGN

Where Quantization fits (and where BF16/QAT wins).

Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.

Think of Where Quantization fits (and where BF16/QAT wins) as the intuition layer for LLM Quantization, GPTQ/AWQ & Inference Performance: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.

Choose W4A16 (AWQ+Marlin) for single-GPU 70B / low-latency decode, FP8 (W8A8) for high-batch Hopper serving, and skip sub-4-bit PTQ on complex coding/reasoning.

ChoiceWhat it buysWhat it costs
Good Candidate: 7B–70B+ Interactive Serving (FP8 / AWQ)2–4x VRAM reduction and 2–3x higher decode tok/s with <1% accuracy drop.Requires fused kernels (Marlin, ExLlamaV2, FP8 Tensor Cores) and domain-matched calibration data.
Avoid: Sub-4-Bit PTQ (INT2) on Code/Math ReasoningKeep BF16/FP8 or use Quantization-Aware Training (QAT) for strict JSON/SQL/reasoning fidelity.Post-training 2-bit quantization degrades multi-step reasoning severely.
04
STAGE 04 · HOW IT IS MANAGEDL5 · APPLIED DESIGN

How Quantized Serving & Task-Specific Evals are managed.

Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.

Think of How Quantized Serving & Task-Specific Evals are managed as the intuition layer for LLM Quantization, GPTQ/AWQ & Inference Performance: Operational control: configure bounds, failure handling, and safe production defaults.

Never ship a quantized checkpoint on WikiText perplexity alone. Calibrate on 256 domain-representative samples (code, JSON, target languages), enable --kv-cache-dtype fp8 for long contexts, and run task-specific evals (HumanEval, JSON schema adherence) + concurrency sweeps against BF16.

Lifecycle & Failure Recovery

How Quantized Serving & Task-Specific Evals are managed

KV blocks allocatedtoken sampledVRAM > 90%Prefill(Compute-Bound)Decode (Memory-BW)SSE StreamingKV Cache Pressure
# Production vLLM launch with FP8 weights + FP8 KV-cache & Marlin/PagedAttention
python -m vllm.entrypoints.openai.api_server \
  --model meta-llama/Llama-3.1-70B-Instruct-FP8 \
  --quantization fp8 \
  --kv-cache-dtype fp8 \
  --max-model-len 32768 \
  --gpu-memory-utilization 0.92
05
STAGE 05 · ALTERNATIVESL6 · SCALE & TRADE-OFFS

Alternatives: FP8 (W8A8) vs. AWQ (W4A16) vs. GGUF K-Quants.

Why this matters: The trade-off: compare competing approaches across latency, consistency, and operational cost.

Think of Alternatives: FP8 (W8A8) vs. AWQ (W4A16) vs. GGUF K-Quants as the intuition layer for LLM Quantization, GPTQ/AWQ & Inference Performance: The trade-off: compare competing approaches across latency, consistency, and operational cost.

Match the quantization scheme to your GPU architecture and concurrency regime.

ChoiceWhat it buysWhat it costs
FP8 E4M3 (W8A8 on H100 / L40S)<0.2% accuracy drop and native Tensor Core acceleration for both prefill and high-batch decode.Only 2x VRAM savings (~70 GB for 70B) and requires Ada/Hopper+ GPUs.
AWQ / GPTQ with Marlin Kernel (W4A16)~4x VRAM savings (~35 GB for 70B) and fastest batch-1 decode.Degrades at high batch (>32) due to register dequantization overhead.
GGUF K-Quants (Q4_K_M)Mixed-precision layer allocation ideal for edge/CPU/Apple Silicon (`llama.cpp`).Not optimized for high-concurrency datacenter continuous batching.
06
STAGE 06 · PRODUCTION ARCHITECTUREL7 · STAFF / PRINCIPAL

Production example: Calibration -> Eval Gate -> Continuous Batching.

Why this matters: Production architecture: see how the components compose end to end under real load.

Think of Production example: Calibration -> Eval Gate -> Continuous Batching as the intuition layer for LLM Quantization, GPTQ/AWQ & Inference Performance: Production architecture: see how the components compose end to end under real load.

An ML platform calibrates AWQ (group_size=128) on 256 production prompts, gates the checkpoint against BF16 on JSON-schema + GSM8K evals, sweeps batch=1..64 latency, and deploys on vLLM with FP8 KV-cache PagedAttention.

Quantization Release Gate

3-Layer Calibration, Accuracy & Concurrency Benchmark Flow

Calibration SetAWQ / FP8 PassTask Eval GatevLLM Serving1. 256 code/JSON/prose samples2. Compare vs BF16(HumanEval/JSON)3. Sweep batch=1 vs batch=64 tok/s4. Serve with FP8 KV-cache

Task-specific evals and concurrency sweeps prevent silent tool-calling breakage and high-batch slowdowns.

07
STAGE 07 · PROBLEMS SOLVED & FURTHER DEEP DIVEL7 · STAFF / PRINCIPAL

Problems solved by Quantization & Related LLM Serving Concepts.

Why this matters: Applied problems: connect these internals to concrete system design and debugging scenarios.

Think of Problems solved by Quantization & Related LLM Serving Concepts as the intuition layer for LLM Quantization, GPTQ/AWQ & Inference Performance: Applied problems: connect these internals to concrete system design and debugging scenarios.

Explore PagedAttention KV-cache management, speculative decoding, and continuous batching.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

On an NVIDIA H100 serving high-concurrency traffic (batch size = 64), why can FP8 (W8A8) outperform INT4 (W4A16)?

Recommended Learning Flow