passdrill
AI & LLM Engineering · How LLMs Work: Transformers & Training · Card 003/012 easy

The original Transformer architecture adds sinusoidal positional encodings to the input token embeddings before the first attention layer. Why is this necessary given how self-attention itself processes a sequence?

  1. Because the feed-forward sublayers in each block are recurrent and require explicit position indices to update their hidden state between positions
  2. Because self-attention computes a weighted sum over all positions regardless of order, so without added positional information the model would treat the input as an unordered set of tokens
  3. Because the token embedding layer cannot represent more than a fixed vocabulary size unless positional offsets are added to each embedding
  4. Because positional encodings replace the residual connections that would otherwise be required around each sublayer
Next card → Shuffle