uiz Space

May 2025 term · Deep Learning · BSCS3004

Deep Learning End Term: 31 August 2025, Set QDB3 (May 2025 term)

The IIT Madras BS Deep Learning (Deep Learning) End Term paper sat on 31 Aug 2025, in the May 2025 term, set QDB3: 19 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.

Questions
19
Marks
40
Duration
180 min
MCQ
4
MSQ
1
Numerical
14

Updated

Official paper: IIT M IMPROVEMENT FN EXAM QIC1 31 Aug 2025 · No negative marking.

Question 1

+2 marksOne correct option

Consider the following two statements regarding model performance:
Statement 1: A model achieving zero training loss is guaranteed to perform well on unseen data. Statement 2: Incorporating a regularization term in the loss function may lead to higher training loss but lower generalization error.
Which of the following options is correct?

  1. A

    Both Statement 1 and Statement 2 are true.

  2. B

    Statement 1 is true, but Statement 2 is false.

  3. C

    None of these.

  4. D

    Statement 1 is false, but Statement 2 is true.

Show answer

Correct answer

  • D

    Statement 1 is false, but Statement 2 is true.

Question 2

+2 marksOne correct option

How does unsupervised layerwise pretraining help in alleviating the vanishing gradient problem?

  1. A

    It allows the network to learn a better representation of the data in each layer, which leads to better- initialized weights for subsequent supervised training.

  2. B

    It adds skip connections to the network, which are then removed before the supervised training.

  3. C

    It replaces the sigmoid functions with ReLU functions during the pretraining phase.

  4. D

    It regularizes the network’s weights, making them smaller and less likely to cause the gradients to explode.

Show answer

Correct answer

  • A

    It allows the network to learn a better representation of the data in each layer, which leads to better- initialized weights for subsequent supervised training.

Question 3

+2 marksOne or more correct options

A dataset is given by

X=[1205010300110111−1000],y=[10652]X = \begin{bmatrix} 1 & 2 & 0 & 5 & 0 \\ 1 & 0 & 3 & 0 & 0 \\ 1 & 1 & 0 & 1 & 1 \\ 1 & -1 & 0 & 0 & 0 \end{bmatrix}, y = \begin{bmatrix} 10 \\ 6 \\ 5 \\ 2 \end{bmatrix}

The rows of XX represent samples and the columns represent features, with the first column corresponds the bias term. We use a linear regression neuron where the prediction y^i\hat{y}_i for a sample xix_i is given by the linear combination y^i=zi=∑j=04wjxij\hat{y}_i = z_i = \sum_{j=0}^{4} w_j x_{ij}.

The weights are updated using Stochastic Gradient Descent (SGD) for one epoch (i.e., once for each of the 4 samples). The loss function is the Mean Squared Error, L=(y^−y)2L = (\hat{y} - y)^2. If all weights are initialized to wj=0.5w_j = 0.5, which of the following weights is updated the fewest number of times?

Select all that apply.

  1. A

    w0

  2. B

    w1

  3. C

    w2

  4. D

    w3

  5. E

    w4

Show answer

Correct answers

  • C

    w2

  • E

    w4

Question 4

+3 marksNumerical answer

Given the input matrix XX and kernel KK:

X=[210101−10321−110−22],K=[010110001]X = \begin{bmatrix} 2 & 1 & 0 & 1 \\ 0 & 1 & -1 & 0 \\ 3 & 2 & 1 & -1 \\ 1 & 0 & -2 & 2 \end{bmatrix}, \quad K = \begin{bmatrix} 0 & 1 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

  • Perform convolution of KK over XX with stride =1= 1 and no padding to get matrix AA.
  • Apply average pooling on all of AA to produce scalar BB.
  • Apply the ReLU activation on BB to obtain final output y^\hat{y}.

If ∂L∂y^=2\frac{\partial L}{\partial \hat{y}} = 2, compute ∂L∂K11\frac{\partial L}{\partial K_{11}}, where K11K_{11} is the centre element of the kernel. Submit the final answer correct to two decimal places.

Show answer

Correct answer: 1.5 (accepted within ±0.5)

Question 5

+2 marksNumerical answer

Suppose you are given three encoder hidden states at time tt:

hj=h1=[10],h2=[01],h3=[11]h_j = h_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad h_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}, \quad h_3 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}

The previous decoder hidden state is:

st−1=[12]s_{t-1} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}

Given the attention score function:

score(st−1,hj)=Vatt⊤tanh⁡(Uattst−1+Watthj)\text{score}(s_{t-1}, h_j) = V_{att}^\top \tanh\left(U_{att} s_{t-1} + W_{att} h_j\right)

where the hyperbolic tangent function is defined as:

tanh⁡(x)=ex−e−xex+e−x=e2x−1e2x+1\tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x} + 1}

