1. Home
  2. Explore
  3. Computer Science
  4. GPT and Transformer Basics

Study methods

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

GPT and Transformer Basics

  • 21Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: GPT and Transformer Overview

What does GPT stand for?

21 questions

  1. 1

    What does GPT stand for?

    Model answer

    Generative Pretrained Transformer.

    Explanation

    The acronym is defined explicitly in the text as Generative Pretrained Transformer.

  2. 2

    What is a transformer in the context of AI?

    Model answer

    A transformer is a specific kind of neural network that is the core invention behind modern AI tools like ChatGPT.

    Explanation

    The text describes the transformer as a type of neural network and the key innovation underlying the current AI boom.

  3. 3

    Describe the basic process by which a transformer generates text from an initial snippet.

    Model answer

    The model tokenizes the input, converts tokens to vectors, processes them through attention and feed-forward layers, then uses the last vector to predict a probability distribution over next tokens, samples from it, appends the sample, and repeats.

    Explanation

    The text outlines this iterative process of prediction and sampling.

  4. 4

    What are tokens in a transformer model?

    Model answer

    Tokens are pieces of text, such as words, subwords, or common character combinations, that the input is broken into.

    Explanation

    The text states that tokens are 'little pieces' like words or parts of words.

  5. 5

    How are tokens converted into vectors for processing?

    Model answer

    Each token is associated with a vector by looking up its column in the embedding matrix.

    Explanation

    The embedding matrix has a column for each token in the vocabulary, and that column is the vector for that token.

  6. 6

    What is the purpose of word embeddings in a transformer?

    Model answer

    Word embeddings encode the meaning of words as vectors, with similar words having vectors that are close in the high-dimensional space.

    Explanation

    The text explains that embeddings represent meaning and that directions in the space can have semantic significance.

  7. 7

    How does the dot product of two vectors relate to their alignment?

    Model answer

    The dot product is positive when vectors point in similar directions, zero when perpendicular, and negative when opposite.

    Explanation

    This geometric interpretation is given explicitly in the text.

  8. 8

    What does the attention block do in a transformer?

    Model answer

    The attention block allows vectors to 'talk to each other' by exchanging information based on relevance, updating their values to incorporate context.

    Explanation

    The text describes attention as enabling vectors to pass information back and forth to update meanings based on context.

  9. 9

    What is the role of the multi-layer perceptron (feed-forward) layer in a transformer?

    Model answer

    It processes each vector independently in parallel, updating them based on a series of learned questions, without communication between vectors.

    Explanation

    The text says vectors go through the same operation in parallel, like asking a list of questions about each vector.

  10. 10

    What does 'context size' refer to in a transformer?

    Model answer

    It is the fixed number of tokens (vectors) the network can process at once, limiting how much text it can consider when making a prediction.

    Explanation

    The text states the context size limits how much text the transformer can incorporate.

  11. 11

    How does the transformer produce a probability distribution over the next token?

    Model answer

    The last vector in the sequence is multiplied by the unembedding matrix to produce logits, which are then normalized by the softmax function into a probability distribution.

    Explanation

    The text explains the final steps: unembedding matrix gives logits, then softmax normalizes them.

  12. 12

    What is the unembedding matrix?

    Model answer

    It is a weight matrix that maps the final vector from the embedding dimension to a vector of size equal to the vocabulary, producing logits for each token.

    Explanation

    The text defines the unembedding matrix as having one row per token and transforming the last embedding into logits.

  13. 13

    What does the softmax function do?

    Model answer

    It converts an arbitrary list of numbers into a valid probability distribution by exponentiating each number, summing them, and dividing each by the sum.

    Explanation

    The text describes softmax as exponentiating then normalizing to get probabilities between 0 and 1 that sum to 1.

  14. 14

    How does temperature affect the softmax output?

    Model answer

    Higher temperature makes the distribution more uniform (gives more weight to lower-probability tokens), while lower temperature makes it sharper (dominant tokens get more weight).

    Explanation

    The text explains temperature by dividing the logits by T before softmax, with T > 1 softening and T < 1 sharpening.

  15. 15

    What are logits?

    Model answer

    Logits are the raw, unnormalized scores output by the unembedding matrix before softmax is applied.

    Explanation

    The text refers to the components of the final multiplication as logits.

  16. 16

    How are the weights (parameters) of a transformer model learned?

    Model answer

    They are learned through training using the backpropagation algorithm on a large dataset, starting from random initialization.

    Explanation

    The text mentions that weights are learned based on data and that deep learning uses backpropagation.

  17. 17

    Why must inputs to a deep learning model be formatted as arrays of real numbers?

    Model answer

    Because the operations used (matrix multiplications, weighted sums) require numerical inputs, and the model processes data as tensors (arrays of numbers).

    Explanation

    The text states that inputs must be arrays of real numbers to perform matrix operations, and that all layers are arrays of numbers.

  18. 18

    What is the approximate number of parameters in GPT-3?

    Model answer

    175 billion parameters.

    Explanation

    The text explicitly gives this number.

  19. 19

    What is the embedding dimension and vocabulary size in GPT-3?

    Model answer

    Embedding dimension is 12,288 and vocabulary size is 50,257.

    Explanation

    These numbers are provided in the text for GPT-3.

  20. 20

    Give an example of a semantic direction found in word embeddings, as illustrated in the text.

    Model answer

    The gender direction: the difference between 'woman' and 'man' vectors is similar to the difference between 'queen' and 'king'.

    Explanation

    The text uses this example to show that directions can encode gender.

  21. 21

    How does the model use the dot product to measure 'plurality' in word embeddings?

    Model answer

    By computing the dot product of a vector representing the 'plurality' direction (e.g., cats - cat) with word embeddings, plural nouns give higher dot products than singular nouns.

    Explanation

    The text demonstrates this with an experiment showing that plural nouns align more with the cat-cats difference vector.

1 of 21
Question 1 of 21

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent