SysDesignAtlas

AI Foundations

Models as systems. Tokens, attention, the KV cache, and the arithmetic that decides what inference costs.

CoreEasy10 min

Tokens — the Unit of Everything

Why models see subword fragments rather than characters or words, how BPE builds a vocabulary, and why the token is simultaneously the unit of cost, latency, memory, and context.

CoreMedium11 min

The Transformer as a System

What a forward pass actually does, where the parameters and the FLOPs live, and why prefill and decode are two completely different workloads running the same code.

CoreMedium11 min

Attention & the KV Cache

The cache that turns quadratic generation into linear, the memory it consumes, and why concurrency on a GPU is set by megabytes rather than by FLOPs.

CoreHard10 min

The Arithmetic of Inference

FLOPs per token, memory bandwidth, arithmetic intensity, and the roofline model — the calculations that tell you what a GPU can actually serve before you buy one.

CoreHard10 min

Context Windows & Long Context

How position is encoded, why attention cost is quadratic and memory cost is linear, and what actually breaks when you extend a model to a million tokens.

CoreMedium12 min

Quantization & Numeric Formats

Why FP32 was always overkill, what BF16, FP8 and INT4 actually change, and why halving the bits nearly halves your latency as well as your memory.

CoreHard10 min

Mixture of Experts

Decoupling parameter count from compute per token — how sparse routing works, why it complicates serving far more than dense models, and what expert parallelism costs.

CoreMedium12 min

Decoding & Sampling

How logits become tokens, why temperature and top-p behave the way they do, constrained decoding for structured output, and speculative decoding — the trick that gets latency for free.

CoreMedium11 min

Embeddings

What a vector actually encodes, why cosine similarity is the metric, how dimensionality trades quality against cost, and the operational problem nobody plans for — re-embedding.

CoreHard11 min

Fine-Tuning & Adaptation

Full fine-tuning, LoRA, and preference optimization from an infrastructure point of view — what each costs to train, and what each does to your serving stack.