C.W.K.
Stream
Lesson 06 of 07 · published

The Fine-Tuning Recipe

~8 min · transfer

Level 0Keras Apprentice
0 XP0/97 lessons0/20 achievements
0/120 XP to next level120 XP to go0% complete

The two-phase recipe, step by step

The last three lessons gave you the pieces; this one is the order to use them in. The proven workflow is two phases, run in sequence:

  1. Freeze the base. Set base_model.trainable = False so only your new head can learn.
  2. Train the head for ~5–10 epochs at a normal learning rate (~1e-3). This is the feature-extraction baseline.
  3. Unfreeze the top layers of the base — typically the last block or last ~20 layers — and re-compile.
  4. Fine-tune everything trainable at a very low learning rate (~1e-5) for ~10–20 more epochs.
  5. Compare and decide. Did phase 2 actually beat phase 1 on validation? If not, ship the simpler feature-extraction model.

Why the order is non-negotiable

The sequence exists to prevent catastrophic forgetting. Your new head starts with random weights. If you unfreeze the base and train from the start, that random head produces huge early gradients — and those gradients flow back into the pretrained layers and scramble the very features you came here to reuse. Training the head first gets it to a sensible state, so by the time you unfreeze the base, the gradients reaching it are small and well-behaved. The tiny phase-2 learning rate is the second guardrail on the same risk.

External links

Exercise

On your binary classifier (1000 images), execute the 5-step recipe. Record validation accuracy after each step. Plot the trajectory. Identify which step gave the biggest gain.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.