Wiki
Production evaluation connects model quality, system reliability, and user outcomes. Compare versions on paired requests, set release gates for critical slices, and use shadow traffic, canaries, and randomized experiments to answer different release questions.
Intermediate 8 min read
Attention has two bottlenecks: the KV cache that decoding rereads at every step, and the N×N score matrix of training and prefill. MQA, GQA and MLA shrink the KV cache; FlashAttention cuts memory traffic with tiling and online softmax, and its output is identical to standard attention.
Intermediate 27 min read
Test-time compute is extra computation spent while answering each question: voting over samples, verifier selection, revision, search and RL-trained long chains of thought. A reproducible simulation shows what caps the gain, what a fooled verifier does and why wall-clock time differs.
Advanced 28 min read
Every decode step reads all the weights, so putting several requests in one batch raises throughput almost for free. This page measures concurrency, continuous batching, paged KV caches and prefix caching with llama.cpp to show how one GPU serves many requests.
Intermediate 35 min read
Decoding turns the model's output distribution into tokens: greedy picks the most likely one, temperature sharpens or flattens the distribution, top-k and top-p cut off the unlikely tail, and beam search keeps several candidates. Together they set how deterministic and diverse the output is.
Beginner 14 min read
Run a local inference endpoint, send JSON, and interpret status codes. Follow the model function, runtime, server, and client before learning streaming and deployment.
Beginner 9 min read
Understand how the KV cache removes repeated computation from autoregressive decoding, and master the trade-offs between latency, throughput, memory and request scheduling.
Intermediate 18 min read
Prefix caching reuses the KV cache of system prompts, shared documents, and chat history across requests (RadixAttention, CacheBlend, LMCache). PD disaggregation places compute-bound prefill and bandwidth-bound decoding on different hardware; DistServe, Splitwise, and Mooncake show when it pays off.
Intermediate 12 min read
A serving system has to balance time to first token, time per output token and total throughput. This page measures where one request's time goes with llama.cpp, shows why laptop benchmarks need a warm-up, and compares llama.cpp, Ollama, vLLM and SGLang.
Intermediate 31 min read
Quantization stores weights, activations or the KV cache in fewer bits. This page starts from the memory budget, builds up from scales and groups, measures INT8 and INT4 on Qwen2.5-0.5B, implements SmoothQuant, AWQ-style scaling, GPTQ and KV-cache quantization, and ends with a selection guide.
Intermediate 55 min read
Speculative decoding lets a small, fast draft model guess the next few tokens and the large model verify them in one parallel forward pass, with an accept-and-correct rule that keeps the output distribution unchanged. This page derives the expected speedup and lets you tune it interactively.
Intermediate 15 min read
One page for the estimates you reuse most: counting parameters, training compute (about 6ND), memory for weights, training state and the KV cache, the bandwidth bound on decoding speed, and the LoRA and pass@k formulas, each with a standard-library script checked against published numbers.
Intermediate 24 min read
A GPU is limited by two walls: how many operations it can do per second (compute) and how many bytes it can move per second (memory bandwidth). The roofline model uses arithmetic intensity to tell which wall an operator hits first. This page derives it and measures it on a CPU.
Intermediate 41 min read
GPU kernel tuning combines thread-level memory access, on-chip reuse, and output stores. Derive the logical traffic of tiled matrix multiplication with edge masks, check it with a CPU experiment, and trace practical limits from staging buffers to register spills.
Intermediate 9 min read
Follow a model request through disk, host and device memory, and CPU and GPU work. Estimate tensor storage and copy time to distinguish capacity, bandwidth, and compute before diagnosing inference.
Beginner 6 min read