uiz Space

September 2024 term · Deep Learning Practice · BSDA5013

Deep Learning Practice Quiz 1: 27 October 2024 (September 2024 term)

The IIT Madras BS Deep Learning Practice (Deep Learning Practice) Quiz 1 paper sat on 27 Oct 2024, in the September 2024 term: 15 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
15
Marks
50
Duration
120 min
MCQ
6
MSQ
4
Numerical
5

Updated

Official paper: IIT M DEGREE AN EXAM QDB2 27 Oct 2024 · No negative marking.

Question 1

+4 marksOne correct option
  1. A

    Pre-Tokenization

  2. B

    Normalization

  3. C

    Post Processor

  4. D

    Tokenization Algorithm

  5. E

    Decoder

Show answer

Correct answer

  • C

    Post Processor

Question 2

+3 marksOne correct option

Choose the Hugging Face module that helps us train a tokenizer from scratch on a specific dataset.

  1. A

    tokenizers

  2. B

    transformers

  3. C

    evaluate

  4. D

    Autotrain

  5. E

    Accelerate

Show answer

Correct answer

  • A

    tokenizers

Question 3

+3 marksOne correct option

A dataset contains 10 billion words ( separated by a single white space). Suppose we use a pre- trained tokenizer that has a vocabulary of size 10,000 to tokenize the dataset, then the number of tokens in the dataset will always be greater than or equal to the number of words in the dataset. The statement is

  1. A

    True

  2. B

    False

Show answer

Correct answer

  • A

    True

Question 4

+3 marksOne correct option

Which of the following tokenization algorithms can be applied to languages that do not have any word delimiters?

  1. A

    BPE (Byte Pair Encoding)

  2. B

    Wordpiece

  3. C

    Sentencepiece

Show answer

Correct answer

  • C

    Sentencepiece

Question 5

+3 marksOne correct option

Consider the Wikipedia dataset scraped from the web that contains 2 billion words. A team decided to use the BPE tokenization algorithm with the varying vocabulary size from 2K to 52K, then the statement that increasing the number of merges will increase the size of the vocabulary is

  1. A

    True

  2. B

    False

  3. C

    Insufficient information

Show answer

Correct answer

  • A

    True

Question 6

+3 marksOne correct option

Suppose that we pre-train a Causal Language Model. Choose the data collator function from the Hugging Face library that is suitable for this task

  1. A

    DataCollator(tokenizer)

  2. B

    DefaultDataCollator(tokenizer)

  3. C

    DataCollatorForLanguageModelling(tokenizer,mlm=False)

  4. D

    DataCollatorForCausalLanguageModelling(tokenizer)

  5. E

    DataLoader(tokenizer)

Show answer

Correct answer

  • C

    DataCollatorForLanguageModelling(tokenizer,mlm=False)

Question 7

+4 marksOne or more correct options

The IMDB dataset has 25000 samples in the training split. It contains two columns, named, text and label. Consider the code snippet given below and choose all the correct statements

python
from datasets import load_dataset
imdb_dataset = load_dataset("stanfordnlp/imdb",split='train')
def get_num_words(example):
num_words = len(example["text"].split())
return {'num_words':num_words}
ds = imdb_dataset.map(get_num_words)

Select all that apply.

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

Correct answers

  • A
  • F

Question 8

+4 marksOne or more correct options

Consider two datasets namely "ds1" and "ds2" . The structure of the dataset with the number of samples in each split is given below. Suppose we create a new dataset in the following ways. Assume necessary

python
DatasetDict({
train: Dataset({
features: ['text', 'label'],
num_rows: 25000
})
test: Dataset({
features: ['text', 'label'],
num_rows: 25000
})
unsupervised: Dataset({
features: ['text', 'label'],
num_rows: 50000
})
})

ds1

python
DatasetDict({
train: Dataset({
features: ['text', 'label'],
num_rows: 8530
})
test: Dataset({
features: ['text', 'label'],
num_rows: 1066
})
unsupervised: Dataset({
features: ['text', 'label'],
num_rows: 1066
})
})

ds2

imports and the statements are executed independently (i.e., an error in executing a statement does not affect the execution of other statements). Select all the correct statements.

python
ds3 = datasets.concatenate_datasets([ds1,ds2])
ds4 = datasets.concatenate_datasets([ds1['train'],ds2['train']])
ds5 = datasets.concatenate_datasets([ds1['train'],ds2['test']])
ds6 = datasets.concatenate_datasets(
[ds1['train'],ds1['test'],
ds2['train'],ds2['validation']])

