Transfer learning: how to reuse models and when to do it
Image generated by the Inferama Editorial Team
01

Definition and purpose

Transfer learning is a machine learning methodology that leverages what was learned in a source task or dataset to improve the learning of a target task or domain. Instead of always starting from scratch, components such as parameters, representations, examples, or relationships that might be useful in the new problem are reused.

The central idea is to transfer knowledge between related contexts. A model that learned visual patterns in a large image dataset, for example, can serve as a starting point for classifying images in a specific task. Reuse does not guarantee improvement: if the target data or task differ too much, prior knowledge may be irrelevant or even worsen performance.

The term does not designate a single architecture or a specific algorithm. It describes a learning strategy whose procedure depends on what knowledge is transferred and how it is adapted. In neural networks, it may involve keeping pre-trained weights and modifying some layers; in other methods, it may consist of reweighting examples, sharing representations, or transferring parameters between tasks.

Transfer learning becomes interesting when labeled target data are scarce, costly to obtain, or different from the data used to train the initial model. It can also reduce training time compared to starting from scratch, although the actual savings depend on the task, resources, and the adaptation and evaluation work required.

02

Domain, task, and transferable knowledge

To describe a case, it is useful to distinguish domain and task. The domain comprises the type of data and its distribution: for example, photographs taken in natural light or medical images. The task defines what is asked of the system, such as classifying an image, detecting objects, or predicting a textual category.

The source context provides already learned information; the target context is the new problem where it is intended to be leveraged. Both can share the task and differ in the data, or have different tasks that benefit from related representations. Therefore, knowing that two applications use images or text is not enough to conclude that transfer will be appropriate.

The transferred knowledge can also take different forms. Source examples, a feature representation, parameters, or relationships between elements can be reused. In a neural network, the weights of initial layers can preserve general patterns while later layers adapt to a new output; in a data-based strategy, certain source examples can receive more or less weight depending on their usefulness for the target.

Domain adaptation is a subfield focused on transferring a model between different data distributions, often when the task remains the same. For example, a classifier can be trained on restaurant reviews and applied to movie reviews; the change in vocabulary and style can alter its behavior even if the task remains classifying opinions. Adaptation attempts to reduce that mismatch, but it does not eliminate the need to evaluate the result in the target domain.

What changes between source and target

This comparison helps to specify the problem before choosing a technique.

Relationship between contextsWhat is maintained or changesIllustrative example
Same task, different domainsThe desired output is similar; the data or their distribution change.Classifying opinions in restaurant reviews and then in movie reviews.
Different tasks, related knowledgeThe target task changes; some representations or parameters may still be useful.Reusing visual features learned for classification when addressing object detection.
Domains and tasks with significant differencesTransfer may be weak or harmful; it must be compared with a reference trained without transfer.Applying representations learned with natural photographs to radar signals.
03

Types of transfer learning

The categories of transfer learning describe the relationship between domains, tasks, and available labels. Terminology can vary between classification frameworks; the most useful approach is to specify the concrete conditions, rather than relying solely on the name of a category.

In inductive transfer, the target task differs from the source task, although the knowledge obtained in the latter can serve as a basis. An example in vision consists of reusing a pre-trained network for feature extraction and adapting it to a task such as object detection. The availability of target labels depends on the particular setup.

In transductive transfer, the task remains the same, but the domain or distribution changes. A classification model can maintain the same required output and still face differences in style, vocabulary, or capture conditions. Domain adaptation usually addresses this type of mismatch; it can use labeled, unlabeled, or a combination of target data, depending on the method.

In unsupervised transfer, no manual labels are available in the relevant data, and the source and target tasks differ, although they have some link. The lack of labels does not imply that the system can infer any objective: the procedure must extract signals from the available data, and its quality depends on whether those signals are adequate.

Another classification distinguishes homogeneous and heterogeneous transfer. The former maintains comparable feature spaces; the latter allows features or outputs to not match. This axis is different from the inductive and transductive distinction: one classification describes the relationship between representation spaces, and the other, the relationship between tasks and domains.

04

How it is applied in neural networks

In deep learning, two frequent strategies are feature extraction and fine-tuning. Both start from a pre-trained model, but differ in which parameters are updated. The choice depends on the size and quality of the target data, the distance between domains, and available resources; no option is universally better.

With feature extraction, part of the pre-trained model is kept frozen, and its layers are used to transform each input into a representation. Then, a classifier or other component is trained with the target data. By keeping the network weights fixed, this procedure limits the parameters that are adjusted; in exchange, the model has less room to adapt to specific differences of the new domain.

In fine-tuning, the model output is replaced or adapted, and some layers or the entire network are trained with data from the target task. A more limited fine-tuning preserves a larger part of the initial parameters; a broader one allows more adaptation but may require more data and increase the risk of overfitting or forgetting previous capabilities. A low learning rate is a possible configuration, not a guarantee of correct results.

A third nearby mechanism is multi-task learning: the system learns several related tasks during the same training process, sometimes sharing layers and reserving others for each objective. It is not identical to taking an already trained model and transferring it later, although it can produce reusable representations.

In language models, pre-trained representations can be reused for a specific task through fine-tuning. The use of instructions and in-context examples can adapt a model's response without updating its weights, but this is different from training the model with a new loss function. It is advisable to describe precisely whether there was additional training or only conditioning through the input.

