The Serving Stack
The Serving Stack

Inference engineering and AI in production — depth-first, no hype.

Posts by The Serving Stack

GPU FOR INFERENCE · 031×128 TILES · 128×128 BLOCKSFP8ONE SCALE PER TILE

DeepGEMM: The Matrix Multiplications Behind DeepSeek's Models

What DeepGEMM computes for DeepSeek's models: block-scaled FP8 and FP4 matrix multiplications, grouped GEMMs for MoE experts, and the fused Mega MoE kernel.

SERVING IN PRODUCTION · 04ONE TOKEN · SIX EXPERTS · 64 GPUSEP64DISPATCH AND COMBINE

Expert Parallelism, and What DeepEP Does for It

Why serving a big MoE model means spreading its experts over many GPUs, what dispatch and combine cost, and how DeepEP and its V2 redesign make it fast.

INFERENCE ENGINES · 02ROUTING · KEPTENGINES · OPENKV STORE · KEPT

DeepInfer: What DeepSeek Open-Sourced, and What It Kept

DeepSeek's open-source engine runs one model on Blackwell and Ascend: why it came out, what the code shows, what was kept back, and what it means for vLLM users.

LLMS EXPLAINED · 0348 LAYERS · 3 LINEAR : 1 SPARSE1/9TRAINING FLOPS

Qwen3.8-Flash-Next, Layer by Layer

Qwen's preview of its next architecture, piece by piece: linear and sparse attention, a gated four-branch residual, 512 experts and an n-gram memory, and what each costs to serve.

LLMS EXPLAINED · 02189 GiB OF N-GRAM MEMORY12.4 KiBREAD PER TOKEN

Engram: Memory You Look Up Instead of Compute

DeepSeek's Engram adds a hashed n-gram memory that a model looks up instead of computing: how it works, why it helps, and how DeepSeek-V4.1 and Qwen serve it.

SERVING IN PRODUCTION · 03SAME BENCHMARK,THREE RUNSMEDIAN TTFT 819 · 1,132 · 894 MS

Benchmark an Inference Server Without Lying to Yourself

Common load-test mistakes made on purpose next to the correct run, on one vLLM server, so each rule comes with how far it moves the numbers.

QUANTIZATION · 09AFTERTRAINEDWEIGHTS THAT SURVIVE ROUNDING

Quantization-Aware Training: When the Model Learns Its Own Precision

Why Kimi K2 Thinking ships in INT4 and gpt-oss and K3 in MXFP4: training with rounding in the loop, explained and measured on a small model.

CUDA FOR INFERENCE · 01xyy[i] = a·x[i] + y[i], ONE THREAD EACH235 GB/s, 86% OF THE MEMORY

Your First CUDA Kernel, Compiled and Profiled

Write SAXPY in CUDA, compile it for a Blackwell GPU, check it, time it, and read what Nsight Systems and Nsight Compute say about it.

BUILDING WITH AI · 01CACHED HISTORY+ NEW TOOL OUTPUT21 TURNS, 90% READ FROM CACHE

A 27B Model as Your Local Agent: What It Can and Can't Do

Real coding-agent turns replayed on a 27B model on one desk-side GPU: what the prefix cache saves, how many agents fit, how well it calls tools.

QUANTIZATION · 08ONE TOKEN× QROTATEDOUTLIER 29.8× → 2.1×, PRODUCT UNCHANGED

Rotations for 4-Bit Activations: QuaRot, SpinQuant, and Friends

A rotation flattens activation outliers and, on real layers, rescues INT4 activations. On Qwen3-8B in NVFP4, it cost 5 GSM8K points instead.

GPU FOR INFERENCE · 0148 SMs · 24 MiB L2 · 273 GB/s DRAM

A GPU in One Picture: SMs, Warps, and Memory

The parts of a GPU that decide inference speed, from streaming multiprocessors to DRAM, with one real GPU's numbers and three measurements.

QUANTIZATION · 13BF16QUANTIZEDSAME SCORE, DIFFERENT ANSWERS

Measuring the Damage: Evaluations That Catch Quantization Errors

GSM8K said every 4-bit format matched BF16. A noise baseline, paired comparisons, token-level KL, and a code benchmark showed which ones did not.

QUANTIZATION · 07ACTIVATIONS÷ sSMOOTHEDMAX 17.5 → 1.32, PRODUCT UNCHANGED

