Skip to content
English

Switch theme

// Stage 4 · Transformers & LLMs

Transformers & Attention

Self-attention, multi-head attention, positional encoding, residuals and normalisation — build a GPT from scratch.

about 16 hours6 algorithms3 paperslesson text ready

01Goals

Do these first: Tokenization & Embeddings · Training Deep Nets

02Read on this site

03Algorithms to master

Each card has the original paper, prerequisites and resources.

04Must-read papers

05Courses & videos

06Hands-on: project, code & exercises

Free, official or author-published pages. Most run in the browser or on a free Colab GPU.

PROJECT

Following nanoGPT, train a character-level GPT on Shakespeare or classical Chinese poetry and visualise one layer’s attention.

  1. 1
    Georgia Tech:Transformer Explainer ↗Interactive

    Type a sentence and step through GPT-2’s attention and next-token probabilities.

  2. 2
    bbycroft ↗Interactive

    Watch one forward pass end to end in 3D.

  3. 3
    github.com ↗Reference code

    Train a character-level GPT from scratch on the Shakespeare dataset.

07Self-test

Answer in your head, then open to check.

Why divide attention scores by √d?

To stop large dot products from saturating the softmax.

What does the causal mask do?

It lets each position see only the tokens before it.

Why multi-head rather than single-head attention?

Different heads can attend to different relationship sub-spaces.

On these routes: Application Developers · Algorithm Researchers · Domain Scientists

Data updated: AI algorithms & curriculum(UTC+8)