This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
Tag: Data Eng
DL0006 Layer Freeze in TL
What are the common strategies for layer freezing in transfer learning?

The Problem: A vision team has one ResNet-50 pretrained on ImageNet and three projects due this quarter: a dog-breed app with 1,200 labeled photos (very similar to ImageNet), a retail shelf classifier with 15,000 images (moderately similar), and a chest X-ray model with 200,000 scans (a very different domain). For each project they must decide which pretrained layers to freeze and which to train.
Answer
Layer freezing controls which pre-trained weights are updated during fine-tuning. Frozen layers keep their learned representations intact, while trainable layers adapt to the target task. The right choice balances leveraging general features against adapting higher-level representations, and depends mainly on target dataset size and task similarity.
(1) Freeze All but the Output Layer(s): Train only the final classification/regression layers; a good starting point for similar tasks and small datasets.
(2) Freeze Early Layers: Early layers capture general features (edges, textures), so train only the later, task-specific layers; effective for moderately similar tasks.
(3) Fine-Tune All Layers with a Low Learning Rate: Adapt all weights slowly; use with caution on small datasets to avoid catastrophic forgetting.
(4) Gradual Unfreezing: Start with frozen layers and progressively unfreeze during training, avoiding large early updates that can destroy learned features.
(5) Backbone-Freeze, Then Low-LR Fine-Tune: Freeze the backbone until the new head converges, then unfreeze it and continue with a reduced learning rate.
Figure 1: The four common strategies differ in how many blocks stay frozen; freeze more when data is scarce and tasks are similar.
Mathematical Formulation:
Where:
is the parameter subset kept fixed at its pre-trained values; only
receives gradient updates.
is the learning rate; strategies (3) and (5) use a reduced
(e.g., 0.1×) to protect pre-trained features.

Figure 2: Gradual unfreezing starts with the head and unfreezes deeper blocks step by step with a reduced learning rate.
Login to view more contentDL0005 Transfer Learning
Why use transfer learning in deep learning instead of training from scratch?

The Problem: A factory QA team has only 1,500 labeled circuit-board defect photos, a single GPU, and a two-week deadline. They must choose between training a ResNet-50 from random weights and starting from a checkpoint pre-trained on a large image dataset.
Answer
Transfer learning reuses knowledge from a pre-trained model to improve performance, reduce training time and data requirements, and lower computational cost on a new but related task. Instead of learning low-level features from random weights, the model starts from representations that already capture generalizable patterns such as edges, textures, and shapes, so far less target data is needed to reach strong accuracy.
(1) Leverages Existing Knowledge & Reduced Data Requirements: Pre-trained weights encode useful representations learned from large datasets, so good performance is possible with significantly less task-specific data.
(2) Faster Convergence & Training Time: Starting from pre-trained weights is a much better initialization than random weights, leading to faster convergence and often better local optima.
(3) Improved Performance on Limited-Data Tasks: When data is scarce, transfer learning typically yields higher accuracy and better generalization than training from scratch.
Figure 1: The backbone’s weights are copied from pre-training; only the new head (and optionally upper layers) must be learned from limited target data.
Mathematical Formulation:
Where:
is the weight set learned on the source task; fine-tuning minimizes the target loss starting from this initialization.
is the learning rate of layer
out of
; a decay factor
below 1 gives earlier (more general) layers smaller updates than later (task-specific) layers.

Figure 2: Transfer learning dominates in the low-data regime; the advantage shrinks as the target dataset grows.
Faster Convergence: Because pre-trained weights are already a strong initialization, the model reaches its accuracy plateau in far fewer epochs than training from random weights.

Figure 3: Transfer learning converges faster and plateaus higher; training from scratch improves slowly over many epochs.
Login to view more contentML0022 Cross Entropy Loss
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
ML0017 Data Augmentation
What are the common data augmentation techniques?

The Problem: A team has only 240 labeled photos and no budget to label more. Their classifier scores 99% on training data but only 64% on validation. How can they get more training variety from the data they already have?
Answer
Data augmentation increases the diversity and effective size of a training set by creating modified versions of the existing data, especially valuable in computer vision and NLP, where collecting and labeling new data is expensive. In computer vision, common techniques are geometric transformations (rotate, flip, crop, scale), color adjustments (brightness, contrast, saturation, color jitter), and noise injection (random noise or blur). In NLP: synonym replacement, back translation (translate to another language and back), and random insertion or deletion of words. For tabular data: SMOTE-style synthetic sample generation and small random noise on numeric features. The benefits: better robustness and generalization, less overfitting (the model cannot memorize a moving target), relief for class imbalance, and lower data-collection cost.
(1) Core Idea: Apply label-preserving transformations so one sample teaches many variations of the same concept.
(2) By Data Type: Geometric/color/noise for images, synonym/back-translation/edit for text, SMOTE/noise for tables.
(3) Benefits: Robustness, regularization against overfitting, imbalance relief, and cost savings, all from data you already have.
Figure 1: One sample, five augmented views. The label never changes (only the appearance does), so the model learns invariance instead of memorizing pixels.
Mathematical Formulation:
Where:
is the augmentation transform applied to sample
with random parameters
(e.g., rotation angle, crop offset).
is the augmented sample and
its label, unchanged because the transforms are label-preserving.
is the model with parameters
, and
is the training loss.
is the expectation over random augmentations: training minimizes loss over infinitely many variants, which is what regularizes the model.
Login to view more contentML0014 Confusion Matrix
What is the confusion matrix?

The Problem: A spam filter reports a single 95% accuracy on a test set where 950 of 1000 emails are not spam. The team needs to know whether spam is slipping into the inbox or real emails are being sent to junk. What tool shows which kinds of errors hide behind that one number?
Answer
A confusion matrix is a table that summarizes the performance of a classification model by comparing its predicted labels against the actual labels. For binary classification it is a 2×2 table with four cells: true positives (correctly predicted positive), false positives (negative predicted as positive), false negatives (positive predicted as negative), and true negatives (correctly predicted negative). Unlike a single scalar metric, it shows not only how many predictions were wrong but which kinds of errors were made. For multi-class problems, the matrix expands into a larger square table where cell
counts the instances of actual class
predicted as class
; off-diagonal clusters reveal which specific classes the model systematically confuses, guiding model refinement or relabeling.
(1) Structure: Rows are actual classes, columns are predicted classes; the diagonal holds all correct predictions.
(2) Binary Case: The four cells TP/FP/FN/TN feed every classification metric: accuracy, precision, recall, F1.
(3) Multi-Class Case: Anmatrix whose off-diagonal hotspots expose systematic class confusions.
Actual \ Predicted Predicted Positive Predicted Negative Actual Positive True Positives (TP): correct positive False Negatives (FN): missed positive Actual Negative False Positives (FP): false alarm True Negatives (TN): correct negative Mathematical Formulation:
Where:
is the count in row
, column
of the confusion matrix.
is the true label of sample
,
its predicted label, and
indexes the
samples.
is the indicator function: 1 when the condition holds, 0 otherwise.
is the row-normalized version: row
then shows the per-class recall distribution, which reads better under class imbalance.

Figure 1: A 3-class example: strong diagonal means healthy classification; the bright off-diagonal cell shows the model systematically confuses class 1 with class 2.
Login to view more content














