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: Model Evolution
In the 2010s, language processing commonly used a different model for each
rather than one general-purpose model.

83 questions

  1. 1
    In the 2010s, language processing commonly used a different model for each
    _____
    rather than one general-purpose model.
    Hint

    Think of tasks such as translation or sentiment classification.

    Answer

    use case

    Explanation

    Before broadly capable language models, systems were typically designed for specific tasks, such as translation, sentiment extraction, or identifying names and locations.

  2. 2
    A model that determines whether a review is positive, negative, or neutral is performing
    _____
    extraction.
    Hint

    It identifies the attitude expressed in a text.

    Answer

    sentiment

    Explanation

    Sentiment extraction classifies the opinion or emotional tone of text, for example as positive, negative, or neutral.

  3. 3
    The 2017 paper “Attention Is All You Need” introduced the
    _____
    architecture.
    Hint

    This architecture is based on attention rather than recurrence through tokens.

    Answer

    transformer

    Explanation

    The paper introduced the transformer, which uses attention mechanisms to build representations of sequences.

  4. 4
    The transformer was considered scalable because increasing data, compute, and model parameters could produce substantial
    _____
    gains.
    Hint

    This is an improvement in how well the model performs.

    Answer

    performance

    Explanation

    Scaling the amount of data, compute, and model parameters was associated with performance gains greater than those commonly seen in earlier approaches.

  5. 5
    The release of ChatGPT in 2022 was a turning point in how widely people interacted with
    _____
    .
    Hint

    These systems let people communicate with a model through conversation.

    Answer

    chatbots

    Explanation

    The release brought many people into direct, conversational interaction with a language model.

  6. 6
    Modern LLMs developed in part by scaling transformers in model size and in the number of training
    _____
    .
    Hint

    These are the text units processed by the model during training.

    Answer

    tokens

    Explanation

    Transformers were scaled both in the number of model parameters and in the number of tokens on which they were trained.

  7. 7
    A system that moves beyond conversation to take actions toward goals exhibits
    _____
    behavior.
    Hint

    This term describes behavior associated with agents that act, not just respond.

    Answer

    agentic

    Explanation

    Agentic behavior refers to language-model systems acting in more capable ways, such as through coding agents and other applications.

  8. 8
    Because models process numbers rather than raw text, tokenization turns text into units that can ultimately be represented
    _____
    .
    Hint

    Think about the kind of input mathematical models can process.

    Answer

    numerically

    Explanation

    Models work with numerical representations, so text must first be divided into units and represented in a numerical form.

  9. 9
    Tokenization is the process of dividing text into
    _____
    entities.
    Hint

    Each resulting unit is treated as an atomic piece by the tokenizer.

    Answer

    indivisible

    Explanation

    Tokenization divides text into units called tokens, which the tokenizer treats as indivisible entities.

  10. 10
    Each unit produced by a tokenizer is called a
    _____
    .
    Hint

    It is one of the text units that a model represents numerically.

    Answer

    token

    Explanation

    A token is an individual unit produced by dividing text during tokenization.

  11. 11
    The set of all tokens permitted by a tokenizer is its
    _____
    .
    Hint

    It lists the tokenizer’s available token units.

    Answer

    vocabulary

    Explanation

    A vocabulary contains the possible tokens that a tokenizer can use to represent text.

  12. 12
    For a fixed text, choosing a different vocabulary can change the number of tokens, or the
    _____
    length.
    Hint

    This length counts the units produced when text is split.

    Answer

    sequence

    Explanation

    Different vocabularies may divide the same text into different numbers of tokens, changing its sequence length.

  13. 13
    A word-level tokenizer can be simple and interpretable because each token corresponds to a
    _____
    .
    Hint

    This approach commonly uses spaces as delimiters.

    Answer

    word

    Explanation

    In word-level tokenization, words are tokens, making the mapping between a token and a word straightforward to interpret.

  14. 14
    A drawback of word-level tokenization is that many word forms and variations can make its vocabulary very
    _____
    .
    Hint

    Consider how singulars, plurals, and other variations add distinct entries.

    Answer

    large

    Explanation

    Word-level tokenization may require separate vocabulary entries for many variations of words, increasing vocabulary size.

  15. 15
    If a word-level tokenizer encounters a word absent from its training data and vocabulary, it faces an out-of-vocabulary
    _____
    .
    Hint

    The model lacks a learned representation for the unseen word.

    Answer

    problem

    Explanation

    An out-of-vocabulary problem occurs when a token is encountered at inference time but was not included in the vocabulary learned from training data.

  16. 16
    Character-level tokenization reduces vocabulary size and can handle misspellings, but typically creates a much longer
    _____
    .
    Hint

    A word must be represented using several small units.

    Answer

    sequence

    Explanation

    Representing text character by character uses fewer token types and can be robust to spelling variation, but it increases the number of tokens in an input.

  17. 17
    A compromise between word-level and character-level tokenization is
    _____
    tokenization.
    Hint

    Its units are smaller than words but can combine common letter sequences.

    Answer

    subword

    Explanation

    Subword tokenization splits text into units between the size of whole words and individual characters.

  18. 18
    Subword tokenization can make related forms such as “bear” and “bears” share a common
    _____
    .
    Hint

    This is the central word element shared by related forms.

    Answer

    root

    Explanation

    By representing common word roots, subword tokenization can share units across related forms such as singular and plural words.

  19. 19
    BPE builds a vocabulary by repeatedly merging the most frequent pairs of tokens until it reaches a desired vocabulary
    _____
    .
    Hint

    This is the target number of available token types.

    Answer

    size

    Explanation

    BPE begins with an initial set of tokens, identifies frequent pairs, adds merged tokens, and repeats until reaching a chosen vocabulary size.

  20. 20
    For multilingual use, a tokenizer should be trained on a corpus that represents all the languages of
    _____
    .
    Hint

    The data should reflect the languages the application needs to handle.

    Answer

    interest

    Explanation

    Training a tokenizer on representative text from the target languages helps ensure that the vocabulary can tokenize those languages effectively.

  21. 21
    A special token used to represent text not present in the vocabulary is the
    _____
    token.
    Hint

    It stands in for a piece of text the tokenizer does not recognize.

    Answer

    unknown

    Explanation

    The unknown token is a dedicated token used for out-of-vocabulary text.

  22. 22
    The token that signals the start of a sequence to be generated is the beginning of sequence, or
    _____
    token.
    Hint

    It is the standard abbreviation for beginning of sequence.

    Answer

    BOS

    Explanation

    A BOS token can be supplied to indicate that the model should begin generating text.

  23. 23
    The token that signals that generation has finished is the end of sequence, or
    _____
    token.
    Hint

    It is the standard abbreviation for end of sequence.

    Answer

    EOS

    Explanation

    An EOS token marks the end of generated text and can tell a system to stop generation.

  24. 24
    A special token used to make sequences reach a chosen length is the
    _____
    token.
    Hint

    It fills space so sequences can share dimensions for efficient processing.

    Answer

    padding

    Explanation

    Padding tokens can make sequences the same length, which is useful when representing batches as matrices or tensors.

  25. 25
    Names and spellings for special tokens are not universal, so different systems may use different
    _____
    .
    Hint

    These are agreed-upon ways of representing tokens and roles.

    Answer

    conventions

    Explanation

    The written forms of tokens such as BOS, EOS, and padding vary across systems; the conventions are not universal.

  26. 26
    Tokens that identify conversational roles, such as user and assistant, are also represented with
    _____
    tokens.
    Hint

    They are dedicated tokens that convey information beyond ordinary text content.

    Answer

    special

    Explanation

    Special tokens can indicate conversational roles, including user and assistant, as well as sequence boundaries or other structural information.

  27. 27
    A vocabulary of roughly hundreds of thousands of entries is a typical order of magnitude for some current LLM
    _____
    .
    Hint

    These systems determine how text is divided into tokens.

    Answer

    tokenizers

    Explanation

    The lecture described current LLM vocabularies as being on the order of hundreds of thousands of tokens, with an example around 200,000.

  28. 28
    A one-hot encoding assigns each token a distinct vector, making different token vectors
    _____
    to one another.
    Hint

    Their pairwise dot products do not indicate semantic similarity.

    Answer

    orthogonal

    Explanation

    Different one-hot vectors have zero dot products, so they do not express meaningful relationships between tokens.

  29. 29
    Useful token representations should reflect how
    _____
    the represented tokens are to one another.
    Hint

    For example, related concepts should have representations that are close in some sense.

    Answer

    similar

    Explanation

    Meaningful representations encode relationships between tokens, such as a teddy bear and the quality “soft.”

  30. 30
    Word2vec learns useful representations through a
    _____
    task that supports a different end goal.
    Hint

    It is an intermediate learning objective rather than the final application itself.

    Answer

    proxy

    Explanation

    A proxy task is learned to produce representations useful for some other goal, such as language understanding or prediction.

  31. 31
    The word2vec variant that predicts a word from its surrounding context words is called continuous bag of
    _____
    .
    Hint

    The name is commonly abbreviated CBOW.

    Answer

    words

    Explanation

    Continuous bag of words predicts a target word from context words surrounding it.

  32. 32
    The word2vec variant that predicts surrounding words from a given word is called skip
    _____
    .
    Hint

    This is the other commonly discussed word2vec objective.

    Answer

    gram

    Explanation

    Skip gram predicts context words that surround a given input word.

  33. 33
    In a basic word-prediction network, the hidden or latent representation has dimension
    _____
    .
    Hint

    The lecture used this symbol for a dimension typically smaller than vocabulary size.

    Answer

    D

    Explanation

    The hidden representation has size DDD, a chosen dimension that is typically much smaller than vocabulary size.

  34. 34
    A model’s predicted probability vector must have one entry for each vocabulary item, so its size is
    _____
    .
    Hint

    This symbol denotes the vocabulary size.

    Answer

    V

    Explanation

    The output layer predicts a probability for every token, giving an output vector of size VVV, where VVV is the vocabulary size.

  35. 35
    A
    _____
    function can normalize predicted token scores so that they form probabilities that sum to one.
    Hint

    It converts a collection of scores into a probability distribution.

    Answer

    softmax

    Explanation

    Softmax transforms output scores into probabilities over the vocabulary, with probabilities summing to one.

  36. 36
    When word2vec is trained, its learned hidden representations can place semantically related words near each other in representation
    _____
    .
    Hint

    This is the mathematical space in which vectors can be compared.

    Answer

    space

    Explanation

    The learned representations can encode semantic relationships, such as associations between Paris and France or between a teddy bear and softness.

  37. 37
    A limitation of static word representations is that a word such as “bank” receives the same representation even when its intended
    _____
    changes.
    Hint

    Compare a river bank with a financial institution.

    Answer

    meaning

    Explanation

    A static embedding does not vary with sentence context, so it cannot by itself distinguish different meanings of the same word.

  38. 38
    Because word2vec does not encode word order, reversing who hugs whom can leave the same set of word
    _____
    and produce indistinguishable input representations.
    Hint

    These are the vector representations associated with the words.

    Answer

    embeddings

    Explanation

    A bag-of-words-style representation ignores order, so sentences containing the same words in different orders may receive the same representations.

  39. 39
    An RNN maintains a
    _____
    state that summarizes the sequence seen so far.
    Hint

    This state is updated as each input token is processed.

    Answer

    hidden

    Explanation

    An RNN carries a hidden state from one token to the next to represent information about the sequence processed so far.

  40. 40
    Unlike a static word embedding, an RNN’s representation can account for word
    _____
    by incorporating the hidden state from earlier tokens.
    Hint

    The sequence in which tokens appear affects the evolving state.

    Answer

    order

    Explanation

    Because an RNN processes tokens sequentially and updates its state, it can represent information about their order.

  41. 41
    For sequence classification, an RNN can process tokens one at a time and use its evolving state to predict a class such as
    _____
    .
    Hint

    This class describes whether text is positive, negative, or neutral.

    Answer

    sentiment

    Explanation

    RNNs were used for classification tasks such as sentiment extraction, where the model predicts a label based on the sequence.

  42. 42
    A word-level classification task can use RNN representations to determine whether each word is a noun or a
    _____
    .
    Hint

    This is another grammatical category mentioned as an example.

    Answer

    verb

    Explanation

    For tasks such as part-of-speech classification, RNN-based systems can use contextual representations to classify each word.

  43. 43
    An RNN may struggle to preserve information about events far back in a sequence, a difficulty known as long-range
    _____
    .
    Hint

    The name describes a relationship between elements separated by a large distance in the sequence.

    Answer

    dependency

    Explanation

    Long-range dependency is the difficulty of retaining and using information from much earlier in a sequence.

  44. 44
    The long-range dependency problem in RNNs is connected to the
    _____
    gradient problem during backpropagation.
    Hint

    This gradient problem involves signals becoming too small as they propagate.

    Answer

    vanishing

    Explanation

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

  45. 45
    An LSTM attempts to retain information for longer by adding a
    _____
    state alongside the hidden state.
    Hint

    This additional state is part of the name long short-term memory.

    Answer

    cell

    Explanation

    Long short-term memory (LSTM) models maintain both a hidden state and a cell state intended to carry information for longer.

  46. 46
    Because a basic RNN must process tokens one at a time, its sequential computation can make training very
    _____
    .
    Hint

    The next step depends on the state produced by the previous step.

    Answer

    slow

    Explanation

    RNN computation is sequential: the model must update its hidden state token by token, which can make training slow.

  47. 47
    Attention improves access to earlier context by allowing direct connections from a token to relevant tokens in the
    _____
    .
    Hint

    These are tokens that appeared earlier in the sequence.

    Answer

    past

    Explanation

    Instead of relying only on a single accumulated hidden state, attention lets a model directly connect to earlier tokens when making a prediction.

  48. 48
    In self-attention, a token’s representation is computed as a function of other tokens in the same
    _____
    .
    Hint

    The tokens belong to the input being processed together.

    Answer

    sequence

    Explanation

    Self-attention allows each token to use information from other tokens in its sequence when constructing its representation.

  49. 49
    In attention, the
    _____
    is the representation that searches for relevant information to construct a token’s representation.
    Hint

    It is compared against keys to determine which tokens are relevant.

    Answer

    query

    Explanation

    A query represents what a token is looking for when identifying useful information from other tokens.

  50. 50
    In attention,
    _____
    are compared with a query to assess how relevant each token is.
    Hint

    Each token has one of these representations, paired with a value.

    Answer

    keys

    Explanation

    Keys are compared with a query, commonly using a dot product, to determine attention weights over tokens.

  51. 51
    In attention, the
    _____
    vectors provide the information combined using the attention weights.
    Hint

    After relevance weights are found, these vectors are weighted and summed.

    Answer

    value

    Explanation

    Values contain the information that is combined according to the weights computed from query-key similarity.

  52. 52
    Query, key, and value representations are produced from input representations using learned
    _____
    matrices.
    Hint

    These matrices map inputs into the query, key, and value spaces.

    Answer

    projection

    Explanation

    Learned projection matrices transform input token representations into queries, keys, and values.

  53. 53
    A query-key dot product provides a measure of their
    _____
    in the attention calculation.
    Hint

    A larger score can indicate that a token is more relevant to the query.

    Answer

    similarity

    Explanation

    The dot product between a query and a key is used as a similarity score that helps determine how strongly the corresponding value contributes.

  54. 54
    The original transformer uses an
    _____
    and a decoder for machine translation.
    Hint

    It processes the source-language text before translation is generated.

    Answer

    encoder

    Explanation

    The transformer’s encoder computes representations of the source text; its decoder uses them to generate a translation.

  55. 55
    The encoder’s role is to compute meaningful representations of the input
    _____
    text.
    Hint

    This is the language from which a translation is made.

    Answer

    source

    Explanation

    In machine translation, the encoder processes the source-language text and produces representations used by the decoder.

  56. 56
    The decoder uses the encoder’s representations and its own generated context to produce the
    _____
    text.
    Hint

    This is the language into which the source is translated.

    Answer

    target

    Explanation

    The decoder produces the target-language sequence using information from the encoded source and the tokens generated so far.

  57. 57
    The input representation in the original transformer combines a token embedding with a
    _____
    embedding.
    Hint

    This added information tells the model where a token appears in the sequence.

    Answer

    position

    Explanation

    Adding positional information to token embeddings gives the model information about token locations and order.

  58. 58
    A limitation of learned position embeddings is that they may not represent positions beyond the largest position seen during
    _____
    .
    Hint

    The model learns its position representations from data during this phase.

    Answer

    training

    Explanation

    If learned position embeddings exist only up to a fixed position, a longer input may include positions for which no embedding was learned.

  59. 59
    The original transformer also described position representations built from sine and cosine functions at different
    _____
    .
    Hint

    Different rates of variation help distinguish positions.

    Answer

    frequencies

    Explanation

    Sinusoidal position representations use sine and cosine functions at different frequencies to encode position information.

  60. 60
    The encoder’s self-attention layer computes each token’s representation using information from other tokens in the
    _____
    .
    Hint

    Unlike an RNN state, the computation can directly use other tokens in the input.

    Answer

    sequence

    Explanation

    Encoder self-attention creates context-aware token representations by allowing tokens to attend to other tokens in the input sequence.

  61. 61
    After self-attention, the encoder uses a feed-forward neural network to project representations and learn
    _____
    .
    Hint

    Activation functions allow the network to model relationships that are not merely linear.

    Answer

    nonlinearities

    Explanation

    The feed-forward neural network includes an activation function and provides the transformer with the capacity to learn nonlinear transformations.

  62. 62
    In a decoder, masked self-attention prevents a token from using tokens that have not yet been
    _____
    .
    Hint

    Generation proceeds from earlier tokens to later ones.

    Answer

    decoded

    Explanation

    Masked self-attention ensures that each position can attend only to itself and earlier generated tokens, not future tokens.

  63. 63
    In cross-attention, decoder representations act as queries, while encoder representations provide the keys and
    _____
    .
    Hint

    These encoder quantities supply information about the source text.

    Answer

    values

    Explanation

    Cross-attention lets decoder tokens use the encoder’s source-text representations, with decoder states as queries and encoder states as keys and values.

  64. 64
    After the decoder produces a token representation, a projection and softmax produce a probability distribution over the
    _____
    .
    Hint

    The model must select its next token from this set.

    Answer

    vocabulary

    Explanation

    The output layer maps a decoder representation to scores for vocabulary tokens and uses softmax to produce next-token probabilities.

  65. 65
    Generating one token, feeding it back, and repeating the process is called
    _____
    generation.
    Hint

    Each new output depends on previously generated output.

    Answer

    autoregressive

    Explanation

    In autoregressive generation, the model predicts a token, adds it to the context, and then predicts the next token.

  66. 66
    The decoder stops generating when it produces the
    _____
    token.
    Hint

    This special token marks completion of the output sequence.

    Answer

    end of sequence

    Explanation

    An end-of-sequence token signals that generation, such as a translation, is finished.

  67. 67
    In the attention calculation, multiplying the query matrix by the transposed key matrix produces pairwise query-key
    _____
    scores.
    Hint

    Each entry compares one query with one key.

    Answer

    similarity

    Explanation

    The product QKTQK^TQKT contains dot products between queries and keys, giving a score for each query-key pair.

  68. 68
    The query-key score matrix for a sequence of length nnn has dimensions nnn by
    _____
    .
    Hint

    There is one score for every query-position and key-position pair.

    Answer

    n

    Explanation

    With nnn queries and nnn keys, the matrix QKTQK^TQKT has shape n×nn \times nn×n.

  69. 69
    Applying softmax to attention scores makes the weights for each query sum to
    _____
    .
    Hint

    They form a probability distribution over the keys.

    Answer

    one

    Explanation

    Softmax normalizes the scores into weights that sum to one for each query, allowing a weighted combination of values.

  70. 70
    Scaled dot-product attention divides query-key scores by the square root of the key dimension, written as
    _____
    outside the blank.
    Hint

    The scaling factor depends on the dimension of the key vectors.

    Answer

    DK\sqrt{D_K}DK​​

    Explanation

    The attention formula scales dot products by DK\sqrt{D_K}DK​​ to control their variance as key dimension changes.

  71. 71
    After attention weights are calculated, they are applied to the
    _____
    vectors to produce weighted representations.
    Hint

    These vectors carry the information being combined.

    Answer

    value

    Explanation

    The attention weights multiply the value vectors, and the resulting weighted vectors are summed to form the attention output.

  72. 72
    Multi-head attention repeats attention using several different learned query, key, and value projections, called attention
    _____
    .
    Hint

    The original transformer used multiple parallel versions of the attention operation.

    Answer

    heads

    Explanation

    Each attention head can learn a different projection and way of attending; the head outputs are combined afterward.

  73. 73
    The original transformer paper stacked six encoder blocks and six decoder blocks, so its stack depth was
    _____
    for each type.
    Hint

    This is the value of NNN given for the original paper.

    Answer

    six

    Explanation

    The original transformer used N=6N=6N=6 repeated blocks in both the encoder and decoder stacks.

  74. 74
    A residual connection adds the layer input back to the layer’s transformation, helping the model modify rather than completely replace its
    _____
    .
    Hint

    The original information is passed along through the connection.

    Answer

    input

    Explanation

    A residual connection makes a layer output resemble a transformation of xxx plus xxx, which can help preserve features and improve learning.

  75. 75
    Residual connections are useful in deep networks partly because they help with
    _____
    propagation.
    Hint

    This is the direction in which gradients travel to update earlier layers.

    Answer

    back

    Explanation

    Passing information directly through residual paths can help backpropagation and make deep models easier to train.

  76. 76
    Layer normalization normalizes activations and can help improve training
    _____
    .
    Hint

    It concerns whether training moves toward a stable solution effectively.

    Answer

    convergence

    Explanation

    Layer normalization is used to normalize activations and can help a model converge during training.

  77. 77
    Dropout randomly removes some units during training so that a model does not rely too strongly on particular
    _____
    .
    Hint

    These are signals in the model’s representation that may be overused.

    Answer

    features

    Explanation

    Dropout reduces reliance on particular units or features by dropping them with some probability during training, which can improve generalization.

  78. 78
    By reducing over-reliance on particular features, dropout can help a model
    _____
    better to new data.
    Hint

    This means performing well beyond the training examples.

    Answer

    generalize

    Explanation

    Dropout is a regularization technique intended to help a model generalize to unseen data.

  79. 79
    Label smoothing replaces a fully certain target distribution with a softer one that assigns some probability to other
    _____
    .
    Hint

    The target is a token prediction, but other completions may also be valid.

    Answer

    words

    Explanation

    Instead of assigning 100% probability to one target token, label smoothing distributes some probability across alternative vocabulary tokens.

  80. 80
    Label smoothing can reflect the fact that language often has multiple valid ways to complete a
    _____
    .
    Hint

    Different words can produce acceptable continuations of the same linguistic context.

    Answer

    sentence

    Explanation

    A single next word is not always the only valid continuation, so label smoothing softens the target distribution rather than demanding absolute certainty.

  81. 81
    The attention softmax creates weights over keys, whereas the final output softmax creates probabilities over candidate next
    _____
    .
    Hint

    One softmax selects relevant context; the other supports generation.

    Answer

    tokens

    Explanation

    Softmax in an attention layer weights source positions, while the final softmax gives probabilities over vocabulary tokens for next-token prediction.

  82. 82
    In the transformer, attention enables tokens to exchange contextual information, while the feed-forward network contains much of the model’s parameter
    _____
    .
    Hint

    This refers to how much the network can learn and represent.

    Answer

    capacity

    Explanation

    The attention layer is central to token interactions, while the feed-forward networks contain many of the model parameters and provide substantial learning capacity.

  83. 83
    The quality of training
    _____
    is also an important factor in how well a language model works.
    Hint

    Models learn from the examples they are trained on.

    Answer

    data

    Explanation

    Alongside architecture and training techniques, the quality of the data used to train a model contributes to its performance.

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