Quiz Space

Large Language Models · End Term · 31 Aug 2025 · May 2025 term · Set QDB3

Question 9: Suppose the input sentence is “tea you enjoy often”. Usin…

Question 9

+2 marksNumerical answer

A vocabulary V={tea,you,enjoy,often}\mathcal{V} = \{\text{tea}, \text{you}, \text{enjoy}, \text{often}\} is associated with the following embedding matrix:

E=[011110−11]E = \begin{bmatrix} 0 & 1 \\ 1 & 1 \\ 1 & 0 \\ -1 & 1 \end{bmatrix}

Words are indexed in the order shown above: “tea” (index 0), “you” (1), “enjoy” (2), and “often” (3). No positional encodings are used.

The parameters of the attention layer are:

WQ=[0.5110.5],WK=[10.5−0.51],WV=[10.20.51],W_Q = \begin{bmatrix} 0.5 & 1 \\ 1 & 0.5 \end{bmatrix}, \quad W_K = \begin{bmatrix} 1 & 0.5 \\ -0.5 & 1 \end{bmatrix}, \quad W_V = \begin{bmatrix} 1 & 0.2 \\ 0.5 & 1 \end{bmatrix},

WO=[0.50.51−1]W_O = \begin{bmatrix} 0.5 & 0.5 \\ 1 & -1 \end{bmatrix}

For the input sequence “you enjoy tea often”. The computed attention matrix A=softmax(QK⊤dk)A = \text{softmax}\left(\frac{QK^\top}{\sqrt{d_k}}\right) is given as:

A=[0.550.320.110.020.430.250.210.10.390.390.160.070.240.40.20.17]A = \begin{bmatrix} 0.55 & 0.32 & 0.11 & 0.02 \\ 0.43 & 0.25 & 0.21 & 0.1 \\ 0.39 & 0.39 & 0.16 & 0.07 \\ 0.24 & 0.4 & 0.2 & 0.17 \end{bmatrix}

Answer the given subquestions. If you believe the information is insufficient, enter -1 as your answer.

Suppose the input sentence is “tea you enjoy often”. Using the same matrices and processing method, what is the attention score (i.e., softmax entry from A) for the query word “tea” attending to key word “often”?

Show answer

Correct answer: 0.07 (accepted within ±0.03)

Question 9 of 17 in the IIT Madras BS Large Language Models (LLM) End Term paper sat on 31 Aug 2025, in the May 2025 term (IIT M DEGREE AN EXAM QDB3 31 Aug 2025). It carries 2 marks.

More questions from this paper

  1. Q1Given the input string: sunshine And the following vocabulary of subword tokens with their corresponding log-probabilit…
  2. Q2A GPT model is trained using causal language modeling. During training, for a sequence of T = 4 tokens, which of the fo…
  3. Q3Figure question
  4. Q4Which of the following preprocessing steps are commonly used when preparing data for transformer models like BERT?
  5. Q5Which modifications are used in transformers to handle longer sequences efficiently?
  6. Q6In Transformer models that use relative position embeddings (such as in Transformer-XL or T5), clipping is often applie…
  7. Q7Figure question
  8. Q8For the input “you enjoy tea often”, compute the final representation of the word “enjoy” after the attention layer (i.…
  9. Q10Choose the correct representation of π for the given mask image.
  10. Q11How many permutations of π are possible for n = 5?
  11. Q12What percentage of entries in the attention matrix are zero (i.e., the sparsity)?
  12. Q13Consider the short sentence: “small models sometimes beat big ones” A model processes this sequence using the naive rel…
  13. Q14Consider the short sentence: “small models sometimes beat big ones” A model processes this sequence using the naive rel…
  14. Q15Consider the short sentence: “small models sometimes beat big ones” A model processes this sequence using the naive rel…
  15. Q16Consider the short sentence: “small models sometimes beat big ones” A model processes this sequence using the naive rel…
  16. Q17Consider the short sentence: “small models sometimes beat big ones” A model processes this sequence using the naive rel…