PART 2 · PRODUCTION SYSTEMS · MODULE S3

Module S3 · Speculative Decoding & Serving Optimization

Break the HBM3 memory-bandwidth wall during autoregressive decode by combining Draft-Verify parallelism (mathematically lossless rejection sampling) with FP8 and INT4 AWQ weight compression — delivering 2.4×–3.1× faster token generation at zero quality degradation.

Act I · Scope, Compute & HBM Bandwidth Math

Breaking the H100 HBM3 Bandwidth Ceiling

Step 1 of 5
H100 HBM3 Bandwidth
3.35 TB/s

Reading 140 GB FP16 70B weights takes ~41.8 ms/token at Batch=1 even if GPU FLOPS were infinite.

Speculative Speedup
2.4× – 3.1×

Verifying γ = 5 draft tokens in 1 Target pass amortizes a single HBM weight read across multiple emitted tokens.

Lossless Sampling
0.00 KL-Div

Modified rejection sampling guarantees the output distribution is mathematically identical to the 70B Target p(x).

Weight Compression
2× – 3.7×

FP8 / INT4 AWQ shrinks 70B weights from 140 GB → 70 GB (FP8) or 38 GB (INT4), cutting HBM read time directly.

Act II · Wire Protocols, Verification & Quantization Contracts

Speculative Verification Frame & AWQ Group-Quant Schema

Step 2 of 5
SpeculativeStepContract (Draft → Target Wire Frame)
AWQGroupQuantSchema (FP8 E4M3 & INT4 Tensor Layout)
Act III · Interactive Speculative Decoding & Quantization Engine

Draft-Verify Parallelism, KV Rollback & HBM3 Bandwidth Lab

SPECULATION OPTIMAL
Step 1 / 5
Draft Lookahead (γ):
Target Precision:
Effective TPOT
7.4 ms
SLO < 12 ms · 2.8× faster
Throughput
135.1 tok/s
Single-stream decode
Acceptance α
82.0%
Target ≥ 72% mean
HBM3 Read / Step
70 GB · 3.1 TB/s
FP8 W8A8 amortized
Speculative Pipeline · Draft & Parallel Verify (γ = 5)
DRAFT STEP
terminal Prompt Queue Batch B=1 · Code ctx: "Write merge.." fast_forward Fast Draft Engine Llama-8B / EAGLE-2 Head DRAFTING γ = 5 TOKS LATENCY: 5 × 1.6ms = 8ms developer_board Target 70B Verifier (H100) 1 Parallel Pass Scores γ+1 Positions VERIFY: 6 POSITIONS PASS: 21.0 ms (FP8) HBM3 WEIGHT READ / STEP (3.35 TB/s PIPE) 70 GB (FP8) 140 GB FP16 | 70 GB FP8 | 38 GB INT4 AWQ rule Lossless Rejection Sampler Accept if u < p(x)/q(x) · Else norm(max(0, p−q)) 0.00 KL-DIVERGENCE EMIT: 4–6 TOKS/STEP Exact 70B Target Distribution Preserved memory Paged KV-Cache & Rollback Pointer Truncates Rejected Tail Slots in O(1) Without Recompute COMMITTED PTR: +5 SLOTS ROLLBACK: 0 SLOTS FP8 E4M3 KV-Cache · Zero Wasted Pages Draft Tokens q(x) 70B Target Verify p(x) Accepted / Lossless Resample / KV Rollback SPEEDUP: 2.84× vs FP16 B=1
Live Token-Verification & KV-Rollback Strip 5 / 5 Accepted + 1 Bonus = 6 Tokens
DRAFT STEP

Loading speculative decoding engine...

Invariant active
Chaos Switchboard
0 Active
Live GPU Event Console
Act IV · Zero-Dependency Python 3.12+ Blueprints

Standard-Library Python Core & Production Stack Mapping

