uiz Space

September 2024 term · Introduction to Natural Language Processing · BSDA5005

Introduction to Natural Language Processing End Term: 22 December 2024 (September 2024 term)

The IIT Madras BS Introduction to Natural Language Processing (Intro to NLP) End Term paper sat on 22 Dec 2024, in the September 2024 term: 28 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.

Questions
28
Marks
100
Duration
180 min
MSQ
6
Numerical
7
MCQ
15

Updated

Official paper: IIT M DEGREE FN EXAM QDB1 22 Dec 2024 · No negative marking.

Question 1

+4 marksOne or more correct options

What are the examples of a free morpheme?

Select all that apply.

  1. A

    “sleep” in “sleeping”

  2. B

    “un-” in “undo”

  3. C

    “book” in “booked”

  4. D

    “-s” in “books”

Show answer

Correct answers

  • A

    “sleep” in “sleeping”

  • C

    “book” in “booked”

Question 2

+4 marksOne or more correct options

Which of the following are challenges in applying Shapley values for model explainability?

Select all that apply.

  1. A

    Computing Shapley values requires evaluating an exponential number of feature coalitions.

  2. B

    Shapley values assume independence between features, which may not hold in real-world data.

  3. C

    Shapley values are computationally efficient for deep neural networks.

  4. D

    Shapley values provide additive explanations, ensuring the contributions of all features sum up to the model's output.

Show answer

Correct answers

  • A

    Computing Shapley values requires evaluating an exponential number of feature coalitions.

  • B

    Shapley values assume independence between features, which may not hold in real-world data.

Question 3

+4 marksNumerical answer
Show answer

Correct answer: 0.815 (accepted within ±0.015)

Question 4

+4 marksNumerical answer
Show answer

Correct answer: 0.036 (accepted within ±0.01)

Question 5

+4 marksNumerical answer
Show answer

Correct answer: 99.5 (accepted within ±0.5)

Question 6

+4 marksNumerical answer

Consider top-k sampling with k=4k = 4 as the decoding strategy for a large language model. For the context "I want to become a", the probabilities output by the model over all the words in the vocabulary are extracted and sorted in descending order. The top four words and their associated probabilities are given below:

  • doctor, 0.4
  • lawyer, 0.3
  • writer, 0.06
  • cook, 0.04

If a word is sampled at this stage, what is the probability with which the model outputs "lawyer"?

Show answer

Correct answer: 0.375 (accepted within ±0.005)

Question 7

+4 marksNumerical answer

In a transformer model, attention rollout is used to compute the contribution of input tokens to the final output. Consider a model with 3 layers and an input sequence of 4 tokens t1,t2,t3,t4t_1, t_2, t_3, t_4. The attention scores for each token in each layer are:

  • Layer 1: [0.2,0.3,0.4,0.1][0.2, 0.3, 0.4, 0.1]
  • Layer 2: [0.3,0.2,0.3,0.2][0.3, 0.2, 0.3, 0.2]
  • Layer 3: [0.4,0.3,0.2,0.1][0.4, 0.3, 0.2, 0.1]

The initial contributions for each token t1,t2,t3,t4t_1, t_2, t_3, t_4 are equal:

[0.25,0.25,0.25,0.25][0.25, 0.25, 0.25, 0.25]

Using attention rollout, compute the final contribution of token t1t_1 to the model's output. Enter your answer correct to three decimal points.

Show answer

Correct answer: 0.006 (accepted within ±0.004)

Question 8

+6 marksOne or more correct options

FastText is a word embedding model that extends Word2Vec by considering subword information through character n-grams (e.g., bi-grams, tri-grams). Which of the following statements about FastText's behavior and capabilities are true?

Select all that apply.

  1. A

    FastText can generate embeddings for unseen words by summing the embeddings of their subword n-grams.

  2. B

    FastText considers only complete words and does not split them into subword n-grams.

  3. C

    FastText embeddings for morphologically similar words (e.g., "run" and "running") will be highly similar because they share many n-grams.

  4. D

    FastText cannot distinguish between semantically unrelated words like "mouse" and "house" because they share common n-grams(e.g., "ouse").

Show answer

Correct answers

  • A

    FastText can generate embeddings for unseen words by summing the embeddings of their subword n-grams.

  • C

    FastText embeddings for morphologically similar words (e.g., "run" and "running") will be highly similar because they share many n-grams.

  • D

    FastText cannot distinguish between semantically unrelated words like "mouse" and "house" because they share common n-grams(e.g., "ouse").

Question 9

+6 marksOne or more correct options

The Direct Preference Optimization (DPO) loss function is given as:

LDPO(πθ;πref)=−E(x,yw,yl)∼D[log⁡σ(βlog⁡πθ(yw∣x)πref(yw∣x)−βlog⁡πθ(yl∣x)πref(yl∣x))]L_{\text{DPO}}(\pi_\theta; \pi_{\text{ref}}) = -\mathbb{E}_{(x, y_w, y_l) \sim D}\left[\log \sigma\left(\beta \log \frac{\pi_\theta(y_w \mid x)}{\pi_{\text{ref}}(y_w \mid x)} - \beta \log \frac{\pi_\theta(y_l \mid x)}{\pi_{\text{ref}}(y_l \mid x)}\right)\right]

where,

  • πθ(y∣x)\pi_\theta(y \mid x): Probability assigned to an output yy by the trained policy (fine-tuned model) for a given input xx.
  • πref(y∣x)\pi_{\text{ref}}(y \mid x): Probability assigned by the reference policy (pretrained model).
  • (x,yw,yl)(x, y_w, y_l): Input xx with a preferred output ywy_w and a less preferred output yly_l.
  • β\beta: A temperature parameter controlling the sensitivity to log-probability ratios.
  • σ(z)=11+e−z\sigma(z) = \frac{1}{1+e^{-z}}: The logistic sigmoid function.

