Transfer Learning: Don't Train Models from Scratch
Transfer learning means not training a model from zero. You start with a model pre-trained on a large, general dataset, then fine-tune it for your specific task. This is common in image recognition, using a general model to learn a niche classification.
Why it exists
Training large machine learning models from scratch is incredibly expensive, requiring huge datasets and weeks of computation. Most projects lack the millions of labeled data points or the budget for this. Transfer learning provides a shortcut by reusing knowledge from existing models.
The mental model
Think of it like an experienced chef learning a new recipe. The chef already has master-level knowledge of knife skills, heat management, and flavor pairing. They can learn the new dish much faster than a novice who must learn everything from the ground up. The pre-trained model is the experienced chef; your new problem is the recipe.
How it works
A pre-trained model has already learned to identify useful features from its original task. For example, an image model's early layers learn to see edges, colors, and textures. In transfer learning, you keep these learned layers (freezing them) and only retrain the final, task-specific layers. This adapts the general knowledge to your specific goal with much less data and time.
When to use it
Use transfer learning when you have a small dataset for your task, but a large, high-quality dataset exists for a related task. It is the default approach in computer vision (using models pre-trained on ImageNet) and natural language processing (using models like BERT pre-trained on vast text corpora).
When not to use it
Avoid it if the pre-trained model's domain is completely unrelated to yours. Using an image recognition model to predict stock prices will likely fail; this is called 'negative transfer' because the prior knowledge is misleading and hurts performance. If you have a very large dataset, training from scratch may yield a better, more specialized model.
One canonical example
A team wants to build a classifier to identify different species of flowers with only a few hundred images per species. Instead of training a new model, they start with a model pre-trained on the ImageNet dataset (millions of general images). They remove the original output layer (which classified 1000 general objects) and add a new one for their flower species. By fine-tuning this model, it quickly learns the task, leveraging its pre-existing ability to recognize petals, leaves, and stems.
Interview question
What is the primary benefit of employing transfer learning for a new machine learning task?
- a.It allows the model to learn effectively even without any labeled data.
- b.It enables the model to perform well on tasks completely unrelated to its pre-training.
- c.It drastically reduces the data and computational resources needed for training.Correct
- d.It ensures the model will always achieve perfect accuracy on the new task.
Why? this is the answer
The card states that transfer learning provides a 'shortcut' by reusing knowledge, significantly reducing the need for large datasets and extensive computation. Option B is incorrect because using a model for an unrelated domain can lead to 'negative transfer' and hurt performance.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on machine learning — each one lists the topics its interview covers.
See open roles