3.2.4 · HinglishTraining Deep Networks

AdaGrad and RMSprop

1,411 words6 min readRead in English

3.2.4 · AI-ML › Training Deep Networks

Adaptive learning-rate optimizers jo har parameter ko uski apni step size dete hain, uske gradients ki history ke hisaab se scale karke.

Core problem (YE KYUN EXIST KARTE HAIN)

KYA chahiye hame: ek aisi rule jo automatically un parameters ke liye step shrink kare jinke gradients bade/frequent hain, aur un parameters ke liye step bada rakhe jinke gradients chhote/rare hain.

KAISE: har parameter ke liye accumulated squared gradient track karo, aur learning rate ko uske square root se divide karo.


AdaGrad — scratch se derivation

Maano step par, aur ek coordinate consider karo to ek scalar hai.

Idea: coordinate mein gradient ka "typical size" uske squares ko sum karke capture hota hai. Bade gradients ⇒ bada sum ⇒ hame ek chhoti effective step chahiye. Kisi "size" ko divisor mein convert karne ka natural tarika yeh hai ki us se divide karo. Squared isliye kyunki yeh hamesha positive rehta hai aur bade gradients ko zyada weight deta hai.

Running sum of squares define karo:

Tab update yeh hai:

kyun, kyun nahi? Units ki wajah se. ke units (gradient) hain; ko se divide karne par ratio dimensionless-ish ban jaata hai aur ek well-behaved, bounded step milti hai. se divide karne par over-shrink ho jaata.

AdaGrad ki fatal kharabi

Kyunki ek sum hai jo sirf badhta hai, , isliye effective learning rate . Deep learning training kaafi steps chalti hai, AdaGrad mar jaata hai — yeh bahut jaldi seekhna band kar deta hai. Convex / sparse problems (NLP embeddings) ke liye achha hai, lekin lambi deep-net training ke liye bura hai.


RMSprop — fix

KYUN: hum nahi chahte ki poori history hamesha ke liye accumulate hoti rahe; hame gradient magnitude ka ek recent estimate chahiye. Purane gradients bhool jaane chahiye.

KAISE: badhte sum ki jagah squared gradients ka ek exponentially weighted moving average (EWMA) use karo. Yeh hamesha badhne wale sum ki jagah ek decaying memory rakhta hai.

Decay ke saath define karo (typically ):

Yeh ek weighted average hai: recent squares puri tarah count hote hain, purane geometrically fade ho jaate hain. Ab yeh blow up nahi hota — yeh recent mean-square gradient par settle ho jaata hai.

Kyunki ek bounded average rehta hai (sum nahi), effective learning rate zero tak decay nahi hoti — training chalti rehti hai.

Figure — AdaGrad and RMSprop

Worked example 1 — do coordinates par AdaGrad

Maano , . Coordinate A hamesha deta hai; coordinate B hamesha deta hai.

Step 1:

  • , step . Kyun? Pehla gradient scale set karta hai.
  • , step .

Interesting kyun hai: bhaale B ka raw gradient 10× chhota hai, AdaGrad ne uski step ko rescale karke A ke barabar kar diya. Yahi equalizing effect hai.

Step 2:

  • , step . Kyun? History accumulate ho gayi, step shrink ho gayi.

Worked example 2 — RMSprop alive rehta hai

, , , constant .

converge karta hai: steady state mein . To step hamesha ke liye. Yeh step kyun? EWMA true mean-square (1) par saturate ho jaata hai, ek constant effective rate deta hai — koi death nahi. AdaGrad se compare karo jahan aur step .


Flashcards

AdaGrad/RMSprop kaun sa global problem solve karte hain?
Ek single global learning rate un parameters ke liye suitable nahi ho sakta jinke gradient magnitudes bahut alag hain; yeh per-parameter adaptive rates dete hain.
AdaGrad accumulator update?
(sum of all past squared gradients).
AdaGrad parameter update?
.
AdaGrad eventually seekhna kyun band kar deta hai?
bina bound ke badhta rehta hai, isliye ; effective learning rate zero tak decay ho jaati hai.
RMSprop use fix kaise karta hai?
Badhte sum ki jagah EWMA use karta hai: , jo bounded rehta hai.
RMSprop update?
.
RMSprop ke liye typical aur ?
, .
Gradient ko square kyun karte hain (abs value kyun nahi)?
Squaring bade gradients ko zyada weight deta hai aur ek differentiable, variance-jaisa measure deta hai; proper units restore karta hai.
Constant gradient ke liye steady-state RMSprop step?
, isliye effective step (constant, AdaGrad se alag).
ka role?
Numerical stability — zero se division rokta hai jab accumulator tiny ho.

Recall Feynman: 12 saal ke bachche ko explain karo

Socho tum fog mein sabse nichle point tak pahunchne ke liye pahaad se neeche ja rahe ho. Kuch directions steep cliffs hain, kuch gentle slopes. Agar tum har jagah same size ka step loge, to cliffs par giroge aur slopes par crawl karoge. AdaGrad dekhta hai ki har direction kitni bumpy rahi hai aur bumpy directions par chhote steps leta hai, smooth directions par bade steps. Problem: AdaGrad hamesha ke liye yaad rakhta hai, isliye kuch der baad yeh har jagah micro-steps le raha hota hai aur basically ruk jaata hai. RMSprop zyada smart hai — yeh sirf recent bumpiness yaad rakhta hai aur purane bumps bhool jaata hai, isliye yeh poore raaste achhi pace se chalta rehta hai.

Connections

  • Stochastic Gradient Descent — yeh baseline hai jise yeh improve karte hain
  • Momentum — gradients smooth karta hai (first moment) vs yeh jo variance se scale karte hain (second moment)
  • Adam Optimizer — literally = RMSprop + momentum + bias correction
  • Exponentially Weighted Moving Averages — RMSprop ke peeche ka math engine
  • Learning Rate Schedules — adaptivity ka alternative/complement
  • Vanishing and Exploding Gradients — per-coordinate scaling kyun help karta hai

Concept Map

fails on

solved by

track

sum over history

divides eta by

gives

G only grows

motivates

replaces sum with

forgets old gradients

good for

Plain SGD one global eta

Per-parameter step size needed

Adaptive learning rates

Accumulated squared gradients

AdaGrad

sqrt of G plus epsilon

Per-coordinate effective rate

Effective rate goes to zero, dies

RMSprop

EWMA of squared gradients, decay rho

Non-vanishing recent estimate

Convex / sparse NLP problems