1. Home
  2. Explore
  3. Computer Science
  4. Self-Attention and Transformers

Study methods

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

Self-Attention and Transformers

  • 50Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: RNN Limitations

What is the main limitation of an RNN's linear interaction distance?

50 questions

  1. 1

    What is the main limitation of an RNN's linear interaction distance?

    1. A

      Words at adjacent positions cannot influence one another during computation

    2. B

      The model cannot represent any dependency involving more than two words

    3. C

      The model always treats every word as independent of its sentence context

    4. D

      Words separated by many time steps may be difficult to connect through computation

    Correct answer
    D

    Words separated by many time steps may be difficult to connect through computation

    Explanation

    In an RNN, information must pass through each intermediate time step. Consequently, words that are far apart may have difficulty interacting and learning long-distance dependencies.

  2. 2

    Why can an RNN struggle to learn that "chef" and "was" are related in a long sentence?

    1. A

      The gradient must propagate through many recurrent steps between the two words

    2. B

      The words must have identical embeddings before the RNN can relate them

    3. C

      The recurrent matrix removes all information about earlier words

    4. D

      The RNN can only process nouns and verbs at separate time steps

    Correct answer
    A

    The gradient must propagate through many recurrent steps between the two words

    Explanation

    The relationship between distant words must be learned through repeated applications of the recurrent transformation, which can make gradient propagation difficult.

  3. 3

    What does the dependence on sequence index imply for an RNN's computation?

    1. A

      The model can process future positions before processing earlier positions

    2. B

      Every hidden state can be computed independently from the input sequence

    3. C

      The hidden state at one position depends on hidden states computed earlier

    4. D

      The number of recurrent operations decreases as sequence length increases

    Correct answer
    C

    The hidden state at one position depends on hidden states computed earlier

    Explanation

    An RNN must compute earlier hidden states before later hidden states, creating a sequential dependency on the position or time index.

  4. 4

    Why are RNN operations difficult to parallelize on a GPU?

    1. A

      GPU matrix multiplication cannot be used with recurrent weight matrices

    2. B

      RNNs perform no matrix multiplications during their forward passes

    3. C

      The hidden state at time step ttt requires the hidden state from an earlier step

    4. D

      Each word must be converted into a different vocabulary before processing

    Correct answer
    C

    The hidden state at time step ttt requires the hidden state from an earlier step

    Explanation

    The hidden state at time step ttt cannot be computed until preceding hidden states have been computed, producing approximately sequence-length many unparallelizable operations.

  5. 5

    How do LSTMs improve on simple RNNs without fully solving the long-distance problem?

    1. A

      They guarantee perfect learning of every dependency in a long document

    2. B

      They model gradients across long distances better, but their sequential structure remains

    3. C

      They replace every word representation with a fixed one-hot vector

    4. D

      They eliminate all sequential dependencies while retaining recurrent computation

    Correct answer
    B

    They model gradients across long distances better, but their sequential structure remains

    Explanation

    LSTMs handle gradient propagation across long distances better than simple RNNs, but they still process sequences recurrently and do not completely eliminate long-distance difficulties.

  6. 6

    What does attention provide in a sequence-to-sequence model?

    1. A

      A replacement for word embeddings with exact dictionary lookups

    2. B

      A guarantee that the decoder generates all target words simultaneously

    3. C

      Flexible access to encoder information instead of one fixed sentence vector

    4. D

      A way to remove the need for an encoder entirely

    Correct answer
    C

    Flexible access to encoder information instead of one fixed sentence vector

    Explanation

    Attention lets a decoder selectively access information from the encoder, avoiding the bottleneck of compressing an entire source sentence into one vector.

  7. 7

    What is the key-value lookup interpretation of attention?

    1. A

      Keys and values are averaged before any query is introduced

    2. B

      Each value selects a query and replaces the corresponding key

    3. C

      A query exactly matches one key and discards all other values

    4. D

      A query softly matches keys and uses the resulting weights to combine values

    Correct answer
    D

    A query softly matches keys and uses the resulting weights to combine values

    Explanation

    Attention performs a fuzzy lookup: the query is compared with every key, the similarities are normalized into weights, and the values are combined using those weights.

  8. 8

    How does attention differ from an exact dictionary lookup?

    1. A

      Attention returns a key instead of the value associated with that key

    2. B

      Attention cannot compare a query with more than one key

    3. C

      Attention requires every query to be identical to a stored key

    4. D

      Attention usually assigns soft weights to multiple keys rather than selecting one exact key

    Correct answer
    D

    Attention usually assigns soft weights to multiple keys rather than selecting one exact key

    Explanation

    A dictionary performs an exact match, whereas attention computes similarities between a query and all keys and typically distributes weight across several values.

  9. 9

    What role does the softmax function play in attention?

    1. A

      It transforms each value vector into a new key vector

    2. B

      It removes the query from the attention computation

    3. C

      It ensures that all keys receive exactly the same weight

    4. D

      It converts similarity scores into normalized attention weights

    Correct answer
    D

    It converts similarity scores into normalized attention weights

    Explanation

    Softmax converts the raw query-key similarity scores into normalized weights that can be used in a weighted sum of the values.

  10. 10

    How is the output of attention computed after obtaining attention weights?

    1. A

      By selecting the value with the smallest similarity score

    2. B

      By taking a weighted sum of the value vectors

    3. C

      By averaging the query with the vocabulary embeddings

    4. D

      By concatenating all keys without using the values

    Correct answer
    B

    By taking a weighted sum of the value vectors

    Explanation

    The attention output is the sum of the value vectors, with each value multiplied by its query-key attention weight.

  11. 11

    Why can self-attention address long-distance interactions more directly than an RNN?

    1. A

      Self-attention stores the entire sequence in one recurrent hidden state

    2. B

      Self-attention processes only neighboring words and ignores distant ones

    3. C

      Self-attention requires one computation for every intermediate word

    4. D

      Any word can potentially attend directly to any other word in the sequence

    Correct answer
    D

    Any word can potentially attend directly to any other word in the sequence

    Explanation

    Self-attention computes interactions between all pairs of positions, so distant words do not need to communicate through every intervening position.

  12. 12

    What is the purpose of the embedding matrix in the described self-attention model?

    1. A

      It maps contextual vectors back into sequence positions

    2. B

      It prevents different words from receiving different representations

    3. C

      It computes the softmax weights between every pair of words

    4. D

      It maps vocabulary identities to non-contextual vectors of dimension DDD

    Correct answer
    D

    It maps vocabulary identities to non-contextual vectors of dimension DDD

    Explanation

    The embedding matrix maps each vocabulary item to a vector in 4\mathord{}D dimensions. These initial word embeddings depend on word identity but not on context.

  13. 13

    What are the query, key, and value vectors in self-attention derived from?

    1. A

      Different learned linear transformations of each word's embedding

    2. B

      The attention weights after the softmax operation

    3. C

      Three copies of the original vocabulary index with no learned parameters

    4. D

      Only the words appearing before the current word

    Correct answer
    A

    Different learned linear transformations of each word's embedding

    Explanation

    For each input embedding xix_ixi​, separate learned matrices QQQ, KKK, and VVV produce its query, key, and value vectors.

  14. 14

    What does the score eij=qi⊤kje_{ij}=q_i^\top k_jeij​=qi⊤​kj​ represent?

    1. A

      The number of recurrent steps between positions iii and jjj

    2. B

      The probability that position iii is the next vocabulary item

    3. C

      The similarity between the query for position iii and the key for position jjj

    4. D

      The distance between the values at positions iii and jjj

    Correct answer
    C

    The similarity between the query for position iii and the key for position jjj

    Explanation

    The dot product qi⊤kjq_i^\top k_jqi⊤​kj​ measures how strongly the query at position iii matches the key at position jjj.

  15. 15

    For a fixed query position iii, how is the attention weight assigned to position jjj obtained?

    1. A

      By applying softmax to eije_{ij}eij​ across all possible key positions

    2. B

      By dividing eije_{ij}eij​ by the value vector at position jjj

    3. C

      By applying softmax independently to each coordinate of vjv_jvj​

    4. D

      By selecting jjj whenever eije_{ij}eij​ is negative

    Correct answer
    A

    By applying softmax to eije_{ij}eij​ across all possible key positions

    Explanation

    The weight αij\alpha_{ij}αij​ is the softmax-normalized score for position jjj among all keys considered by query iii.

  16. 16

    What is the self-attention output oio_ioi​ for position iii?

    1. A

      oi=∑jαijvjo_i=\sum_j\alpha_{ij}v_joi​=∑j​αij​vj​

    2. B

      oi=qi⊤kio_i=q_i^\top k_ioi​=qi⊤​ki​

    3. C

      oi=∑jeijqjo_i=\sum_j e_{ij}q_joi​=∑j​eij​qj​

    4. D

      oi=softmax⁡(vi)o_i=\operatorname{softmax}(v_i)oi​=softmax(vi​)

    Correct answer
    A

    oi=∑jαijvjo_i=\sum_j\alpha_{ij}v_joi​=∑j​αij​vj​

    Explanation

    The output at position iii is the weighted sum of all value vectors, using the attention weights αij\alpha_{ij}αij​.

  17. 17

    Why are separate QQQ and KKK matrices useful in self-attention?

    1. A

      They remove the need to compute value vectors

    2. B

      They force every word to attend to itself with maximum weight

    3. C

      They allow the model to learn how queries and keys should be compared

    4. D

      They ensure that attention is symmetric between every pair of words

    Correct answer
    C

    They allow the model to learn how queries and keys should be compared

    Explanation

    Separate learned transformations allow the model to determine which aspects of a representation should serve as queries and which should serve as keys. A word need not automatically attend strongly to itself.

  18. 18

    What major information is missing from basic self-attention when no positional representation is added?

    1. A

      The dimensionality of each value vector

    2. B

      The ability to compute a weighted average

    3. C

      The order in which words occur in the sequence

    4. D

      The identity of every word in the vocabulary

    Correct answer
    C

    The order in which words occur in the sequence

    Explanation

    Basic self-attention operates on a set of vectors and does not directly encode their sequence indices. Therefore, different word orders can produce the same representations.

  19. 19

    Why would basic self-attention treat "Zuko made his uncle" and "his uncle made Zuko" identically?

    1. A

      The value matrix removes all syntactic information from words

    2. B

      The model can process only sentences with repeated words

    3. C

      The softmax function always produces uniform attention weights

    4. D

      The word embeddings do not indicate the positions at which the words occur

    Correct answer
    D

    The word embeddings do not indicate the positions at which the words occur

    Explanation

    Without positional information, self-attention sees the same collection of word vectors regardless of their order, even though the two sentences have different meanings.

  20. 20

    How can positional vectors be incorporated into the input of a self-attention network?

    1. A

      By adding a position vector to the word embedding at each index

    2. B

      By replacing every word embedding with its sequence index

    3. C

      By applying softmax directly to the position indices

    4. D

      By masking every word that does not occur at position one

    Correct answer
    A

    By adding a position vector to the word embedding at each index

    Explanation

    A positional vector pip_ipi​ can be added to the word embedding xix_ixi​, allowing the resulting representation to encode both word identity and position.

  21. 21

    How do sinusoidal positional representations encode position?

    1. A

      They assign a separate one-hot vector to every possible sentence

    2. B

      They apply sine or cosine functions with different periods across dimensions

    3. C

      They use the same constant vector for every sequence position

    4. D

      They randomly permute the dimensions of each word embedding

    Correct answer
    B

    They apply sine or cosine functions with different periods across dimensions

    Explanation

    Sinusoidal representations use sine and cosine functions whose periods vary across dimensions, producing position-dependent vectors.

  22. 22

    What is a limitation of learned absolute positional embeddings?

    1. A

      They prevent word embeddings from containing lexical information

    2. B

      A model trained with a maximum length nnn has no learned position vectors beyond nnn

    3. C

      They cannot represent any position within the training length

    4. D

      They require recurrent computation across all sequence positions

    Correct answer
    B

    A model trained with a maximum length nnn has no learned position vectors beyond nnn

    Explanation

    If the model learns a position matrix for only nnn positions, it cannot directly represent a sequence position beyond nnn without some additional method.

  23. 23

    Why is sequence length a practical problem for self-attention?

    1. A

      The embedding matrix grows exponentially with sequence length

    2. B

      The model can attend to only one word for each sequence

    3. C

      Self-attention requires exactly nnn recurrent hidden states

    4. D

      The all-pairs interaction matrix has dimensions n×nn\times nn×n

    Correct answer
    D

    The all-pairs interaction matrix has dimensions n×nn\times nn×n

    Explanation

    Self-attention computes scores for every pair of positions, producing an n×nn\times nn×n matrix and therefore quadratic memory and computation with respect to sequence length.

  24. 24

    Why is a feed-forward network added after self-attention?

    1. A

      It introduces nonlinear processing of each attention output vector

    2. B

      It supplies the missing query-key similarity scores

    3. C

      It removes the contextual information created by attention

    4. D

      It forces the network to process words sequentially

    Correct answer
    A

    It introduces nonlinear processing of each attention output vector

    Explanation

    Self-attention by itself mainly computes weighted averages. A position-wise feed-forward network adds nonlinear transformations and greater expressive power.

  25. 25

    How is the feed-forward network applied within a Transformer block?

    1. A

      Each position's attention output is processed independently by the same network

    2. B

      All positions are concatenated into one vector before one recurrent operation

    3. C

      Each position uses a completely unrelated feed-forward network

    4. D

      Only the first position is passed through the feed-forward network

    Correct answer
    A

    Each position's attention output is processed independently by the same network

    Explanation

    The feed-forward layer is position-wise: every output vector is processed independently, typically using shared parameters across positions.

  26. 26

    What problem does causal masking solve?

    1. A

      It prevents a position from using information from future positions

    2. B

      It prevents every position from attending to its own representation

    3. C

      It removes all attention interactions between different sentences

    4. D

      It makes the encoder unable to access the source sentence

    Correct answer
    A

    It prevents a position from using information from future positions

    Explanation

    For autoregressive generation, the representation used to predict a word must not access later words. Causal masking blocks those future positions.

  27. 27

    How is causal masking implemented before softmax?

    1. A

      Past-position scores are replaced with zero before normalization

    2. B

      Future-position scores are replaced with negative infinity or an equivalent value

    3. C

      The query vector is removed whenever a future word exists

    4. D

      Future-position values are multiplied by a large positive constant

    Correct answer
    B

    Future-position scores are replaced with negative infinity or an equivalent value

    Explanation

    Setting future scores to negative infinity makes their softmax weights effectively zero, so the current position cannot attend to them.

  28. 28

    Why can causal masking still permit efficient training?

    1. A

      The model avoids calculating any attention scores involving earlier words

    2. B

      Masking removes the need for matrix multiplication

    3. C

      The decoder computes each position with a separate recurrent loop

    4. D

      All pairwise scores can be computed together and future scores can then be masked

    Correct answer
    D

    All pairwise scores can be computed together and future scores can then be masked

    Explanation

    The complete score matrix can be computed in parallel, after which entries corresponding to future positions are masked before softmax.

  29. 29

    Where is masking generally used in a standard encoder-decoder Transformer?

    1. A

      In both encoder and decoder self-attention in exactly the same way

    2. B

      In encoder self-attention, but not in decoder self-attention

    3. C

      In neither encoder nor decoder attention

    4. D

      In decoder self-attention, but not in encoder self-attention

    Correct answer
    D

    In decoder self-attention, but not in encoder self-attention

    Explanation

    The encoder needs bidirectional access to the source sentence, whereas the autoregressive decoder must be prevented from looking at future target tokens.

  30. 30

    What is the main purpose of multi-head self-attention?

    1. A

      To restrict each word to attending to only one other word

    2. B

      To make every head use exactly the same query, key, and value matrices

    3. C

      To eliminate the need for a final transformation after attention

    4. D

      To let different attention mechanisms focus on different relationships or information

    Correct answer
    D

    To let different attention mechanisms focus on different relationships or information

    Explanation

    Different heads have separate learned projections, allowing them to attend to different parts of a sequence for different reasons, such as syntactic or semantic relationships.

  31. 31

    How are the parameters of different attention heads related?

    1. A

      The heads are fixed copies with no independently learned parameters

    2. B

      All heads share one projection matrix but use different softmax functions

    3. C

      Each head has its own query, key, and value projection matrices

    4. D

      Each head uses only the value matrix and omits queries and keys

    Correct answer
    C

    Each head has its own query, key, and value projection matrices

    Explanation

    Multi-head attention defines independent QQQ, KKK, and VVV matrices for each head, allowing the heads to specialize.

  32. 32

    Why are the query, key, and value vectors in each head projected to a lower dimension?

    1. A

      To ensure that all heads produce identical attention distributions

    2. B

      To prevent the model from computing any pairwise similarities

    3. C

      To encode sequence position without any positional vectors

    4. D

      To make multiple heads computationally manageable while preserving separate subspaces

    Correct answer
    D

    To make multiple heads computationally manageable while preserving separate subspaces

    Explanation

    Each head typically works in a space of dimension D/HD/HD/H, making it possible to use several heads without multiplying the full cost by the number of heads.

  33. 33

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

    1. A

      They are discarded except for the head with the largest score

    2. B

      They are fed sequentially into a recurrent network

    3. C

      They are concatenated and passed through a final linear transformation

    4. D

      They are averaged before any value vectors are used

    Correct answer
    C

    They are concatenated and passed through a final linear transformation

    Explanation

    Each head produces an output in a lower-dimensional space. These outputs are concatenated and then mixed using a final learned linear transformation.

  34. 34

    How does sequence stacking improve the implementation of self-attention?

    1. A

      It represents all word embeddings as one matrix and uses large matrix multiplications

    2. B

      It requires the sequence to be processed from left to right

    3. C

      It processes each word in a separate Python loop to reduce memory use

    4. D

      It replaces all word embeddings with one scalar sentence representation

    Correct answer
    A

    It represents all word embeddings as one matrix and uses large matrix multiplications

    Explanation

    Stacking the nnn word embeddings creates an n×Dn\times Dn×D matrix, allowing the projections and attention computations to be vectorized efficiently on GPUs.

  35. 35

    What does the matrix product XQ(XK)⊤XQ(XK)^\topXQ(XK)⊤ compute?

    1. A

      The matrix of all query-key dot-product scores

    2. B

      The output of the feed-forward network at each position

    3. C

      The weighted sum of all value vectors after softmax

    4. D

      The positional embedding for every sequence index

    Correct answer
    A

    The matrix of all query-key dot-product scores

    Explanation

    The product forms an n×nn\times nn×n matrix whose entry at row iii and column jjj is the dot product between query qiq_iqi​ and key kjk_jkj​.

  36. 36

    What is the purpose of scaled dot-product attention?

    1. A

      It replaces all query and key projections with identity matrices

    2. B

      It guarantees that every attention weight is exactly uniform

    3. C

      It keeps large-dimensional dot products from making softmax gradients too small

    4. D

      It increases the sequence length that can be represented by learned positions

    Correct answer
    C

    It keeps large-dimensional dot products from making softmax gradients too small

    Explanation

    As dimensionality grows, dot products can become large. Dividing by a scale related to the head dimension keeps softmax inputs better behaved and helps gradients.

  37. 37

    What does a residual connection add to a layer's output?

    1. A

      The input to the layer is added to the transformation produced by the layer

    2. B

      The output of the layer is replaced by the previous layer's input

    3. C

      The attention scores are added to the vocabulary logits

    4. D

      The position vector is added only after the final prediction

    Correct answer
    A

    The input to the layer is added to the transformation produced by the layer

    Explanation

    A residual connection produces an output such as x+f(x)x+f(x)x+f(x), allowing the layer to learn a residual modification while providing a direct path for information and gradients.

  38. 38

    Why do residual connections help optimization?

    1. A

      They provide an identity path through which gradients can pass directly

    2. B

      They eliminate all nonlinearities from the network

    3. C

      They prevent the model from using information from earlier layers

    4. D

      They force every layer to learn a completely new representation

    Correct answer
    A

    They provide an identity path through which gradients can pass directly

    Explanation

    The identity path has derivative one, which can help gradients avoid vanishing through the transformed layer. Residual connections can also make a layer initially behave approximately like the identity.

  39. 39

    What does layer normalization normalize in the described Transformer?

    1. A

      All words in a document using one shared document mean

    2. B

      All examples in a batch using one shared batch mean

    3. C

      Only the attention weights associated with one query

    4. D

      The coordinates within each individual word vector

    Correct answer
    D

    The coordinates within each individual word vector

    Explanation

    Layer normalization computes statistics across the dimensions of one vector, normalizing that vector independently rather than sharing statistics across sequence positions or batch examples.

  40. 40

    What transformation is central to layer normalization?

    1. A

      Multiply every coordinate by its sequence index and apply softmax

    2. B

      Subtract the batch mean and divide by the batch size

    3. C

      Subtract the vector mean and divide by its standard deviation plus a small epsilon

    4. D

      Replace every coordinate with the largest coordinate in the vector

    Correct answer
    C

    Subtract the vector mean and divide by its standard deviation plus a small epsilon

    Explanation

    For a vector xxx, layer normalization uses a form of (x−μ)/σ2+ϵ(x-\mu)/\sqrt{\sigma^2+\epsilon}(x−μ)/σ2+ϵ​, optionally followed by learned scale and shift parameters.

  41. 41

    Why is a small epsilon included in layer normalization?

    1. A

      To force the normalized mean to become positive

    2. B

      To increase the number of dimensions in each word vector

    3. C

      To prevent numerical instability when the variance is very small

    4. D

      To ensure that all positions receive nonzero attention

    Correct answer
    C

    To prevent numerical instability when the variance is very small

    Explanation

    The epsilon term keeps the denominator from becoming zero or extremely small when the vector has little variation.

  42. 42

    What is the structure of a typical Transformer block described in the lecture?

    1. A

      Attention followed by add-and-normalize, then feed-forward followed by add-and-normalize

    2. B

      A single linear transformation followed by vocabulary lookup

    3. C

      Feed-forward computation followed by recurrence and then positional masking

    4. D

      Two recurrent layers followed by one unmasked attention operation

    Correct answer
    A

    Attention followed by add-and-normalize, then feed-forward followed by add-and-normalize

    Explanation

    A Transformer block applies self-attention, a residual connection and layer normalization, then a position-wise feed-forward network followed by another residual connection and layer normalization.

  43. 43

    What distinguishes a Transformer encoder from a causal Transformer decoder?

    1. A

      The encoder uses unmasked self-attention, whereas the decoder uses masked self-attention

    2. B

      The encoder uses only values, whereas the decoder uses only queries

    3. C

      The encoder has no feed-forward layers, whereas the decoder has several

    4. D

      The encoder processes one word at a time, whereas the decoder is fully parallel

    Correct answer
    A

    The encoder uses unmasked self-attention, whereas the decoder uses masked self-attention

    Explanation

    An encoder builds bidirectional contextual representations, so its self-attention is unmasked. A causal decoder must mask future positions during autoregressive prediction.

  44. 44

    What is the purpose of cross-attention in an encoder-decoder Transformer?

    1. A

      It combines the encoder and decoder vocabularies before embedding

    2. B

      It replaces masked decoder self-attention with a recurrent layer

    3. C

      It lets the encoder attend only to future decoder positions

    4. D

      It lets decoder positions query representations produced by the encoder

    Correct answer
    D

    It lets decoder positions query representations produced by the encoder

    Explanation

    In cross-attention, decoder representations supply the queries, while encoder outputs supply the keys and values. This lets each decoder position access the encoded source sentence.

  45. 45

    In encoder-decoder cross-attention, where do the queries, keys, and values come from?

    1. A

      Queries and keys come from positions, while values come from vocabulary indices

    2. B

      All three come from the decoder's masked self-attention scores

    3. C

      Queries come from decoder states, while keys and values come from encoder outputs

    4. D

      Queries come from encoder outputs, while keys and values come from decoder states

    Correct answer
    C

    Queries come from decoder states, while keys and values come from encoder outputs

    Explanation

    The decoder state determines what information it is seeking, so it provides queries. The encoder output provides the keys and values that can be searched.

  46. 46

    Why was the Transformer more efficient to train than recurrent sequence models?

    1. A

      It represented every document with a single learned scalar

    2. B

      It avoided all matrix multiplications in its attention layers

    3. C

      It removed sequential recurrence and allowed more computation to run in parallel

    4. D

      It trained only on adjacent word pairs rather than full sequences

    Correct answer
    C

    It removed sequential recurrence and allowed more computation to run in parallel

    Explanation

    Unlike an RNN, a Transformer can compute attention for all positions together, making better use of GPUs and enabling faster training on large amounts of data.

  47. 47

    What major development did Transformer efficiency help enable in NLP?

    1. A

      The return to exclusively hand-designed syntactic features

    2. B

      The elimination of word representations from language models

    3. C

      Large-scale pre-training on substantial amounts of data and computation

    4. D

      The restriction of language models to short, fixed two-word inputs

    Correct answer
    C

    Large-scale pre-training on substantial amounts of data and computation

    Explanation

    Parallelizability made it practical to train large models on massive datasets, contributing to the rise of Transformer-based pre-training.

  48. 48

    What is a major computational drawback of standard self-attention?

    1. A

      Its memory and computation grow quadratically with sequence length

    2. B

      It requires more sequential steps than a standard RNN

    3. C

      It cannot process more than one attention head at a time

    4. D

      Its computation grows exponentially with vocabulary size only

    Correct answer
    A

    Its memory and computation grow quadratically with sequence length

    Explanation

    Because self-attention computes all pairwise interactions, the attention-score matrix has n2n^2n2 entries for a sequence of length nnn.

  49. 49

    Why can long documents be difficult for standard Transformers?

    1. A

      Positional embeddings automatically delete every word after the first sentence

    2. B

      Transformers cannot represent relationships between words in different sentences

    3. C

      The encoder must use recurrence for every document longer than one paragraph

    4. D

      The quadratic attention cost can make the required memory and computation infeasible

    Correct answer
    D

    The quadratic attention cost can make the required memory and computation infeasible

    Explanation

    For long sequences, the n×nn\times nn×n attention matrix becomes very large, creating substantial memory and computational demands.

  50. 50

    Why have researchers explored alternatives to absolute positional embeddings?

    1. A

      Absolute embeddings prevent self-attention from computing any dot products

    2. B

      Relative methods are required because word embeddings contain no lexical information

    3. C

      Relative relationships may represent sequence structure more naturally than absolute indices

    4. D

      Absolute embeddings can be used only in recurrent models

    Correct answer
    C

    Relative relationships may represent sequence structure more naturally than absolute indices

    Explanation

    The absolute index of a word may be less informative than its relative position or structural relationship to other words, motivating alternative positional representations.

Question 1 of 50
Question 1 of 50

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent