What is Fine-Tuning?
After feature extraction, your new classifier head is trained. Fine-tuning goes one step further: you unfreeze the last part of the pretrained base and train it together with your head, using a very small learning rate. This adapts the high-level features to your own images.
The Two-Phase Recipe
- Phase 1: freeze the base and train only the head until it converges.
- Phase 2: unfreeze the top layers of the base, recompile with a low learning rate and train a few more epochs.
Phase 2 in Code
- Always recompile after changing
trainable - Use a learning rate about 10 to 100 times smaller than in phase 1
- Early layers learn general features (edges), so keep them frozen. Later layers are more specific, so those are the ones to adapt
BatchNormalization Layers
When calling the base model, we used training=False. This keeps the BatchNormalization layers in inference mode, so their statistics are not destroyed while fine-tuning. Keras handles this correctly when you set base_model.trainable = True and call the model with training=False as shown.
Compare the Results
| Setting | Typical choice |
|---|---|
| Layers to unfreeze | Top 20 to 30 percent of the base |
| Learning rate | 1e-5 to 1e-4 |
| Epochs | 3 to 10 |
| Callbacks | EarlyStopping with restore_best_weights |
Conclusion
Fine-tuning gives the last few percent of accuracy. Be gentle: unfreeze only the top layers and use a tiny learning rate.

