0Pricing
Deep Learning Academy · Lezione

Fine-tuning con un learning rate più basso

Aggiorni delicatamente i pesi preaddestrati

Fine-tuning con un learning rate più basso è una lezione Deep Learning Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Deep Learning Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Deep Learning Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

Beyond Just the Head

Freezing the backbone is fast, but sometimes you want the whole model to adapt. Fine-tuning unfreezes it and trains everything together. 🔧

Unfreeze the Backbone

To fine-tune, you flip requires_grad back to True so the pretrained weights can move again during training.

for p in model.parameters():
    p.requires_grad = True

The Danger of a Big Step

Those pretrained weights are already excellent. A large learning rate would overwrite them with noisy updates and destroy what they learned.

Go Gentle

The fix is a lower learning rate. Small steps nudge the pretrained weights toward your task without erasing their knowledge.

opt = torch.optim.Adam(model.parameters(), lr=1e-5)

How Much Lower?

A common rule of thumb: use a learning rate ten to a hundred times smaller than you would for training from scratch.

Warm Up the Head First

A popular trick: train only the head for a few epochs, then unfreeze and fine-tune. This avoids a shock to the backbone early on.

Watch Validation Loss

Fine-tuning can quickly overfit a small dataset. Keep an eye on validation loss and stop as soon as it starts climbing.

Fewer Epochs Needed

Because the model already understands the data, fine-tuning usually converges in just a few epochs, not dozens.

Pair It With a Scheduler

A scheduler can shrink the learning rate further over time, letting the model settle gently into a good solution.

sched = torch.optim.lr_scheduler.CosineAnnealingLR(opt, T_max=5)

Full Fine-Tune vs Frozen

Full fine-tuning needs more data and compute but reaches higher accuracy. Frozen training is cheaper. The tradeoff depends on your dataset size.

Keep the Best Checkpoint

Since fine-tuning can drift, save the model whenever validation accuracy improves so you never lose your best version.

Quick Check

You unfroze a pretrained model to fine-tune it. What learning rate should you use?

Recap

You unfroze the backbone, fine-tuned with a low learning rate, warmed up the head first, and watched validation to stop overfitting. 🎯

Domande Frequenti

La lezione «Fine-tuning con un learning rate più basso» è gratuita?

Sì — il testo completo di «Fine-tuning con un learning rate più basso» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Deep Learning Academy, passa a CoddyKit PRO. Il corso Deep Learning Academy include 4 lezioni in totale.

Cosa imparerò in «Fine-tuning con un learning rate più basso»?

Aggiorni delicatamente i pesi preaddestrati Eserciti Deep Learning Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Deep Learning Academy?

Non è richiesta alcuna esperienza precedente. Deep Learning Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.

Quanto tempo richiede la lezione «Fine-tuning con un learning rate più basso»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Deep Learning Academy?

Sì. Ogni lezione Deep Learning Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Bloccare il backbone e addestrare la head
  2. Fine-tuning con un learning rate più basso
  3. Learning rate discriminativi per layer
  4. Fare il fine-tuning di un modello Hugging Face
← Torna a Deep Learning Academy