0Pricing
Deep Learning Academy · Lezione

Learning rate discriminativi per layer

Addestri diversamente i layer profondi e superficiali

Learning rate discriminativi per layer è una lezione Deep Learning Academy gratuita su CoddyKit. Questa è la lezione 3 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.

One Rate for All?

So far every layer shared a single learning rate. But early and late layers learn very different things. Maybe they deserve different rates. 🎚️

Early Layers Are General

The early layers of a pretrained net detect edges, colors, and textures. These features transfer to almost any task, so they barely need changing.

Late Layers Are Specific

The later layers capture task-specific patterns. These are the ones that should adapt most to your new dataset.

The Big Idea

Discriminative fine-tuning gives deep layers a tiny learning rate and shallow output layers a larger one. Each part learns at the right speed.

Group the Parameters

To use different rates, you split the model into parameter groups, each with its own settings.

backbone_params = model.features.parameters()
head_params = model.classifier.parameters()

Per-Group Learning Rates

PyTorch optimizers accept a list of dicts, one per group, each carrying its own lr. The backbone gets a small one, the head a bigger one.

opt = torch.optim.Adam([
  {'params': backbone_params, 'lr': 1e-5},
  {'params': head_params, 'lr': 1e-3}])

Why It Helps

This protects the precious general features while letting the head adapt quickly. You often get higher accuracy than a single shared rate.

Slanted Across Many Layers

You can scale rates smoothly: each deeper block gets a slightly smaller rate. This gradient of speeds is sometimes called a slanted schedule.

Gradual Unfreezing

A partner technique is gradual unfreezing: unfreeze the top layer first, train, then unfreeze the next, working downward over epochs.

Inspect Your Groups

You can read back each group's settings from the optimizer to confirm every param_group got the rate you intended.

for g in opt.param_groups:
    print(g['lr'])

When to Reach for It

Discriminative rates pay off most on deep networks where the gap between general and specific layers is large.

Quick Check

In discriminative fine-tuning, which layers should get the smallest learning rate?

Recap

You gave deep layers small rates and the head a larger one using parameter groups, optionally with gradual unfreezing, for sharper transfer learning. 🎯

Domande Frequenti

La lezione «Learning rate discriminativi per layer» è gratuita?

Sì — il testo completo di «Learning rate discriminativi per layer» è 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 «Learning rate discriminativi per layer»?

Addestri diversamente i layer profondi e superficiali 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 3 di 4.

Quanto tempo richiede la lezione «Learning rate discriminativi per layer»?

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