SmoothQuant and W8A8: Quantizing Activations Too

Why activation outliers break INT8, how SmoothQuant moves them into the weights, and what it changes for FP8 W8A8, measured on Qwen3-8B with vLLM.

QUANTIZATION · 10BF16 · 498K TOKENSFP8 · 975K4-BIT · 1.84MSAME TOKENS, FEWER BYTES

Quantizing the KV Cache: FP8 and Below

Seven KV cache formats in vLLM, from FP8 to 3-bit, on one model: how many more tokens fit, what long-context recall loses, and why speed follows the kernel.

SERVING IN PRODUCTION · 02QUIET · FIRST TOKEN, THEN A STEADY STREAMLOADED · LONGER WAIT, LONGER GAPSTHROUGHPUT UP, GOODPUT DOWN

TTFT, ITL, Goodput: Measuring What Users Feel

What TTFT, TPOT, ITL, end-to-end latency, and goodput each measure, how the tools compute them, and why peak throughput is the wrong target.

REQUEST TO TOKENS · 02PREFILL · ALL TOKENS, ONE PASSDECODE · ONE TOKEN PER PASS0.20 ms vs 74 ms PER TOKEN

Prefill vs. Decode: Why the Second Token Is a Different Workload

Why a prompt token costs hundreds of times less than an answer token on the same weights: prefill and decode, seen in a kernel trace.

REQUEST TO TOKENS · 01PROMPT · ONE PASSANSWER · ONE PASS PER TOKENFIRST TOKEN 82 ms · THEN 73 ms EACH

From Prompt to Token: The Life of an LLM Request

One chat request followed through a real inference server, from chat template and tokens to prefill, decode, sampling, and streaming, each stage timed.

QUANTIZATION · 06INPUT SIZEWEIGHT COLUMNSSCALED UP BY s1% OF CHANNELS, CHOSEN BY THEIR INPUTS

AWQ: Protecting the Weights That Matter

Which 1% of weights matter, why scaling them protects them, and the search behind AWQ, in a few lines of PyTorch on a real layer, then AWQ on Qwen3-8B with llm-compressor and vLLM against plain rounding, GPTQ and a published checkpoint.

QUANTIZATION · 05

GPTQ, Explained and Run

How GPTQ trades weight error for output error, in 30 lines of PyTorch on a real layer, then how to run it with llm-compressor and serve it with vLLM, and which settings actually change the result on Qwen3-8B.

QUANTIZATION · 11Q4BITSKK-QUANTMMIX4.0 NOMINAL → 4.9 REALBITS PER WEIGHT, QWEN3-8B Q4_K_M

GGUF Quant Types Decoded: K-Quants and I-Quants

What Q4_K_M, IQ3_XXS, and the rest mean: the block layouts from llama.cpp's source, the real bits per weight of each file, and the weight error of each type on Qwen3-8B.

QUANTIZATION · 04ONE CHANNEL26× A TYPICAL ONEQ_PROJ INPUT, LAYER 10, QWEN3-8B

Post-Training Quantization: Rounding, Calibration, and the Outlier Problem

Why rounding each weight to the nearest value is not enough, what calibration data is for, and the two kinds of outliers in a real model's activations, measured on Qwen3-8B.

QUANTIZATION · 033×

How Much Does Each Bit Cost? Size, Speed, and Quality, Measured

Qwen3-8B in thirteen formats from BF16 to 3-bit GGUF, on one GPU with vLLM: memory, decode speed, prompt reading, perplexity, and GSM8K, plus the formats that would not run.

NUMBER FORMATS · 09256x² FITS IN FP1612,096A REAL ACTIVATION, FAR PAST 256

Where Low Precision Bites: Rounding, Overflow, and Accumulation

Five places where low precision breaks real computations, each reproduced on Qwen3-8B's own tensors, and the fix every serious implementation applies.

QUANTIZATION · 02WEIGHTSACTIVATIONSKV CACHE16 BITS → 4, 8, 8

Quantization, Mapped: Weights, Activations, KV Cache

What can be quantized in a model, what each saves (memory, bandwidth, compute), and what each risks, with Qwen3-8B's numbers.

NUMBER FORMATS · 0816-BIT2.5 PF8-BIT5 PF4-BIT10 PF2×PER HALVINGDENSE TENSOR-CORE RATE, ONE GB200 GPU

