Self-Attention and Transformers
- 64Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
64 questions
- 1The main bottleneck that motivated attention in machine translation was the need to encode the entire source sentence into_____.
Hint
Attention was introduced to avoid compressing all source information into one fixed-size representation.
Answer
a single vector
- 2In an RNN, words that occur far apart have a large_____interaction distance because information must pass through intermediate recurrent steps.
Hint
The problem is named for the sequential left-to-right or right-to-left structure of recurrence.
Answer
linear
- 3In the sentence “The chef who went to the store ... was ...,” learning the relationship between “chef” and “was” is difficult because the dependency is_____.
Hint
The relevant words are separated by many intervening words.
Answer
long distance
- 4Although LSTMs model gradients across long distances better than simple RNNs, their handling of long-distance dependencies is_____.
Hint
The lecture noted that LSTMs improve the problem but do not eliminate it.
Answer
not perfect
- 5The hidden state at time step five in a recurrent network cannot be computed before the hidden state at time step_____.
Hint
A recurrent computation depends directly on the immediately preceding state.
Answer
four
- 6The number of sequentially dependent, unparallelizable operations in an RNN grows with the_____of the input.
Hint
Longer sequences require more recurrent steps before later states can be computed.
Answer
sequence length
- 7The dependence of RNN computation on the sequence index is also commonly described as dependence on_____.
Hint
Each recurrent state corresponds to a particular position in the sequence.
Answer
time
- 8Attention represents each word as a_____that accesses and incorporates information from a set of values.
Hint
In the key-value lookup analogy, this object asks which stored information is relevant.
Answer
query
- 9In an ordinary lookup table, a query that exactly matches a key returns the key's associated_____.
Hint
A dictionary maps keys to what is stored under them.
Answer
value
- 10Unlike an exact dictionary lookup, attention compares a query with_____keys and matches them softly.
Hint
Attention computes similarities rather than selecting only one exact match.
Answer
all
- 11The similarity scores in attention are converted into weights between zero and one using a_____.
Hint
This function normalizes a set of scores into a probability-like distribution.
Answer
softmax
- 12The output of attention is formed by taking a_____sum of the value vectors.
Hint
Each value contributes according to the similarity between its key and the query.
Answer
weighted
- 13In self-attention, the query, key, and value for each word are produced by transforming its non-contextual word embedding with three different_____.
Hint
These are learned linear transformations commonly denoted by Q, K, and V.
Answer
weight matrices
- 14If a word embedding has dimensionality D, multiplying it by a key matrix maps it to a key vector of dimensionality_____.
Hint
In the basic formulation, the query, key, and value transformations preserve dimensionality.
Answer
D
- 15The attention score between a query for one word and a key for another word is computed using their_____.
Hint
The score measures alignment between two vectors through multiplication and summation.
Answer
dot product
- 16A word's self-attention representation is computed by summing the value vectors for all words, weighted by their_____with that word's query.
Hint
These weights come from normalized query-key similarities.
Answer
attention weights
- 17Self-attention can be interpreted as a fuzzy lookup in a_____store.
Hint
This analogy uses queries to softly retrieve stored values through keys.
Answer
key-value
- 18When all word embeddings are stacked into a matrix, the sequence representation has shape_____.
Hint
The first dimension indexes sequence positions and the second indexes embedding dimensions.
Answer
n by D
- 19Multiplying the stacked sequence matrix by the query, key, or value matrix applies the same transformation to every word using one large_____.
Hint
This avoids explicitly looping over sequence positions.
Answer
matrix multiply
- 20The softmax in matrix-form self-attention is applied across the dimension representing the possible_____positions.
Hint
For each query, the scores must be normalized over the positions it may attend to.
Answer
key
- 21After the attention weights are computed, multiplying them by the stacked value matrix produces the complete self-attention_____.
Hint
This operation performs all weighted averages at once.
Answer
output
- 22Computing all pairwise interactions in self-attention requires memory and computation that grow_____with sequence length.
Hint
The score matrix has one entry for every pair of positions.
Answer
quadratically
- 23The matrix-vector formulation of self-attention is especially useful because GPUs can perform the operations_____.
Hint
Vectorization allows many position-wise calculations to be grouped together.
Answer
in parallel
- 24Multi-head attention allows different attention mechanisms to examine different parts of a sequence for different_____.
Hint
One head might focus on syntactic relations while another focuses on entities or context.
Answer
reasons
- 25In multi-head attention, each head has an independent query, key, and_____matrix.
Hint
The three transformations correspond to the three roles in key-query-value attention.
Answer
value
- 26If the model dimensionality is D and there are H heads, each head typically operates in a space of dimensionality_____.
Hint
The model representation is divided among the heads.
Answer
D divided by H
- 27After each attention head produces an output, the outputs are_____together along their feature dimension.
Hint
The separate head representations are joined into one larger representation.
Answer
concatenated
- 28A final linear transformation is applied after concatenating the attention heads to_____their information together.
Hint
The transformation combines the specialized representations into the model's output space.
Answer
mix
- 29The number of attention heads is often scaled with model dimensionality so that each head has a reasonable number of_____.
Hint
The lecture gave values such as 64 or 128 dimensions per head as an intuition.
Answer
dimensions
- 30The fact that different attention heads often learn different roles is called head_____.
Hint
Different heads may focus on syntactic dependencies, averaging context, or other patterns.
Answer
specialization
- 31Scaled dot-product attention divides attention scores by a constant based on the head's model_____.
Hint
The scaling compensates for the tendency of dot products to grow in high-dimensional spaces.
Answer
dimensionality
- 32Without scaling, large dot products can make the softmax distribution too peaked and cause the_____to become small.
Hint
The problem concerns learning difficulty when softmax inputs have very large magnitudes.
Answer
gradients
- 33Plain self-attention has no inherent notion of the_____of words in a sequence.
Hint
Reordering the same set of word embeddings would otherwise produce the same corresponding representations.
Answer
order
- 34Without position information, self-attention would give the same representations to sequences containing the same words in different_____.
Hint
For example, “Zuko made his uncle” and “his uncle made Zuko” would be indistinguishable.
Answer
orders
- 35A position vector can be added to a word embedding so the representation contains both word identity and sequence_____.
Hint
The added vector indicates whether the word is at position one, two, three, and so on.
Answer
position
- 36Sinusoidal positional representations use sine and cosine functions with different_____across dimensions.
Hint
Different periodic patterns allow position vectors to vary across dimensions.
Answer
periods
- 37A learned positional representation can be implemented as a matrix with dimensions equal to model dimensionality by maximum_____length.
Hint
The matrix contains one learned vector for each possible position up to a fixed limit.
Answer
sequence
- 38A limitation of learned absolute position embeddings is that the model cannot directly process sequences longer than the maximum_____length used to learn them.
Hint
Only a fixed number of position vectors are available.
Answer
sequence
- 39In autoregressive decoding, attention must be masked so that a word cannot attend to words in the_____.
Hint
The model should predict the next word without seeing the answer in advance.
Answer
future
- 40Future attention scores are effectively set to_____before the softmax operation.
Hint
This value becomes zero after softmax.
Answer
negative infinity
- 41Causal masking permits a position to attend to itself and positions at_____indices.
Hint
The decoder may use the current and preceding context, but not later tokens.
Answer
earlier
- 42Self-attention alone repeatedly averages value vectors, so a feed-forward network is added to provide_____and nonlinear expressivity.
Hint
This component supplies the traditional deep-learning transformations missing from pure weighted averaging.
Answer
nonlinearities
- 43The feed-forward network applied after self-attention processes each word position_____.
Hint
Self-attention mixes information across positions; the following network operates separately on each resulting vector.
Answer
independently
- 44A residual connection adds a layer's output to its_____.
Hint
The skip path carries the representation around the layer.
Answer
input
- 45Residual connections help gradients flow through a layer because the skip path implements the_____function.
Hint
The input is passed directly along the shortcut without a learned transformation.
Answer
identity
- 46Residual connections can make a network easier to optimize because the layer initially needs to learn only the_____from the previous representation.
Hint
The layer models the difference between the desired transformation and simply copying its input.
Answer
residual
- 47Layer normalization normalizes the coordinates of an individual word vector across its model_____.
Hint
The mean and standard deviation are computed across the features of one vector.
Answer
dimensions
- 48Layer normalization subtracts the vector's mean and divides by its standard deviation plus a small_____.
Hint
This small constant prevents numerical instability when variation is very small.
Answer
epsilon
- 49Unlike batch normalization, layer normalization computes its statistics independently for each_____.
Hint
The lecture emphasized that statistics are not shared across sequence positions or batch examples.
Answer
word vector
- 50A Transformer decoder block consists of masked multi-head self-attention followed by add-and-norm, then a feed-forward layer followed by another_____.
Hint
Each major sublayer is paired with a residual connection and layer normalization.
Answer
add-and-norm
- 51A Transformer encoder uses multi-head self-attention without causal_____because it can access the entire input sequence.
Hint
Unlike an autoregressive decoder, the encoder is allowed to use bidirectional context.
Answer
masking
- 52The Transformer decoder uses causal masking because it must generate a sequence_____.
Hint
Each next token is predicted from the tokens already generated.
Answer
autoregressively
- 53In an encoder-decoder Transformer, the decoder's masked self-attention is followed by an operation called_____attention.
Hint
This operation connects representations from the decoder to representations produced by the encoder.
Answer
cross
- 54In encoder-decoder cross attention, the decoder representations provide the_____.
Hint
The decoder asks which source information is relevant to generating the next target token.
Answer
queries
- 55In encoder-decoder cross attention, the encoder outputs provide the keys and_____.
Hint
The source sequence supplies the information that the decoder retrieves.
Answer
values
- 56The original Transformer architecture was presented in the paper titled “_____Is All You Need.”
Hint
The title emphasizes the central mechanism replacing recurrence.
Answer
Attention
- 57Transformers were more efficient to train than recurrent systems primarily because their computations are more_____.
Hint
They do not require walking through the sequence one recurrent step at a time.
Answer
parallelizable
- 58Transformers achieved strong early results in_____translation while training significantly more efficiently than recurrent systems.
Hint
This was the main application used to motivate attention in the lecture.
Answer
machine
- 59The parallelizability of Transformers made it possible to train on much more_____using faster GPUs.
Hint
The advantage concerned the amount of training material and available computation.
Answer
data
- 60Transformers helped enable the modern revolution in large-scale_____.
Hint
The lecture connected their scalability to training models before adapting them to tasks.
Answer
pre-training
- 61As datasets and computational resources grew, Transformers generally surpassed LSTMs across many modern NLP_____.
Hint
The comparison concerned progress and state-of-the-art systems in natural language processing.
Answer
advancements
- 62The principal computational drawback of standard self-attention is its_____dependence on sequence length.
Hint
Every position interacts with every other position.
Answer
quadratic
- 63Because of quadratic attention cost, processing an entire novel or Wikipedia page in one sequence can become_____.
Hint
The issue is that the required memory and computation become too large.
Answer
infeasible
- 64Research on replacing the quadratic attention operation with lower-cost alternatives remains an_____area of research.
Hint
The lecture described the question as unresolved rather than settled.
Answer
open

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