Attention and Transformers
- 71Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What major capability do recurrent neural networks add compared with networks designed primarily for one-to-one image tasks?
What major capability do recurrent neural networks add compared with networks designed primarily for one-to-one image tasks?
71 questions
- 1
What major capability do recurrent neural networks add compared with networks designed primarily for one-to-one image tasks?
- A
They replace all learned parameters with manually specified rules
- B
They restrict neural networks to image classification problems
- C
They guarantee that every input sequence has the same fixed length
- D
They process sequences and support mappings involving multiple inputs or outputs
Correct answer
DThey process sequences and support mappings involving multiple inputs or outputs
Explanation
Recurrent neural networks process sequential data, enabling one-to-many, many-to-one, and sequence-to-sequence problems in addition to one-to-one tasks.
- A
- 2
Which example best represents a one-to-many problem?
- A
Inputting a sequence of frames and producing one classification
- B
Inputting one image and producing one class label
- C
Inputting an English sentence and producing one sentiment score
- D
Inputting an image and generating a sequence of words describing it
Correct answer
DInputting an image and generating a sequence of words describing it
Explanation
Image captioning takes one image as input and generates a sequence of words, making it a one-to-many problem.
- A
- 3
Which example best represents a many-to-one problem?
- A
Inputting one word and generating a sequence of translated words
- B
Inputting one image and producing one classification label
- C
Inputting one image and generating a sequence of caption words
- D
Inputting a sequence of video frames and producing one classification
Correct answer
DInputting a sequence of video frames and producing one classification
Explanation
A many-to-one task maps a sequence of inputs, such as video frames, to a single output classification.
- A
- 4
Why is translation a sequence-to-sequence problem?
- A
It maps one word to a fixed-dimensional numerical feature
- B
It maps one image to one class label in the same representation
- C
It maps many frames to one label without generating a sequence
- D
It maps a sequence of words in one language to a sequence of words in another
Correct answer
DIt maps a sequence of words in one language to a sequence of words in another
Explanation
Machine translation receives an input word sequence, such as English, and produces an output word sequence, such as Italian or French.
- A
- 5
Why can translation not generally rely on a position-by-position correspondence between source and target words?
- A
Every translated word must correspond to exactly one source character
- B
The source and target languages always contain the same number of words
- C
The target sentence is generated without using any source information
- D
The two languages may differ in both sentence length and word order
Correct answer
DThe two languages may differ in both sentence length and word order
Explanation
The number and order of words can differ between languages, so translation requires a flexible sequence-processing architecture.
- A
- 6
What distinguishes a recurrent neural network unit from a standard feed-forward unit in sequence processing?
- A
It uses the current input together with the previous hidden state
- B
It requires the entire sequence to be presented simultaneously
- C
It uses fixed, non-learnable weights at every time step
- D
It uses only the current input and discards all previous information
Correct answer
AIt uses the current input together with the previous hidden state
Explanation
An RNN unit receives the current input xt​ and the previous hidden state ht−1​, then produces a new hidden state.
- A
- 7
What does applying the same recurrent unit repeatedly across time allow an RNN to process?
- A
Only sequences containing exactly one token
- B
Sequences whose lengths can vary across examples
- C
Sequences whose length must equal the hidden-state dimension
- D
Only images with a fixed spatial resolution
Correct answer
BSequences whose lengths can vary across examples
Explanation
The recurrent unit is reused at successive time steps, allowing it to process sequences of potentially variable length.
- A
- 8
Why are transformers considered broadly useful across modern deep-learning applications?
- A
They eliminate the need for training data in all large-scale applications
- B
They are restricted to translating short sentences between closely related languages
- C
They can serve as large, data-trained architectures for text, images, audio, and other tasks
- D
They are designed only for classifying two-dimensional images
Correct answer
CThey can serve as large, data-trained architectures for text, images, audio, and other tasks
Explanation
The lecture identifies transformers as the dominant architecture for many large, state-of-the-art applications involving text, images, audio, and more.
- A
- 9
What is the role of the encoder in a recurrent sequence-to-sequence model?
- A
It generates the output tokens without receiving any hidden state
- B
It processes the input sequence and summarizes it for the decoder
- C
It compares only the first and last tokens of the input sequence
- D
It converts every output token directly into an image
Correct answer
BIt processes the input sequence and summarizes it for the decoder
Explanation
The encoder RNN processes the input sequence and creates a representation that the decoder can use to generate the target sequence.
- A
- 10
In the basic encoder-decoder RNN described, what does the context vector usually represent?
- A
A fixed-dimensional summary based on the encoder's final hidden state
- B
A probability distribution over the output vocabulary at every step
- C
A variable-length list containing every raw input token
- D
The decoder's previous output token without any source information
Correct answer
AA fixed-dimensional summary based on the encoder's final hidden state
Explanation
The context vector is commonly formed from the encoder's last hidden state, which is intended to summarize the entire input sequence.
- A
- 11
Which inputs does the decoder RNN unit receive at each output time step in the basic model?
- A
The entire target sequence and the decoder's final state
- B
Only the previous output token and a fixed classification label
- C
The previous output token, previous decoder state, and context vector
- D
Only the current source token and the encoder's initial state
Correct answer
CThe previous output token, previous decoder state, and context vector
Explanation
The decoder receives yt−1​, the previous decoder hidden state st−1​, and the context vector C.
- A
- 12
Why does the basic encoder-decoder architecture create a communication bottleneck?
- A
The encoder is unable to process more than one input token
- B
The decoder receives every encoder hidden state independently at every output step
- C
The output sequence must always have the same length as the input sequence
- D
All information from the input sequence must pass through one fixed-length context vector
Correct answer
DAll information from the input sequence must pass through one fixed-length context vector
Explanation
The input and output sequences communicate only through the single fixed-length vector C, creating a bottleneck as sequences become longer.
- A
- 13
Why does the fixed context vector become problematic for very long sequences?
- A
A fixed-size representation may be unable to preserve all relevant information from a long input
- B
The encoder loses the ability to apply the same recurrent unit repeatedly
- C
The context vector automatically grows so large that it cannot be stored
- D
Long sequences prevent the decoder from producing any output token
Correct answer
AA fixed-size representation may be unable to preserve all relevant information from a long input
Explanation
The vector's dimensionality remains fixed even as the input grows, making it increasingly unreasonable to expect it to summarize an entire paragraph, book, or corpus.
- A
- 14
What architectural change addresses the fixed-vector bottleneck in an encoder-decoder RNN?
- A
Force the encoder to compress the input into an even smaller vector
- B
Allow the decoder to look back at the full input sequence at every output step
- C
Require the decoder to generate all output tokens simultaneously
- D
Remove the input sequence after computing the first decoder state
Correct answer
BAllow the decoder to look back at the full input sequence at every output step
Explanation
Attention gives the decoder access to the input sequence repeatedly, allowing it to compute a new summary for each output step.
- A
- 15
What is the purpose of an alignment score in an attention-based decoder?
- A
It measures how well a decoder state matches each encoder hidden state
- B
It determines the fixed dimensionality of the decoder's weight matrices
- C
It measures the number of recurrent steps remaining in the sequence
- D
It directly specifies the correct output token without learning
Correct answer
AIt measures how well a decoder state matches each encoder hidden state
Explanation
An alignment score is computed for each input position to estimate how relevant that encoder state is to the current decoder state.
- A
- 16
How can a simple learned alignment function produce one score for a decoder state and an encoder state?
- A
It averages all output tokens and compares the result with the input length
- B
It multiplies the two states element by element and keeps the entire resulting vector
- C
It applies a hard threshold to the decoder state without using the encoder state
- D
It concatenates the two states and applies a learned linear transformation to a scalar
Correct answer
DIt concatenates the two states and applies a learned linear transformation to a scalar
Explanation
The described function concatenates the decoder hidden state and an encoder hidden state, then applies a learned linear layer that outputs a scalar.
- A
- 17
Why is softmax applied to the alignment scores?
- A
It converts arbitrary scores into nonnegative weights that sum to one
- B
It forces all input positions to receive exactly equal weight
- C
It converts every score into an unrestricted negative or positive value
- D
It removes the need for any learned alignment function
Correct answer
AIt converts arbitrary scores into nonnegative weights that sum to one
Explanation
Softmax transforms the alignment scores into a probability-like distribution whose entries lie between 0 and 1 and sum to 1.
- A
- 18
How is an attention context vector computed from encoder hidden states?
- A
It is formed by selecting the longest encoder state without weighting
- B
It is always equal to the encoder's first hidden state
- C
It is produced by concatenating all encoder states without any learned weights
- D
It is a weighted linear combination of encoder states using attention weights
Correct answer
DIt is a weighted linear combination of encoder states using attention weights
Explanation
The context vector is computed as a linear combination of the encoder hidden states, weighted by the attention distribution.
- A
- 19
Why might a decoder assign higher attention weights to the source words corresponding to a word it is currently generating?
- A
The decoder is explicitly given a human-provided word alignment
- B
Every output word must attend equally to every source word
- C
Attention weights are required to be largest for the first source word
- D
Those source words may contain the information most relevant to predicting the current output
Correct answer
DThose source words may contain the information most relevant to predicting the current output
Explanation
Attention allows the decoder to emphasize source words that are useful for producing the current target word, such as focusing on relevant words during translation.
- A
- 20
How is attention learning performed in the translation model described?
- A
The decoder learns attention only after the output sequence is manually reordered
- B
The attention mechanism is learned end to end through gradient descent on the output prediction task
- C
Human annotators must label the source words used for every target word
- D
The alignment weights are fixed randomly and never updated
Correct answer
BThe attention mechanism is learned end to end through gradient descent on the output prediction task
Explanation
The entire computation graph is differentiable, so the model learns attention weights indirectly through the output-token loss and gradient descent.
- A
- 21
What loss provides the training signal for learning attention in the sequence-to-sequence example?
- A
A loss that directly compares human-labeled alignment matrices
- B
A classification loss for identifying the source language only
- C
A reconstruction loss for reproducing the encoder's initial state
- D
A cross-entropy loss for predicting the target sequence tokens
Correct answer
DA cross-entropy loss for predicting the target sequence tokens
Explanation
The network is trained to predict the correct output tokens using a cross-entropy and softmax objective, and attention is learned as part of that process.
- A
- 22
Which statement correctly distinguishes decoder weight initialization from decoder-state initialization?
- A
Weights are learned parameters, whereas the initial hidden state is set when processing each sequence
- B
Weights are recomputed at every time step, whereas the initial state is fixed during all training
- C
Weights are output tokens, whereas the initial state is an alignment score
- D
Weights and the initial state are identical objects with the same role
Correct answer
AWeights are learned parameters, whereas the initial hidden state is set when processing each sequence
Explanation
Decoder weights are typically initialized randomly and learned by gradient descent. Separately, an initial decoder state must be chosen for each processed sequence.
- A
- 23
Which is one possible method for setting the decoder's initial hidden state?
- A
Use the attention distribution from a decoder state that does not yet exist
- B
Always use the first target token before the target sequence has been generated
- C
Use zeros, the encoder's final state, or a learned projection of the encoder's final state
- D
Set the state equal to the number of words in the source sentence
Correct answer
CUse zeros, the encoder's final state, or a learned projection of the encoder's final state
Explanation
Possible strategies include initializing the state to zeros, using the encoder's final state, or applying a learned projection from the encoder's final state.
- A
- 24
What changes when the decoder advances from one output step to the next in an attention-based RNN?
- A
It reuses one context vector permanently for the entire output sequence
- B
It discards the encoder states after generating the first output token
- C
It computes attention only over previously generated output tokens
- D
It computes a new alignment distribution and a new context vector using the new decoder state
Correct answer
DIt computes a new alignment distribution and a new context vector using the new decoder state
Explanation
At every decoder step, the current decoder state is compared with all encoder states to produce a new attention distribution and context vector.
- A
- 25
What information does an attention visualization matrix show in a translation task?
- A
The raw pixel values associated with each translated word
- B
The number of recurrent layers used to encode each target word
- C
The attention distribution over source words for each generated target word
- D
The learned vocabulary size for each source word in the sentence
Correct answer
CThe attention distribution over source words for each generated target word
Explanation
Each row can represent the distribution over the input sentence predicted while generating one output word.
- A
- 26
What does a diagonal pattern in an attention matrix usually indicate?
- A
An equal attention weight assigned to every source word
- B
A requirement that every target word attend to the final source word
- C
A complete lack of correspondence between the two languages
- D
A mostly order-preserving correspondence between source and target words
Correct answer
DA mostly order-preserving correspondence between source and target words
Explanation
Diagonal structures suggest that source and target words align in roughly the same order.
- A
- 27
What can a backward-diagonal pattern in an attention matrix suggest?
- A
The model is applying a convolutional kernel to the source sentence
- B
The model has learned a reversed or differently ordered correspondence between languages
- C
The model has learned that all source words are irrelevant
- D
The model is assigning equal probability to all possible translations
Correct answer
BThe model has learned a reversed or differently ordered correspondence between languages
Explanation
A backward diagonal can reflect a different word order between the source and target languages.
- A
- 28
What might a small two-by-two attention block indicate in a translation visualization?
- A
Several source and target words have a less perfectly one-to-one alignment
- B
The model has stopped computing attention for the remainder of the sentence
- C
The decoder has been initialized with an all-zero hidden state
- D
Every source word is aligned with exactly one target word in order
Correct answer
ASeveral source and target words have a less perfectly one-to-one alignment
Explanation
A block-like pattern can indicate that multiple words in one language correspond to multiple words in the other without perfect one-to-one disentanglement.
- A
- 29
In the generalized attention operator, what are the data vectors?
- A
Vectors that determine the order in which queries are generated
- B
Vectors representing only the model's learned scalar loss values
- C
Vectors containing information that can be summarized for the task
- D
Vectors that specify only the output vocabulary probabilities
Correct answer
CVectors containing information that can be summarized for the task
Explanation
In the original RNN setting, the encoder hidden states serve as data vectors that the attention mechanism summarizes.
- A
- 30
In the generalized attention operator, what is a query vector?
- A
A vector containing every data vector concatenated without comparison
- B
A vector used only to initialize the encoder's recurrent state
- C
A vector used to determine how the data vectors should be summarized for one output
- D
A vector that permanently stores the model's output vocabulary
Correct answer
CA vector used to determine how the data vectors should be summarized for one output
Explanation
A query represents the information needed to produce a particular output and is compared with the data vectors to determine relevance.
- A
- 31
What does the attention operator produce for each query vector?
- A
A new sequence whose length must exceed the number of data vectors
- B
A copy of the query vector with no contribution from the data
- C
An output vector formed by summarizing the data vectors according to query-dependent weights
- D
A fixed scalar that is independent of all data vectors
Correct answer
CAn output vector formed by summarizing the data vectors according to query-dependent weights
Explanation
Attention compares a query with the data, creates weights, and uses those weights to form an output summary vector.
- A
- 32
What is the simplest commonly used similarity function between a query and a key?
- A
The number of tokens in the source sequence
- B
Their dot product
- C
The maximum coordinate of the two vectors
- D
Their concatenation without any further operation
Correct answer
BTheir dot product
Explanation
Although many functions are possible in principle, the lecture introduces the dot product as a simple similarity measure.
- A
- 33
Why is the dot product scaled by the square root of the vector dimension in scaled dot-product attention?
- A
To ensure that every attention weight becomes exactly equal
- B
To allow dot products between vectors with unrelated dimensions
- C
To remove the need for query, key, and value projections
- D
To reduce overly sharp softmax behavior and help prevent vanishing gradients
Correct answer
DTo reduce overly sharp softmax behavior and help prevent vanishing gradients
Explanation
Scaling by the square root of the dimension helps maintain better gradient flow through the softmax as vector dimensions grow.
- A
- 34
Why are matrix multiplications useful when attention processes many queries and data vectors?
- A
They eliminate the need to calculate any similarity between queries and data
- B
They force the attention layer to process only one query at a time
- C
They efficiently compute all pairwise dot products and weighted combinations in parallel
- D
They guarantee that the input vectors have identical semantic meanings
Correct answer
CThey efficiently compute all pairwise dot products and weighted combinations in parallel
Explanation
A matrix multiplication computes many inner products at once, and another matrix multiplication forms the weighted combinations of value vectors.
- A
- 35
When attention handles multiple query vectors, what distribution is computed for each query?
- A
A distribution over the dimensions of the query vector only
- B
A distribution over the model's training examples
- C
A distribution over the data vectors or keys
- D
A distribution over the decoder layers rather than the input vectors
Correct answer
CA distribution over the data vectors or keys
Explanation
Each query receives its own softmax distribution over the available data vectors or keys.
- A
- 36
Why are keys and values introduced as separate projections of the data vectors?
- A
They make the query vectors unnecessary during attention computation
- B
They let the model learn separate representations for matching queries and producing retrieved outputs
- C
They eliminate all learned parameters from the attention layer
- D
They force the model to use the same representation for matching and retrieval
Correct answer
BThey let the model learn separate representations for matching queries and producing retrieved outputs
Explanation
Keys are compared with queries to compute alignment, while values are combined to produce the output, allowing these two roles to be learned separately.
- A
- 37
What does the key projection do in a cross-attention layer?
- A
It transforms each query into the final output without using the data
- B
It transforms each data vector into a representation compared with the queries
- C
It determines the number of output time steps in the decoder
- D
It converts attention weights into target-language tokens directly
Correct answer
BIt transforms each data vector into a representation compared with the queries
Explanation
The key matrix projects data vectors into keys, which are compared with query vectors to obtain similarity scores.
- A
- 38
What does the value projection do in a cross-attention layer?
- A
It computes the similarity scores while ignoring the query vectors
- B
It transforms each data vector into a representation that is weighted to form outputs
- C
It converts each output token into a source-language word
- D
It determines the initial hidden state of the encoder
Correct answer
BIt transforms each data vector into a representation that is weighted to form outputs
Explanation
The value vectors are combined using the attention weights to produce the attention layer's output vectors.
- A
- 39
Which situation most naturally calls for cross-attention?
- A
Normalizing each feature independently without comparing any vectors
- B
Applying a linear classifier to one already-computed feature vector
- C
Generating text from an image by relating image representations to text-generation queries
- D
Processing only one collection of image patches with no second input source
Correct answer
CGenerating text from an image by relating image representations to text-generation queries
Explanation
Cross-attention is useful when two distinct sets of vectors interact, such as image features and text-generation states.
- A
- 40
What is the defining input structure of a self-attention layer?
- A
Only scalar inputs are accepted, so vector comparisons are impossible
- B
A recurrent hidden state must be supplied before any attention computation
- C
Two unrelated sets of vectors are required to generate queries and values
- D
One set of input vectors is used to generate queries, keys, and values
Correct answer
DOne set of input vectors is used to generate queries, keys, and values
Explanation
Self-attention derives queries, keys, and values from the same input sequence or set of vectors.
- A
- 41
How does self-attention differ from cross-attention in its use of input representations?
- A
Self-attention requires recurrence, whereas cross-attention cannot use learned weights
- B
Self-attention computes one scalar, whereas cross-attention always computes a classification label
- C
Self-attention derives queries, keys, and values from one input set, whereas cross-attention uses distinct sets
- D
Self-attention uses no values, whereas cross-attention uses no keys
Correct answer
CSelf-attention derives queries, keys, and values from one input set, whereas cross-attention uses distinct sets
Explanation
Cross-attention relates two sets, while self-attention projects one set into queries, keys, and values and relates the elements within that set.
- A
- 42
Why might image classification use self-attention rather than cross-attention?
- A
Self-attention is used only when the input contains words in two languages
- B
Cross-attention cannot compute weighted combinations of image representations
- C
The relevant inputs are image regions that need to interact with one another within one set
- D
Image classification always requires an independent target sentence as a second input
Correct answer
CThe relevant inputs are image regions that need to interact with one another within one set
Explanation
When there is one set of inputs, such as image patches, self-attention allows the elements of that set to exchange information.
- A
- 43
What happens to self-attention outputs if the input vectors are permuted while the weights remain fixed?
- A
The output vectors become independent random vectors with new values
- B
All output vectors collapse into one identical vector
- C
The attention layer becomes unable to compute any output
- D
The same output vectors are produced in the corresponding permuted order
Correct answer
DThe same output vectors are produced in the corresponding permuted order
Explanation
Because the operations are permutation-equivariant, permuting the inputs permutes the outputs in the same way.
- A
- 44
Why is self-attention described as operating on sets rather than inherently ordered sequences?
- A
It always sorts the inputs alphabetically before processing them
- B
It uses recurrence to remember the order of previously processed vectors
- C
It requires every sequence to contain exactly one vector
- D
Its computation does not depend on the order in which the input vectors are presented
Correct answer
DIts computation does not depend on the order in which the input vectors are presented
Explanation
Without an added positional signal, self-attention produces corresponding outputs regardless of how the input vectors are ordered.
- A
- 45
What problem results from self-attention's lack of inherent order information when processing language?
- A
The model cannot represent more than one word at a time
- B
The model is forced to use a recurrent unit after every attention operation
- C
The model may not know the positions of words in the sequence
- D
The model cannot compute dot products between any two words
Correct answer
CThe model may not know the positions of words in the sequence
Explanation
Self-attention alone is insensitive to ordering, so language models need an additional signal indicating each token's position.
- A
- 46
What is the purpose of a positional embedding?
- A
It replaces the value projection with a fixed classification vector
- B
It forces all vectors at different positions to have different dimensions
- C
It supplies information about where each input vector occurs in the sequence
- D
It prevents attention weights from being normalized by softmax
Correct answer
CIt supplies information about where each input vector occurs in the sequence
Explanation
A positional embedding is concatenated or added to an input representation to communicate its sequence index or position.
- A
- 47
What does masked self-attention accomplish?
- A
It restricts which input positions are allowed to influence each output position
- B
It allows the model to inspect future tokens specifically to improve training accuracy
- C
It removes all attention weights before the output projection
- D
It guarantees that every input position attends equally to every other position
Correct answer
AIt restricts which input positions are allowed to influence each output position
Explanation
Masked self-attention modifies selected alignment scores so that particular interactions are blocked.
- A
- 48
Why are negative infinities inserted into selected attention scores during masking?
- A
Their softmax probabilities become zero, preventing those positions from contributing
- B
They make the corresponding queries and keys identical
- C
Their softmax probabilities become one, forcing attention to those positions
- D
They increase the magnitude of the corresponding value vectors
Correct answer
ATheir softmax probabilities become zero, preventing those positions from contributing
Explanation
A score of negative infinity receives probability zero after softmax, so the associated value cannot affect the output.
- A
- 49
Why is masking useful for autoregressive language modeling?
- A
It prevents an output at position t from using future input tokens
- B
It ensures that the model attends only to the final token
- C
It allows each output to use every future token before it is generated
- D
It replaces the language-modeling loss with an image-classification loss
Correct answer
AIt prevents an output at position t from using future input tokens
Explanation
For autoregressive prediction, the output at position t should depend only on the current and earlier tokens, not on future tokens.
- A
- 50
What is multi-headed self-attention?
- A
Several independent self-attention copies run in parallel and their outputs are fused
- B
Several recurrent networks process the same sequence one after another
- C
One attention head assigns a separate scalar to every model parameter
- D
One self-attention layer runs repeatedly with exactly the same weights
Correct answer
ASeveral independent self-attention copies run in parallel and their outputs are fused
Explanation
Multi-headed self-attention routes the inputs through multiple independently parameterized attention heads and combines their outputs with a projection.
- A
- 51
What distinguishes different attention heads in a multi-headed layer?
- A
They receive different examples but cannot process the same input
- B
They use different input sequence lengths but no learned parameters
- C
They perform unrelated operations such as convolution and pooling
- D
They have different learned weights while sharing the same general computation
Correct answer
DThey have different learned weights while sharing the same general computation
Explanation
The heads use the same attention architecture but have separately initialized and learned weight matrices, allowing them to learn different transformations.
- A
- 52
Which feature makes self-attention highly parallelizable?
- A
Its main computations can be expressed as large batched matrix multiplications
- B
It processes only one vector during the entire forward pass
- C
It uses manually ordered symbolic rules instead of numerical operations
- D
Each output must wait for the previous output's hidden state
Correct answer
AIts main computations can be expressed as large batched matrix multiplications
Explanation
The projections, similarity calculations, value combinations, and output mixing can be implemented with batched matrix multiplications.
- A
- 53
Why are recurrent neural networks difficult to parallelize across a sequence?
- A
They discard all previous hidden states before computing the next one
- B
They use only matrix multiplications, which cannot run on parallel hardware
- C
They require every input to be independently compared with every other input
- D
Each hidden state depends on the hidden state computed at the previous time step
Correct answer
DEach hidden state depends on the hidden state computed at the previous time step
Explanation
The recurrence creates a sequential dependency from one time step to the next, preventing straightforward parallel computation across positions.
- A
- 54
What type of structure does convolution primarily operate on?
- A
Single scalar outputs without any input geometry
- B
Only variable-length word sequences with no spatial arrangement
- C
Unordered sets with no local neighborhood structure
- D
Multi-dimensional grids such as image grids
Correct answer
DMulti-dimensional grids such as image grids
Explanation
Convolution operates on grids, including one-dimensional, two-dimensional, and higher-dimensional grids.
- A
- 55
What is a key limitation of convolution for modeling very long-range relationships?
- A
It cannot be computed at multiple spatial positions in parallel
- B
It automatically gives every input position access to every other position in one small kernel
- C
It mixes information locally and may require large kernels or many layers for a large receptive field
- D
It can process only one-dimensional inputs
Correct answer
CIt mixes information locally and may require large kernels or many layers for a large receptive field
Explanation
Convolution has local receptive fields, so broad information exchange requires large kernels or stacking many layers.
- A
- 56
What is a major computational advantage of self-attention over recurrence?
- A
All positions can interact in one layer using operations that are highly parallelizable
- B
It requires more sequential steps than an RNN for every sequence
- C
It reduces every input sequence to one fixed vector before processing
- D
It eliminates all computation involving pairwise interactions
Correct answer
AAll positions can interact in one layer using operations that are highly parallelizable
Explanation
A self-attention layer allows every vector to attend to every other vector in a single operation, implemented efficiently with matrix multiplications.
- A
- 57
What is the main computational cost of standard self-attention for a sequence of length n?
- A
Its cost grows only linearly because each vector sees one neighbor
- B
Its cost decreases as the sequence length increases
- C
Its pairwise interactions require approximately quadratic compute and memory in n
- D
Its cost is always constant regardless of the sequence length
Correct answer
CIts pairwise interactions require approximately quadratic compute and memory in n
Explanation
Standard self-attention compares each query with every key, leading to approximately n2 computation and memory for sequence length n.
- A
- 58
Why can a large amount of computation be beneficial in a neural network despite higher computational cost?
- A
More computation automatically makes every prediction mathematically correct
- B
More computation guarantees that the model will need no training data
- C
Higher computational cost removes the need for learned parameters
- D
More computation can give the model greater capacity to process and reason about its inputs
Correct answer
DMore computation can give the model greater capacity to process and reason about its inputs
Explanation
The lecture notes that increased computation can provide more capacity and allow a network to perform more processing, even though it is more expensive.
- A
- 59
What is the central computational primitive of a transformer?
- A
A single convolutional kernel
- B
A fixed-size recurrent bottleneck
- C
Self-attention
- D
A manually programmed alignment table
Correct answer
CSelf-attention
Explanation
Transformers are neural-network architectures that place self-attention at the core of their computation.
- A
- 60
What is the role of self-attention inside a transformer block?
- A
It converts the entire input into one scalar before normalization
- B
It allows the vectors in the representation to communicate and compare with one another
- C
It processes every vector independently without any interaction
- D
It replaces all subsequent feed-forward computation
Correct answer
BIt allows the vectors in the representation to communicate and compare with one another
Explanation
Self-attention allows all vectors to exchange information, providing global interactions within the representation.
- A
- 61
What is the role of the MLP or FFN inside a transformer block?
- A
It applies learned computation independently to each vector
- B
It determines the positional order without using learned parameters
- C
It computes pairwise similarities between every pair of vectors
- D
It replaces the attention weights with a recurrent hidden state
Correct answer
AIt applies learned computation independently to each vector
Explanation
The feed-forward network or MLP operates separately on each vector, complementing self-attention's cross-vector communication.
- A
- 62
How do residual connections and layer normalization contribute to transformer blocks?
- A
Residual connections remove all input information, while normalization creates sequence order
- B
Residual connections enforce causal masking, while normalization computes attention scores
- C
Residual connections support information flow, while normalization helps stabilize training
- D
Residual connections generate vocabulary tokens, while normalization replaces the MLP
Correct answer
CResidual connections support information flow, while normalization helps stabilize training
Explanation
Transformer blocks wrap attention and MLP components with residual connections and layer normalization, helping preserve information and make training more stable.
- A
- 63
What is a transformer in terms of its overall structure?
- A
A convolutional network with no normalization or residual connections
- B
A single recurrent unit applied once to the first input token
- C
A lookup table that maps each input token directly to an output token
- D
A sequence of transformer blocks containing self-attention and feed-forward components
Correct answer
DA sequence of transformer blocks containing self-attention and feed-forward components
Explanation
A transformer is built by stacking transformer blocks, each containing self-attention, an MLP or FFN, residual connections, and normalization.
- A
- 64
How can a transformer process an image?
- A
It can process only the image's first patch because attention is sequential
- B
It requires a separate recurrent unit for every pixel before any transformer operation
- C
It can divide the image into patches and project each patch into an input vector
- D
It must first convert the image into a single scalar before using attention
Correct answer
CIt can divide the image into patches and project each patch into an input vector
Explanation
For image applications, image patches can be separately projected into vectors that serve as transformer inputs.
- A
- 65
How can a transformer produce an image-classification prediction from patch representations?
- A
Convert every patch directly into a separate unrelated class label
- B
Pool the output vectors and pass the pooled representation through a linear classifier
- C
Use the input image dimensions as the only classification features
- D
Select the last patch and discard all other transformer outputs
Correct answer
BPool the output vectors and pass the pooled representation through a linear classifier
Explanation
The transformer produces an output for each patch; pooling these outputs and applying a linear layer yields class scores.
- A
- 66
Why can the same transformer-style architecture be applied to both language and images?
- A
Transformers require all inputs to be words before attention can operate
- B
Both can be represented as sets or sequences of vectors processed by the same attention machinery
- C
Images and language always have identical input dimensions and ordering
- D
The architecture uses different fundamental operations for every application
Correct answer
BBoth can be represented as sets or sequences of vectors processed by the same attention machinery
Explanation
Language tokens and image patches can both be embedded as vectors, allowing the same transformer primitives to process them.
- A
- 67
Why might the three projections for queries, keys, and values be fused into one matrix multiplication?
- A
Hardware often handles fewer large matrix multiplications more efficiently than many smaller ones
- B
Fusion removes the need for three distinct learned projections
- C
Fusion guarantees that queries, keys, and values have identical learned meanings
- D
Hardware cannot execute separate matrix multiplications for neural networks
Correct answer
AHardware often handles fewer large matrix multiplications more efficiently than many smaller ones
Explanation
Concatenating projection matrices permits one larger matrix multiplication, which is often more efficient on modern hardware.
- A
- 68
Why is parallelizability especially valuable when scaling neural networks?
- A
Parallel algorithms eliminate the need to distribute data across processors
- B
Parallel algorithms can use many processors when making individual processors faster is difficult
- C
Parallel algorithms require fewer operations than every possible sequential algorithm
- D
Parallelizability guarantees that all model parameters have the same value
Correct answer
BParallel algorithms can use many processors when making individual processors faster is difficult
Explanation
The lecture emphasizes that large computations can scale by using many processors or GPUs in parallel rather than relying on one increasingly fast processor.
- A
- 69
Which description best summarizes the historical motivation for attention?
- A
Attention originated as a method for replacing softmax with a hard threshold
- B
Attention developed as a way to overcome the fixed-context bottleneck in recurrent sequence-to-sequence models
- C
Attention was introduced to make convolutional kernels operate on image pixels
- D
Attention was designed primarily to eliminate all training data from translation
Correct answer
BAttention developed as a way to overcome the fixed-context bottleneck in recurrent sequence-to-sequence models
Explanation
The lecture presents attention as emerging from efforts to let an RNN decoder access relevant parts of the input sequence instead of relying on one fixed context vector.
- A
- 70
What does attention make possible that the basic encoder-decoder bottleneck does not?
- A
It prevents the decoder from using any information from the input sequence
- B
It forces every output step to use exactly the same source representation
- C
It requires the source and target sequences to have identical lengths
- D
It lets each output step dynamically summarize the full input sequence in a different way
Correct answer
DIt lets each output step dynamically summarize the full input sequence in a different way
Explanation
Attention computes a new, query-dependent context vector at each output step, avoiding reliance on one fixed summary.
- A
- 71
What makes the attention mechanism interpretable to some extent?
- A
It exposes the exact causal reason for every parameter update
- B
It provides a guaranteed verbal explanation generated by the model designer
- C
It uses hard-coded linguistic grammar to label every alignment
- D
Its learned attention weights reveal which input positions receive emphasis for each output
Correct answer
DIts learned attention weights reveal which input positions receive emphasis for each output
Explanation
Visualizing attention weights can show which source positions the model emphasized while producing particular outputs, although this is not a complete explanation of the model.
- A

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