Which GPU Computes Which Format: Ampere to Rubin, MI300 to MI355

Which number formats each data-center GPU computes natively, at what rate, from the vendors' own pages: A100 to Rubin, MI300X to MI355X.

NUMBER FORMATS · 07TENSOR SCALE, FP324.5 BITS PER VALUE

NVFP4: Two Levels of Scale

How NVFP4 differs from MXFP4: 16-value blocks, FP8 block scales, and a per-tensor scale, with what each part buys measured on Qwen3-8B.

NUMBER FORMATS · 06E8M0 SCALE32 VALUES SHARE ONE SCALE

Microscaling: MXFP8, MXFP6, MXFP4 and Block Scales

The OCP microscaling formats: 32 values sharing one power-of-two scale, what MXFP8, MXFP6, and MXFP4 cost in accuracy on a real model, and why the scale rule matters.

NUMBER FORMATS · 04ONE SCALE PER TENSOR87% ERROR IN INT432 WEIGHTS, ONE OUTLIER

Integers for AI: INT8, INT4, Scales, and Zero Points

How integers represent real weights: scales, zero points, per-tensor, per-channel, and per-group, measured on every weight of Qwen3-8B.

NUMBER FORMATS · 050010101011101000SIGNEXPONENTMANTISSA

FP8: E4M3, E5M2, and Why There Are Two

The two FP8 formats, what each is for, and how FP8 is scaled, measured on Qwen3-8B's weights and activations against INT8.

NUMBER FORMATS · 032,048WHERE THE SUM STOPSFP16 SUM OF 1.0, ADDED AGAIN AND AGAIN

TF32 and Accumulation: What Tensor Cores Really Compute In

Inputs, products, and accumulators: the precision a matrix multiplication really uses, and why FP32 accumulation still matters.

NUMBER FORMATS · 02FP16BF16SAME 16 BITS · FP16 STOPS AT 65,504

FP16 vs. BF16: Same Size, Different Trade

Why training moved from FP16 to BF16, and why a BF16 model may still run fine in FP16: the same 16 bits split differently, measured on Qwen3-8B.

NUMBER FORMATS · 01FP32BF161 + 8 + 23: SIGN, EXPONENT, MANTISSA

How a Computer Stores a Real Number: Sign, Exponent, Mantissa

What the bits of a floating-point number mean, why range and precision trade against each other, with an interactive bit explorer.

LLMS EXPLAINED · 0183%ON THE TOP WORDTHE TEACHER'S NEXT-TOKEN DISTRIBUTION

Distillation: How Small Models Learn from Big Ones

What distillation is, the ways labs distill models, and how they use it on their own models and on others', from primary sources.

OPEN-MODEL LABS · 02GLM-4.5368 KiBGLM-587.75 KiBGLM-5.3-FLASH11 KiB33×KV CACHE PER TOKEN

Z.ai's GLM Models: From ChatGLM to GLM-5

Z.ai's (Zhipu's) GLM models in order, from the GLM pretraining objective to agentic MoE models, the idea behind each step, and what each changed for the ecosystem.

QUANTIZATION · 012.7×DECODE VS BF1616 FP4 VALUES PER BLOCK, ONE SCALE EACH

NVFP4 on Blackwell: Serving a 4-Bit Model End to End

What NVFP4 stores, how vLLM serves it on Blackwell, and what it changes in memory, speed, and quality.

REQUEST TO TOKENS · 09DRAFTVERIFY2.9× FASTER, SAME OUTPUT

Speculative Decoding from First Principles

How a cheap guess and one verification pass produce several tokens per step, when it speeds things up and when it does not, measured.

REQUEST TO TOKENS · 10ABFIRST TOKEN: 2.26 s → 0.28 s

Prefix Caching: When It Pays and How to Design Prompts for It

Why a repeated prompt can cost almost nothing, how vLLM and SGLang find shared prefixes, what breaks a hit, and how to structure prompts for agents and chat.

REQUEST TO TOKENS · 07ONE PIECEIN CHUNKSWORST STALL 7.6 s → 0.22 s

Chunked Prefill: Trading First-Token Time for Smooth Streaming

How engines split long prompts across steps, what the per-step token budget trades between time to first token and time per token, and how to set it.

REQUEST TO TOKENS · 08VALID ANSWERS: 7 → 199 OF 200

