0Pricing
Deep Learning Academy · Lección

SGD con momentum

Suavice las actualizaciones para superar el ruido

SGD con momentum es una lección gratuita de Deep Learning Academy en CoddyKit. Esta es la lección 1 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Deep Learning Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Deep Learning Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

Plain SGD Forgets

Vanilla SGD steps using only the current gradient. Every update starts from scratch, so a noisy slope makes it wobble and crawl toward the minimum.

Borrow Some Inertia

Momentum gives SGD memory. It keeps a running average of past gradients and rolls in that direction, like a ball gathering speed downhill.

The Velocity Vector

Momentum tracks a velocity that blends the old velocity with the new gradient. The weights then move by that smoothed velocity each step.

v = beta * v + grad
w = w - lr * v

The Beta Knob

The momentum coefficient beta sets how much past steps count. A common value is 0.9, meaning most of the velocity carries over.

Smooths Out Noise

Because momentum averages many gradients, random noise in any single batch mostly cancels. The path to the minimum becomes smoother and steadier.

Rolls Past Small Bumps

Built-up speed lets the optimizer coast through tiny dips and flat spots that would stall plain SGD. The ball does not stop at every pebble.

Turn It On in PyTorch

You do not code this by hand. Just pass momentum to the built-in SGD optimizer and PyTorch tracks the velocity for you.

opt = torch.optim.SGD(model.parameters(), lr=0.01, momentum=0.9)

Nesterov Looks Ahead

A sharper variant, Nesterov momentum, peeks at where the velocity is heading before measuring the gradient. It often converges a touch faster.

opt = torch.optim.SGD(model.parameters(), lr=0.01, momentum=0.9, nesterov=True)

Mind the Overshoot

Too much speed can carry you past the valley floor. If loss bounces or diverges, lower the learning rate or trim momentum a little.

Why It Still Matters

Even with fancy optimizers around, SGD with momentum remains a strong baseline and often generalizes beautifully on vision models.

A Faster Descent

The payoff is real: momentum usually reaches a good minimum in fewer epochs than plain SGD, with less zig-zagging along the way.

Quick Check

Make sure momentum's role is clear.

Recap

Momentum gives SGD a velocity that blends past gradients, smoothing noise and coasting past small bumps. Set momentum near 0.9 for a faster, steadier descent. 🏂

Preguntas frecuentes

¿La lección «SGD con momentum» es gratis?

Sí — el texto completo de «SGD con momentum» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Deep Learning Academy, actualiza a CoddyKit PRO. El curso de Deep Learning Academy incluye 4 lecciones en total.

¿Qué aprenderé en «SGD con momentum»?

Suavice las actualizaciones para superar el ruido Practicas Deep Learning Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Deep Learning Academy?

No se requiere experiencia previa. Deep Learning Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 1 de 4.

¿Cuánto tiempo toma la lección «SGD con momentum»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Deep Learning Academy?

Sí. Cada lección de Deep Learning Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. SGD con momentum
  2. Adam y AdamW explicados
  3. Weight decay frente a regularización L2
  4. Programaciones de la tasa de aprendizaje y warmup
← Volver a Deep Learning Academy