uiz Space

September 2024 term · Introduction to Natural Language Processing · BSDA5005

Introduction to Natural Language Processing Quiz 2: 1 December 2024 (September 2024 term)

The IIT Madras BS Introduction to Natural Language Processing (Intro to NLP) Quiz 2 paper sat on 1 Dec 2024, in the September 2024 term: 17 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
17
Marks
50
Duration
120 min
MCQ
6
MSQ
5
Numerical
6

Updated

Official paper: IIT M DEGREE AN EXAM QDB2 01 Dec 2024 · No negative marking.

Question 1

+2 marksOne correct option

FastText differs from traditional word embedding models like Word2Vec because it can handle out-of-vocabulary (OOV) words more effectively. Which of the following best explains how FastText achieves this capability?

  1. A

    FastText predicts context words using an entire sentence rather than just nearby words.

  2. B

    FastText generates embeddings by averaging multiple pre-trained word vectors.

  3. C

    FastText breaks words down into smaller subword units (character n-grams) and creates embeddings based on these subwords, allowing it to estimate embeddings for unseen words.

  4. D

    FastText uses neural networks with an additional layer dedicated to identifying unknown words.

Show answer

Correct answer

  • C

    FastText breaks words down into smaller subword units (character n-grams) and creates embeddings based on these subwords, allowing it to estimate embeddings for unseen words.

Question 2

+3 marksOne correct option

Consider the sentences:

In a transformer model, each word receives positional encoding. How will the positional encoding of "playful" differ across these sentences?

  1. A

    It will be identical in all three sentences.

  2. B

    It will vary in each sentence based on the position of "playful" within that sentence.

  3. C

    It will vary only if "playful" has a different meaning.

  4. D

    It will be identical but scaled by the number of words in each sentence.

Show answer

Correct answer

  • B

    It will vary in each sentence based on the position of "playful" within that sentence.

Question 3

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

Correct answer

  • E

Question 4

+3 marksOne correct option

In the encoder of a transformer model, what are the sources of the queries (Q), keys (K), and values (V)?

  1. A

    Q comes from the encoder output, K from the decoder input, and V from the output layer.

  2. B

    Q comes from the decoder output, while K and V come from the encoder input.

  3. C

    Q comes from the positional encoding, K from the input sequence length, and V from the output embeddings.

  4. D

    Q, K, and V all come from the input embeddings representing the tokens in the input sequence.

Show answer

Correct answer

  • D

    Q, K, and V all come from the input embeddings representing the tokens in the input sequence.

Question 5

+3 marksOne or more correct options

Given the following statements, select all that are correct:

Select all that apply.

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

Correct answers

  • A
  • C
  • D

Question 6

+3 marksOne or more correct options

Consider the following statements about statistical-based (SMT) and example-based (EBMT) machine translation techniques. Select all statements that are correct:

Select all that apply.

  1. A

    SMT uses probabilistic models to estimate the likelihood of translating one phrase to another.

  2. B

    EBMT relies on a database of example translations and reuses similar examples to translate new sentences.

  3. C

    SMT requires extensive linguistic rules and manually defined grammar to create effective translations.

  4. D

    When EBMT encounters an unseen sentence, it decomposes the sentence into smaller segments and reuses similar examples from its database to generate translations.

Show answer

Correct answers

  • A

    SMT uses probabilistic models to estimate the likelihood of translating one phrase to another.

  • B

    EBMT relies on a database of example translations and reuses similar examples to translate new sentences.

  • D

    When EBMT encounters an unseen sentence, it decomposes the sentence into smaller segments and reuses similar examples from its database to generate translations.

Question 7

+3 marksOne or more correct options

Consider a scenario where you are fine-tuning a large language model using LoRA (Low-Rank Adaptation) and QLoRA (Quantized LoRA) techniques. Each technique has specific ways of reducing the model's memory and computational requirements. Select all statements that are correct about LoRA ans QLoRa.

Select all that apply.

  1. A

    LoRA achieves computational efficiency by performing inference with only a subset of the model's original parameters, completely ignoring any layers that are not low-rank.

  2. B

    QLoRA enables the model to dynamically switch between full and low-rank matrices during inference, improving accuracy while saving memory.

  3. C

    QLoRA applies quantization to the low-rank matrices introduced by LoRA, combining memory efficiency through quantization with a reduced number of trainable parameters from low-rank adaptation.

  4. D

    LoRA reduces the number of parameters by introducing low-rank matrices to approximate the weight updates, which minimizes the number of parameters that need to be stored and trained.

Show answer

Correct answers

  • C

    QLoRA applies quantization to the low-rank matrices introduced by LoRA, combining memory efficiency through quantization with a reduced number of trainable parameters from low-rank adaptation.

  • D

    LoRA reduces the number of parameters by introducing low-rank matrices to approximate the weight updates, which minimizes the number of parameters that need to be stored and trained.

Question 8

+3 marksNumerical answer

You are analysing a collection of customer reviews using the Bag of Words (BoW) model. Here are three sample reviews:
• Review 1: "This product is amazing, I absolutely love it!"
• Review 2: "The product is terrible, I hate it."
• Review 3: "Not the best, but it works okay."

