Prompting Large Language Models
The word related matters. Transfer works when the earlier task and the new task share something useful, such as the same language, the same kind of structure, or the same underlying skills. An unrelated earlier task offers no such shared foundation to reuse.
The Problem of Scarce Labeled Data
Imagine you need a model that answers questions about legal documents. You have a clear target, but the number of labeled legal examples you can collect is small. A natural question follows: must the model learn everything about legal language from those few examples alone, or can it start from something it already knows? This article answers that question. The short version is that a model can often start from a foundation that already contains much of what it needs, and the remaining work is mostly refinement.
The idea has a practical motivation. Since the early days of deep learning, transfer learning has offered a way out when the data for a target task is limited or expensive to collect. The strategy is to train a base model on a task where data is abundant, and then move what it learned toward the target task where data is scarce.
Reusing Skills Across Related Tasks
People do this constantly without naming it. Someone who already plays the piano usually finds it easier to pick up another instrument, because reading notes, sense of rhythm, and finger coordination carry over. The new skill is not learned from zero. Transfer learning asks the same question of machines: which parts of what was learned for one job still help with a different but related job?
The word related matters. Transfer works when the earlier task and the new task share something useful, such as the same language, the same kind of structure, or the same underlying skills. An unrelated earlier task offers no such shared foundation to reuse.
Tracing Knowledge From a Data-Rich Task to a Data-Poor Task
It helps to trace the movement of knowledge step by step. The diagram below lays out the path that a transfer learning workflow follows, from the data-rich starting task to the data-poor destination task. Read it from left to right as a chain of hand-offs.
Abundant data shapes the base model during pre-training. What it learned is kept, not thrown away, and then applied to the new task. The target task contributes only the final adjustment, so the model does not need to rediscover the foundations. The scarce data is spent on refinement rather than on building everything from the beginning.
Google's multilingual translation system (Johnson et al., 2016) is an early large-scale success of this idea. That system had learned Portuguese-English and English-Spanish translation. Using that knowledge, it could translate directly from Portuguese to Spanish, even though its training data contained no Portuguese-Spanish examples.
What do you think happens?
If training data contained no Portuguese-Spanish pairs, can the system still translate from Portuguese to Spanish?
Reveal answer
Yes, by reusing what it learned from the other language pairs
The system had learned Portuguese-English and English-Spanish translation. That transferred knowledge let it translate directly from Portuguese to Spanish without any Portuguese-Spanish training examples.
Finetuning as One Route Inside Transfer Learning
Finetuning is a specific way of carrying out transfer learning. You begin with a base model that has some, but not all, of the capabilities your task demands. The goal of finetuning is to adjust that model until it performs well enough on your particular task.
The relationship between the two terms is one of containment. Transfer learning is the general idea of reusing knowledge. Finetuning is one method that puts the idea into practice. The diagram below shows that finetuning sits inside transfer learning as one method, not as a separate field that competes with it.
Sample Efficiency and Why Scarce Data Matters
Transfer learning improves sample efficiency, which means a model can learn the same behavior from fewer examples. A sample-efficient model learns effectively from a small number of samples. Finetuning brings this benefit directly to specialized work. In the source's framing, knowledge from pre-training on text completion, a task with abundant data, is transferred to more specialized tasks such as legal question answering or text-to-SQL, which often have far less data available.
| Aspect | Training from scratch | Finetuning a base model |
|---|---|---|
| Starting point | No prior foundation for the task | A partly capable base model |
| Work performed | Construction of the capability from nothing | Refinement of an existing capability |
| Examples needed (as stated in the source) | May need millions | Can need only a few hundred |
| Role of scarce target data | Must carry the full learning load | Contributes the final adjustment |
Learning from scratch versus learning through transfer, using the source's stated example counts
Applying transfer learning to a legal question-answering task
A team wants a model that answers questions about legal documents, but they can collect only a small set of labeled legal examples. How does transfer learning change the amount of work the scarce data must do?
- 1Identify the data-rich task
A base model is first shaped by pre-training on text completion, a task where data is abundant.
- 2Identify what is retained
The general language knowledge the base model learned is kept rather than discarded.
- 3Identify the target task
Legal question answering is a more specialized, related task where labeled data is scarce.
- 4Apply finetuning
The small set of legal examples is used to refine the existing base model for the task, rather than to teach legal language from zero.
The scarce legal data is spent on refinement of an existing foundation, which is why a small number of examples can be enough.
Mistakes Beginners Make With Transfer Learning
Common mistake Treating transfer learning and finetuning as two unrelated methods
Why it failsFinetuning sits inside transfer learning as one method of carrying it out. Transfer learning is the general idea.
Do this insteadThink of transfer learning as the umbrella term and finetuning as one specific route under it.
Common mistake Assuming the base model is a blank slate
Why it failsA base model is not blank, and it is not finished. It is a partial foundation that already holds some of the needed capabilities.
Do this insteadAsk which capabilities the base model already has, and treat finetuning as closing the remaining gap.
Common mistake Assuming finetuning builds a capability from nothing
Why it failsFinetuning performs refinement of an existing capability, which is why it can be economical in data.
Do this insteadExpect finetuning to adjust and surface what the model already contains.
Common mistake Assuming transfer only works between identical tasks, when the source frames it around related tasks
Check Your Understanding
A company has abundant text data for general language completion but only a few hundred labeled examples of customer support questions. Explain, in your own words, how transfer learning would be used here and what role the scarce labeled examples play.
Hints
- Consider which task has abundant data and which task has scarce data.
- Think about whether the scarce examples must teach the whole language from scratch, or only refine an existing capability.
- Connect the answer to the idea of sample efficiency.
Without looking back, state in one sentence the difference between transfer learning and finetuning, using the word contains or nested.
Hints
- Transfer learning is the general idea.
- Finetuning is one way of carrying it out.
Key Takeaways
- Transfer learning carries knowledge from a data-rich task to a related task where data is scarce, so the new task does not have to be learned from zero.
- Finetuning is one specific method of transfer learning that starts from a partly capable base model and refines it for a particular task.
- Because the base model already holds much of what is needed, finetuning can unlock existing capabilities and can require far fewer examples than training from scratch.
- Sample efficiency, the ability to learn effectively from fewer examples, is the practical payoff of transfer learning when training data is scarce.