0Pricing
Deep Learning Academy · Lekcja

Adam i AdamW wyjaśnione

Poznać adaptacyjne learning rates i rozdzielone zanikanie wag

Adam i AdamW wyjaśnione to bezpłatna lekcja Deep Learning Academy na CoddyKit. To lekcja 2 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Deep Learning Academy, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Deep Learning Academy zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

One Rate Per Weight

SGD uses a single learning rate for every parameter. Adam adapts the step size for each weight on its own, based on that weight's gradient history.

Two Moving Averages

Adam tracks two running averages: the mean of gradients and the mean of their squares. Together they form the first and second moments.

First Moment Is Momentum

The first moment is basically momentum, the smoothed average of recent gradients. It decides the overall direction each weight should move.

Second Moment Scales Steps

The second moment estimates each gradient's size. Adam divides by its square root, so noisy weights take smaller steps and quiet ones take larger.

The Betas

Two decay rates, the betas, control those averages, typically 0.9 and 0.999. They balance how much recent versus older gradients matter.

Bias Correction

The averages start at zero, so early steps look too small. Adam applies a bias correction to fix this so updates are sane from step one.

Use It in PyTorch

One line gives you Adam. The default learning rate of 0.001 works well across a huge range of models, which is why it is so popular.

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

Adam's Weight Decay Flaw

Classic Adam mixes weight decay into the gradient, where the adaptive scaling distorts it. The regularization ends up weaker than you intended.

AdamW Fixes It

AdamW decouples weight decay from the gradient step and applies it directly to the weights. The decay now works as a clean, predictable shrink.

opt = torch.optim.AdamW(model.parameters(), lr=1e-3, weight_decay=0.01)

The Modern Default

For transformers and most large models, AdamW is the standard choice. Reach for it first whenever you want fast, reliable convergence.

Adaptive, With Caveats

Adam often trains faster than SGD, yet plain SGD with momentum can generalize better on vision tasks. Try both when accuracy really counts.

Quick Check

Pin down the Adam to AdamW difference.

Recap

Adam adapts a learning rate per weight using gradient mean and variance, while AdamW fixes its weight decay. AdamW is today's go-to optimizer. ⚙️

Często zadawane pytania

Czy lekcja „Adam i AdamW wyjaśnione” jest bezpłatna?

Tak — pełny tekst „Adam i AdamW wyjaśnione” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Deep Learning Academy, przejdź na CoddyKit PRO. Kurs Deep Learning Academy zawiera 4 lekcji w sumie.

Co nauczysz się w „Adam i AdamW wyjaśnione”?

Poznać adaptacyjne learning rates i rozdzielone zanikanie wag Ćwiczysz Deep Learning Academy z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Deep Learning Academy?

Nie wymagamy żadnego doświadczenia. Deep Learning Academy w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 2 z 4.

Ile czasu zajmuje lekcja „Adam i AdamW wyjaśnione”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Deep Learning Academy?

Tak. Każda lekcja Deep Learning Academy zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. SGD z momentum
  2. Adam i AdamW wyjaśnione
  3. Weight decay a regularyzacja L2
  4. Harmonogramy learning rate i warmup
← Powrót do Deep Learning Academy