Transformer Fundamentals: Attention, Positions and Normalization

Asked at OpenAI, Amazon, Apple · Research & Paper Understanding · Difficulty: Medium · Last asked Jun 29, 2026

Explain how a Transformer language model layer works and why it is built the way it is. The six parts below cover the cost of attention, the attention formula, heads, positional information, masking, and the residual, feed-forward and normalization structure of a layer. Use `n` for the sequence length, `d` for the model width, `h` for the number of heads and `d_k = d / h` for the width of one head.

Loading the problem…