tensorturnBETA
Home › Machine Learning Tasks

What Is Transfer Learning? Pretrained Models, Freezing vs Fine-Tuning, for Images and Text

Transfer learning reuses a model already trained on a large dataset, such as ImageNet for images or a large text corpus for language, as the starting point for your own task. You keep the pretrained backbone, replace the final layer with one for your classes, and either freeze the backbone and train only the new head, or fine-tune some or all layers at a low learning rate. It lets you build accurate image and text models from hundreds of examples instead of hundreds of thousands. On TensorTurn you can ask for a transfer learning setup in plain English and it generates and runs the PyTorch or Keras notebook on a GPU.

What is transfer learning?

Training a deep network from scratch means learning everything from raw pixels or tokens: edges, textures, shapes, grammar, word meaning. That takes enormous data and compute. Transfer learning skips most of it. A model pretrained on a broad dataset has already learned general-purpose features, and those features are useful for many related tasks. You transfer that knowledge and only teach the model what is specific to your problem.

It works because early layers of a network learn generic patterns, such as edges and colour blobs in vision or common word relationships in language, while later layers become more task-specific. The more similar your data is to the pretraining data, the more of the network you can reuse unchanged.

Popular pretrained backbones for images and text

DomainBackbonesPretrained onCommon sources
Image classificationResNet, EfficientNet, ConvNeXt, MobileNetImageNettorchvision, timm, Keras Applications
Image featuresVision Transformer (ViT), DINOv2Large image collections, often self-supervisedHugging Face, timm
Object detection and segmentationYOLO modelsCOCOUltralytics
Text classification and NERBERT, DistilBERT, RoBERTaLarge general text corporaHugging Face transformers
Text similarity and searchSentence-transformer modelsPaired sentence datasetsHugging Face

Smaller backbones (MobileNet, DistilBERT) train and serve faster and are often enough; larger ones help when classes are subtle or data is plentiful. Start small and scale up only if validation results justify it.

Feature extraction vs fine-tuning: which layers to freeze

The main decision in transfer learning is how much of the pretrained network to update. Freezing a layer means its weights stay fixed during training.

StrategyWhat gets trainedBest whenRisk
Feature extraction (freeze all)Only the new classification headSmall dataset, similar to pretraining dataUnderfits if your domain is very different
Partial fine-tuningHead plus the top few blocksModerate data, or domain somewhat differentNeeds a lower learning rate for unfrozen layers
Full fine-tuningEvery layerLarge dataset, or very different domain (medical scans, satellite images, legal text)Overfitting and catastrophic forgetting with small data or high learning rates

A useful rule of thumb: little data and similar domain, freeze more; lots of data or a different domain, unfreeze more. Transformer models for text are usually fully fine-tuned with a small learning rate, because they adapt well and the head alone often underperforms.

A practical transfer learning recipe

Common transfer learning mistakes

How to use transfer learning on TensorTurn

See the plant disease detection and text classification use cases for transfer learning applied end to end.

Start building free

Frequently asked questions

What is the difference between transfer learning and fine-tuning?

Transfer learning is the general idea of reusing a pretrained model for a new task. Fine-tuning is one way to do it, where you continue training some or all pretrained layers on your data, as opposed to feature extraction, where the backbone stays frozen and only a new head is trained.

How much data do I need for transfer learning?

Far less than training from scratch. For image classification, a few hundred labeled images per class is often enough for useful results, and text classifiers fine-tuned from BERT-style models can work with similar amounts.

Which layers should I freeze?

With little data and a domain similar to the pretraining data, freeze the whole backbone and train only the head. With more data or a different domain, unfreeze the top blocks or the entire network and use a much lower learning rate.

Can transfer learning work on medical or satellite images?

Yes, ImageNet-pretrained backbones still give a better starting point than random weights for most image domains. Because these domains differ from everyday photos, you typically fine-tune more layers rather than only training the head.

Does transfer learning work for tabular data?

Much less commonly. Pretrained backbones exist mainly for images, text and audio. For tables, gradient-boosted trees are usually the strongest option, although tabular foundation models are an active research area.