internalsGet Pro

Module 10 · Lesson 8 of 12Pro

The transformer, layer by layer

Level
Advanced
Topic
Deep learning architectures
Reading time
18 min

When you finish this page you can

  1. Trace a batch of product IDs through a transformer, naming the shape of the tensor after every layer.
  2. Explain why each part of a block exists, position vectors, several heads, the feed-forward layer, the residual adds and layer normalization, and what breaks without it.
  3. Count a transformer’s parameters and its work per layer, and find the sequence length where attention starts to dominate.
  4. Build a pre-norm block in PyTorch, check it against PyTorch’s own layer, and test that the causal mask stops it reading ahead.
  1. Batch and layer normalization16 min
  2. Vision architectures: ResNet to vision transformers17 min
  3. Learned embeddings: vectors for words, items and users18 min
  4. Attention: the maths of focusing on what matters18 min

Reversed sessions, identical answers

is our example online store. Its ML team works on a notebook sample of about 1 million orders from 200,000 customers across 50,000 products. Joseph, who leads the growth team, wants a “Next for you” row: after a customer views a few products, show the products they are most likely to view next.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan