Transformers and Large Language Models
- 83Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
How did natural language processing systems in the 2010s typically handle different language tasks?
How did natural language processing systems in the 2010s typically handle different language tasks?
83 questions
- 1
How did natural language processing systems in the 2010s typically handle different language tasks?
- A
They used one general model for sentiment, translation, and entity recognition
- B
They relied exclusively on character-level models for every task
- C
They usually used a separate model for each specific use case
- D
They used transformer-based chatbots as the standard approach
Correct answer
CThey usually used a separate model for each specific use case
Explanation
The lecture describes the 2010s as a period when models were generally specialized for individual tasks, such as sentiment analysis, translation, or identifying names and locations.
- A
- 2
What was a major contribution of the transformer architecture introduced in 2017?
- A
It ensured models could learn without training data
- B
It eliminated the need to represent text as numbers
- C
It enabled a more scalable approach that could benefit from more data, compute, and parameters
- D
It made every language task require its own separately trained architecture
Correct answer
CIt enabled a more scalable approach that could benefit from more data, compute, and parameters
Explanation
The transformer was presented as a turning point because its architecture scaled effectively: increasing data, compute, and model parameters could produce substantial performance gains.
- A
- 3
Which development most directly helped bring modern large language models into use, according to the lecture?
- A
Replacing all text tokens with one-hot vectors permanently
- B
Removing training data and relying only on manually written rules
- C
Scaling transformer models in model size and in the number of training tokens
- D
Returning to one specialized recurrent model for every task
Correct answer
CScaling transformer models in model size and in the number of training tokens
Explanation
The lecture connects modern LLMs to scaling the transformer architecture, both in model size and in the amount of text used for training.
- A
- 4
Why was ChatGPT's 2022 release described as a product-level turning point?
- A
It introduced many people to interacting with a chatbot
- B
It removed the need for models to generate text
- C
It made recurrent neural networks the dominant architecture again
- D
It introduced the first use of neural networks for language
Correct answer
AIt introduced many people to interacting with a chatbot
Explanation
The lecture characterizes ChatGPT's release as a turning point because it brought chatbot interaction to a much wider audience.
- A
- 5
What broad shift does the lecture identify in the movement from conversational assistants toward coding agents?
- A
Language models are increasingly limited to sentiment classification
- B
Language models are increasingly being used to exhibit agentic behavior
- C
Language models have returned to processing one task per model
- D
Language models are no longer used to generate code
Correct answer
BLanguage models are increasingly being used to exhibit agentic behavior
Explanation
The lecture frames the transition from conversational LLMs to coding agents as an increase in agentic behavior and practical system use.
- A
- 6
What is tokenization in the context of language models?
- A
Assigning a final sentiment label to an entire document
- B
Combining several neural network layers into one computation
- C
Dividing text into units that can be represented for the model
- D
Converting model predictions into a human-readable explanation
Correct answer
CDividing text into units that can be represented for the model
Explanation
Tokenization divides text into discrete units, called tokens, that can then be represented numerically for a model.
- A
- 7
Why must text be represented numerically before a language model can process it?
- A
The model can process text only when each word has a unique spelling
- B
The model uses numerical representations only when producing classifications
- C
The model operates on numerical representations rather than directly understanding text
- D
The model requires every sentence to be translated into another language
Correct answer
CThe model operates on numerical representations rather than directly understanding text
Explanation
The lecture emphasizes that models process numbers, not text directly, so tokens need mathematical representations such as vectors.
- A
- 8
What is a vocabulary in tokenization?
- A
The set of labels a model can assign to a sentence
- B
The list of positions available in a training sequence
- C
The collection of hidden states produced during one prediction
- D
The set of tokens that a tokenizer is allowed to use
Correct answer
DThe set of tokens that a tokenizer is allowed to use
Explanation
A vocabulary specifies the possible tokens available to represent text under a particular tokenizer.
- A
- 9
What is the relationship between vocabulary choice and sequence length?
- A
Different vocabularies can divide the same text into different numbers of tokens
- B
Vocabulary choice affects token meaning but cannot affect sequence length
- C
A larger vocabulary always produces a longer token sequence
- D
Sequence length is fixed regardless of how text is tokenized
Correct answer
ADifferent vocabularies can divide the same text into different numbers of tokens
Explanation
Because tokenizers divide text differently depending on their vocabularies, the number of tokens representing the same text can vary.
- A
- 10
What is a key advantage of word-level tokenization?
- A
It prevents unseen words from occurring at inference time
- B
It always produces shorter sequences than subword tokenization
- C
It is simple and often interpretable because tokens correspond to whole words
- D
It guarantees that related word forms share the same representation
Correct answer
CIt is simple and often interpretable because tokens correspond to whole words
Explanation
Word-level tokenization can be simple and interpretable: a token directly corresponds to a word. The lecture also describes important drawbacks of this approach.
- A
- 11
Why can word-level tokenization lead to a very large vocabulary?
- A
The tokenizer must include a separate token for every sentence
- B
Word-level tokenization requires a unique token for every position
- C
Different forms of a word, such as singular and plural, may each require separate tokens
- D
Every word is divided into all of its individual letters
Correct answer
CDifferent forms of a word, such as singular and plural, may each require separate tokens
Explanation
Word-level vocabularies can grow because variations such as singular, plural, masculine, and feminine forms may be treated as distinct words.
- A
- 12
Why can word-level tokenization make it difficult to use knowledge about related words?
- A
All related words are forced to have identical representations
- B
The vocabulary contains no information about word identity
- C
Words are always split into individual characters
- D
Related forms such as “bear” and “bears” may be represented as separate tokens
Correct answer
DRelated forms such as “bear” and “bears” may be represented as separate tokens
Explanation
If related forms are separate tokens, the tokenizer itself does not ensure that they share information or receive similar representations.
- A
- 13
What is an out-of-vocabulary problem with word-level tokenization?
- A
A word is assigned too many different positions in the input sequence
- B
A word encountered at inference may not have appeared in training and may lack a learned representation
- C
A token is represented by a vector that is larger than the hidden state
- D
A model produces too many probabilities for a word already in its vocabulary
Correct answer
BA word encountered at inference may not have appeared in training and may lack a learned representation
Explanation
A word-level tokenizer may encounter a word at inference that was absent from its training corpus, leaving the model without a learned representation for that word.
- A
- 14
What is an advantage of character-level tokenization?
- A
It learns common multi-letter combinations without additional training
- B
It gives each complete word its own easily interpretable token
- C
It ensures that input sequences are shorter than word-level sequences
- D
It uses a small, fixed set of units and is robust to many unseen spellings
Correct answer
DIt uses a small, fixed set of units and is robust to many unseen spellings
Explanation
Character-level tokenization uses a relatively small set of characters and can represent novel or misspelled words using familiar character units.
- A
- 15
What is a major cost of character-level tokenization?
- A
It often creates long sequences that take more computation to process
- B
It requires a separate vocabulary entry for every possible word
- C
It prevents the model from processing text one character at a time
- D
It cannot represent misspelled words using known units
Correct answer
AIt often creates long sequences that take more computation to process
Explanation
A word becomes several character tokens, making sequences longer. The lecture notes that model computation becomes slower as sequence length increases.
- A
- 16
Why are subword tokenizers commonly used?
- A
They eliminate the need to learn tokens from data
- B
They guarantee that every word is represented by a single token
- C
They assign one token to every possible sentence
- D
They balance word-level efficiency with the ability to reuse parts of related words
Correct answer
DThey balance word-level efficiency with the ability to reuse parts of related words
Explanation
Subword tokenization is an intermediate approach: it can reuse common word parts while avoiding the extremely long sequences of character-level tokenization.
- A
- 17
How can subword tokenization help represent related word forms?
- A
The tokenizer assigns identical positions to all related words
- B
Related forms are required to have completely separate vocabularies
- C
Related forms can share a token for their common root or word part
- D
All forms are reduced to a single character token
Correct answer
CRelated forms can share a token for their common root or word part
Explanation
For example, a tokenizer might give “bear” and “bears” the shared subword token “bear,” allowing the forms to share part of their representation.
- A
- 18
What is one limitation of learned subword tokenization?
- A
It always creates sequences as long as character-level tokenization
- B
Its splits depend on the training data used to learn the tokenizer
- C
It must split every word at spaces and nowhere else
- D
It cannot represent any word that was absent from the tokenizer's corpus
Correct answer
BIts splits depend on the training data used to learn the tokenizer
Explanation
Subword units are learned from data, so the resulting vocabulary and splits depend on the corpus used to train the tokenizer.
- A
- 19
What does BPE stand for, and what kind of tokenizer is it?
- A
Bidirectional prediction encoding, a type of character tokenizer
- B
Basic position encoding, a type of word tokenizer
- C
Byte pair encoding, a type of subword tokenizer
- D
Batch probability estimation, a type of sentence classifier
Correct answer
CByte pair encoding, a type of subword tokenizer
Explanation
BPE stands for byte pair encoding and is a widely used approach to subword tokenization.
- A
- 20
How does BPE build its vocabulary?
- A
It divides every word into the same fixed number of characters
- B
It removes the least frequent complete sentences from the training corpus
- C
It repeatedly merges frequent pairs of units until it reaches a chosen vocabulary size
- D
It assigns a unique token to every word found in a dictionary
Correct answer
CIt repeatedly merges frequent pairs of units until it reaches a chosen vocabulary size
Explanation
BPE starts from an initial set of units, finds frequent adjacent pairs, adds merged units, and repeats until reaching the desired vocabulary size.
- A
- 21
Why can a BPE tokenizer reduce processing time compared with character-level tokenization?
- A
It makes the model's vocabulary equal to the number of sentences
- B
Frequent combinations can become single tokens, shortening the sequence
- C
It prevents attention from operating over the input sequence
- D
It removes the need to represent tokens as vectors
Correct answer
BFrequent combinations can become single tokens, shortening the sequence
Explanation
By merging frequent character or subword pairs into tokens, BPE can represent text with fewer tokens, reducing sequence length and processing cost.
- A
- 22
What should be considered when training a tokenizer for multilingual use?
- A
The tokenizer should use a separate position vocabulary for each language
- B
The training corpus should represent the languages the tokenizer needs to handle
- C
The corpus should exclude words that occur frequently across languages
- D
The corpus should contain only the language with the shortest words
Correct answer
BThe training corpus should represent the languages the tokenizer needs to handle
Explanation
The lecture advises using a tokenizer-training corpus that represents all languages of interest, since the learned vocabulary is distributed across those languages.
- A
- 23
What trade-off can arise when a fixed-size vocabulary is shared across multiple languages?
- A
Some languages may receive fewer useful tokens and therefore have longer sequences
- B
All languages are forced to have identical token sequences
- C
The tokenizer becomes unable to represent tokens from any one language
- D
Every language is guaranteed to have shorter sequences than with a monolingual tokenizer
Correct answer
ASome languages may receive fewer useful tokens and therefore have longer sequences
Explanation
A shared vocabulary has to allocate its entries across languages. For a particular language, this can result in less efficient tokenization and longer sequences, though cross-language sharing may also help in some cases.
- A
- 24
What does an unknown token represent?
- A
A piece of input text that is not represented by an available vocabulary token
- B
The first position in every generated sequence
- C
A padding unit added to make all sequences equally meaningful
- D
A token whose representation has the highest similarity to the query
Correct answer
AA piece of input text that is not represented by an available vocabulary token
Explanation
An unknown token is a special token used to represent text that is not covered by the tokenizer's vocabulary.
- A
- 25
What roles do beginning-of-sequence and end-of-sequence tokens commonly play in generation?
- A
They specify which tokens are used only during model training
- B
They signal when generation starts and when the generated sequence is finished
- C
They mark the most frequent and least frequent words in a sentence
- D
They convert the input text into its position embeddings
Correct answer
BThey signal when generation starts and when the generated sequence is finished
Explanation
A beginning-of-sequence token can prompt the model to start generating, while an end-of-sequence token can signal that generation is complete.
- A
- 26
Why might a model use a padding token?
- A
To tell the decoder to predict the next token with certainty
- B
To make sequences fit a common length for efficient batch processing
- C
To distinguish the source language from the target language
- D
To indicate that a word is absent from the vocabulary
Correct answer
BTo make sequences fit a common length for efficient batch processing
Explanation
Padding can make sequences the same length, which is useful for tensor operations and hardware-efficient processing.
- A
- 27
What should users remember about the spelling or convention of special tokens?
- A
Their names and conventions are not universal across models
- B
Every model must use the exact same names for them
- C
Only unknown tokens can have different conventions
- D
Special tokens are always ordinary words in the vocabulary
Correct answer
ATheir names and conventions are not universal across models
Explanation
The lecture warns that conventions such as BOS, EOS, padding, and role markers can differ between systems.
- A
- 28
What is a one-hot encoding of a token?
- A
A vector with one active entry identifying that token and zeros elsewhere
- B
A vector that changes according to the sentence in which the token occurs
- C
A weighted average of the values of every token in the context
- D
A vector whose entries describe the token's position in a sentence
Correct answer
AA vector with one active entry identifying that token and zeros elsewhere
Explanation
A one-hot encoding assigns each token a vector with one entry set to one and all other entries set to zero.
- A
- 29
Why are one-hot encodings inadequate as meaningful token representations?
- A
They prevent a model from using a vocabulary-sized output layer
- B
Different tokens are orthogonal, so the encodings do not express semantic similarity
- C
They change a token's meaning whenever its context changes
- D
They make all tokens share the same numerical representation
Correct answer
BDifferent tokens are orthogonal, so the encodings do not express semantic similarity
Explanation
One-hot vectors distinguish tokens but do not encode how related they are; distinct vectors have zero dot product and are orthogonal.
- A
- 30
What property should useful learned token representations ideally capture?
- A
Similarity between tokens that have related meanings or uses
- B
The number of times each token appears as a sentence boundary
- C
The alphabetical order of the tokens in the vocabulary
- D
The requirement that every token be equally distant from all others
Correct answer
ASimilarity between tokens that have related meanings or uses
Explanation
Meaningful representations should reflect relationships between tokens, such as the relatedness of “teddy bear” and “soft.”
- A
- 31
What is a proxy task in representation learning?
- A
The final task for which a model's predictions are always evaluated
- B
A training task used to learn representations that can support a different end goal
- C
A method for replacing all training examples with artificial tokens
- D
A rule that directly specifies every token's numerical representation
Correct answer
BA training task used to learn representations that can support a different end goal
Explanation
A proxy task is not necessarily the final goal; it is a task used to learn useful representations for another purpose.
- A
- 32
Which pair correctly describes the two Word2Vec objectives discussed in the lecture?
- A
CBOW predicts context words from a target; skip-gram predicts a target from context
- B
CBOW predicts a target word from context; skip-gram predicts context words from a target
- C
CBOW predicts spelling corrections; skip-gram predicts token boundaries
- D
CBOW predicts token positions; skip-gram predicts sentence labels
Correct answer
BCBOW predicts a target word from context; skip-gram predicts context words from a target
Explanation
The continuous bag-of-words objective predicts a word from surrounding context, while skip-gram predicts surrounding words from a given word.
- A
- 33
In the simple neural network example for learning word representations, what is the role of the hidden representation?
- A
It is the complete list of possible tokens in the vocabulary
- B
It is a lower-dimensional learned representation between the input and vocabulary prediction
- C
It is a position marker that is added to the input sentence
- D
It is the one-hot label that identifies the correct output word
Correct answer
BIt is a lower-dimensional learned representation between the input and vocabulary prediction
Explanation
The network maps an input representation through a hidden or latent vector, often of dimension smaller than the vocabulary, before predicting vocabulary probabilities.
- A
- 34
Why is a probability distribution over the vocabulary produced in the Word2Vec training example?
- A
So the model can compare its predicted word probabilities with the target word
- B
So the model can determine the input token's position in the sentence
- C
So the model can ensure every word has an identical vector
- D
So the model can merge frequent pairs into new vocabulary tokens
Correct answer
ASo the model can compare its predicted word probabilities with the target word
Explanation
The output has a probability for each vocabulary token, allowing the model to measure how well it predicts the training target.
- A
- 35
How does the training process encourage the model to predict the target word?
- A
A padding token replaces the model's predicted distribution
- B
A position embedding forces the target token to be the first input
- C
A tokenizer removes every word except the target from the corpus
- D
A loss penalizes incorrect probabilities, and training updates the model's weights
Correct answer
DA loss penalizes incorrect probabilities, and training updates the model's weights
Explanation
The model computes a loss based on the difference between its predictions and the target, then updates its weights to reduce that loss.
- A
- 36
What kind of relationships can emerge in learned word representations?
- A
Only the number of characters in each word
- B
Only the order in which words appeared in the training corpus
- C
Semantic and relational patterns, such as country-capital associations
- D
The exact position where each word will appear in every future sentence
Correct answer
CSemantic and relational patterns, such as country-capital associations
Explanation
The lecture notes that learned representations can capture meaningful relationships, such as analogies between Paris and France and Berlin and Germany.
- A
- 37
What is a limitation of static word representations learned by methods such as Word2Vec?
- A
The representation cannot be learned from a prediction task
- B
The representation necessarily encodes the complete order of the sentence
- C
A word receives a different representation for every occurrence in a sentence
- D
A word receives the same representation in different contexts, even when its meaning changes
Correct answer
DA word receives the same representation in different contexts, even when its meaning changes
Explanation
A static embedding does not depend on the sentence context, so a word such as “bank” gets the same representation for a riverbank and a financial institution.
- A
- 38
Why can a bag-of-words representation fail to distinguish two sentences with different meanings?
- A
It assigns a unique position embedding to every token
- B
It allows words to have different representations in different contexts
- C
It always replaces every word with an unknown token
- D
It can ignore word order, making sentences with the same words look alike
Correct answer
DIt can ignore word order, making sentences with the same words look alike
Explanation
If word order is ignored, sentences containing the same words can receive the same representation even when their meanings differ, such as reversing who hugs whom.
- A
- 39
What does an RNN's hidden state represent as it processes a sequence?
- A
A separate position embedding for every future token
- B
An evolving summary of the sequence seen so far
- C
A fixed one-hot representation of the entire vocabulary
- D
A list of all possible next tokens, independent of the input
Correct answer
BAn evolving summary of the sequence seen so far
Explanation
An RNN updates its hidden state as each token is processed; that state is intended to encode information about the sequence so far.
- A
- 40
How can an RNN use its hidden state when predicting the next token?
- A
It replaces the current token with a one-hot sentence label
- B
It directly accesses every future token in the sequence
- C
It predicts using only the final token in the vocabulary
- D
It combines the current input token with information carried from earlier tokens
Correct answer
DIt combines the current input token with information carried from earlier tokens
Explanation
The hidden state from earlier steps is passed forward and helps inform the representation and prediction at the next step.
- A
- 41
Why can an RNN represent word order better than a static embedding approach?
- A
It ignores earlier tokens and uses only token frequencies
- B
It assigns the same representation to every word in a sentence
- C
It converts each sentence into an unordered collection of words
- D
Its hidden state changes as tokens are processed in sequence
Correct answer
DIts hidden state changes as tokens are processed in sequence
Explanation
Because the hidden state is updated in token order, the model can encode sequence information that static, context-independent embeddings do not capture.
- A
- 42
Which tasks were described as uses for RNNs?
- A
Only vocabulary construction and token merging
- B
Only image classification and object detection
- C
Sequence classification, token classification, and generation
- D
Only static word embedding lookup
Correct answer
CSequence classification, token classification, and generation
Explanation
The lecture gives sentiment classification, identifying whether a word is a noun or verb, and sequence generation as examples of RNN uses.
- A
- 43
What is the long-range dependency problem in RNNs?
- A
Difficulty preserving information about tokens that occurred far earlier in a sequence
- B
A tendency to assign the same output probability to every vocabulary item
- C
Difficulty identifying the next token when it immediately follows the current one
- D
An inability to process any token unless it is a complete word
Correct answer
ADifficulty preserving information about tokens that occurred far earlier in a sequence
Explanation
An RNN compresses prior sequence information into a changing state, which can make it difficult to retain information from far back in the sequence.
- A
- 44
What underlying training difficulty is associated with the long-range dependency problem in RNNs?
- A
The out-of-vocabulary problem caused by padding
- B
The loss of token boundaries during softmax
- C
The inability to construct a vocabulary from training data
- D
The vanishing gradient problem during backpropagation
Correct answer
DThe vanishing gradient problem during backpropagation
Explanation
The lecture links RNN long-range dependency limitations to the vanishing gradient problem during backpropagation.
- A
- 45
How was an LSTM designed to address the difficulty of retaining information in an RNN?
- A
It adds a cell state intended to carry information for longer
- B
It predicts all future tokens without using sequence information
- C
It replaces each token with a fixed one-hot encoding
- D
It removes the hidden state and processes the entire sequence as one word
Correct answer
AIt adds a cell state intended to carry information for longer
Explanation
An LSTM retains a hidden state and adds a cell state designed to carry information over longer spans, although it still has limitations.
- A
- 46
What computational drawback follows from an RNN's step-by-step processing?
- A
Predictions depend on processing tokens sequentially, making training slow
- B
All input tokens can be processed independently in a single step
- C
The model cannot produce any representation for an input token
- D
The model needs a separate vocabulary for every sequence position
Correct answer
APredictions depend on processing tokens sequentially, making training slow
Explanation
Because each step depends on the hidden state from the previous step, RNNs process tokens sequentially, limiting parallelism and making training slow.
- A
- 47
What central idea distinguishes attention from relying only on an RNN hidden state?
- A
A model must discard the sequence after computing a hidden state
- B
A token can attend only to itself and never to other tokens
- C
A token must be represented only by its spelling
- D
A token can directly connect to earlier tokens that may be relevant
Correct answer
DA token can directly connect to earlier tokens that may be relevant
Explanation
Attention gives a prediction direct access to relevant earlier tokens instead of requiring all past information to be compressed into one hidden state.
- A
- 48
In a translation task, why can direct access to earlier source tokens be useful?
- A
The model no longer needs to represent the target language
- B
The model can replace all source tokens with a single padding token
- C
The model can use the specific source word relevant to the translation being generated
- D
The model can avoid learning any relationship between source and target text
Correct answer
CThe model can use the specific source word relevant to the translation being generated
Explanation
A direct connection lets the model consult source words that matter for generating a target word, rather than relying only on a compressed recurrent state.
- A
- 49
What does self-attention use to form a token's representation?
- A
A label supplied for the entire sequence
- B
Only a fixed embedding independent of all other tokens
- C
Only the final token in the sequence
- D
Information from other tokens in the same sequence
Correct answer
DInformation from other tokens in the same sequence
Explanation
Self-attention represents a token as a function of tokens within the same sequence.
- A
- 50
What role does a query play in attention?
- A
It represents the training label for the whole sentence
- B
It stores the final probability distribution over the vocabulary
- C
It marks the position where the sequence should stop
- D
It represents what a token is seeking from other tokens to build a useful representation
Correct answer
DIt represents what a token is seeking from other tokens to build a useful representation
Explanation
The query is used to identify which other tokens are relevant to the token whose representation is being constructed.
- A
- 51
What role do keys play in attention?
- A
They contain the final generated text sequence
- B
They are compared with a query to determine the relevance of tokens
- C
They encode the label used by the loss function
- D
They force all tokens to receive equal attention weights
Correct answer
BThey are compared with a query to determine the relevance of tokens
Explanation
Attention compares a query with keys associated with tokens; the resulting similarity scores determine how strongly those tokens contribute.
- A
- 52
What role do values play in attention?
- A
They determine the vocabulary size of the tokenizer
- B
They convert the query into a one-hot encoding
- C
They mark which tokens occur after the current position
- D
They provide the information combined using the attention weights
Correct answer
DThey provide the information combined using the attention weights
Explanation
Once relevance weights have been determined, the values are combined in a weighted sum to produce the attention output.
- A
- 53
How are queries, keys, and values typically obtained from token representations?
- A
By selecting three tokens from the end of the sequence
- B
By converting the representation into a padding mask only
- C
By applying learned projection matrices to the input representations
- D
By assigning each token an alphabetical rank
Correct answer
CBy applying learned projection matrices to the input representations
Explanation
The model learns projection matrices that map input token representations into query, key, and value spaces.
- A
- 54
What does the dot product between a query and a key indicate in the attention example?
- A
Where the token occurs relative to the end of the sequence
- B
How many characters are in the corresponding token
- C
How similar or relevant the query is to that key
- D
How many times the token appears in the vocabulary
Correct answer
CHow similar or relevant the query is to that key
Explanation
The dot product serves as a similarity score between a query and each key, helping determine the attention weights.
- A
- 55
Why is softmax applied to attention scores?
- A
It produces the end-of-sequence token directly
- B
It turns the scores into normalized weights that sum to one
- C
It ensures every query has the same similarity to every key
- D
It converts the token sequence into a vocabulary
Correct answer
BIt turns the scores into normalized weights that sum to one
Explanation
Softmax transforms attention scores into weights that form a probability-like distribution and sum to one.
- A
- 56
What is the main effect of scaling query-key scores by the key dimension in attention?
- A
It helps control the magnitude and variance of the scores
- B
It increases the number of tokens in the sequence
- C
It changes the attention output into a position index
- D
It makes all values identical before they are combined
Correct answer
AIt helps control the magnitude and variance of the scores
Explanation
The scaled dot-product attention formulation divides scores by the square root of the key dimension to help control their scale.
- A
- 57
Why can unmodified self-attention lose information about word order?
- A
Values must be arranged in alphabetical order
- B
Queries and keys cannot be compared using dot products
- C
Softmax removes every token except the first one
- D
Every token can interact with every other token without inherently encoding their positions
Correct answer
DEvery token can interact with every other token without inherently encoding their positions
Explanation
Self-attention by itself does not inherently indicate where tokens occur in the sequence, so positional information must be added separately.
- A
- 58
What is the role of the encoder in the original transformer for translation?
- A
It determines the final sequence length before tokenization
- B
It converts all target-language tokens into one-hot labels
- C
It computes contextual representations of the source text
- D
It chooses the next target token without consulting the source
Correct answer
CIt computes contextual representations of the source text
Explanation
The encoder processes the source sequence and produces meaningful contextual representations for its tokens.
- A
- 59
What is the role of the decoder in the original transformer for translation?
- A
It learns the vocabulary by merging frequent character pairs
- B
It uses encoder information and generated tokens to produce the target sequence
- C
It tokenizes only the source text and discards the target language
- D
It creates static representations that never depend on context
Correct answer
BIt uses encoder information and generated tokens to produce the target sequence
Explanation
The decoder generates the translation using its current target-side representations and information from the encoder.
- A
- 60
Why are token embeddings combined with position embeddings before transformer processing?
- A
To make all tokens in the sequence have identical representations
- B
To indicate that the model should stop generating text
- C
To convert the input sequence into an output probability distribution
- D
To represent both token identity and the token's location in the sequence
Correct answer
DTo represent both token identity and the token's location in the sequence
Explanation
Token embeddings represent token identity, while position embeddings supply information about where each token occurs.
- A
- 61
What is a limitation of learned position embeddings?
- A
They always make the sequence longer than character tokenization
- B
They cannot distinguish adjacent positions from distant positions
- C
They prevent the model from representing token identity
- D
They may not represent positions longer than those seen or learned during training
Correct answer
DThey may not represent positions longer than those seen or learned during training
Explanation
If learned position embeddings exist only up to a certain position, a longer input may contain positions for which the model has no learned embedding.
- A
- 62
What is one motivation for sinusoidal positional representations using different frequencies?
- A
They prevent the model from processing sequences in parallel
- B
They can represent positions with a predefined pattern that is not limited to learned position indices
- C
They ensure that every position receives exactly the same vector
- D
They replace all token embeddings with character embeddings
Correct answer
BThey can represent positions with a predefined pattern that is not limited to learned position indices
Explanation
Fixed sine and cosine patterns provide positional representations without learning a separate embedding for every position, which can help with positions beyond the learned range.
- A
- 63
What property of sinusoidal positional representations was highlighted in the lecture?
- A
Nearby positions must always be more dissimilar than distant positions
- B
Position representations encode only the identity of the token
- C
Nearby positions can have similar representations while distant positions are more dissimilar
- D
All positions have exactly identical representations
Correct answer
CNearby positions can have similar representations while distant positions are more dissimilar
Explanation
The lecture describes the representations as having a useful property: positions close to one another are similar, while positions farther apart are more dissimilar.
- A
- 64
What does the encoder's self-attention layer do?
- A
It computes each token's representation using information from the other source tokens
- B
It adds padding until every token has the same meaning
- C
It predicts the next target token using only the vocabulary labels
- D
It prevents source tokens from interacting with one another
Correct answer
AIt computes each token's representation using information from the other source tokens
Explanation
Encoder self-attention allows each source token to be represented in relation to tokens throughout the source sequence.
- A
- 65
What is the purpose of the feed-forward network within a transformer block?
- A
It transforms representations and learns nonlinear features
- B
It determines which source language the input uses
- C
It marks the beginning and end of every sequence
- D
It replaces the attention mechanism with sequential recurrence
Correct answer
AIt transforms representations and learns nonlinear features
Explanation
The feed-forward network projects representations through a higher-dimensional space and uses an activation function to learn nonlinearities.
- A
- 66
What information does decoder self-attention use during generation?
- A
The current decoded token and tokens generated up to that point
- B
Only the final probability distribution over the vocabulary
- C
All future target tokens, including those not generated yet
- D
Only the encoder's source representations
Correct answer
AThe current decoded token and tokens generated up to that point
Explanation
Decoder self-attention uses the current token and the target-side tokens generated so far; masking prevents access to future target tokens.
- A
- 67
What is cross-attention in the transformer decoder?
- A
Attention in which encoder queries use future decoder tokens as values
- B
Attention that compares token positions but ignores token representations
- C
Attention in which decoder queries use encoder representations as keys and values
- D
Attention that assigns every vocabulary item the same probability
Correct answer
CAttention in which decoder queries use encoder representations as keys and values
Explanation
In cross-attention, the decoder's representations provide the queries, while encoder outputs provide the keys and values.
- A
- 68
How does a transformer decoder typically generate a sequence?
- A
It repeatedly replaces the source with a padding token
- B
It generates the entire output using only the beginning token in one step
- C
It predicts one next token, feeds that token back in, and repeats until an end token
- D
It predicts every token independently before seeing any input
Correct answer
CIt predicts one next token, feeds that token back in, and repeats until an end token
Explanation
Generation is autoregressive: the decoder predicts a next token, adds it to the generated sequence, and continues until it produces an end-of-sequence token.
- A
- 69
What is the function of the beginning-of-sequence token when translation generation starts?
- A
It is the target sentence's final output token
- B
It supplies the source tokens as keys and values
- C
It provides a placeholder input that prompts the decoder to produce the first target token
- D
It prevents the decoder from generating any further tokens
Correct answer
CIt provides a placeholder input that prompts the decoder to produce the first target token
Explanation
The beginning-of-sequence token is fed to the decoder to start generation; the first predicted token follows it.
- A
- 70
What controls when autoregressive generation should stop?
- A
The decoder produces a padding token as its first input
- B
The encoder runs out of position embeddings
- C
The model uses every token in the vocabulary once
- D
The model produces an end-of-sequence token
Correct answer
DThe model produces an end-of-sequence token
Explanation
An end-of-sequence token signals that the generated sequence is finished.
- A
- 71
Why are residual connections useful in deep transformer networks?
- A
They convert attention weights into word-level tokens
- B
They ensure that the model never changes its representations
- C
They force each layer to replace its input entirely
- D
They let information pass around a sublayer, helping optimization and learning
Correct answer
DThey let information pass around a sublayer, helping optimization and learning
Explanation
A residual connection adds a sublayer's transformation to its input, providing a direct path for features and helping backpropagation in deep networks.
- A
- 72
What is the purpose of layer normalization in a transformer?
- A
It normalizes activations and can help convergence
- B
It merges frequent token pairs into a vocabulary
- C
It supplies the decoder with future target words
- D
It makes the output vocabulary smaller
Correct answer
AIt normalizes activations and can help convergence
Explanation
Layer normalization is one of the techniques used to normalize activations and improve convergence during training.
- A
- 73
Why does a decoder use masked self-attention?
- A
To ensure the decoder uses only one attention head
- B
To restrict attention to source tokens and exclude all target tokens
- C
To prevent the decoder from attending to its own current token
- D
To prevent a token from attending to target tokens that have not yet been generated
Correct answer
DTo prevent a token from attending to target tokens that have not yet been generated
Explanation
The mask prevents information from future target positions from leaking into the prediction at the current position.
- A
- 74
How can a causal attention mask be implemented conceptually?
- A
By copying the encoder's values into the decoder's queries
- B
By setting every permitted score to zero after softmax
- C
By replacing future tokens with their vocabulary probabilities
- D
By setting disallowed future-position scores to negative infinity before softmax
Correct answer
DBy setting disallowed future-position scores to negative infinity before softmax
Explanation
A triangular mask can assign negative infinity to forbidden connections; softmax then gives those connections zero weight.
- A
- 75
What is multi-head attention?
- A
Using one shared query and removing all key and value projections
- B
Using several distinct query, key, and value projections in parallel
- C
Replacing attention with several recurrent hidden states
- D
Running the decoder once for each vocabulary token
Correct answer
BUsing several distinct query, key, and value projections in parallel
Explanation
Multi-head attention performs attention through multiple learned projection sets, allowing the model to learn different ways of relating tokens.
- A
- 76
What happens after the outputs of multiple attention heads are computed?
- A
They are used only to identify unknown tokens
- B
They are concatenated and projected back into the model representation space
- C
They are discarded and replaced with one-hot token labels
- D
They are averaged with the input positions before tokenization
Correct answer
BThey are concatenated and projected back into the model representation space
Explanation
The head outputs are concatenated and passed through an output projection that returns them to the model's representation dimension.
- A
- 77
How does dropout help during model training?
- A
It randomly drops some units so the model does not rely too heavily on particular features
- B
It guarantees a probability of one for the correct label
- C
It removes all input tokens that occur infrequently
- D
It forces all attention heads to produce identical outputs
Correct answer
AIt randomly drops some units so the model does not rely too heavily on particular features
Explanation
Dropout randomly omits units during training, discouraging excessive reliance on particular features and helping generalization.
- A
- 78
What is label smoothing intended to do?
- A
It requires the model to assign probability one to the target token
- B
It assigns most probability to the target while allowing some probability for other valid alternatives
- C
It removes all non-target tokens from the output vocabulary
- D
It converts a target token into a position embedding
Correct answer
BIt assigns most probability to the target while allowing some probability for other valid alternatives
Explanation
Label smoothing softens the target distribution, for example by assigning most but not all probability to the expected token and distributing the remainder among alternatives.
- A
- 79
Why can label smoothing be useful for language generation?
- A
The model otherwise cannot produce a vocabulary-sized output
- B
The model otherwise has no way to compute attention scores
- C
A sentence can have multiple plausible continuations, so alternatives need not be treated as impossible
- D
Every context has exactly one valid next word
Correct answer
CA sentence can have multiple plausible continuations, so alternatives need not be treated as impossible
Explanation
Language often permits several valid continuations, so label smoothing avoids treating the observed target as the only possible continuation.
- A
- 80
How do attention-layer softmax and final-output softmax differ in purpose?
- A
Attention softmax weights tokens; output softmax gives probabilities over next-token choices
- B
Attention softmax gives next-token probabilities; output softmax weights source tokens
- C
Both softmax operations select the same single token at every layer
- D
Both softmax operations serve only to normalize position embeddings
Correct answer
AAttention softmax weights tokens; output softmax gives probabilities over next-token choices
Explanation
Softmax in attention normalizes query-key scores across tokens, whereas the final softmax produces a distribution over vocabulary tokens for next-token prediction.
- A
- 81
Which components were emphasized as central to the transformer's learning capacity?
- A
Tokenization and position indices alone
- B
Attention and the feed-forward network
- C
Residual connections and end-of-sequence markers alone
- D
Padding tokens and sentence boundaries
Correct answer
BAttention and the feed-forward network
Explanation
The lecture highlights attention as the key mechanism and the feed-forward network as a major location of model parameters and learning capacity.
- A
- 82
Why can a feed-forward network expand representations to a higher dimension before transforming them?
- A
The expanded space allows the network to learn more complex representations
- B
The expanded space guarantees that no nonlinearities are needed
- C
The expanded space removes the need for output probabilities
- D
The expanded space stores future tokens for masked attention
Correct answer
AThe expanded space allows the network to learn more complex representations
Explanation
The transformer feed-forward network typically expands the representation dimension, enabling richer feature transformations before projecting back.
- A
- 83
What evaluation metric was mentioned as an example for machine translation?
- A
BPE
- B
BLEU
- C
Word2Vec
- D
LSTM
Correct answer
BBLEU
Explanation
The lecture names BLEU as an example of a metric used to evaluate machine translation.
- A

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