The transformer
Step 7 of 10 in NLP · Build · Hard
Self-attention lets every token look at every other token in parallel. Stacks of attention + MLP blocks with residuals and LayerNorm make the transformer.
Build it
Attention & a GPT block
Scaled dot-product attention with causal mask, multi-head attention, then a full GPT block.
Done when: Matches PyTorch's attention given the same weights.
Tiny GPT
Train your GPT on tiny-shakespeare.
Done when: Lower validation loss than your LSTM.
Resources
- Wikipedia: Transformer (deep learning architecture) Article
- The Illustrated Transformer Article
- Attention Is All You Need Paper
- Karpathy: nanoGPT Article
Earn this star
On the map, you log what you built. Finish the step and its star lights.
Open this step on the map