Structured Output: How Engines Force Valid JSON, Token by Token

How vLLM and SGLang guarantee valid JSON or a grammar: compiling a schema into a token mask, applying it at every step, and what it costs in latency and quality.

GPU FOR INFERENCE · 02DECODEPREFILL

The Roofline for LLMs: Why Decode Is Memory-Bound

Where prefill and decode sit against a GPU's compute and memory limits, and why batching, quantization, and speculative decoding work, with an interactive roofline.

OPEN-MODEL LABS · 03TEXT-01M2M3LINEAR → FULL → SPARSE ATTENTION

MiniMax: Lightning Attention, Agents, and What They Tried

MiniMax's models in order: lightning (linear) attention at a 4-million-token context, reasoning, the return to full attention for agents, and what each choice taught the ecosystem.

OPEN-MODEL LABS · 01STANDARD ATTENTION · 4.8 MiBLATENT (MLA) · 68.6 KiB71×LESS KV PER TOKEN

DeepSeek: From V1 to V4, the Models and the Breakthroughs

DeepSeek's models in order, the idea behind each one (MoE, latent attention, FP8 training, RL reasoning, sparse attention), and what each changed for everyone else.

SPEECH AI · 03ASRLLMTTS172×REAL TIMEPARAKEET ON ONE GPU, 1.57% WER

NVIDIA's Speech Stack: Parakeet, Canary, Nemotron Speech, and Magpie

What NVIDIA's open speech models are for: Parakeet and Canary for recognition, Nemotron Speech for streaming, Magpie for synthesis, and how they fit a voice agent.

SERVING IN PRODUCTION · 01PREFILLKV CACHEDECODE

Disaggregated Serving: Dynamo, llm-d, and When Splitting Prefill from Decode Pays

Why production stacks run prefill and decode on separate GPUs, how NVIDIA Dynamo and llm-d move the KV cache between them, and when the split pays.

OPEN-MODEL LABS · 042.8TPARAMETERS69 KDA + 24 MLA LAYERS

Kimi: Moonshot AI's Models, from Long Context to Trillion-Parameter Agents

Moonshot AI's Kimi models in order, from long-context chat to trillion-parameter agentic MoE models, the idea behind each step, and what each changed for the ecosystem.

SPEECH AI · 01

Speech Recognition with Whisper on vLLM: Mel Spectrograms, Streaming, and Who Spoke When

How Whisper turns audio into text, from mel spectrograms to an encoder-decoder; serving it with vLLM, transcribing in real time, and labeling speakers.

SPEECH AI · 02106 msTO THE FIRST SOUNDQWEN3-TTS, STREAMED BY VLLM-OMNI

Text-to-Speech in 2026: How the Models Work and Who Leads

How modern text-to-speech models turn text into audio tokens and waveforms, the open models that lead today, and how to choose one for latency, quality, and voices.

INFERENCE ENGINES · 01MANY USERSYOUR MACHINEONE TARGET

Choosing an Inference Server: The Landscape, from Data Centers to Laptops

Inference servers in three groups: production engines and their stacks, local apps built on llama.cpp, and enthusiasts' specialized engines, with how to pick.

REQUEST TO TOKENS · 06

Paged Attention: Virtual Memory for the KV Cache

How serving engines hand out KV cache memory in 16-token blocks instead of reserving the maximum, how the same blocks let requests share a prompt, and what that saves in memory and time to first token.

REQUEST TO TOKENS · 054 SLOTS, REFILLED AT EVERY STEP

Continuous Batching, Animated: How a Server Keeps the GPU Busy

Why serving engines re-form the batch at every decode step, what it buys in throughput and latency, and the settings that control it.

REQUEST TO TOKENS · 041 LAYER IN 4 KEEPS EVERY TOKEN

When Most Layers Stop Caching: Hybrid, Sliding, and Sparse Attention, Sized

Why a 27B model holds 262k tokens of context on a 24 GB GPU: what hybrid, sliding-window, and sparse attention store and read per token, on real models.

REQUEST TO TOKENS · 03144 KiBPER TOKEN36 LAYERS × KEY, VALUE

The KV Cache, Sized: What the Formula Says and What Your Engine Gives You

Compute what each token of KV cache costs from a model's config, then predict the capacity vLLM reports at startup, and see where the two differ.