3.2.7 · HinglishTraining Deep Networks

Learning rate warmup

1,674 words8 min readRead in English

3.2.7 · AI-ML › Training Deep Networks


WHAT hai warmup?

Do sabse common shapes:

  • Linear warmup: for .
  • Exponential/constant-then-ramp: kam common; linear practically zyada use hoti hai.

WHY help karta hai? (first-principles reasoning)

Socho ek SGD step kya karta hai:

Reason 1 — Kharab early gradients. Random init ke saath loss surface chaotic hoti hai; ki magnitude badi aur batches mein variance bahut zyada hota hai. Bada us noise ko multiply karta hai → step enormous ho sakta hai → weights blow up ho jaate hain (loss → NaN) ya kisi bure basin mein land karte hain.

Reason 2 — Adam ka variance estimate early mein unreliable hota hai. Adaptive optimizers ek running second moment estimate karte hain (jo ka estimate hai). Shuruaat mein, sirf kuch samples ke saath, ek bekar estimate hota hai, isliye effective step size bahut zyada swing karta hai. Warmup ko chhota rakhta hai jab tak ke paas trustworthy hone ke liye kaafi samples na aa jaayein. (Yahi RAdam ke peeche exact motivation hai.)

Reason 3 — Large-batch training. Jab tum batch size scale karte ho, tum aksar bhi upar scale karte ho (linear scaling rule). Lekin step 0 se bada unstable hai, isliye warmup hi hai jo bade LR ko usable banata hai — "ImageNet in 1 hour" kaam mein famous tarike se.


HOW compute karo — linear schedule derive karo

Hum chahte hain ek function jo:

  1. par ke barabar ho,
  2. par ke barabar ho,
  3. beech mein ek straight line ho (sabse simple continuous choice).

Do points aur se ek line:

set karna (common default) simplify karke yeh deta hai:

Warmup ke baad () hum main schedule ko de dete hain. Ek bahut common full recipe hai warmup + cosine decay total steps par:

Figure — Learning rate warmup

Worked examples


Common mistakes


Recall Feynman: ek 12 saal ke bachche ko explain karo

Socho tum abhi sokar uthe ho aur tumhare pair stiff hain. Agar tum immediately sprint karo toh muscle pull ho jaayegi aur tum din bhar ke liye out ho jaoge. Isliye pehle dhire-dhire jog karo, warm ho jao, phir sprint karo. Ek neural network bhi aisa hi hai: "born" hone ke baad (random weights), yeh clumsily hota hai aur bade steps se khud ko hurt kar leta. Isliye hum pehle use chhote learning steps lene dete hain, unhe dheere-dheere badhate hain, aur phir bade confident steps lete hain. Yahi slow-start-then-speed-up warmup hai.


Active recall

Learning rate warmup kya hai?
LR ko ek chhoti value se peak value tak pehle steps mein increase karna, main schedule shuru hone se pehle.
Early gradients bade LR ke liye kyun dangerous hain?
Random init ke saath, gradients bade aur high-variance hote hain; weights blow up kar sakta hai ya kisi bure basin mein land kar sakta hai.
Zero start ke saath linear warmup ka formula?
for .
Warmup Adam ki specially kyun help karta hai?
Second-moment estimate shuruaat mein kuch samples ke saath unreliable hota hai, jisse effective step wildly swing karta hai; chhota ise tab tak control rakhta hai jab tak trustworthy na ho jaaye.
General two-point linear warmup formula?
.
Cosine decay apne midpoint par (progress = 0.5) kya value deta hai?
Exactly , kyunki .
Warmup ko hamesha kiske saath pair karna chahiye?
Ek decay schedule (jaise cosine ya step) post-warmup phase ke liye.
kis unit mein measure hota hai?
Optimizer steps mein, epochs mein nahi.
Kaun sa optimizer method automatically warmup-jaisa behavior build karta hai?
RAdam (rectified Adam), early mein variance ko rectify karke.
Warmup large batches ke liye linear-scaling rule ko kaise enable karta hai?
Yeh tumhe bade scaled LR ko step 0 se apply karne ki jagah safely use karne deta hai, usmein ramp karke.

Connections

Concept Map

produces

large eta amplifies

prevents

ramps eta from 0 to peak

unreliable early

delays until v_t trusted

scales eta via

needs

hands off after Tw to

gives

Random init weights

Noisy huge early gradients

Weights blow up or bad basin

Learning rate warmup

Linear schedule eta_peak times t over Tw

Adam variance estimate v_t

RAdam motivation

Large-batch training

Linear scaling rule

Main decay schedule cosine step

Stability early speed later