Question 1
Which of the following is the MOST correct way to run a trained model on test data?
y = model(X_test)
model.eval() y = model(X_test)
with torch.no_grad(): y = model(X_test)
model.eval() with torch.no_grad(): y = model(X_test)

The IIT Madras BS Introduction to Deep Learning and Generative AI (Deep Learning and GenAI) End Term paper sat on 10 May 2026, in the January 2026 term, set 1: 24 questions for 100 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.
Which of the following is the MOST correct way to run a trained model on test data?
y = model(X_test)
model.eval() y = model(X_test)
with torch.no_grad(): y = model(X_test)
model.eval() with torch.no_grad(): y = model(X_test)
Correct answer
model.eval() with torch.no_grad(): y = model(X_test)
Consider the sentence:
"Data science is fun"
In a bigram language model, which probability expression correctly represents the probability of the word "is"?
P(is | Data, science)
P(is | science)
P(is | fun)
P(is | science, fun)
Correct answer
P(is | science)
We are given the Q, K, V matrices to compute the scaled dot product attention matrix for a transformer.
Keeping everything else same we double every value in the V matrix.
How will this change the scaled dot product attention scores that are computed?
There won't be any change to the attention scores.
Attention scores will double.
Attention scores will get halved.
Attention scores will change but we can't determine how much they will change without checking the actual values of the V matrix.
Correct answer
There won't be any change to the attention scores.
Consider the following code representing a component of a traditional encoder decoder model which uses Bahdanau attention:
Which of the following completes the missing line?
Correct answer
What is the output of the following code?
(2,3,4)
(0,2,1)
(2,4,3)
(4,2,3)
Correct answer
(2,3,4)
Consider an attention mechanism defined as:
Attention(Q, K, V) = softmax(QKT) V
Which of the following is the most likely consequence of removing the scaling factor in this attention computation?
The attention scores become smaller, leading to uniform attention weights.
The dot product values grow large, causing the softmax to produce extremely peaked distributions and unstable gradients.
The model becomes invariant to the dimensionality of key vectors.
The attention mechanism works as usual.
Correct answer
The dot product values grow large, causing the softmax to produce extremely peaked distributions and unstable gradients.
Set shuffle=False
Increase batch_size to 64
Set drop_last=True
Set num_workers=0
Correct answer
Set drop_last=True
What is the primary capability that the Position-wise Feed-Forward Network (FFN) provides to the Transformer architecture?
The ability to attend to other tokens in the sequence and capture dependencies between words
The ability to preserve and utilize positional information about token order
The ability to apply non-linear transformations and learn complex feature interactions within each token's representation
The ability to mix information across different positions in the sequence
Correct answer
The ability to apply non-linear transformations and learn complex feature interactions within each token's representation
Correct answer
A transformer model has the following embedding layer: Vocabulary size = 50,000• Embedding dimension = 768• The embeddings are currently stored in float32 format.
You decide to optimize memory as follows: Quantize 70% of the embedding vectors to int81. Keep the remaining 30% in float32 (for high-frequency tokens)2. What is the overall percentage reduction in memory for the embedding matrix?
(Round to the nearest integer)
52%
60%
53%
65%
Correct answer
53%
Consider the following code:
Which of the following describes the output of decoded_texts?
The output will return decoded text strings with special tokens like [CLS] and [SEP] removed.
The output will include [CLS] and [SEP] tokens explicitly in each string.
The output will be a list of token IDs instead of strings and exclude special tokens.
The output will return the tokenized words but still include padding tokens.
Correct answer
The output will return decoded text strings with special tokens like [CLS] and [SEP] removed.
We use the following LORA code to finetune BERT model:
But we notice that the code does not work as intended. Which of the following parameters of the lora need to be changed to make it work as intended?
rank (r)
task_type
lora_dropout
lora_alpha
Correct answer
task_type
Which of the following are data augmentation techniques?
Correct answers
Consider the following optimization algorithms used for training neural networks: SGD with Momentum• RMSProp• Adam• Which of the following statements is/are correct?
SGD with Momentum accumulates an exponentially decaying moving average of past gradients to accelerate convergence along consistent directions.
Momentum methods adapt individual learning rates for each parameter based on past squared gradients.
RMSProp maintains a running average of squared gradients to scale learning rate.
Adam combines ideas from Momentum and RMSProp by using both first and second moment estimates of gradients.
Adam requires computing second-order derivatives of the loss function.
Adaptive methods such as RMSProp and Adam can use different effective learning rates for different parameters.
Correct answers
SGD with Momentum accumulates an exponentially decaying moving average of past gradients to accelerate convergence along consistent directions.
RMSProp maintains a running average of squared gradients to scale learning rate.
Adam combines ideas from Momentum and RMSProp by using both first and second moment estimates of gradients.
Adaptive methods such as RMSProp and Adam can use different effective learning rates for different parameters.
Select the correct statement(s) regarding a CNN:
Increasing the number of kernels proportionately increases the size of the output feature map.
Increasing the number of kernels proportionately decreases the size of the output feature map.
Low padding and high stride are the ideal combination if we want to minimize the reduction of the feature map size.
Low padding and high stride are the ideal combination if we want to maximize the reduction of the feature map size.
Correct answer
Low padding and high stride are the ideal combination if we want to maximize the reduction of the feature map size.
Which of the following situations may lead to a mode collapse while training a GAN?
A GAN trained on MNIST generates only the digit '3' repeatedly, even though the dataset contains digits 0-9.
GAN generates limited variations of faces with similar expressions despite diverse training data.
The GAN underfits the training data.
The discriminator becomes accurate straightaway after training the GAN on just the first 5 images.
Correct answers
A GAN trained on MNIST generates only the digit '3' repeatedly, even though the dataset contains digits 0-9.
GAN generates limited variations of faces with similar expressions despite diverse training data.
Consider the evaluation metrics commonly used for generative models: Fréchet Inception Distance (FID), Inception Score (IS), and CLIP Score.
Which of the following statements are correct?
FID compares the mean and covariance of real and generated feature distributions extracted from a pretrained Inception network.
Inception Score directly compares generated images with real images.
A lower FID score indicates that generated samples are closer to the real data distribution.
Inception Score rewards images that are both classifiable (low entropy conditional distribution) and diverse (high entropy marginal distribution).
CLIP Score requires real images to compute the metric.
CLIP Score measures alignment between generated images and their corresponding text prompts.
FID and Inception Score both explicitly evaluate text-image alignment.
Correct answers
FID compares the mean and covariance of real and generated feature distributions extracted from a pretrained Inception network.
A lower FID score indicates that generated samples are closer to the real data distribution.
Inception Score rewards images that are both classifiable (low entropy conditional distribution) and diverse (high entropy marginal distribution).
CLIP Score measures alignment between generated images and their corresponding text prompts.
A text-to-image generative model is evaluated on three metrics with the following results: FID = 8.5• Inception Score (IS) = 2.1• CLIP Score = 0.34• For comparison, a strong baseline model on the same dataset achieves: FID = 15.2• IS = 6.8• CLIP Score = 0.31• Which of the following interpretations are correct?
The new model generates images that are statistically closer to the real data distribution than the baseline.
The new model produces more class-diverse samples than the baseline.
The new model likely generates less classifiable or less confident object predictions compared to the baseline.
The new model aligns slightly better with the provided text prompts than the baseline.
The higher CLIP score guarantees better perceptual image quality.
The baseline model likely generates more diverse categories of images than the new model.
Correct answers
The new model generates images that are statistically closer to the real data distribution than the baseline.
The new model likely generates less classifiable or less confident object predictions compared to the baseline.
The new model aligns slightly better with the provided text prompts than the baseline.
The baseline model likely generates more diverse categories of images than the new model.
Consider an encoder-decoder architecture trained using maximum likelihood for sequence generation.
Which of the following statements are correct?
During training, the decoder may receive ground-truth tokens as inputs at subsequent time steps.
During inference, the decoder conditions on its own previously generated tokens.
Teacher forcing can be used during inference to give more accurate predictions.
Beam search trades computational cost for a broader exploration of possible output sequences.
Beam search guarantees recovery of the globally optimal sequence for any fixed beam width.
Correct answers
During training, the decoder may receive ground-truth tokens as inputs at subsequent time steps.
During inference, the decoder conditions on its own previously generated tokens.
Beam search trades computational cost for a broader exploration of possible output sequences.
You want to reduce parameters in multi-head attention from 4,096 to 1,024. Which of the following changes achieve(s) this? (MSQ)
Reduce sequence length from 100 to 25
Correct answer
Consider the following single-layer RNN:
Correct answer
Consider the following PyTorch model:
Note: Do not round intermediate values.• Final answer can be rounded to 3 decimal places.•
-0.462
0.364
-0.364
-0.787
Correct answer
-0.364
Correct answer: 0.5 (accepted within ±0.1)
A model is fine-tuned with the following configuration: dataset_size = 2048• batch_size = 16• epochs = 2• Assuming the optimizer performs exactly one update after a fixed number of gradient accumulation steps and 64 updates are performed, how many gradient accumulation steps were used during training?
Correct answer: 4