MLCrack

    DEEP LEARNING · INTERVIEW QUESTION

    What is transfer learning? When and why does it work?

    🟢 beginner · Training & Optimization

    Hint: Pre-trained knowledge transfers when tasks share common patterns.

    Answer

    Transfer learning uses a model trained on one task (source) as a starting point for another task (target).

    Interview reasoning

    Why it works:

    1. Lower layers learn general features (edges, syntax, basic patterns) that transfer across tasks.

    2. Pre-training provides better weight initialization than random init.

    3. Large pre-training datasets encode broad world knowledge. When it works: source and target domains are related (ImageNet → medical imaging, English text → legal text). When it fails: very different domains (natural images → satellite imagery may need domain adaptation).

    Types:

    1. Feature extraction: freeze pre-trained layers, only train new head.

    2. Fine-tuning: unfreeze and update all layers with smaller LR.

    3. Domain adaptation: bridge domain gap.

    Modern paradigm: 'pre-train then fine-tune' is the default in NLP (BERT→task) and CV (ImageNet→task).

    Transfer learning starts from representations trained on a related distribution. Freeze or partially fine-tune when labels are scarce, and allow broader adaptation when domain cues differ. Compare head-only, partial and full fine-tuning with layer-appropriate learning rates, keeping acquisition-specific holdouts and training/evaluation state explicit.

    Worked example. A generic language or vision model may benefit from domain data, but its pretraining features can also be inappropriate for the new task.

    Validation

    Compare against a strong from-scratch or simple baseline under matched budgets; assess domain, rare-class and sample-size slices across seeds.

    Common pitfalls

    Transfer can be negative. Frozen weights do not automatically freeze normalization running state, and pretraining/evaluation overlap can inflate results.