Practical route to test a transfer

Compare the transferred result with a reference that does not reuse the source model. Keep the evaluation set fixed during comparisons and avoid using it to select adjustments.

  1. 01Define the target task, the evaluation metric, and the type of error that matters most.
  2. 02Describe the differences between source and target data: format, population, language, style, or capture conditions.
  3. 03Choose what to reuse: frozen features, partially adjusted parameters, or a more broadly adapted model.
  4. 04Also train a simple reference without transfer, using the same target data and a comparable protocol.
  5. 05Evaluate both models with independent and representative data of the intended use; review errors by subgroups or relevant conditions.
  6. 06If the transfer does not improve the target metric or generates more costly errors, change the model, reduce the reuse, or discard it.
05

Examples in different fields

Computer vision: a team with few labeled images of animal species can try a network previously trained with general images. The network can provide starting visual features, and the team can train a classification layer or adjust some layers. The result depends on whether those features are useful for the species, cameras, and lighting conditions of the project; the transfer must be compared with its own reference.

Language processing: a model trained with large amounts of text can be adapted to classify opinions or recognize entities in documents from a sector. General language representations can help, but specialized terms, language, and documentary style may differ from the source corpus. In contracts from a specific legal area, for example, keywords and their meanings may be infrequent in the initial corpus, so evaluation with documents from the target domain is necessary.

Reinforcement learning: a policy or part of the experience acquired in one task can guide the learning of another, such as transferring strategies between related control environments. Before doing so, states, actions, rewards, and dynamics must be compared: an appropriate action in the source environment may be unsafe or ineffective in the new one.

Biomedical images: a network pre-trained with photographs can be tried as an initialization for a medical task, but it cannot be assumed that the learned patterns are sufficient to interpret X-rays or other clinical images. Manuel García Domínguez's thesis describes, within a computer vision research work, transfer and domain shift techniques along with specific biomedical applications. That scope does not prove that an architecture or strategy serves any diagnosis.

06

Risks, limits, and common errors

Negative transfer occurs when reusing source information worsens learning or performance in the target compared to a comparable alternative. It can appear even if the domains seem similar: sharing the general type of data does not ensure that their most useful features match. Teaching slides from the National Institute of Astrophysics, Optics and Electronics highlight that transferring knowledge does not always help and that similarity alone does not rule out this risk.

Distribution shift can also hide failures. A model may perform well on data similar to the training data and fail on other devices, user groups, writing styles, or capture conditions. Therefore, evaluation must represent the real target. If test metrics reflect data too similar to the training data, they do not necessarily describe behavior in other contexts.

Overfitting is another risk: the model may adjust too much to a small target set and lose generalization capacity. In fine-tuning, catastrophic forgetting is also discussed when training degrades useful knowledge acquired previously. Freezing layers, regularizing, or adjusting gradually are design options that can be explored, but their effects must be measured.

A frequent error is treating data quantity thresholds as general laws. The necessary amount depends on the task, data variability, architecture, noise level, and evaluation. Another error is assuming that a network pre-trained on natural images automatically benefits a medical task. Such a model can be an experimental starting point, not a clinical validation or a guarantee of accuracy.

Transfer evaluation must separate four questions: whether the model learns faster, whether it achieves better final performance, whether it reduces training cost, and whether it maintains acceptable behavior in important cases. An improvement in one dimension does not prove improvements in the others. The difference between source and target, the data used, and the chosen metric must accompany any conclusion.

Signals to decide whether to continue

Use these criteria as an evaluation guide, not as an automatic rule.

Observed signalPossible interpretationReasonable decision
Improvement over the reference on independent dataSource knowledge could be useful for this task and configuration.Check stability and errors in relevant conditions before deploying.
Similar results, but lower cost or timeTransfer could provide efficiency without improving the final metric.Assess whether the savings compensate for the adaptation and maintenance work.
Worse performance or more severe errorsThere may be negative transfer or a significant mismatch between domains.Reduce the transfer, change the source, or train without reusing it.
Good average and failures concentrated in certain groupsThe global metric may hide coverage or distribution problems.Analyze the groups and conditions that matter for the intended use.
07

Differences with nearby concepts and practical criteria

Transfer learning is related to fine-tuning, but they are not synonyms: fine-tuning is a training technique that can be part of a transfer strategy when it reuses a previous model. Transfer can also be performed without updating weights, for example, by using the model as a feature extractor.

Knowledge distillation is another related but more specific concept: it transfers signals from a teacher model to a student model, usually to obtain a smaller model. It is not equivalent to any transfer learning between tasks or domains. It should also not be interpreted as a guarantee of preserving all the validity or performance of the original model.

Domain adaptation deals with the mismatch between distributions, usually with a task that remains the same. Multi-task learning, in contrast, trains several tasks in the same process and can share representations. These techniques can be combined with transfer, but they describe different mechanisms.

When designing a project, document what is transferred, where the model comes from, what differences exist between source and target data, and what set is used for evaluation. Compare methods with a reference, observe both global metrics and relevant errors, and re-evaluate if the population, language, device, or environment changes. Transfer is a working hypothesis that is validated in the target, not a promise of savings, accuracy, or safety.

08

Keep exploring

Sources consulted

03

Corrections and transparency

If you spot incorrect or outdated information, send us a correction with the page and source we should review.

Submit a correction