Research

Research seriesL2algorithms

The Math Behind Modern LLM Inference

The algorithms that make a large language model answer on demand — attention and the KV cache, speculative decoding, quantization error, and vector-index recall — derived properly, with the complexity and the point where each one breaks. Grounded in the primary papers.

Murali Chillakuru·4 articles
  1. 1
    Attention and the KV Cache: The Arithmetic of a Forward Pass

    Why serving a language model is a memory problem, derived from the attention equation to the exact bytes a running conversation holds.

  2. 2
    Speculative Decoding: The Accept-Reject Math of Faster Tokens

    How a cheap draft model and a rejection-sampling rule cut latency without changing a single output token's distribution.

  3. 3
    Quantization Error: How Low Can the Bits Go Before Quality Breaks

    The arithmetic of rounding a model's weights to a coarse grid, why every bit buys about six decibels, and where the error finally wins.

  4. 4
    Vector Indexes: The Recall-vs-Latency Trade-off of HNSW and IVF

    Why approximate nearest-neighbour search is a dial between how many true neighbours you find and how long you wait, and how HNSW and IVF set that dial.