AlgoViz

Attention Is All You Need

medium 40 min

The 2017 paper that introduced the Transformer.

What each level should show

The same question is judged differently for mid, senior and staff.

  • Mid

    Must show

    • Explains Q, K, V and the attention equation
    • Says why √d_k
    • Knows positional encoding and the mask

    Will be probed on

    • Why RNNs were slow
    • What multi-head adds

    Stands out

    Works the 'it' example with numbers and says the weights add up to 1.

  • Senior

    Must show

    • Table 1 costs and what they mean at long context
    • KV cache formula and an estimate
    • Encoder, decoder and encoder-decoder uses

    Will be probed on

    • Prefill against decode
    • GQA and FlashAttention

    Stands out

    Separates compute-bound prefill from memory-bound decode and picks fixes for each.

  • Staff

    Must show

    • What changed since 2017 and why
    • Serving capacity from cache size
    • Trade-offs of sub-quadratic alternatives

    Will be probed on

    • Interpretability limits
    • When to choose a state-space or hybrid model

    Stands out

    Connects one equation to a cost model for a product: memory per user, time to first token, tokens per second.