Large Language Models End Term: 31 August 2025, Set QDB3 (May 2025 term)
The IIT Madras BS Large Language Models (LLM) End Term paper sat on 31 Aug 2025, in the May 2025 term, set QDB3: 17 questions for 40 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Official paper: IIT M DEGREE AN EXAM QDB3 31 Aug 2025 · No negative marking.
Question 1
+3 marksOne correct option
Given the input string:
sunshine
And the following vocabulary of subword tokens with their corresponding log-probabilities:
Subword
Log-Probability (base e)
sun
-0.5
shine
-0.7
sunshine
-1.6
su
-0.3
nshine
-0.4
n
-1.8
shi
-0.6
ne
-0.5
Using the Viterbi algorithm (as used in the SentencePiece tokenizer), determine the most probable tokenization of the input string. The probability of a tokenized sequence is the sum of the log-probabilities of the selected subwords. Only subwords from the vocabulary may be used.
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?
In Transformer models that use relative position embeddings (such as in Transformer-XL or T5), clipping is often applied to the relative position indices. Which of the following statements about clipping in relative position embeddings are correct?
Select all that apply.
A
Clipping ensures that very large relative distances are mapped to a fixed maximum distance.
B
Without clipping, the model would require embeddings for every possible relative distance, which is infeasible for long sequences.
C
Clipping increases the precision of embeddings for large relative distances.
D
Clipping introduces an upper bound k such that all distances greater than k are mapped to the same index.
Show answerTap to reveal
Correct answers
A
Clipping ensures that very large relative distances are mapped to a fixed maximum distance.
B
Without clipping, the model would require embeddings for every possible relative distance, which is infeasible for long sequences.
D
Clipping introduces an upper bound k such that all distances greater than k are mapped to the same index.
Answer the given subquestions. If you believe the information is insufficient, enter -1 as your answer.
For the input “you enjoy tea often”, compute the final representation of the word “enjoy” after the attention layer (i.e., after applying WQ, WK, WV , attention weights, and WO). Enter the sum of the elements in the resulting vector.
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”?
A model processes this sequence using the naive relative positional embedding method. The model's embedding dimension is dmodel=4, and the number of tokens is T=6. We use zero-based indexing for token positions:
0:small1:models2:sometimes3:beat4:big5:ones
Note: In this context, the relative position between two tokens is:
Relative position=j−i
(rows = current token i, columns = other token j).
Token embeddings (rows correspond to tokens in order):
X=123456123456123456123456.
Denote the i-th row by xi.
Positional embedding definition: For a relative position,
p(j−i)=[5(j−i)5(j−i)5(j−i)5(j−i)].
Based on the above data, answer the given subquestions.
A model processes this sequence using the naive relative positional embedding method. The model's embedding dimension is dmodel=4, and the number of tokens is T=6. We use zero-based indexing for token positions:
0:small1:models2:sometimes3:beat4:big5:ones
Note: In this context, the relative position between two tokens is:
Relative position=j−i
(rows = current token i, columns = other token j).
Token embeddings (rows correspond to tokens in order):
X=123456123456123456123456.
Denote the i-th row by xi.
Positional embedding definition: For a relative position,
p(j−i)=[5(j−i)5(j−i)5(j−i)5(j−i)].
Based on the above data, answer the given subquestions.
A model processes this sequence using the naive relative positional embedding method. The model's embedding dimension is dmodel=4, and the number of tokens is T=6. We use zero-based indexing for token positions:
0:small1:models2:sometimes3:beat4:big5:ones
Note: In this context, the relative position between two tokens is:
Relative position=j−i
(rows = current token i, columns = other token j).
Token embeddings (rows correspond to tokens in order):
X=123456123456123456123456.
Denote the i-th row by xi.
Positional embedding definition: For a relative position,
p(j−i)=[5(j−i)5(j−i)5(j−i)5(j−i)].
Based on the above data, answer the given subquestions.
With a naive implementation, for each token embedding we combine (by addition) relative position embeddings. For token index i∈{0,…,T−1},
hi=xi+∑j=0T−1pj−i
compute the final combined embedding hi for the token "models" (i.e., i=1). Submit the sum of all the elements of h1
A model processes this sequence using the naive relative positional embedding method. The model's embedding dimension is dmodel=4, and the number of tokens is T=6. We use zero-based indexing for token positions:
0:small1:models2:sometimes3:beat4:big5:ones
Note: In this context, the relative position between two tokens is:
Relative position=j−i
(rows = current token i, columns = other token j).
Token embeddings (rows correspond to tokens in order):
X=123456123456123456123456.
Denote the i-th row by xi.
Positional embedding definition: For a relative position,
p(j−i)=[5(j−i)5(j−i)5(j−i)5(j−i)].
Based on the above data, answer the given subquestions.
A model processes this sequence using the naive relative positional embedding method. The model's embedding dimension is dmodel=4, and the number of tokens is T=6. We use zero-based indexing for token positions:
0:small1:models2:sometimes3:beat4:big5:ones
Note: In this context, the relative position between two tokens is:
Relative position=j−i
(rows = current token i, columns = other token j).
Token embeddings (rows correspond to tokens in order):
X=123456123456123456123456.
Denote the i-th row by xi.
Positional embedding definition: For a relative position,
p(j−i)=[5(j−i)5(j−i)5(j−i)5(j−i)].
Based on the above data, answer the given subquestions.
Now consider the same sequence but assume the model uses the ALiBi (Attention with Linear Biases) method. The model has H=4 heads and the per-head slope is defined as
mh=2h1,h=0,1,2,3,
The pre-attention eij for head h are computed as:
xiWQxjWK+mh⋅[(j−i)]
Assume WQ=I and WK=2I where I is an identity matrix . Answer eij for the current token “big” and other token “small” for head h=2. correct upto 1 digit after the decimal.