Select all that apply.

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

Correct answers

  • B
  • C
  • D

Question 9

+3 marksOne or more correct options

Select all that apply.

  1. A
  2. B
  3. C
Show answer

Correct answers

  • A
  • C

Question 10

+3 marksOne or more correct options

Select all that apply.

  1. A

    ids

  2. B

    tokens

  3. C

    offsets

  4. D

    attention_mask

  5. E

    special_token_mask

  6. F

    type_ids

  7. G

    vocab_size

Show answer

Correct answers

  • A

    ids

  • B

    tokens

  • C

    offsets

  • D

    attention_mask

  • E

    special_token_mask

  • F

    type_ids

Question 11

+3 marksNumerical answer

Here is a configuration of the GPTNeo model from the Hugging Face hub.

text
"bos_token_id": 50256,
"classifier_dropout": 0.1,
"embed_dropout": 0.0,
"eos_token_id": 50256,
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": null,
"layer_norm_epsilon": 1e-05,
"max_position_embeddings": 2048,
"model_type": "gpt_neo",
"num_heads": 16,
"num_layers": 24,
"resid_dropout": 0.0,
"transformers_version": "4.44.2",
"use_cache": true,
"vocab_size": 50257,
"window_size": 256

Figure 1: GPTNeoConfig

Based on the above data, answer the given subquestions.

Enter the number of parameters in the embedding layer of the model in millions. For example, if the answer is 1234567. Then enter it as 1.23

Show answer

Correct answer: 102.5 (accepted within ±0.5)

Question 12

+3 marksNumerical answer

Here is a configuration of the GPTNeo model from the Hugging Face hub.

text
"bos_token_id": 50256,
"classifier_dropout": 0.1,
"embed_dropout": 0.0,
"eos_token_id": 50256,
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": null,
"layer_norm_epsilon": 1e-05,
"max_position_embeddings": 2048,
"model_type": "gpt_neo",
"num_heads": 16,
"num_layers": 24,
"resid_dropout": 0.0,
"transformers_version": "4.44.2",
"use_cache": true,
"vocab_size": 50257,
"window_size": 256

Figure 1: GPTNeoConfig

Based on the above data, answer the given subquestions.

Enter the context length.

Show answer

Correct answer: 2048

Question 13

+5 marksNumerical answer

Here is a set of training arguments used by the GPT-2 model that was pre-trained on a dataset that contains 10 billion tokens. The context length of the model is modified to 2048, the vocabulary size is 50,257 and the embedding dimension is 768. The length of all the samples in a batch is equal to the context length of the model.

python
training_args = TrainingArguments( output_dir='out',
evaluation_strategy="steps",
eval_steps=500,
num_train_epochs=1,
per_device_train_batch_size=16,
per_device_eval_batch_size=16,
tf32=True,
gradient_accumulation_steps=2,
adam_beta1=0.9,
adam_beta2=0.999,
learning_rate=2e-5,
weight_decay=0.01,
logging_dir='logs',
logging_strategy="steps",
logging_steps = 500,
save_steps=5000,
save_total_limit=20,
report_to='wandb',
)

Based on the above data, answer the given subquestions.

Enter the number of tokens (in millions) processed by the model after 1000 steps. Enter the answer to 2 decimal places. For example, if your answer is 123456789, then enter it as 123.45.

Show answer

Correct answer: 65.5 (accepted within ±0.2)

Question 14

+3 marksNumerical answer

Here is a set of training arguments used by the GPT-2 model that was pre-trained on a dataset that contains 10 billion tokens. The context length of the model is modified to 2048, the vocabulary size is 50,257 and the embedding dimension is 768. The length of all the samples in a batch is equal to the context length of the model.

python
training_args = TrainingArguments( output_dir='out',
evaluation_strategy="steps",
eval_steps=500,
num_train_epochs=1,
per_device_train_batch_size=16,
per_device_eval_batch_size=16,
tf32=True,
gradient_accumulation_steps=2,
adam_beta1=0.9,
adam_beta2=0.999,
learning_rate=2e-5,
weight_decay=0.01,
logging_dir='logs',
logging_strategy="steps",
logging_steps = 500,
save_steps=5000,
save_total_limit=20,
report_to='wandb',
)

Based on the above data, answer the given subquestions.

How many steps does it take to complete one epoch of training? Enter the answer in thousands (round down to an integer). For example, if your answer is 1234567.89, then enter it as 1234567.

Show answer

Correct answer: 152.5 (accepted within ±0.5)

Question 15

+3 marksNumerical answer
Show answer

Correct answer: 500