Visual explainer
Transfer Learning
Reuse a learned representation, fit a target head and decide what to adapt using held-out predictions, while checking missing features and forgetting.
Transfer learning reuses a representation learned on a source task for a target task. You can fit a new head on fixed features or adapt some of the feature extractor too. Reuse is useful when the representation and training procedure suit the target; parameter count alone does not guarantee generalization.
Our synthetic feature space has two coordinates, . Circles have target label 0 and squares label 1, determined by whether . The source head instead predicts from , the dashed horizontal cut. It mislabels two of these four target examples, marked with crosses. These are constructed points, not a benchmark or an estimate of real transfer performance.
Reuse Features, Change The Head
For selected feature vector , the source head produces score −1, while target head produces score +1. The projections show which coordinate each head reads; scores above zero predict class 1. The representation did not change. A new head can use information the source classifier did not need.
Yosinski et al. investigate which learned features transfer and how specialization and co-adaptation affect reuse. Their results do not establish universal transferability indices or a rule that early features must always stay frozen. The two-coordinate example here is an explanatory construction rather than a model of every visual hierarchy.
Freeze The Body Parameters
The toy body computes with and input ; head yields score 1. Forward computation still passes through the body. The update loop selects only the head parameters, while the dashed body remains fixed. In practical fixed feature extraction, exclude frozen parameters from the optimizer and configure gradient tracking appropriately. Freezing a parameter does not make its mathematical derivative zero or automatically remove every previously allocated optimizer state.
The PyTorch transfer workflow demonstrates fixed feature extraction separately from fine-tuning. If gradients are needed for trainable modules before a frozen module, backward computation may still need to pass through its operations. The drawing specifies parameter update scope, not a universal gradient-stopping rule.
Adapt The Representation
For this controlled variant, old features have . A changed top transform multiplies the first coordinate by 5, moving them to while leaving the second coordinate fixed. Open markers are old positions; filled markers are new positions. The decision cut stays at . This constructs a larger geometric margin without claiming a measured accuracy gain. Head-only training cannot move fixed body features; fine-tuning can. Choosing trainable blocks and learning rates requires validation, not a universal layer count or guaranteed safe rate.
Count What Is Trainable
The countable toy body and two-output head are each affine maps. Each grid has four weights and the two circles are biases, giving six parameters per module. Fixing the body leaves six of twelve parameters trainable. This two-output count illustration differs from the earlier single-score head; it demonstrates accounting, not a second benchmark.
For a larger shape example, a linear head has trainable parameters with bias. Training fewer parameters can reduce update storage and computation, but does not eliminate overfitting, forward cost or the need for held-out data. There is no parameter-per-example threshold that proves a model cannot memorize.
Compare Held-Out Predictions
This separate synthetic validation set has feature values and labels . Suppose head-only adaptation yields a cutoff .5 and another adaptation yields cutoff 0. Predicting 1 strictly above the cutoff gives versus : three correct versus four. Both rows keep the samples and scale fixed. The numbers are deliberately constructed candidate outputs, not evidence that fine-tuning always wins.
Use validation data to compare training choices, including a suitable scratch baseline when needed, while reserving an independent test set for final evaluation. Repeated tuning against a small validation set can itself overfit. Dataset size and domain similarity inform experiments; they do not provide fixed universal decision thresholds.
Check What Features Discard
Change the target to depend on coordinate . Inputs and have opposing labels, but a frozen extractor maps both to the same vector. The overlaid circle and square show the collision. A deterministic head receiving only that representation cannot separate them, however many parameters it has. Adapting the representation or adding a useful input signal may be necessary. Apparent domain distance alone does not prove negative transfer; the retained information and comparative target performance matter.
Cache Fixed Features
The table stores four corner vectors from a fixed extractor. Once computed for fixed inputs, those rows can train a head repeatedly without reevaluating the body. The loop denotes repeated head training on stored features. This trades storage for saved computation. The cache must match the intended preprocessing and model state: random augmentation, changing normalization buffers or fine-tuned weights can make it stale. A frozen body alone does not make every feature deterministic.
Freeze Parameters And State Separately
Suppose BN scale and shift stay fixed at , but the body is in training mode and tracks running moments. With running mean 0, current batch mean 10 and momentum .1, the buffer becomes . The arrow shows that state change even though the affine parameters are frozen. Gradient flags and train/eval mode control different things. Check batch normalization when deciding which running statistics to adapt or preserve.
Where It Breaks
Use scalar model at input . The source wants output +1 and the target wants −1, giving and . Start at : source loss is zero and target loss is 2. A target gradient step with derivative 2 and illustrative learning rate 1 moves to . Target loss becomes zero, but source loss becomes 2 and the source prediction flips sign. Both curves share the same weight and loss axes.
This objective conflict shows forgetting can occur even while target optimization succeeds. It does not claim that every fine-tuning step destroys source knowledge or that a smaller rate removes an underlying conflict. Evaluate any behavior that must be retained; transfer offers an initialization and representation, not a guarantee that all previous behavior survives.
The Quick Version
- A new head can reuse fixed features for a new task.
- Fine-tuning changes features as well as classifier parameters.
- Count biases and distinguish frozen parameters from model state.
- Compare adaptation choices using held-out predictions.
- A head cannot recover a distinction absent from its input.
- Target adaptation can conflict with source behavior.