where

Vatt=[11],Uatt=[1001],Watt=[1001]V_{att} = \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \quad U_{att} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \quad W_{att} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 1.925 (accepted within ±0.035)

Question 6

+4 marksNumerical answer

Suppose you are given three encoder hidden states at time tt:

hj=h1=[10],h2=[01],h3=[11]h_j = h_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad h_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}, \quad h_3 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}

The previous decoder hidden state is:

st−1=[12]s_{t-1} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}

Given the attention score function:

score(st−1,hj)=Vatt⊤tanh⁡(Uattst−1+Watthj)\text{score}(s_{t-1}, h_j) = V_{att}^\top \tanh\left(U_{att} s_{t-1} + W_{att} h_j\right)

where the hyperbolic tangent function is defined as:

tanh⁡(x)=ex−e−xex+e−x=e2x−1e2x+1\tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x} + 1}

where

Vatt=[11],Uatt=[1001],Watt=[1001]V_{att} = \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \quad U_{att} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \quad W_{att} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

Based on the above data, answer the given subquestions.

Normalize the attention scores using the softmax function to obtain the attention weights αtj\alpha_{tj}. submit αt1\alpha_{t1} (i.e first element of α\alpha vector). Submit the final answer correct to two decimal places.

αtj=align(st−1,hj)=exp⁡(score(st−1,hj))∑i=1nexp⁡(score(st−1,hi))\alpha_{tj} = \text{align}(s_{t-1}, h_j) = \frac{\exp\left(\text{score}(s_{t-1}, h_j)\right)}{\sum_{i=1}^{n} \exp\left(\text{score}(s_{t-1}, h_i)\right)}

Show answer

Correct answer: 0.34 (accepted within ±0.04)

Question 7

+2 marksNumerical answer

Suppose you are given three encoder hidden states at time tt:

hj=h1=[10],h2=[01],h3=[11]h_j = h_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad h_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}, \quad h_3 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}

The previous decoder hidden state is:

st−1=[12]s_{t-1} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}

Given the attention score function:

score(st−1,hj)=Vatt⊤tanh⁡(Uattst−1+Watthj)\text{score}(s_{t-1}, h_j) = V_{att}^\top \tanh\left(U_{att} s_{t-1} + W_{att} h_j\right)

where the hyperbolic tangent function is defined as:

tanh⁡(x)=ex−e−xex+e−x=e2x−1e2x+1\tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x} + 1}

where

Vatt=[11],Uatt=[1001],Watt=[1001]V_{att} = \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \quad U_{att} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \quad W_{att} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

Based on the above data, answer the given subquestions.

Calculate the context vector ctc_t

ct=∑j=1nαtjhjc_t = \sum_{j=1}^{n} \alpha_{tj} h_j

Provide the sum all the elements of ctc_t. Submit the final answer correct to two decimal places.

Show answer

Correct answer: 1.36 (accepted within ±0.04)

Question 8

+2 marksNumerical answer
  • Sequence Length : tt
  • Number of Heads : hh
  • Embedding dimension : dmodeld_{\text{model}}
  • Input X∈Rdmodel×tX \in \mathbb{R}^{d_{\text{model}} \times t}
  • dk=dq=dmodelhd_k = d_q = \frac{d_{\text{model}}}{h}
  • WQ∈Rdq×dmodelW_Q \in \mathbb{R}^{d_q \times d_{\text{model}}}
  • WK∈Rdk×dmodelW_K \in \mathbb{R}^{d_k \times d_{\text{model}}}
  • WV∈Rdv×dmodelW_V \in \mathbb{R}^{d_v \times d_{\text{model}}}
  • Wo∈Rdmodel×(h×dv)W_o \in \mathbb{R}^{d_{\text{model}} \times (h \times d_v)}

Based on the above data, answer the given subquestions.

Suppose t=32t = 32, dmodel=64d_{\text{model}} = 64, h=2h = 2 and dv=16d_v = 16. What will be the shape of the output of the scaled dot-product attention operation for a single head, given by:

Attention(Q,K,V)=softmax(QTKdk)VT\text{Attention}(Q, K, V) = \text{softmax}\left(\frac{Q^T K}{\sqrt{d_k}}\right) V^T

Compute the resulting output dimension and report the total number of elements in the resulting attention output.

Show answer

Correct answer: 512

Question 9

+2 marksNumerical answer
  • Sequence Length : tt
  • Number of Heads : hh
  • Embedding dimension : dmodeld_{\text{model}}
  • Input X∈Rdmodel×tX \in \mathbb{R}^{d_{\text{model}} \times t}
  • dk=dq=dmodelhd_k = d_q = \frac{d_{\text{model}}}{h}
  • WQ∈Rdq×dmodelW_Q \in \mathbb{R}^{d_q \times d_{\text{model}}}
  • WK∈Rdk×dmodelW_K \in \mathbb{R}^{d_k \times d_{\text{model}}}
  • WV∈Rdv×dmodelW_V \in \mathbb{R}^{d_v \times d_{\text{model}}}
  • Wo∈Rdmodel×(h×dv)W_o \in \mathbb{R}^{d_{\text{model}} \times (h \times d_v)}

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 12288

