Practice
1. In the context of sequence modeling, why is the attention mechanism preferred over recurrent neural networks (RNNs)?
easy
Solution
Step 1: Understand the advantage of attention mechanisms.
Attention mechanisms allow for parallel processing, unlike RNNs which process sequentially.Step 2: Eliminate wrong options.
RNNs cannot handle sequences longer than 100 tokens. is incorrect as RNNs can handle longer sequences but with difficulty. Attention mechanisms require less data to train effectively. is incorrect because both require substantial data. RNNs are unable to capture any long-term dependencies. is incorrect as RNNs can capture long-term dependencies but less effectively.Final Answer:
Option A -> Option AQuick Check:
Parallel processing makes attention faster. [OK]
Hint: Parallel processing makes attention faster. [OK]
Common Mistakes:
2. Given the following Python code snippet for evaluating a model offline, what will be the output if the test set is not representative of the real-world data?
from sklearn.metrics import accuracy_score
y_true = [0, 1, 0, 1]
y_pred = [0, 1, 1, 0]
accuracy = accuracy_score(y_true, y_pred)
print(accuracy)easy
Solution
Step 1: Calculate the accuracy score.
The accuracy score is calculated as the number of correct predictions divided by the total number of predictions. Here, 2 out of 4 predictions are correct, so the accuracy is 0.5.Step 2: Consider the representativeness of the test set.
If the test set is not representative, the accuracy score may not reflect real-world performance.Final Answer:
Option A -> Option AQuick Check:
Accuracy 0.5, but test set matters. [OK]
Hint: Accuracy 0.5, but test set matters. [OK]
Common Mistakes:
3. A model performs well on the validation set but poorly on the test set. What is the most likely cause?
medium
Solution
Step 1: Identify the discrepancy
Good validation performance but poor test performance suggests a mismatch between sets.Step 2: Eliminate less likely causes
The model is underfitting the data. is incorrect as underfitting would affect both sets. The validation set is too small. is less likely unless the validation set is extremely small. The model has too many parameters. would likely affect both sets similarly.Final Answer:
Option A -> Option AQuick Check:
Mismatch between validation and test sets. [OK]
Hint: Mismatch between validation and test sets. [OK]
Common Mistakes:
4. A model is showing unexpectedly high validation accuracy but low test accuracy. What is the most likely cause?
medium
Solution
Step 1: Diagnose the issue
High validation accuracy but low test accuracy suggests the validation set may not be representative.Step 2: Eliminate wrong options
The model is underfitting the training data. would affect both validation and test accuracy, The test set is too similar to the training set. would not cause low test accuracy, and The model has too many parameters. would affect both validation and test accuracy similarly.Final Answer:
Option D -> Option DQuick Check:
Small validation set = misleading accuracy [OK]
Hint: Small validation set = misleading accuracy [OK]
Common Mistakes:
5. A fine-tuned model is underperforming on a specific task despite using a well-known pretrained model. What is a likely cause?
medium
Solution
Step 1: Identify common issues in fine-tuning.
Small task-specific datasets can lead to poor adaptation of pretrained models.Step 2: Eliminate wrong options.
The pretrained model was not trained on a large enough dataset. is incorrect because the pretrained model's dataset size is not the issue. The learning rate during fine-tuning was too high, causing overfitting. is incorrect because a high learning rate typically causes instability, not overfitting. The pretrained model's architecture is incompatible with the task. is incorrect because architecture incompatibility would prevent fine-tuning altogether.Final Answer:
Option D -> Option DQuick Check:
Small dataset? Poor fine-tuning. [check]
Hint: Small dataset? Poor fine-tuning. [check]
Common Mistakes:
