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

Extending a transformer-based language model's context window to accept much longer input sequences is architecturally expensive without further modifications to the standard attention mechanism. What property of self-attention, as defined by Vaswani et al. (2017), causes this?

  1. Compute and memory for self-attention scale linearly with sequence length, so extending the context window costs proportionally the same amount regardless of length
  2. The context window is limited only by the size of the token vocabulary, not by any property of the attention computation itself
  3. Self-attention's cost depends solely on the number of stacked layers in the model and is unaffected by how many tokens are in the input sequence
  4. Self-attention computes a pairwise compatibility score between every two positions in the sequence, so both compute and memory scale quadratically with sequence length, making much longer context windows substantially more expensive
Next card → Shuffle