Transformer Attention Mechanism
- 23Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
23 questions
- 1The attention mechanism was introduced in the 2017 paper titled_____.
Hint
This paper's title summarizes the core idea that attention alone is sufficient for sequence modeling.
Answer
Attention is All You Need
- 2In a transformer, the input text is broken into pieces called_____.
Hint
These are commonly words or subwords that serve as the basic units of input.
Answer
tokens
- 3Each token is initially associated with a high-dimensional vector called its_____.
Hint
This vector encodes the token's identity and position, but initially lacks context.
Answer
embedding
- 4The goal of the attention mechanism is to_____embeddings so they encode contextual meaning beyond individual words.
Hint
Think of updating or refining the initial representations based on surrounding words.
Answer
adjust
- 5In the example with the word 'mole', attention allows the surrounding embeddings to pass information into the embedding of 'mole' because the initial embedding is the_____across different contexts.
Hint
Initially, the embedding does not depend on context; it is uniform for the same word.
Answer
same
- 6The query vector for a token is computed by multiplying the token's embedding by a matrix called the_____matrix.
Hint
This matrix is denoted Wq and projects embeddings into a smaller space.
Answer
query
- 7The key matrix produces vectors called_____that are matched against queries to determine relevance.
Hint
These answer queries; they are also in the same smaller space as queries.
Answer
keys
- 8The relevance between a key and a query is measured by their_____.
Hint
This operation yields a scalar that quantifies alignment between two vectors.
Answer
dot product
- 9The key and query vectors have a much smaller dimension than the embedding; in the example, they have dimension_____.
Hint
This number is much smaller than the embedding dimension (e.g., 12,288) to save parameters.
Answer
128
- 10After computing all key-query dot products, a_____function is applied column-wise to normalize the values between 0 and 1.
Hint
This converts the scores into a probability-like distribution per column.
Answer
softmax
- 11To prevent later tokens from influencing earlier ones,_____is applied by setting certain entries to negative infinity before softmax.
Hint
This ensures the attention pattern is causal (autoregressive).
Answer
masking
- 12The size of the attention pattern is the_____of the context size.
Hint
If the context has N tokens, there are N2 possible pairs.
Answer
square
- 13In cross-attention, the keys and queries come from_____datasets.
Hint
For example, one language vs. another in translation, or audio vs. text.
Answer
different
- 14The value matrix produces vectors that are_____to the embeddings of target tokens to update their meaning.
Hint
These value vectors represent the information to be transferred from one token to another.
Answer
added
- 15For efficiency, the value map is factored into two matrices: the value down matrix and the value_____matrix.
Hint
The second matrix maps from the smaller space back to the large embedding space.
Answer
up
- 16After computing the attention pattern, for each column we take a weighted_____of the value vectors from all tokens.
Hint
The weights come from the attention scores; this combined vector is added to the target embedding.
Answer
sum
- 17A full attention block in a transformer consists of_____attention heads run in parallel.
Hint
This allows the model to learn multiple distinct types of contextual relationships simultaneously.
Answer
multi-headed
- 18GPT-3 uses_____attention heads inside each block.
Hint
This number is the same as the number of layers in the full model.
Answer
96
- 19The proposed changes from each attention head are_____together and added to the original embedding for each position.
Hint
Combining all head outputs into a single update vector before addition.
Answer
summed
- 20For a single attention head, the key and query matrices have dimensions 128 by 12,288, each containing approximately_____million parameters.
Hint
Multiply 128 by 12,288 and convert to millions.
Answer
1.5
- 21With 96 heads, each block of multi-headed attention in GPT-3 ends up with around_____million parameters.
Hint
Multiply 6.3 million by 96.
Answer
600
- 22In GPT-3, the total number of parameters devoted to all attention heads across 96 layers is just under_____billion.
Hint
Multiply per-block parameters by 96 layers.
Answer
58
- 23One major advantage of the attention mechanism is that it is highly_____, enabling efficient use of GPUs for large-scale training.
Hint
This property allows many computations to happen simultaneously on modern hardware.
Answer
parallelizable

Ask anything
We've read this whole study set, so questions about it get the best answers.