Auto-Synced to Simulator
Production Stack Mapping Strip 6 Serving Optimization Primitives
Vendor-Agnostic Primitive Production Engines & Kernels Operational Role
Speculative Decoding Runtime vLLM Speculative / SGLang / TensorRT-LLM Orchestrates draft lookahead, parallel target verification, and KV rollback
Lightweight Draft Heads EAGLE-2 / Medusa / Lookahead Decoding Predicts 4–7 next tokens directly from Target hidden states without a separate 8B model
FP8 W8A8 Inference Engine TensorRT-LLM FP8 / vLLM FP8 (H100/B200) Halves HBM weight reads and doubles Tensor Core FLOPS with near-zero PPL delta
INT4 AWQ / Dequant Kernels AWQ / Marlin INT4 / ExLlamaV2 / llama.cpp Fuses 4-bit unpack + FP16 salient-channel scale directly inside SRAM matmul
FP8 KV-Cache Compression vLLM FP8 E4M3 KV-Cache / SGLang FP8 KV Cuts KV-cache HBM footprint in half to sustain larger batches under long contexts
Tree Verification Kernels FlashInfer / Cascade Attention / Sequoia Verifies branching draft token trees in one custom-masked Target forward pass
Act V · Serving Tradeoffs & Production SLOs

Speculation & Quantization Tradeoffs & SLO Targets

Step 5 of 5
Tradeoff 01 Draft Architecture

Separate Draft Model vs. EAGLE-2 / Medusa Heads

EAGLE-2 / Medusa Heads

Reuses Target's own hidden states; tiny VRAM footprint (<2% of base), no separate tokenizer/KV-cache sync, and high acceptance α.

Separate Draft Model

Zero training required if a matching small family model exists (e.g. Llama-8B → 70B), but doubles KV-cache management overhead.

Verdict Use EAGLE-2 in production for best acceptance-per-ms; use a separate draft model for rapid zero-training prototyping.
Tradeoff 02 Batch Regime

Low-Batch Speculation vs. High-Batch Compute Wall

Low Batch (B = 1..16)

GPU is HBM-bandwidth-bound with idle Tensor Cores; verifying γ=5 draft tokens is nearly free and yields 2.4×–3.1× TPOT speedup.

High Batch (B ≥ 64)

GPU crosses into compute-bound regime; extra rejected draft tokens burn real FLOPS and can actually slow down aggregate throughput.

Verdict Run a batch-aware adaptive γ controller that scales γ down smoothly (5 → 2 → 0) as active batch size approaches compute saturation.
Tradeoff 03 Precision Choice

FP8 (W8A8) vs. INT4 AWQ (W4A16)

FP8 W8A8 (Hopper/Blackwell)

Hardware FP8 Tensor Cores accelerate both compute-bound Prefill and high-batch Decode while maintaining <0.05 ΔPPL.

INT4 AWQ (W4A16)

Cuts weight memory 3.7× (best for single-GPU 70B or low-batch memory-bound decode), but dequantizes to FP16 on high-batch compute.

Verdict Default to FP8 W8A8 on H100/B200 clusters; pick INT4 AWQ + Marlin when squeezing 70B onto 1 GPU or maximizing low-batch tok/s.
Tradeoff 04 Draft Topology

Linear Drafting vs. Tree-Based Verification (Medusa / Sequoia)

Tree Verification

Verifies multiple branching continuations in 1 Target pass using a custom tree attention mask, boosting expected accepted length even at high T.

Linear Chain (γ=5)

Simpler KV-cache rollback and standard causal attention kernels, performing best on low-entropy tasks like code completion and JSON.

Verdict Use Linear Drafting for code/structured generation; adopt Tree Verification for creative or higher-temperature chat traffic.
Production Observability SLOs
Serving Optimization Targets
Effective TPOT < 12 ms Speculative + quantized
Mean Draft α ≥ 72% Adaptive γ EWMA guard
Lossless Fidelity 0.00 KL-Div Exact 70B Target distribution
Quantization Drift ≤ 0.15 ΔPPL FP8 / AWQ salient guard