inference

4 posts

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.

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 · 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.

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.