AlgoViz

Attention Is All You Need

medium 40 min

The 2017 paper that introduced the Transformer.

Where it shows up

The same pattern appears across everyday software.

  • Chat assistants

    Decoder-only Transformers in the GPT line write one token at a time with the paper's causal mask, keeping a KV cache per conversation. GPT-3 is described in its paper as an autoregressive model with 175 billion parameters.

  • Search and embeddings

    BERT kept only the encoder and pretrained it on unlabelled text. Embedding and reranking models in search systems follow that encoder-only shape.

  • Machine translation

    The paper's own task. An encoder reads the whole source sentence at once, and a decoder writes the translation while attending to it.

  • Images as tokens

    The Vision Transformer cuts an image into patches and feeds them to a plain Transformer, the other-modalities plan of the paper's §7.

  • LLM serving

    vLLM's PagedAttention stores the KV cache in fixed-size blocks, as an operating system stores memory in pages, so more requests fit on one GPU.

  • Long documents

    FlashAttention computes the same exact attention in tiles that fit in on-chip memory, which makes long inputs practical without changing the maths.

  • Code completion

    An editor sends the file around the cursor as the prompt. Prefill reads it in one pass, and each suggested token is one decode step over the cache.