Deep Learning

Transfer Learning & Fine-Tuning

Leveraging pre-trained representations from massive datasets to achieve state-of-the-art results on small target tasks.

🟡 intermediate4 min readtrainingmust-know
Transfer Learning adapts a model pretrained on a large source dataset (ImageNet, C4, Wikipedia) to a specific target task. Strategies range from Feature Extraction (freezing backbone weights and training a new linear classification head) to Full Fine-Tuning and Parameter-Efficient Fine-Tuning (PEFT / LoRA). Key decision factors include target dataset size and domain similarity to the source data.

The Decision Matrix

Transfer learning strategy depends on two axes: Target Dataset Size and Domain Similarity to Pretraining Source:

                       Domain Similarity to Source Data
                               High                        Low
                 ┌───────────────────────────┬───────────────────────────┐
      Small      │ Strategy 1:               │ Strategy 2:               │
                 │ Freeze backbone, train    │ Train linear head on      │
                 │ linear head only.         │ shallow layer features.   │
  Dataset Size   ├───────────────────────────┼───────────────────────────┤
                 │ Strategy 3:               │ Strategy 4:               │
      Large      │ Fine-tune all layers with │ Full fine-tuning from     │
                 │ low learning rate.        │ pretrained weights.       │
                 └───────────────────────────┴───────────────────────────┘

Three Fine-Tuning Frameworks

  1. Linear Probing (Feature Extraction):
    • Freeze all pretrained backbone weights $W_0$.
    • Train only new classification head $W_{head}$.
    • Fast, low memory, zero catastrophic forgetting, but lower accuracy ceiling.
  2. Full Fine-Tuning:
    • Unfreeze all layers. Train end-to-end with low learning rate (e.g. 1/10th pretraining rate).
    • High accuracy, but high GPU memory cost and risk of catastrophic forgetting.
  3. Parameter-Efficient Fine-Tuning (PEFT / LoRA):
    • Freeze base model weights $W_0$. Inject small trainable rank matrices $\Delta W = B \cdot A$.
    • Achieves full fine-tuning performance with $< 1%$ trainable parameters.

Best Practices to Avoid Degradation

Say this out loud

"Transfer learning reuses features pretrained on massive datasets for target tasks. When target data is small and domain-similar, we freeze the backbone and train a linear head to prevent overfitting. When target data is large, we fine-tune with small learning rates or LoRA adapters. We use layer-wise learning rate decay and gradual unfreezing to prevent catastrophic forgetting."

Follow-ups to expect

Check yourself

Question 1 of 3

What transfer learning strategy should you use when your target dataset is very small and highly similar to the pretraining source dataset?

More in Deep Learning

See all →
Activation Functions4 minDropout4 minBackpropagation5 min