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

Study methods

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

Building Large Language Models

  • 27Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Overview

Which of the following is NOT one of the five key components for training large language models mentioned in the lecture?

27 questions

  1. 1

    Which of the following is NOT one of the five key components for training large language models mentioned in the lecture?

    1. A

      Architecture

    2. B

      Data

    3. C

      Training loss and algorithm

    4. D

      User interface design

    Correct answer
    D

    User interface design

    Explanation

    The five components are architecture, training loss/algorithm, data, evaluation, and systems. User interface design was not listed as a key component.

  2. 2

    What does an autoregressive language model compute?

    1. A

      The product of conditional probabilities of each word given the previous words

    2. B

      The probability of each word independently of the others

    3. C

      The joint probability of a sequence directly

    4. D

      The probability of the entire sequence using a single feedforward pass

    Correct answer
    A

    The product of conditional probabilities of each word given the previous words

    Explanation

    Autoregressive models decompose the joint distribution using the chain rule: P(x1,x2,...,xL)=∏t=1LP(xt∣x<t)P(x_1, x_2, ..., x_L) = \prod_{t=1}^L P(x_t | x_{<t})P(x1​,x2​,...,xL​)=∏t=1L​P(xt​∣x<t​).

  3. 3

    In the language modeling task, what loss function is typically used for training?

    1. A

      Hinge loss

    2. B

      Cross-entropy loss

    3. C

      Mean squared error

    4. D

      Pairwise ranking loss

    Correct answer
    B

    Cross-entropy loss

    Explanation

    The task is framed as classification of the next token, and cross-entropy loss is used, which is equivalent to maximizing the log-likelihood of the text.

  4. 4

    Why is tokenization necessary for language models?

    1. A

      To reduce the vocabulary size to exactly 50,000 tokens

    2. B

      Because words are too large to process efficiently

    3. C

      To handle typos, languages without spaces, and manage sequence length

    4. D

      Because character-level sequences are too short

    Correct answer
    C

    To handle typos, languages without spaces, and manage sequence length

    Explanation

    Tokenization handles typos (unseen words), languages like Thai (no spaces), and avoids extremely long sequences from character-level tokenization, which would be computationally expensive due to quadratic attention.

  5. 5

    How does Byte Pair Encoding (BPE) create a tokenizer?

    1. A

      By training a neural network to predict token boundaries

    2. B

      By splitting text into individual characters and then merging the most common adjacent pairs iteratively

    3. C

      By randomly selecting substrings from the corpus

    4. D

      By using a pre-defined dictionary of common words

    Correct answer
    B

    By splitting text into individual characters and then merging the most common adjacent pairs iteratively

    Explanation

    BPE starts with character-level tokens, then iteratively merges the most frequent pair of consecutive tokens, creating new tokens for common substrings.

  6. 6

    What does perplexity measure in the context of language models?

    1. A

      The total number of parameters in the model

    2. B

      The average number of tokens the model is uncertain about at each step

    3. C

      The fraction of correct predictions made by the model

    4. D

      The speed of text generation

    Correct answer
    B

    The average number of tokens the model is uncertain about at each step

    Explanation

    Perplexity is 2average loss2^{\text{average loss}}2average loss and ranges from 1 to vocabulary size, representing how many tokens the model is 'hesitating between' on average.

  7. 7

    Why is perplexity not used for academic benchmarking of modern LLMs?

    1. A

      Because it depends on the tokenizer, making comparisons across models unfair

    2. B

      Because it is too computationally expensive to compute

    3. C

      Because it only measures training loss, not generalization

    4. D

      Because it cannot be calculated for autoregressive models

    Correct answer
    A

    Because it depends on the tokenizer, making comparisons across models unfair

    Explanation

    Perplexity depends on vocabulary size and tokenization choices; different tokenizers lead to incomparable values. It remains useful for development within a fixed tokenizer.

  8. 8

    In the MMLU benchmark, how are models typically evaluated?

    1. A

      By using a separate reward model to score responses

    2. B

      By comparing the likelihood of each answer choice and selecting the most likely one

    3. C

      By generating free-form answers and checking for semantic equivalence

    4. D

      By asking human annotators to rank the outputs

    Correct answer
    B

    By comparing the likelihood of each answer choice and selecting the most likely one

    Explanation

    MMLU is multiple-choice; models are evaluated by computing the probability of each answer option (e.g., A, B, C, D) and picking the highest, often by comparing likelihoods or conditioning on the prompt.

  9. 9

    What is one approach to detect train-test contamination in language models?

    1. A

      Asking the model to report whether it has seen the data

    2. B

      Measuring perplexity on a held-out set

    3. C

      Using a separate validation set from the same distribution

    4. D

      Checking if the model generates examples in the original order better than in a shuffled order

    Correct answer
    D

    Checking if the model generates examples in the original order better than in a shuffled order

    Explanation

    If the test set was seen during training, the model will have lower perplexity when examples are in their original order (since it may have memorized sequences) compared to a shuffled order.

  10. 10

    Which of the following is a step NOT typically involved in processing Common Crawl data for pre-training?

    1. A

      Extracting text from HTML

    2. B

      Filtering out undesirable content (NSFW, PII)

    3. C

      Deduplicating near-duplicate documents

    4. D

      Labeling every sentence with its source domain

    Correct answer
    D

    Labeling every sentence with its source domain

    Explanation

    While domain classification is done, it is not applied to every sentence but to entire documents or segments. The other steps are standard: text extraction, filtering, and deduplication.

  11. 11

    How is model-based filtering of web data performed?

    1. A

      By using a pre-trained language model to score each document's quality

    2. B

      By selecting only documents that have been cited by academic papers

    3. C

      By training a classifier to distinguish between Wikipedia-referenced pages and random web pages

    4. D

      By removing any document that contains out-of-vocabulary tokens

    Correct answer
    C

    By training a classifier to distinguish between Wikipedia-referenced pages and random web pages

    Explanation

    A classifier is trained on pages linked from Wikipedia (assumed high-quality) versus random web pages, and documents with high probability of being from the Wikipedia-linked distribution are kept.

  12. 12

    According to scaling laws, what relationship exists between compute, data, model size, and test loss?

    1. A

      Loss is inversely proportional to the square of the number of parameters

    2. B

      Loss decreases as a power-law with compute, data size, and parameter count

    3. C

      Loss plateaus quickly and then increases with more compute

    4. D

      Loss decreases linearly with compute on a log-log scale, independent of data and parameters

    Correct answer
    B

    Loss decreases as a power-law with compute, data size, and parameter count

    Explanation

    Scaling laws show a power-law relationship: on a log-log plot, loss decreases linearly with increases in compute, dataset size, and number of parameters.

  13. 13

    The Chinchilla paper found that for compute-optimal training, the ratio of tokens to parameters should be approximately:

    1. A

      150 tokens per parameter

    2. B

      20 tokens per parameter

    3. C

      1 token per parameter

    4. D

      1000 tokens per parameter

    Correct answer
    B

    20 tokens per parameter

    Explanation

    Chinchilla determined optimal training uses about 20 tokens per parameter. However, considering inference cost, a higher ratio (around 150) is often used in practice to favor smaller models.

  14. 14

    What is one benefit of using scaling laws when deciding between two model architectures?

    1. A

      They provide a theoretical upper bound on model accuracy

    2. B

      They allow extrapolation of performance from small models to larger ones, enabling comparison

    3. C

      They eliminate the need for hyperparameter tuning

    4. D

      They guarantee which architecture will perform better at all scales

    Correct answer
    B

    They allow extrapolation of performance from small models to larger ones, enabling comparison

    Explanation

    By training both architectures at multiple smaller scales and fitting scaling laws, one can predict which architecture will be better when scaled up, as shown with Transformers vs. LSTMs.

  15. 15

    What is the main purpose of supervised fine-tuning (SFT) in the post-training stage?

    1. A

      To increase the model's vocabulary size

    2. B

      To teach the model entirely new factual knowledge

    3. C

      To reduce the number of parameters for faster inference

    4. D

      To specialize the pre-trained model to follow instructions and produce desired answer formats

    Correct answer
    D

    To specialize the pre-trained model to follow instructions and produce desired answer formats

    Explanation

    SFT fine-tunes the model on human-written instructions and desired responses, teaching it the format and style of a helpful assistant rather than new knowledge (which is already in pre-training data).

  16. 16

    According to the Lima paper, how does the amount of SFT data affect model performance?

    1. A

      Performance degrades with more data due to overfitting

    2. B

      Performance scales linearly with the amount of data

    3. C

      Performance does not improve much beyond a few thousand examples

    4. D

      Performance improves significantly up to 1 million examples

    Correct answer
    C

    Performance does not improve much beyond a few thousand examples

    Explanation

    The Lima paper showed that increasing SFT data from 2,000 to 32,000 examples did not yield significant gains, suggesting that SFT mainly teaches format and style, not knowledge.

  17. 17

    Why might supervised fine-tuning contribute to hallucination in LLMs?

    1. A

      Because the model overfits to the small SFT dataset

    2. B

      Because the model is forced to generate plausible-sounding responses for facts it may not know

    3. C

      Because SFT uses a different loss function that encourages creativity

    4. D

      Because the human-written answers may contain factual errors

    Correct answer
    B

    Because the model is forced to generate plausible-sounding responses for facts it may not know

    Explanation

    If a human provides a reference that the model never saw during pre-training, the model learns to generate that reference even though it has no real knowledge of it, leading to fabricated or hallucinated content.

  18. 18

    In RLHF, what is the role of a reward model?

    1. A

      To compute a continuous reward score for a given output, trained on human preferences

    2. B

      To generate new training examples

    3. C

      To replace the language model during inference

    4. D

      To penalize the model for using certain words

    Correct answer
    A

    To compute a continuous reward score for a given output, trained on human preferences

    Explanation

    The reward model is a classifier trained on human comparisons of outputs; it outputs a scalar reward (logit) that indicates how much humans would prefer that output.

  19. 19

    Which of the following is a key difference between PPO (used in RLHF) and DPO?

    1. A

      DPO does not require a separate reward model; it directly optimizes the policy using preference data

    2. B

      PPO is simpler and easier to implement than DPO

    3. C

      PPO does not use any regularization, while DPO does

    4. D

      DPO cannot be used with human feedback at all

    Correct answer
    A

    DPO does not require a separate reward model; it directly optimizes the policy using preference data

    Explanation

    DPO bypasses explicit reward modeling by directly using the likelihood of preferred and dispreferred outputs in a loss function that is mathematically equivalent to the RL objective.

  20. 20

    What challenge arises when using humans to provide preference data for RLHF?

    1. A

      Humans cannot distinguish between good and bad answers

    2. B

      Humans tend to focus on superficial features like length rather than correctness

    3. C

      Humans are always perfectly consistent

    4. D

      Humans require extensive training to become annotators

    Correct answer
    B

    Humans tend to focus on superficial features like length rather than correctness

    Explanation

    Human annotators often rely on heuristics such as preferring longer or more verbose answers, which can lead to reward models that over-optimize for those superficial qualities.

  21. 21

    According to the lecture, how do LLMs compare to humans as annotators for preference data?

    1. A

      LLMs cannot be used for preference annotation because they lack understanding

    2. B

      LLMs are cheaper and can achieve higher agreement with the human majority than humans themselves

    3. C

      Humans are always more reliable than LLMs

    4. D

      LLMs are more expensive but more accurate

    Correct answer
    B

    LLMs are cheaper and can achieve higher agreement with the human majority than humans themselves

    Explanation

    The lecture showed that LLMs are much cheaper and their preferences agree with the mode of human judges at a higher rate than individual humans do, reducing variance and cost.

  22. 22

    Why can perplexity not be used to evaluate post-trained (aligned) models?

    1. A

      Because perplexity does not reflect correctness

    2. B

      Because perplexity is only defined for regression tasks

    3. C

      Because aligned models are not trained to maximize likelihood and their perplexity is not meaningful

    4. D

      Because post-training changes the tokenizer

    Correct answer
    C

    Because aligned models are not trained to maximize likelihood and their perplexity is not meaningful

    Explanation

    After PPO/DPO, models are trained as policies rather than maximum likelihood estimators, so their probability distributions are distorted and perplexity does not reflect generation quality.

  23. 23

    Chatbot Arena evaluates models by:

    1. A

      Automatically checking answers against a golden dataset

    2. B

      Measuring the perplexity of each model on a standard test set

    3. C

      Using a single benchmark like MMLU for all tasks

    4. D

      Having blind pairwise comparisons by random users and aggregating preferences

    Correct answer
    D

    Having blind pairwise comparisons by random users and aggregating preferences

    Explanation

    Chatbot Arena allows users to chat with two anonymous models and pick the better response, then ranks models based on millions of such comparisons.

  24. 24

    A known bias of LLM-based evaluators (e.g., using GPT-4 to compare outputs) is:

    1. A

      They are perfectly aligned with human judgment

    2. B

      They prefer longer outputs, regardless of quality

    3. C

      They always prefer shorter answers

    4. D

      They cannot detect factual errors

    Correct answer
    B

    They prefer longer outputs, regardless of quality

    Explanation

    LLM evaluators exhibit a length bias: they tend to favor longer responses, even when humans would not. This can be partially corrected using regression with length as a confounding variable.

  25. 25

    What is Model FLOP Utilization (MFU) and what value is considered good?

    1. A

      The percentage of GPU memory used; 90% is ideal

    2. B

      The speed of data loading; 1 TB/s is required

    3. C

      The ratio of observed throughput to theoretical maximum; ~50% is typical

    4. D

      The number of floating-point operations per second; 100% is common

    Correct answer
    C

    The ratio of observed throughput to theoretical maximum; ~50% is typical

    Explanation

    MFU measures how efficiently the GPU is used. Values around 45-50% are considered good for large-scale training, indicating communication and memory bottlenecks limit throughput.

  26. 26

    Why is automatic mixed precision training commonly used?

    1. A

      To simplify the training code by removing manual precision choices

    2. B

      To ensure compatibility with older hardware

    3. C

      To reduce memory and speed up computation by using lower precision for most operations while maintaining accuracy

    4. D

      To increase model accuracy by using higher precision for all operations

    Correct answer
    C

    To reduce memory and speed up computation by using lower precision for most operations while maintaining accuracy

    Explanation

    Mixed precision stores weights in 32-bit but performs forward/backward in 16-bit, speeding up matrix multiplications and reducing memory. Updates are done in 32-bit to preserve small gradient changes.

  27. 27

    What does operator fusion (e.g., via torch.compile) achieve?

    1. A

      It merges multiple model checkpoints into one

    2. B

      It increases the batch size to use all GPU memory

    3. C

      It fuses different training datasets into one stream

    4. D

      It combines multiple sequential operations into a single kernel launch, reducing memory transfers

    Correct answer
    D

    It combines multiple sequential operations into a single kernel launch, reducing memory transfers

    Explanation

    Operator fusion reduces the number of round trips between GPU memory and compute units by performing all operations in one kernel, significantly improving throughput.

Question 1 of 27
Question 1 of 27

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent