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

The Transformer decoder (Vaswani et al., 2017) contains an "encoder-decoder attention" sublayer in addition to its own masked self-attention sublayer. Where do the queries, keys, and values for this encoder-decoder attention sublayer come from?

  1. The queries come from the decoder's own previous sublayer, while the keys and values come from the output of the encoder stack, letting every decoder position attend over the entire input sequence
  2. The queries, keys, and values all come from the encoder's final layer, and the decoder only reads the resulting attention output without contributing any of its own vectors
  3. The queries and keys come from the encoder output while the values come from the decoder's own previous sublayer, reversing the usual roles of queries and keys
  4. The queries, keys, and values all come from the decoder's own previous sublayer, identical to the masked self-attention sublayer that precedes it
Next card → Shuffle