1. Home
  2. Explore
  3. Computer Science
  4. Transformers and Large Language Models

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Transformers and Large Language Models

  • 83Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: LLM Evolution

How did natural language processing systems in the 2010s typically handle different language tasks?

83 questions

  1. 1

    How did natural language processing systems in the 2010s typically handle different language tasks?

    1. A

      They used one general model for sentiment, translation, and entity recognition

    2. B

      They relied exclusively on character-level models for every task

    3. C

      They usually used a separate model for each specific use case

    4. D

      They used transformer-based chatbots as the standard approach

    Correct answer
    C

    They 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.

  2. 2

    What was a major contribution of the transformer architecture introduced in 2017?

    1. A

      It ensured models could learn without training data

    2. B

      It eliminated the need to represent text as numbers

    3. C

      It enabled a more scalable approach that could benefit from more data, compute, and parameters

    4. D

      It made every language task require its own separately trained architecture

    Correct answer
    C

    It 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.

  3. 3

    Which development most directly helped bring modern large language models into use, according to the lecture?

    1. A

      Replacing all text tokens with one-hot vectors permanently

    2. B

      Removing training data and relying only on manually written rules

    3. C

      Scaling transformer models in model size and in the number of training tokens

    4. D

      Returning to one specialized recurrent model for every task

    Correct answer
    C

    Scaling 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.

  4. 4

    Why was ChatGPT's 2022 release described as a product-level turning point?

    1. A

      It introduced many people to interacting with a chatbot

    2. B

      It removed the need for models to generate text

    3. C

      It made recurrent neural networks the dominant architecture again

    4. D

      It introduced the first use of neural networks for language

    Correct answer
    A

    It 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.

  5. 5

    What broad shift does the lecture identify in the movement from conversational assistants toward coding agents?

    1. A

      Language models are increasingly limited to sentiment classification

    2. B

      Language models are increasingly being used to exhibit agentic behavior

    3. C

      Language models have returned to processing one task per model

    4. D

      Language models are no longer used to generate code

    Correct answer
    B

    Language 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.

  6. 6

    What is tokenization in the context of language models?

    1. A

      Assigning a final sentiment label to an entire document

    2. B

      Combining several neural network layers into one computation

    3. C

      Dividing text into units that can be represented for the model

    4. D

      Converting model predictions into a human-readable explanation

    Correct answer
    C

    Dividing 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.

  7. 7

    Why must text be represented numerically before a language model can process it?

    1. A

      The model can process text only when each word has a unique spelling

    2. B

      The model uses numerical representations only when producing classifications

    3. C

      The model operates on numerical representations rather than directly understanding text

    4. D

      The model requires every sentence to be translated into another language

    Correct answer
    C

    The 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.

  8. 8

    What is a vocabulary in tokenization?

    1. A

      The set of labels a model can assign to a sentence

    2. B

      The list of positions available in a training sequence

    3. C

      The collection of hidden states produced during one prediction

    4. D

      The set of tokens that a tokenizer is allowed to use

    Correct answer
    D

    The 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.

  9. 9

    What is the relationship between vocabulary choice and sequence length?

    1. A

      Different vocabularies can divide the same text into different numbers of tokens

    2. B

      Vocabulary choice affects token meaning but cannot affect sequence length

    3. C

      A larger vocabulary always produces a longer token sequence

    4. D

      Sequence length is fixed regardless of how text is tokenized

    Correct answer
    A

    Different 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.

  10. 10

    What is a key advantage of word-level tokenization?

    1. A

      It prevents unseen words from occurring at inference time

    2. B

      It always produces shorter sequences than subword tokenization

    3. C

      It is simple and often interpretable because tokens correspond to whole words

    4. D

      It guarantees that related word forms share the same representation

    Correct answer
    C

    It 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.

  11. 11

    Why can word-level tokenization lead to a very large vocabulary?

    1. A

      The tokenizer must include a separate token for every sentence

    2. B

      Word-level tokenization requires a unique token for every position

    3. C

      Different forms of a word, such as singular and plural, may each require separate tokens

    4. D

      Every word is divided into all of its individual letters

    Correct answer
    C

    Different 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.

  12. 12

    Why can word-level tokenization make it difficult to use knowledge about related words?

    1. A

      All related words are forced to have identical representations

    2. B

      The vocabulary contains no information about word identity

    3. C

      Words are always split into individual characters

    4. D

      Related forms such as “bear” and “bears” may be represented as separate tokens

    Correct answer
    D

    Related 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.

  13. 13

    What is an out-of-vocabulary problem with word-level tokenization?

    1. A

      A word is assigned too many different positions in the input sequence

    2. B

      A word encountered at inference may not have appeared in training and may lack a learned representation

    3. C

      A token is represented by a vector that is larger than the hidden state

    4. D

      A model produces too many probabilities for a word already in its vocabulary

    Correct answer
    B

    A 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.

  14. 14

    What is an advantage of character-level tokenization?

    1. A

      It learns common multi-letter combinations without additional training

    2. B

      It gives each complete word its own easily interpretable token

    3. C

      It ensures that input sequences are shorter than word-level sequences

    4. D

      It uses a small, fixed set of units and is robust to many unseen spellings

    Correct answer
    D

    It 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.

  15. 15

    What is a major cost of character-level tokenization?

    1. A

      It often creates long sequences that take more computation to process

    2. B

      It requires a separate vocabulary entry for every possible word

    3. C

      It prevents the model from processing text one character at a time

    4. D

      It cannot represent misspelled words using known units

    Correct answer
    A

    It 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.

  16. 16

    Why are subword tokenizers commonly used?

    1. A

      They eliminate the need to learn tokens from data

    2. B

      They guarantee that every word is represented by a single token

    3. C

      They assign one token to every possible sentence

    4. D

      They balance word-level efficiency with the ability to reuse parts of related words

    Correct answer
    D

    They 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.

  17. 17

    How can subword tokenization help represent related word forms?

    1. A

      The tokenizer assigns identical positions to all related words

    2. B

      Related forms are required to have completely separate vocabularies

    3. C

      Related forms can share a token for their common root or word part

    4. D

      All forms are reduced to a single character token

    Correct answer
    C

    Related 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.

  18. 18

    What is one limitation of learned subword tokenization?

    1. A

      It always creates sequences as long as character-level tokenization

    2. B

      Its splits depend on the training data used to learn the tokenizer

    3. C

      It must split every word at spaces and nowhere else

    4. D

      It cannot represent any word that was absent from the tokenizer's corpus

    Correct answer
    B

    Its 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.

  19. 19

    What does BPE stand for, and what kind of tokenizer is it?

    1. A

      Bidirectional prediction encoding, a type of character tokenizer

    2. B

      Basic position encoding, a type of word tokenizer

    3. C

      Byte pair encoding, a type of subword tokenizer

    4. D

      Batch probability estimation, a type of sentence classifier

    Correct answer
    C

    Byte pair encoding, a type of subword tokenizer

    Explanation

    BPE stands for byte pair encoding and is a widely used approach to subword tokenization.

  20. 20

    How does BPE build its vocabulary?

    1. A

      It divides every word into the same fixed number of characters

    2. B

      It removes the least frequent complete sentences from the training corpus

    3. C

      It repeatedly merges frequent pairs of units until it reaches a chosen vocabulary size

    4. D

      It assigns a unique token to every word found in a dictionary

    Correct answer
    C

    It 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.

  21. 21

    Why can a BPE tokenizer reduce processing time compared with character-level tokenization?

    1. A

      It makes the model's vocabulary equal to the number of sentences

    2. B

      Frequent combinations can become single tokens, shortening the sequence

    3. C

      It prevents attention from operating over the input sequence

    4. D

      It removes the need to represent tokens as vectors

    Correct answer
    B

    Frequent 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.

  22. 22

    What should be considered when training a tokenizer for multilingual use?

    1. A

      The tokenizer should use a separate position vocabulary for each language

    2. B

      The training corpus should represent the languages the tokenizer needs to handle

    3. C

      The corpus should exclude words that occur frequently across languages

    4. D

      The corpus should contain only the language with the shortest words

    Correct answer
    B

    The 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.

  23. 23

    What trade-off can arise when a fixed-size vocabulary is shared across multiple languages?

    1. A

      Some languages may receive fewer useful tokens and therefore have longer sequences

    2. B

      All languages are forced to have identical token sequences

    3. C

      The tokenizer becomes unable to represent tokens from any one language

    4. D

      Every language is guaranteed to have shorter sequences than with a monolingual tokenizer

    Correct answer
    A

    Some 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.

  24. 24

    What does an unknown token represent?

    1. A

      A piece of input text that is not represented by an available vocabulary token

    2. B

      The first position in every generated sequence

    3. C

      A padding unit added to make all sequences equally meaningful

    4. D

      A token whose representation has the highest similarity to the query

    Correct answer
    A

    A 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.

  25. 25

    What roles do beginning-of-sequence and end-of-sequence tokens commonly play in generation?

    1. A

      They specify which tokens are used only during model training

    2. B

      They signal when generation starts and when the generated sequence is finished

    3. C

      They mark the most frequent and least frequent words in a sentence

    4. D

      They convert the input text into its position embeddings

    Correct answer
    B

    They 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.

  26. 26

    Why might a model use a padding token?

    1. A

      To tell the decoder to predict the next token with certainty

    2. B

      To make sequences fit a common length for efficient batch processing

    3. C

      To distinguish the source language from the target language

    4. D

      To indicate that a word is absent from the vocabulary

    Correct answer
    B

    To 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.

  27. 27

    What should users remember about the spelling or convention of special tokens?

    1. A

      Their names and conventions are not universal across models

    2. B

      Every model must use the exact same names for them

    3. C

      Only unknown tokens can have different conventions

    4. D

      Special tokens are always ordinary words in the vocabulary

    Correct answer
    A

    Their 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.

  28. 28

    What is a one-hot encoding of a token?

    1. A

      A vector with one active entry identifying that token and zeros elsewhere

    2. B

      A vector that changes according to the sentence in which the token occurs

    3. C

      A weighted average of the values of every token in the context

    4. D

      A vector whose entries describe the token's position in a sentence

    Correct answer
    A

    A 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.

  29. 29

    Why are one-hot encodings inadequate as meaningful token representations?

    1. A

      They prevent a model from using a vocabulary-sized output layer

    2. B

      Different tokens are orthogonal, so the encodings do not express semantic similarity

    3. C

      They change a token's meaning whenever its context changes

    4. D

      They make all tokens share the same numerical representation

    Correct answer
    B

    Different 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.

  30. 30

    What property should useful learned token representations ideally capture?

    1. A

      Similarity between tokens that have related meanings or uses

    2. B

      The number of times each token appears as a sentence boundary

    3. C

      The alphabetical order of the tokens in the vocabulary

    4. D

      The requirement that every token be equally distant from all others

    Correct answer
    A

    Similarity 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.”

  31. 31

    What is a proxy task in representation learning?

    1. A

      The final task for which a model's predictions are always evaluated

    2. B

      A training task used to learn representations that can support a different end goal

    3. C

      A method for replacing all training examples with artificial tokens

    4. D

      A rule that directly specifies every token's numerical representation

    Correct answer
    B

    A 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.

  32. 32

    Which pair correctly describes the two Word2Vec objectives discussed in the lecture?

    1. A

      CBOW predicts context words from a target; skip-gram predicts a target from context

    2. B

      CBOW predicts a target word from context; skip-gram predicts context words from a target

    3. C

      CBOW predicts spelling corrections; skip-gram predicts token boundaries

    4. D

      CBOW predicts token positions; skip-gram predicts sentence labels

    Correct answer
    B

    CBOW 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.

  33. 33

    In the simple neural network example for learning word representations, what is the role of the hidden representation?

    1. A

      It is the complete list of possible tokens in the vocabulary

    2. B

      It is a lower-dimensional learned representation between the input and vocabulary prediction

    3. C

      It is a position marker that is added to the input sentence

    4. D

      It is the one-hot label that identifies the correct output word

    Correct answer
    B

    It 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.

  34. 34

    Why is a probability distribution over the vocabulary produced in the Word2Vec training example?

    1. A

      So the model can compare its predicted word probabilities with the target word

    2. B

      So the model can determine the input token's position in the sentence

    3. C

      So the model can ensure every word has an identical vector

    4. D

      So the model can merge frequent pairs into new vocabulary tokens

    Correct answer
    A

    So 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.

  35. 35

    How does the training process encourage the model to predict the target word?

    1. A

      A padding token replaces the model's predicted distribution

    2. B

      A position embedding forces the target token to be the first input

    3. C

      A tokenizer removes every word except the target from the corpus

    4. D

      A loss penalizes incorrect probabilities, and training updates the model's weights

    Correct answer
    D

    A 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.

  36. 36

    What kind of relationships can emerge in learned word representations?

    1. A

      Only the number of characters in each word

    2. B

      Only the order in which words appeared in the training corpus

    3. C

      Semantic and relational patterns, such as country-capital associations

    4. D

      The exact position where each word will appear in every future sentence

    Correct answer
    C

    Semantic 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.

  37. 37

    What is a limitation of static word representations learned by methods such as Word2Vec?

    1. A

      The representation cannot be learned from a prediction task

    2. B

      The representation necessarily encodes the complete order of the sentence

    3. C

      A word receives a different representation for every occurrence in a sentence

    4. D

      A word receives the same representation in different contexts, even when its meaning changes

    Correct answer
    D

    A 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.

  38. 38

    Why can a bag-of-words representation fail to distinguish two sentences with different meanings?

    1. A

      It assigns a unique position embedding to every token

    2. B

      It allows words to have different representations in different contexts

    3. C

      It always replaces every word with an unknown token

    4. D

      It can ignore word order, making sentences with the same words look alike

    Correct answer
    D

    It 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.

  39. 39

    What does an RNN's hidden state represent as it processes a sequence?

    1. A

      A separate position embedding for every future token

    2. B

      An evolving summary of the sequence seen so far

    3. C

      A fixed one-hot representation of the entire vocabulary

    4. D

      A list of all possible next tokens, independent of the input

    Correct answer
    B

    An 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.

  40. 40

    How can an RNN use its hidden state when predicting the next token?

    1. A

      It replaces the current token with a one-hot sentence label

    2. B

      It directly accesses every future token in the sequence

    3. C

      It predicts using only the final token in the vocabulary

    4. D

      It combines the current input token with information carried from earlier tokens

    Correct answer
    D

    It 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.

  41. 41

    Why can an RNN represent word order better than a static embedding approach?

    1. A

      It ignores earlier tokens and uses only token frequencies

    2. B

      It assigns the same representation to every word in a sentence

    3. C

      It converts each sentence into an unordered collection of words

    4. D

      Its hidden state changes as tokens are processed in sequence

    Correct answer
    D

    Its 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.

  42. 42

    Which tasks were described as uses for RNNs?

    1. A

      Only vocabulary construction and token merging

    2. B

      Only image classification and object detection

    3. C

      Sequence classification, token classification, and generation

    4. D

      Only static word embedding lookup

    Correct answer
    C

    Sequence 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.

  43. 43

    What is the long-range dependency problem in RNNs?

    1. A

      Difficulty preserving information about tokens that occurred far earlier in a sequence

    2. B

      A tendency to assign the same output probability to every vocabulary item

    3. C

      Difficulty identifying the next token when it immediately follows the current one

    4. D

      An inability to process any token unless it is a complete word

    Correct answer
    A

    Difficulty 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.

  44. 44

    What underlying training difficulty is associated with the long-range dependency problem in RNNs?

    1. A

      The out-of-vocabulary problem caused by padding

    2. B

      The loss of token boundaries during softmax

    3. C

      The inability to construct a vocabulary from training data

    4. D

      The vanishing gradient problem during backpropagation

    Correct answer
    D

    The vanishing gradient problem during backpropagation

    Explanation

    The lecture links RNN long-range dependency limitations to the vanishing gradient problem during backpropagation.

  45. 45

    How was an LSTM designed to address the difficulty of retaining information in an RNN?

    1. A

      It adds a cell state intended to carry information for longer

    2. B

      It predicts all future tokens without using sequence information

    3. C

      It replaces each token with a fixed one-hot encoding

    4. D

      It removes the hidden state and processes the entire sequence as one word

    Correct answer
    A

    It 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.

  46. 46

    What computational drawback follows from an RNN's step-by-step processing?

    1. A

      Predictions depend on processing tokens sequentially, making training slow

    2. B

      All input tokens can be processed independently in a single step

    3. C

      The model cannot produce any representation for an input token

    4. D

      The model needs a separate vocabulary for every sequence position

    Correct answer
    A

    Predictions 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.

  47. 47

    What central idea distinguishes attention from relying only on an RNN hidden state?

    1. A

      A model must discard the sequence after computing a hidden state

    2. B

      A token can attend only to itself and never to other tokens

    3. C

      A token must be represented only by its spelling

    4. D

      A token can directly connect to earlier tokens that may be relevant

    Correct answer
    D

    A 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.

  48. 48

    In a translation task, why can direct access to earlier source tokens be useful?

    1. A

      The model no longer needs to represent the target language

    2. B

      The model can replace all source tokens with a single padding token

    3. C

      The model can use the specific source word relevant to the translation being generated

    4. D

      The model can avoid learning any relationship between source and target text

    Correct answer
    C

    The 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.

  49. 49

    What does self-attention use to form a token's representation?

    1. A

      A label supplied for the entire sequence

    2. B

      Only a fixed embedding independent of all other tokens

    3. C

      Only the final token in the sequence

    4. D

      Information from other tokens in the same sequence

    Correct answer
    D

    Information from other tokens in the same sequence

    Explanation

    Self-attention represents a token as a function of tokens within the same sequence.

  50. 50

    What role does a query play in attention?

    1. A

      It represents the training label for the whole sentence

    2. B

      It stores the final probability distribution over the vocabulary

    3. C

      It marks the position where the sequence should stop

    4. D

      It represents what a token is seeking from other tokens to build a useful representation

    Correct answer
    D

    It 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.

  51. 51

    What role do keys play in attention?

    1. A

      They contain the final generated text sequence

    2. B

      They are compared with a query to determine the relevance of tokens

    3. C

      They encode the label used by the loss function

    4. D

      They force all tokens to receive equal attention weights

    Correct answer
    B

    They 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.

  52. 52

    What role do values play in attention?

    1. A

      They determine the vocabulary size of the tokenizer

    2. B

      They convert the query into a one-hot encoding

    3. C

      They mark which tokens occur after the current position

    4. D

      They provide the information combined using the attention weights

    Correct answer
    D

    They 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.

  53. 53

    How are queries, keys, and values typically obtained from token representations?

    1. A

      By selecting three tokens from the end of the sequence

    2. B

      By converting the representation into a padding mask only

    3. C

      By applying learned projection matrices to the input representations

    4. D

      By assigning each token an alphabetical rank

    Correct answer
    C

    By 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.

  54. 54

    What does the dot product between a query and a key indicate in the attention example?

    1. A

      Where the token occurs relative to the end of the sequence

    2. B

      How many characters are in the corresponding token

    3. C

      How similar or relevant the query is to that key

    4. D

      How many times the token appears in the vocabulary

    Correct answer
    C

    How 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.

  55. 55

    Why is softmax applied to attention scores?

    1. A

      It produces the end-of-sequence token directly

    2. B

      It turns the scores into normalized weights that sum to one

    3. C

      It ensures every query has the same similarity to every key

    4. D

      It converts the token sequence into a vocabulary

    Correct answer
    B

    It 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.

  56. 56

    What is the main effect of scaling query-key scores by the key dimension in attention?

    1. A

      It helps control the magnitude and variance of the scores

    2. B

      It increases the number of tokens in the sequence

    3. C

      It changes the attention output into a position index

    4. D

      It makes all values identical before they are combined

    Correct answer
    A

    It 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.

  57. 57

    Why can unmodified self-attention lose information about word order?

    1. A

      Values must be arranged in alphabetical order

    2. B

      Queries and keys cannot be compared using dot products

    3. C

      Softmax removes every token except the first one

    4. D

      Every token can interact with every other token without inherently encoding their positions

    Correct answer
    D

    Every 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.

  58. 58

    What is the role of the encoder in the original transformer for translation?

    1. A

      It determines the final sequence length before tokenization

    2. B

      It converts all target-language tokens into one-hot labels

    3. C

      It computes contextual representations of the source text

    4. D

      It chooses the next target token without consulting the source

    Correct answer
    C

    It computes contextual representations of the source text

    Explanation

    The encoder processes the source sequence and produces meaningful contextual representations for its tokens.

  59. 59

    What is the role of the decoder in the original transformer for translation?

    1. A

      It learns the vocabulary by merging frequent character pairs

    2. B

      It uses encoder information and generated tokens to produce the target sequence

    3. C

      It tokenizes only the source text and discards the target language

    4. D

      It creates static representations that never depend on context

    Correct answer
    B

    It 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.

  60. 60

    Why are token embeddings combined with position embeddings before transformer processing?

    1. A

      To make all tokens in the sequence have identical representations

    2. B

      To indicate that the model should stop generating text

    3. C

      To convert the input sequence into an output probability distribution

    4. D

      To represent both token identity and the token's location in the sequence

    Correct answer
    D

    To 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.

  61. 61

    What is a limitation of learned position embeddings?

    1. A

      They always make the sequence longer than character tokenization

    2. B

      They cannot distinguish adjacent positions from distant positions

    3. C

      They prevent the model from representing token identity

    4. D

      They may not represent positions longer than those seen or learned during training

    Correct answer
    D

    They 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.

  62. 62

    What is one motivation for sinusoidal positional representations using different frequencies?

    1. A

      They prevent the model from processing sequences in parallel

    2. B

      They can represent positions with a predefined pattern that is not limited to learned position indices

    3. C

      They ensure that every position receives exactly the same vector

    4. D

      They replace all token embeddings with character embeddings

    Correct answer
    B

    They 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.

  63. 63

    What property of sinusoidal positional representations was highlighted in the lecture?

    1. A

      Nearby positions must always be more dissimilar than distant positions

    2. B

      Position representations encode only the identity of the token

    3. C

      Nearby positions can have similar representations while distant positions are more dissimilar

    4. D

      All positions have exactly identical representations

    Correct answer
    C

    Nearby 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.

  64. 64

    What does the encoder's self-attention layer do?

    1. A

      It computes each token's representation using information from the other source tokens

    2. B

      It adds padding until every token has the same meaning

    3. C

      It predicts the next target token using only the vocabulary labels

    4. D

      It prevents source tokens from interacting with one another

    Correct answer
    A

    It 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.

  65. 65

    What is the purpose of the feed-forward network within a transformer block?

    1. A

      It transforms representations and learns nonlinear features

    2. B

      It determines which source language the input uses

    3. C

      It marks the beginning and end of every sequence

    4. D

      It replaces the attention mechanism with sequential recurrence

    Correct answer
    A

    It 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.

  66. 66

    What information does decoder self-attention use during generation?

    1. A

      The current decoded token and tokens generated up to that point

    2. B

      Only the final probability distribution over the vocabulary

    3. C

      All future target tokens, including those not generated yet

    4. D

      Only the encoder's source representations

    Correct answer
    A

    The 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.

  67. 67

    What is cross-attention in the transformer decoder?

    1. A

      Attention in which encoder queries use future decoder tokens as values

    2. B

      Attention that compares token positions but ignores token representations

    3. C

      Attention in which decoder queries use encoder representations as keys and values

    4. D

      Attention that assigns every vocabulary item the same probability

    Correct answer
    C

    Attention 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.

  68. 68

    How does a transformer decoder typically generate a sequence?

    1. A

      It repeatedly replaces the source with a padding token

    2. B

      It generates the entire output using only the beginning token in one step

    3. C

      It predicts one next token, feeds that token back in, and repeats until an end token

    4. D

      It predicts every token independently before seeing any input

    Correct answer
    C

    It 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.

  69. 69

    What is the function of the beginning-of-sequence token when translation generation starts?

    1. A

      It is the target sentence's final output token

    2. B

      It supplies the source tokens as keys and values

    3. C

      It provides a placeholder input that prompts the decoder to produce the first target token

    4. D

      It prevents the decoder from generating any further tokens

    Correct answer
    C

    It 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.

  70. 70

    What controls when autoregressive generation should stop?

    1. A

      The decoder produces a padding token as its first input

    2. B

      The encoder runs out of position embeddings

    3. C

      The model uses every token in the vocabulary once

    4. D

      The model produces an end-of-sequence token

    Correct answer
    D

    The model produces an end-of-sequence token

    Explanation

    An end-of-sequence token signals that the generated sequence is finished.

  71. 71

    Why are residual connections useful in deep transformer networks?

    1. A

      They convert attention weights into word-level tokens

    2. B

      They ensure that the model never changes its representations

    3. C

      They force each layer to replace its input entirely

    4. D

      They let information pass around a sublayer, helping optimization and learning

    Correct answer
    D

    They 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.

  72. 72

    What is the purpose of layer normalization in a transformer?

    1. A

      It normalizes activations and can help convergence

    2. B

      It merges frequent token pairs into a vocabulary

    3. C

      It supplies the decoder with future target words

    4. D

      It makes the output vocabulary smaller

    Correct answer
    A

    It normalizes activations and can help convergence

    Explanation

    Layer normalization is one of the techniques used to normalize activations and improve convergence during training.

  73. 73

    Why does a decoder use masked self-attention?

    1. A

      To ensure the decoder uses only one attention head

    2. B

      To restrict attention to source tokens and exclude all target tokens

    3. C

      To prevent the decoder from attending to its own current token

    4. D

      To prevent a token from attending to target tokens that have not yet been generated

    Correct answer
    D

    To 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.

  74. 74

    How can a causal attention mask be implemented conceptually?

    1. A

      By copying the encoder's values into the decoder's queries

    2. B

      By setting every permitted score to zero after softmax

    3. C

      By replacing future tokens with their vocabulary probabilities

    4. D

      By setting disallowed future-position scores to negative infinity before softmax

    Correct answer
    D

    By 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.

  75. 75

    What is multi-head attention?

    1. A

      Using one shared query and removing all key and value projections

    2. B

      Using several distinct query, key, and value projections in parallel

    3. C

      Replacing attention with several recurrent hidden states

    4. D

      Running the decoder once for each vocabulary token

    Correct answer
    B

    Using 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.

  76. 76

    What happens after the outputs of multiple attention heads are computed?

    1. A

      They are used only to identify unknown tokens

    2. B

      They are concatenated and projected back into the model representation space

    3. C

      They are discarded and replaced with one-hot token labels

    4. D

      They are averaged with the input positions before tokenization

    Correct answer
    B

    They 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.

  77. 77

    How does dropout help during model training?

    1. A

      It randomly drops some units so the model does not rely too heavily on particular features

    2. B

      It guarantees a probability of one for the correct label

    3. C

      It removes all input tokens that occur infrequently

    4. D

      It forces all attention heads to produce identical outputs

    Correct answer
    A

    It 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.

  78. 78

    What is label smoothing intended to do?

    1. A

      It requires the model to assign probability one to the target token

    2. B

      It assigns most probability to the target while allowing some probability for other valid alternatives

    3. C

      It removes all non-target tokens from the output vocabulary

    4. D

      It converts a target token into a position embedding

    Correct answer
    B

    It 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.

  79. 79

    Why can label smoothing be useful for language generation?

    1. A

      The model otherwise cannot produce a vocabulary-sized output

    2. B

      The model otherwise has no way to compute attention scores

    3. C

      A sentence can have multiple plausible continuations, so alternatives need not be treated as impossible

    4. D

      Every context has exactly one valid next word

    Correct answer
    C

    A 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.

  80. 80

    How do attention-layer softmax and final-output softmax differ in purpose?

    1. A

      Attention softmax weights tokens; output softmax gives probabilities over next-token choices

    2. B

      Attention softmax gives next-token probabilities; output softmax weights source tokens

    3. C

      Both softmax operations select the same single token at every layer

    4. D

      Both softmax operations serve only to normalize position embeddings

    Correct answer
    A

    Attention 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.

  81. 81

    Which components were emphasized as central to the transformer's learning capacity?

    1. A

      Tokenization and position indices alone

    2. B

      Attention and the feed-forward network

    3. C

      Residual connections and end-of-sequence markers alone

    4. D

      Padding tokens and sentence boundaries

    Correct answer
    B

    Attention 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.

  82. 82

    Why can a feed-forward network expand representations to a higher dimension before transforming them?

    1. A

      The expanded space allows the network to learn more complex representations

    2. B

      The expanded space guarantees that no nonlinearities are needed

    3. C

      The expanded space removes the need for output probabilities

    4. D

      The expanded space stores future tokens for masked attention

    Correct answer
    A

    The 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.

  83. 83

    What evaluation metric was mentioned as an example for machine translation?

    1. A

      BPE

    2. B

      BLEU

    3. C

      Word2Vec

    4. D

      LSTM

    Correct answer
    B

    BLEU

    Explanation

    The lecture names BLEU as an example of a metric used to evaluate machine translation.

Question 1 of 83
Question 1 of 83

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent