Deep Learning Practice · Quiz 2 · May 2026
Deep Learning Practice · Quiz 2 · May 2026
← Course papers · Start practice / exam
Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
19 / 20 published solutions
Which of the following factors can adversely impact the accuracy of speech language
identification?
Background noise
Very short utterances
Code-switching
Large balanced training data
Language identification depends on linguistic evidence in the speech signal. Background noise can mask phonetic cues; a very short clip may contain too little evidence; code-switching can mix languages within one labelled example. A large, balanced and representative training set normally supports better learning rather than being an adverse factor by itself.
**Answer: A, B, C.**
A: **Correct:** Can obscure the sound patterns needed for language recognition.
B: **Correct:** May contain too few informative phonetic or lexical cues.
C: **Correct:** Mixes language evidence and can violate a single-language assumption.
D: **Incorrect:** Size and balance are generally beneficial when data quality and relevance are maintained.
Question 3 MSQ · 3.0 marks
You are building an end-to-end speaker-attributed transcription pipeline using the Whisper model
for speech recognition and timestamp generation, the ECAPA-TDNN model for speaker
embedding extraction, and the SpeechBrain toolkit to integrate the diarization pipeline.
Which of the following subtasks are necessary to achieve this? (Select all that apply)
Voice Activity Detection (VAD) / Segmentation
Speech Recognition and Timestamp Generation
Speaker Embedding Extraction
Language Identification
Speaker Clustering
Text-to-Speech (TTS) Synthesis
Alignment and Segment Merging
Published solution
Build speech regions with VAD/segmentation, transcribe them with timestamps, compute speaker embeddings, cluster those embeddings into speaker identities, and align the speaker intervals with the recognised text. Segment merging combines compatible neighbouring intervals into readable speaker-attributed turns. Language identification can be useful in multilingual settings, but it is not universally required to assign speakers and transcribe a known-language recording. TTS generates speech rather than analysing this recording.
**Answer: A, B, C, E, G.**
A: **Correct:** Defines speech regions and excludes irrelevant silence/non-speech.
B: **Correct:** Supplies the transcript and its timing for speaker attribution.
C: **Correct:** Provides representations from which speaker identity can be compared.
D: **Incorrect:** Optional for this task, rather than a necessary diarization stage.
E: **Correct:** Groups speech segments belonging to the same speaker.
F: **Incorrect:** Speech synthesis is not needed to produce speaker-labelled text.
G: **Correct:** Associates text/times with speaker segments and merges compatible turns.
Question 4 MSQ · 3.0 marks
When feeding audio into the pretrained speechbrain/spkrec-ecapa-voxceleb model, which of the
following statements regarding the expected input is (are) true? (Select all that apply)
The system is trained on single-channel (mono) recordings.
The user must manually extract acoustic features (like MFCCs or Mel-
filterbanks) before passing the data to the model.
The expected sampling rate for the input audio is 16kHz.
The model accepts variable-length audio inputs, dynamically generating fixed-
size embeddings regardless of the utterance duration.
Published solution
The specified ECAPA-TDNN checkpoint is trained for mono 16 kHz speech. Its inference interface takes waveform batches and performs its configured acoustic-feature extraction internally. Temporal pooling turns a variable-duration speech sequence into a fixed-width speaker representation; duration can vary although extremely short clips may yield less reliable embeddings. Inputs still require suitable channel handling, sampling rate and valid lengths.
**Answer: A, C, D.**
A: **Correct:** Matches the checkpoint's single-channel training setup.
B: **Incorrect:** Manual MFCC extraction is not required by the waveform inference interface.
C: **Correct:** 16 kHz is the checkpoint's expected waveform sampling rate.
D: **Correct:** Temporal pooling yields a fixed embedding dimension for variable-duration inputs.
Question 5 MSQ · 3.0 marks
Which statements accurately describe the roles, constraints, and data-processing behaviors when
preparing batches for speech models (e.g., Whisper, Wav2Vec2, and SpeechT5) using the Hugging
Face Transformers library?
For sequence-to-sequence ASR models such as Whisper, the data collator
replaces padded token label IDs with
so they are ignored by the cross-entropy loss during
training.
Dynamic padding in speech data collators pads input features and target
labels only to the maximum sequence length within each batch, reducing unnecessary memory
usage compared to dataset-wide padding.
Speech data collators automatically resample raw audio (e.g., from 44.1 kHz to
16 kHz) during batch collation before creating model inputs.
During SpeechT5 TTS training, the target spectrogram is padded to a length
that is a multiple of the reduction factor (
) so that it is compatible with the decoder's frame-
reduction architecture.
computes log-Mel spectrogram features
directly from raw audio waveforms while constructing each batch.
Published solution
Batch preparation must distinguish padding from signal preprocessing. Padded token targets use the loss's ignore index, conventionally -100. Dynamic padding uses the longest relevant sequence in the current batch instead of the whole dataset. SpeechT5 target lengths must be compatible with its reduction factor; implementations may round/truncate valid target lengths to a multiple and mask padded frames. Thus D describes the required multiple-of-r compatibility, not a universal promise that every implementation pads upward. Resampling and acoustic-feature extraction belong in the preprocessing pipeline and are not automatic responsibilities of a padding-only collator.
**Answer: A, B, D.**
A: **Correct:** Ignored padded token positions must not contribute to cross-entropy loss.
B: **Correct:** Batch-local padding reduces unnecessary work for variable-length sequences; individual model constraints may still impose fixed feature sizes.
C: **Incorrect:** A padding collator does not generally resample raw waveforms automatically.
D: **Correct:** The target/frame layout must respect the decoder reduction factor; details can include rounding and truncation as well as padding.
E: **Incorrect:** DataCollatorCTCWithPadding pads prepared inputs/labels; it is not a log-Mel feature extractor.
Question 6 NAT · 2.0 marks
An audio recording is sampled at 16,000 Hz for 8 seconds. How many samples are contained in the
recording?
Published solution
Sampling rate is the number of samples per second. Therefore \(N=f_sT=16000\times8=128000\) samples per channel. The question supplies one recording stream and does not ask for bytes; storage size would additionally depend on channel count and sample precision.
**Answer: 128000.**
Question 7 NAT · 2.0 marks
A multilingual language identification model is trained to classify **40 languages**. The training
dataset contains **1000 audio clips per language**, and each audio clip has been resampled to **16**
**kHz**. The Transformer encoder produces a **1024 dimensional embedding** for every audio clip.
During training, a mini-batch contains **64 audio clips**. Before the classification layer, the
embeddings are stacked into a tensor of shape **(batch_size, embedding_dimension)**.
**Question:** Determine the **total number of embedding values** in this output tensor.
Published solution
The requested tensor has one 1024-component vector for each of 64 clips, so its shape is (64,1024). Number of scalar entries \(=64\times1024=65536\). The 40 output classes and the full dataset's size do not multiply this pre-classifier mini-batch embedding tensor.
**Answer: 65536.**
Question 8 NAT · 2.0 marks
An Automatic Speech Recognition (ASR) system produces a hypothesis transcript for a spoken
audio clip. Calculate the Word Error Rate (WER) of the system given the reference (ground truth)
and hypothesis transcripts below:
• Reference (Ground Truth): "the quick brown fox jumps over the lazy black dog"
• Hypothesis (ASR Output): "the fast brown fox jumped over lazy black dog today"
(Note: Provide your answer as a decimal rounded to two decimal places.)
Published solution
Word error rate is \(WER=(S+D+I)/N\), with N the number of reference words. The reference has 10 words. One minimum-edit alignment substitutes quick→fast and jumps→jumped (S=2), deletes the second 'the' before lazy (D=1), and inserts today (I=1). Thus WER=(2+1+1)/10=0.40. Count the reference words in the denominator, even if the hypothesis happens to have the same total length.
**Answer: 0.40.**
Question 9 MCQ · 2.0 marks
In a spoken language identification task, a pretrained speech model is used to extract features
from an input audio waveform. To obtain a single fixed-length embedding representing the entire
audio clip for language classification, fill in the missing statement in the following code.
sum
max
mean
flatten
Published solution
last_hidden_state has a time dimension containing one feature vector per frame. mean(dim=1) averages over time while preserving batch and hidden-feature dimensions, giving one fixed-width vector per clip. In padded batches the mean should normally exclude padded frames using an appropriate mask. This question intends mean pooling as a duration-normalised clip representation.
**Answer: C.**
A: **Incorrect:** A sum also removes the time dimension, but its magnitude grows with the number of frames; it is not the intended normalised mean-pooling completion.
B: **Incorrect:** PyTorch max(dim=1) ordinarily returns values and indices, not the plain mean-pooled embedding tensor required by this line.
C: **Correct:** Averages frame vectors to produce the intended fixed-width clip embedding.
D: **Incorrect:** Flattening combines time and feature dimensions, so the vector size varies with clip length.
Question 10 MCQ · 2.0 marks
What is the effect of setting compute_type="int8" in WhisperModel(whisper_model,
compute_type="int8")?
It restricts the model to only transcribing 8-second audio chunks.
It forces the audio file to be read as an 8-bit WAV file.
It quantizes the model weights to 8-bit integers, significantly reducing
GPU/CPU memory usage with minimal accuracy loss.
It limits the language detection capability to the 8 most common languages.
Published solution
compute_type selects the inference engine's numerical representation/quantisation mode. int8 uses 8-bit integer quantisation for supported model operations/weights, reducing memory compared with full precision. Accuracy and speed effects depend on hardware, model and data; a small accuracy change is typical motivation, not a mathematical guarantee. This setting does not change the audio file format, clip duration or number of recognised languages.
**Answer: C.**
A: **Incorrect:** The numeral refers to numerical precision, not an eight-second duration limit.
B: **Incorrect:** The model's compute representation is separate from waveform file encoding.
C: **Correct:** Describes the intended reduced-precision quantised inference mode.
D: **Incorrect:** Language support is not truncated to eight languages by this setting.
Question 11 MCQ · 2.0 marks
Consider the following incomplete script intended for fine-tuning a Wav2Vec2 model:
Which of the following code blocks correctly fills in the blank to ensure the model's output layer
matches the tokenizer's vocabulary size and recognizes its padding token?
pad_token_id=tokenizer.pad_token_id, vocab_size=len(tokenizer)
padding_id=tokenizer.pad_token, vocabulary=tokenizer.vocab
pad_token=tokenizer.pad_token_id, size=tokenizer.vocab_size
pad_token_id=tokenizer.pad_token, vocab_len=len(tokenizer)
Published solution
vocab_size must be an integer matching the tokenizer's number of token IDs, including any added tokens; len(tokenizer) supplies that count. pad_token_id must be the numeric ID, not the padding token's string. These are the recognised configuration argument names for the CTC model. A supplies both with the correct types.
**Answer: A.**
A: **Correct:** Uses the correct argument names and numeric values.
B: **Incorrect:** Uses unsupported names and provides token/string or dictionary values instead of the required IDs/count.
C: **Incorrect:** The configuration names are pad_token_id and vocab_size, not pad_token and size.
D: **Incorrect:** pad_token is a string and vocab_len is not the required configuration field.
Question 12 MCQ · 2.0 marks
Which of the following describes the correct input for the Decoder during the training of a
Seq2Seq ASR model like Whisper?
The raw audio waveform normalized to a zero mean.
A sequence of random noise to improve robustness.
The Log-Mel Spectrogram extracted from the audio signal.
The tokens predicted by the decoder up to the previous time step during
inference
A published solution is not available for this question yet.
Question 13 MCQ · 2.0 marks
When fine-tuning a pre-trained Transformer-based ASR model using Connectionist Temporal
Classification (CTC), what is the primary function of the 'blank' token?
Indicating the end of a sentence.
Handling out-of-vocabulary words.
Aligning variable-length sequences.
Representing silent audio segments.
Published solution
CTC sums over possible frame-level alignment paths that collapse to the desired token string. The blank symbol lets a frame contribute no output label; the collapse operation removes blanks and merges consecutive repeated labels. This permits many frame sequences to map to a shorter text sequence without a provided frame-by-frame alignment. Blank is an alignment symbol, not necessarily a physically silent audio frame.
**Answer: C.**
A: **Incorrect:** Blank is not an end-of-sentence marker.
B: **Incorrect:** It is not a replacement for unknown vocabulary words.
C: **Correct:** It supports the alignment and collapsing of variable-length frame and label sequences.
D: **Incorrect:** A blank prediction need not mean acoustic silence; it means no emitted label at that alignment step.
Question 14 MCQ · 2.0 marks
Consider the following PyTorch implementation of a **Convolutional Neural Network (CNN)**
designed for an **audio language identification** task. The input to the model consists of speech
embeddings with shape
.
Based on the above data, answer the given subquestions.
Choose the option to fill in the blanks for the missing code (A)
Published solution
conv1 outputs 128 channels. Pooling changes sequence length but not channel count, so conv2 must accept 128 input channels. The subsequent shape calculation uses 256 output channels. Because the data are channel×sequence tensors, use Conv1d, with kernel 3, stride 1 and padding 1 to preserve sequence length through this convolution.
**Answer: C.**
A: **Incorrect:** Uses the original input_dim=1 instead of the 128 channels produced by conv1.
B: **Incorrect:** Uses a 2D convolution and the wrong input-channel count.
C: **Correct:** Conv1d(128,256,3,stride=1,padding=1) matches the incoming tensor and required output depth.
D: **Incorrect:** Uses Conv2d although the architecture and tensor use one spatial/temporal dimension.
E: **Incorrect:** Expects 256 incoming channels although conv1 supplies 128, and reverses the output depth.
Question 15 NAT · 3.0 marks
Consider the following PyTorch implementation of a **Convolutional Neural Network (CNN)**
designed for an **audio language identification** task. The input to the model consists of speech
embeddings with shape
.
Based on the above data, answer the given subquestions.
The input tensor **train_data** has shape
Determine the correct value of **in_features** for the **fc1** layer.
Published solution
Input shape is (100,1,768). conv1 uses kernel 3, stride 1, padding 1, so length stays 768 and channels become 128. The first size-2 stride-2 pool reduces length to 384. conv2 preserves length and produces 256 channels; the second pool reduces length to 192. Flattening each example therefore gives \(256\times192=49152\) features. The batch size 100 is preserved separately and must not multiply in_features.
**Answer: 49152.**
Question 16 MCQ · 3.0 marks
returns a tensor of shape
. For a stereo file (2
channels), the tensor shape is
.
If you pass this tensor directly into
without first averaging the channels down
to mono, how will the model interpret it?
It will raise a
, since the ECAPA-TDNN model strictly requires
mono (1-channel) input.
It will automatically mean-pool the left and right channels into a mono signal
before processing.
It will treat the tensor's first dimension as a batch dimension, producing two
separate embeddings — one per channel.
It will produce a single embedding, but with double the feature dimension to
account for the extra channel.
Published solution
A speaker-embedding waveform interface expects a 2D tensor shaped (batch,time). A stereo waveform loaded as (2,num_samples) has the same rank, so this interface interprets its first dimension as two batch examples. It produces one embedding for each channel rather than merging them automatically. For one mono representation, first apply the intended channel mixing/downmixing procedure and preserve an explicit batch dimension.
**Answer: C.**
A: **Incorrect:** The shape can be valid as a batch of two mono waveforms, so mono training alone does not imply a shape error here.
B: **Incorrect:** The interface does not infer from this 2D shape that the rows should be downmixed.
C: **Correct:** The first dimension is interpreted as batch, producing two embeddings.
D: **Incorrect:** The embedding feature dimension is fixed; extra rows increase batch size instead.
Question 17 MCQ · 3.0 marks
Why might you freeze the encoder layers of a pre-trained ASR model during the initial phases of
fine-tuning on a very small dataset ?
Reducing the inference latency.
Eliminating the need for CTC.
Preventing catastrophic forgetting.
Increasing the model capacity.
Published solution
A small fine-tuning set can give noisy gradients that rapidly overwrite useful pretrained representations. Freezing the encoder initially preserves those representations while the task-specific part adapts, reducing the risk of catastrophic forgetting and excessive fitting to the small dataset. Layers can be unfrozen later if validation supports it.
**Answer: C.**
A: **Incorrect:** Freezing training updates does not by itself remove encoder computation during inference.
B: **Incorrect:** The training objective, such as CTC, remains necessary.
C: **Correct:** Protects useful pretrained features from being overwritten too quickly.
D: **Incorrect:** It does not add model parameters or capacity.
Question 18 MCQ · 3.0 marks
What is the primary disadvantage of using a character-level tokenizer compared to a Byte-Pair
Encoding (BPE) subword tokenizer for ASR fine-tuning ?
Longer output sequence lengths.
Larger vocabulary size.
Inability to predict new words.
Higher memory usage for embedding.
Published solution
Characters are smaller units than typical BPE subwords. The same transcript therefore usually requires more output tokens with a character tokenizer, increasing sequence lengths and potentially alignment or decoder work. A character vocabulary is generally smaller and can spell new words from known characters; it is not inherently unable to represent unseen word combinations.
**Answer: A.**
A: **Correct:** The same text normally takes more character tokens than subword tokens.
B: **Incorrect:** Character vocabularies are usually smaller, not larger.
C: **Incorrect:** Known characters can compose words absent from the training vocabulary.
D: **Incorrect:** A smaller vocabulary often reduces embedding-table size; this is not the primary disadvantage.
Question 19 MCQ · 3.0 marks
In a standard TTS pipeline involving an acoustic model and a vocoder, which component is
primarily responsible for converting Mel-spectrograms into time-domain waveforms during the
fine-tuning process?
The Vocoder.
The Duration Predictor.
The Phonemizer.
The Attention Mechanism.
Published solution
The acoustic model predicts an intermediate representation such as a Mel-spectrogram. The vocoder converts that time-frequency representation into waveform samples. Duration prediction determines how long units last; phonemisation converts text to pronunciation units; attention supports alignment. None of those replaces the waveform-generation role of the vocoder.
**Answer: A.**
A: **Correct:** Converts acoustic/spectral features to a time-domain signal.
B: **Incorrect:** Predicts durations rather than synthesising the final waveform.
C: **Incorrect:** Converts text into phonetic units.
D: **Incorrect:** Aligns or weights representations rather than directly performing vocoding.
Question 20 MSQ · 2.0 marks
Which of the following linkages is possible in agglomerative clustering?
Ward Linkage
Web Linkage
Single Linkage
Hierarchical Linkage
Published solution
Agglomerative clustering repeatedly merges clusters according to a linkage criterion. Single linkage uses the smallest interpoint distance between two clusters. Ward linkage chooses a merge by the increase in within-cluster squared error and is normally paired with Euclidean geometry. Web linkage is not a standard criterion, and hierarchical describes the family of clustering methods rather than one particular linkage rule.
**Answer: A, C.**
A: **Correct:** Ward is a recognised agglomerative linkage criterion.
B: **Incorrect:** Web is not a standard linkage criterion.
C: **Correct:** Single linkage is a recognised criterion based on minimum intercluster distance.
D: **Incorrect:** Hierarchical names the clustering framework, not a particular linkage definition.
Question 21 NAT · 3.0 marks
The "sentence-transformers/all-mpnet-base-v2" model generates **768-dimensional** sentence
embeddings. A data processing pipeline processes **400 unique documents, each containing 25**
**sentences**. It stores the embedding vector for every sentence in a single contiguous NumPy array.
How many floating-point values does the array contain?
Published solution
There are \(400\times25=10000\) sentence vectors. Each contains 768 scalar values, so the array has \(10000\times768=7680000\) floating-point values. This asks for the number of values, not memory in bytes; byte size would additionally depend on whether storage uses float32, float64 or another dtype.
**Answer: 7680000.**