Question 10

+1 markNumerical answer
  • Sequence Length : tt
  • Number of Heads : hh
  • Embedding dimension : dmodeld_{\text{model}}
  • Input X∈Rdmodel×tX \in \mathbb{R}^{d_{\text{model}} \times t}
  • dk=dq=dmodelhd_k = d_q = \frac{d_{\text{model}}}{h}
  • WQ∈Rdq×dmodelW_Q \in \mathbb{R}^{d_q \times d_{\text{model}}}
  • WK∈Rdk×dmodelW_K \in \mathbb{R}^{d_k \times d_{\text{model}}}
  • WV∈Rdv×dmodelW_V \in \mathbb{R}^{d_v \times d_{\text{model}}}
  • Wo∈Rdmodel×(h×dv)W_o \in \mathbb{R}^{d_{\text{model}} \times (h \times d_v)}

Based on the above data, answer the given subquestions.

Assume a Feed-Forward Network (FFN) follows the Multi-Head Attention layer in the encoder. The FFN consists of two linear transformations:

FFN(x)=max⁡(0,xW1+b1)W2+b2\text{FFN}(x) = \max(0, xW_1 + b_1)W_2 + b_2

where W1∈Rdmodel×dff,W2∈Rdff×dmodel\text{where } W_1 \in \mathbb{R}^{d_{\text{model}} \times d_{\text{ff}}}, \quad W_2 \in \mathbb{R}^{d_{\text{ff}} \times d_{\text{model}}}

Calculate the total number of parameters in the FFN layer (including bias terms), where dff=256d_{\text{ff}} = 256 and dmodel=64d_{\text{model}} = 64.

Show answer

Correct answer: 33088

Question 11

+2 marksNumerical answer

Consider a CBOW model for learning word embeddings. The vocabulary is made up of three words, {good, bad, ugly}. W and C are the matrices that contain the word and context embeddings respectively. The columns in each matrix correspond to the embeddings. Both matrices are of shape 2 x 3:

The context window is 1, meaning, the next word is predicted using just the current word as context. Recall that we use softmax to make predictions at the output.
Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.67 (accepted within ±0.05)

Question 12

+2 marksOne correct option

Consider a CBOW model for learning word embeddings. The vocabulary is made up of three words, {good, bad, ugly}. W and C are the matrices that contain the word and context embeddings respectively. The columns in each matrix correspond to the embeddings. Both matrices are of shape 2 x 3:

The context window is 1, meaning, the next word is predicted using just the current word as context. Recall that we use softmax to make predictions at the output.
Based on the above data, answer the given subquestions.

The CBOW model is now used to generate a “sentence” or a string of words. First we pass the word “good” and retain the word with highest probability as the output, say word1, which is in turn passed as input to the model. If the model is run this way for exactly three time steps, what is the sentence that it outputs? Note that the sentence here is “word1 word2 word3”.

  1. A

    bad ugly good

  2. B

    good bad ugly

  3. C

    bad bad bad

  4. D

    good good good

  5. E

    bad ugly bad

Show answer

Correct answer

  • A

    bad ugly good

Question 13

+3 marksOne correct option

Consider a CBOW model for learning word embeddings. The vocabulary is made up of three words, {good, bad, ugly}. W and C are the matrices that contain the word and context embeddings respectively. The columns in each matrix correspond to the embeddings. Both matrices are of shape 2 x 3:

The context window is 1, meaning, the next word is predicted using just the current word as context. Recall that we use softmax to make predictions at the output.
Based on the above data, answer the given subquestions.

Now consider updating the word embeddings using the sample “good good”. The first “good” in the string is used as context and the second “good” as the true label. Use cross entropy as the loss function and run one iteration of gradient descent with η = 1 starting with the existing values for the embeddings.
Find the updated word embedding for “good” and choose the most appropriate option from below. Note that you have to compute the updated word embedding for “good” and not its context embedding.

  1. A

    (1.76, -0.24)

  2. B

    (1.24, -0.76)

  3. C

    (1.76, 1.76)

  4. D

    (1.76, -1.76)

  5. E

    (1.24, -1.24)

Show answer

Correct answer

  • A

    (1.76, -0.24)

Question 14

+1 markNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.25

Question 15

+2 marksNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.5

Question 16

+1 markNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 1

Question 17

+3 marksNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.125

Question 18

+2 marksNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 2

Question 19

+2 marksNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 1