Positional embeddings inject token-position information into transformers, whose attention mechanism otherwise needs explicit sequence-order information. They are added to input token embeddings in both encoder and decoder stacks. section 11.3
The construction follows three constraints:
- Match the embedding dimensions so positional and token representations can be summed. section 11.3
- Make an identical word’s representation differ when its sequence position changes. section 11.3
- Support order-aware processing alongside self-attention, multihead attention, residual connections, and normalization layers. section 11.3
Figure 11.10 Transformer architecture
The transformer architecture diagram locates positional encodings at the input bottoms of the encoder and decoder stacks. section 11.3