Which of the following statements about the terms in the DPO loss function are correct?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answers

  • A
  • C
  • D

Question 10

+3 marksOne correct option

Which of the following are suitable choices for an autoregressive language model with the primary objective of using it to generate text based on a given prompt?
(1) Vanilla RNN
(2) Bidirectional RNN

  1. A

    Only (1)

  2. B

    Only (2)

  3. C

    Both (1) and (2)

Show answer

Correct answer

  • A

    Only (1)

Question 11

+3 marksOne correct option
  1. A

    The model will completely ignore the future tokens during training.

  2. B

    The model will stop attending to any tokens in the sequence.

  3. C

    The model will incorrectly attend to future tokens, leading to information leakage and breaking the causality constraint.

  4. D

    The softmax function will fail to compute attention scores for any position.

Show answer

Correct answer

  • C

    The model will incorrectly attend to future tokens, leading to information leakage and breaking the causality constraint.

Question 12

+3 marksOne correct option

What will be the 0th element in the positional encoding for a word at position 10000 in models with dimensions 512 and 1024, respectively?

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answer

  • E

Question 13

+3 marksOne correct option

Which of the following approaches would be the best fit for these specific use cases? 1. A system that retrieves the latest financial data to provide investment advice.
2. Optimizing a general-purpose model for sentiment analysis on product reviews.
3. Generating concise summaries from a pre-trained model with a carefully worded input. 4. Using a general-purpose language model without any modifications.

  1. A

    RAG, Fine-tuning, Prompt engineering, Pre-trained model

  2. B

    Prompt engineering, RAG, Fine-tuning, Pre-trained model

  3. C

    RAG, Prompt engineering, Fine-tuning, Pre-trained model

  4. D

    Fine-tuning, RAG, Prompt engineering, Pre-trained model

Show answer

Correct answer

  • A

    RAG, Fine-tuning, Prompt engineering, Pre-trained model

Question 14

+3 marksOne correct option

What are the inputs and outputs of the query encoder and passage encoder in the Dense Passage Retriever (DPR)?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 15

+3 marksOne correct option
  1. A

    Few-shot prompting

  2. B

    Chain-of-thought prompting

  3. C

    Zero-shot prompting

  4. D

    Instruction prompting

Show answer

Correct answer

  • D

    Instruction prompting

Question 16

+3 marksOne correct option
  1. A

    A-4, B-3, C-1, D-2

  2. B

    A-2, B-3, C-1, D-4

  3. C

    A-2, B-4, C-3, D-1

  4. D

    A-1, B-3, C-2, D-4

Show answer

Correct answer

  • B

    A-2, B-3, C-1, D-4

Question 17

+5 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 18

+2 marksOne correct option

Based on the above data, answer the given subquestions.

Which of the following is the embedding matrix?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 19

+2 marksOne correct option

Based on the above data, answer the given subquestions.

Which of the following is the matrix corresponding to the feedforward connections between the embedding layer and the hidden layer?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 20

+2 marksOne or more correct options

Based on the above data, answer the given subquestions.

Which of the following are true?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • B
  • C

Question 21

+3 marksNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 4800

Question 22

+4 marksOne correct option
  1. A

    Part of speech tagging

  2. B

    Named entity recognition

  3. C

    Machine translation

  4. D

    Sentiment analysis

Show answer

Correct answer

  • D

    Sentiment analysis

Question 23

+4 marksOne correct option

Consider an encoder-decoder transformer used for story generation. If we use exhaustive search to generate tokens for 20 time steps for a story generation task given a vocabulary of size 5,000 , what is the size of the search space?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 24

+4 marksOne correct option

A decoder-only transformer-based language model is used to generate text based on some prompt. The language model is prompted ten times with the same prompt. It produces the same response all ten times. Each run is to be treated independently without any memory of the previous runs. Which of the following could be the most likely decoding strategy used?

  1. A

    Beam search with beam width of 4

  2. B

    Top-k sampling

  3. C

    Nucleus sampling

  4. D

    Greedy sampling

Show answer

Correct answer

  • D

    Greedy sampling

Question 25

+4 marksOne correct option

In the context of bias mitigation techniques, loss function modification would fall under which of the following categories?

  1. A

    Pre-processing mitigation

  2. B

    In-training mitigation

  3. C

    Intra-processing mitigation

  4. D

    Post-processing mitigation

Show answer

Correct answer

  • B

    In-training mitigation

Question 26

+5 marksNumerical answer
Show answer

Correct answer: 3

Question 27

+2 marksOne or more correct options

Which of the following techniques can be used to explain the predictions of a deep learning model by attributing the importance of each feature?

Select all that apply.

  1. A

    Shapley Values

  2. B

    Integrated Gradients

  3. C

    Principal Component Analysis

  4. D

    Attention Mechanisms

Show answer

Correct answers

  • A

    Shapley Values

  • B

    Integrated Gradients

  • D

    Attention Mechanisms

Question 28

+2 marksOne correct option

Why is calculating Shapley values computationally expensive for models with a large number of features?

  1. A

    It requires retraining the model for every subset of features.

  2. B

    It depends on the dataset size, which scales quadratically.

  3. C

    It evaluates the contribution of all possible feature subsets, which grows exponentially.

  4. D

    It computes gradients for every input sample.

Show answer

Correct answer

  • C

    It evaluates the contribution of all possible feature subsets, which grows exponentially.