Assume that each unique word from the vocabulary appears in at least one of the three reviews and each unique word from reviews are added in the vocabulary. A word that appears in a review contributes 1 non-zero entry to that review's BoW vector.

Show answer

Correct answer: 22

Question 9

+3 marksNumerical answer

Consider the following sentences:

  • S1: "I like studying LLMs"
  • S2: "I like studying big data"
  • S3: "I also like studying computer vision"

Assuming each word is represented by a positional encoding vector with an embedding dimension of 512512, calculate the total number of unique elements in the positional encoding vectors of these sentences.

(Example: Number of unique elements in vectors [3.7,7.3][3.7, 7.3] and [3.4,3.7][3.4, 3.7] and [7.3,3.7][7.3, 3.7] is 33)

Show answer

Correct answer: 3072

Question 10

+3 marksNumerical answer
Show answer

Correct answer: 950

Question 11

+3 marksNumerical answer
Show answer

Correct answer: 96.85 (accepted within ±0.15)

Question 12

+3 marksNumerical answer

Consider a reward model in RLHF that uses the Bradley-Terry model to compute pairwise preference probabilities between completions. Let yiy_i , yjy_j, and yky_k be three different completions for a given input xx.

R(yi),R(yj)R(y_i), R(y_j) and R(yk)R(y_k) are the rewards output by the model for completions yi,yjy_i, y_j and yky_k respectively. We have:

  • R(yi)=0.4R(y_i) = 0.4
  • R(yj)=0.2R(y_j) = 0.2
  • R(yk)=0.5R(y_k) = 0.5

Calculate the combined probability that yiy_i is preferred over both yjy_j and yky_k (assuming independence).

Use log⁡e\log_e (natural logarithm) for calculations and provide the final answer for the combined probability correct to two decimal places.

Show answer

Correct answer: 0.26 (accepted within ±0.04)

Question 13

+3 marksNumerical answer
Show answer

Correct answer: 21.5 (accepted within ±0.5)

Question 14

+3 marksOne or more correct options

Consider an RNN for a language modelling task with one hidden layer, trained with cross-entropy loss with a softmax over the logits at the output layer.

  • Let EE be the embedding matrix that converts an input token into an embedding vector.
  • Let UU be the matrix corresponding to the recurrent connections.
  • Let WW be the matrix corresponding to the feed-forward connections from the embedding layer to the hidden layer.
  • Let VV be the unembedding matrix that converts the hidden layer vectors to logits.

Ignore the biases

The size of the vocabulary is 5,0005,000. The hidden layer size and the size of the word embedding are the same and both are equal to 256256.

Based on the above data, answer the given subquestions.

Which of the following are square matrices?

Select all that apply.

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

Correct answers

  • A
  • C

Question 15

+3 marksOne correct option

Consider an RNN for a language modelling task with one hidden layer, trained with cross-entropy loss with a softmax over the logits at the output layer.

  • Let EE be the embedding matrix that converts an input token into an embedding vector.
  • Let UU be the matrix corresponding to the recurrent connections.
  • Let WW be the matrix corresponding to the feed-forward connections from the embedding layer to the hidden layer.
  • Let VV be the unembedding matrix that converts the hidden layer vectors to logits.

Ignore the biases

The size of the vocabulary is 5,0005,000. The hidden layer size and the size of the word embedding are the same and both are equal to 256256.

Based on the above data, answer the given subquestions.

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

Correct answer

  • B

Question 16

+3 marksOne correct option

Consider an RNN for a language modelling task with one hidden layer, trained with cross-entropy loss with a softmax over the logits at the output layer.

  • Let EE be the embedding matrix that converts an input token into an embedding vector.
  • Let UU be the matrix corresponding to the recurrent connections.
  • Let WW be the matrix corresponding to the feed-forward connections from the embedding layer to the hidden layer.
  • Let VV be the unembedding matrix that converts the hidden layer vectors to logits.

Ignore the biases

The size of the vocabulary is 5,0005,000. The hidden layer size and the size of the word embedding are the same and both are equal to 256256.

Based on the above data, answer the given subquestions.

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

Correct answer

  • A

Question 17

+3 marksOne or more correct options

Consider an RNN for a language modelling task with one hidden layer, trained with cross-entropy loss with a softmax over the logits at the output layer.

  • Let EE be the embedding matrix that converts an input token into an embedding vector.
  • Let UU be the matrix corresponding to the recurrent connections.
  • Let WW be the matrix corresponding to the feed-forward connections from the embedding layer to the hidden layer.
  • Let VV be the unembedding matrix that converts the hidden layer vectors to logits.

Ignore the biases

The size of the vocabulary is 5,0005,000. The hidden layer size and the size of the word embedding are the same and both are equal to 256256.

Based on the above data, answer the given subquestions.

At training time, consider a training sample, "this is good", where each word is a token. At the last time step (while processing "good"), the word probabilities output by the RNN for these three tokens are:

Which of the following are true?

Select all that apply.

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

Correct answers

  • C
  • D