The architecture behind the attention.
The full encoder–decoder Transformer, with the structure of Figure 1 from Attention Is All You Need. Select any block to follow its role.
Represent tokens and positions
Source tokens and shifted target tokens enter separate embedding paths. The original model scales embeddings by √d_model and adds sinusoidal positions before either stack.
Encoder self-attention · all source positions
Original base model: d_model = 512, 8 heads, d_k = d_v = 64. Post-norm; dropout is inside the residual branch. This map shows structure, not live model activations.
Explore positional encodingVaswani et al. · Figure 1Source-grounded structure, not a running language model. The original architecture uses post-normalization; the numerical lab in Study shows a separately labelled pre-norm variant.
Read the complete explanation and original figureThe architecture keeps evolving.
Follow the trade-off from exact GPU kernels to recurrent memory and sparse retrieval.
Same attention. Less memory traffic.
Tiles of Q, K and V move through fast on-chip memory. An online softmax combines their contributions without storing the full score or probability matrix in high-bandwidth memory.
- Dense score entries / head
- 16,777,216
- One 64 × 64 score tile
- 4,096
Element counts with fixed head width 64. Excludes model weights, other intermediates, batching and layers; not peak GPU memory or a speed benchmark.
Exact dense softmax attention up to floating-point rounding. Arithmetic remains quadratic in sequence length; this is not a linear-attention architecture. Dao et al., 2022