Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Large Language Models
Transformer & self-attention
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- NAT: Numerical response. No negative marking.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
Quiz 1 · 26 Oct 2025 (AN)Quiz 1
- Q1MCQ2 Marks·Choose one option

- ATo increase the numerical precision of the attention scores.
- BTo reduce the overall computational cost of the attention mechanism.
- CTo ensure that the sum of the attention scores for each query equals 1.
- DTo avoid numerical issues and loss of gradients during training.
- Q2MCQ2 Marks·Choose one option

- A

- B

- C

- D

- E

- A
- Q3MCQ3 Marks·Choose one option

- A

- B

- C

- D

- A
- Q4MSQ2 Marks·Choose all correct options
Which of the following statements about multiple attention heads in a Transformer are true?
- AThey allow learning diverse local/global relations.
- BThey reduce memory usage compared to one head.
- CIncreasing the number of heads while keeping d_(model) fixed, decreases the dimensionality handled by each head.
- DAll heads necessarily learn completely independent information about the input.
- Q5MSQ4 Marks·Choose all correct options
Which of the following statements about the Transformer architecture are true?
- AMasking (look-ahead mask) is applied in every decoder self-attention layer, not just the first one.
- BToken embeddings are used in the encoder but not in the decoder.
- CPositional encoding is required only in the encoder, not in the decoder.
- DToken embeddings are used in both the encoder and the decoder.
- EPositional encodings are added to the input embeddings in both the encoder and the decoder.
- Q6NAT3 Marks·Write the number
Your answer: - Q7NAT3 Marks·Write the number
Your answer: - Q8NAT2 Marks·Write the number
Your answer: Read the passage below, then answer Q9–Q11
Q9NAT3 Marks·Write the numberHow many next-token prediction targets are generated during training a full batch?
Your answer:- Q10NAT2 Marks·Write the number
For one sequence, how many non-zero attention scores remain in the masked attention score matrix (per head)?
Your answer: - Q11NAT2 Marks·Write the number
Your answer:
End Term · 31 Aug 2025 (FN)End Term
Read the passage below, then answer Q12–Q13
Q12NAT3 Marks·Write the numberFor the input “you enjoy tea often”, compute the final representation of the word “tea” after the attention layer (i.e., after applying W_Q, W_K, W_V , attention weights, and W_O). Enter the sum of the elements in the resulting vector.
Your answer:- Q13NAT2 Marks·Write the number
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”?
Your answer:
End Term · 31 Aug 2025 (AN)End Term
- Q14MCQ2 Marks·Choose one option
A GPT model is trained using causal language modeling. During training, for a sequence of T = 4 tokens, which of the following correctly represents the attention mask matrix applied to the attention logits?
- A

- B

- C

- D

- A
Read the passage below, then answer Q15–Q16
Q15NAT3 Marks·Write the numberFor the input “you enjoy tea often”, compute the final representation of the word “enjoy” after the attention layer (i.e., after applying W_Q, W_K, W_V , attention weights, and W_O). Enter the sum of the elements in the resulting vector.
Your answer:- Q16NAT2 Marks·Write the number
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”?
Your answer: