WHY two nested minimizations? If we tuned λ on the training loss, we'd just pick
whatever memorizes the data (e.g. zero regularization, huge model). We need a held-out
signal to detect generalization. That is the validation set's whole job.
WHAT we want: samples spread evenly across orders of magnitude, not across raw values.
WHY: the effect of η is roughly multiplicative. Going 0.001→0.002 (×2) changes
training as much as 0.01→0.02 (×2), even though the absolute gaps (0.001 vs 0.01)
differ 10×. If we sampled uniformly in [10−5,10−1], ~90% of samples would land in
[10−2,10−1] and we'd almost never test the small values.
HOW — derive the sampling rule. Sample the exponent uniformly:
u∼U(a,b),η=10u.
Then for the density, with u=log10η, dηdu=ηln101, so
p(η)=p(u)dηdu=b−a1⋅ηln101∝η1.
What distinguishes a hyperparameter from a parameter?
Parameters (W,b) are learned by gradient descent on training loss; hyperparameters are set before training and control how learning happens, tuned on the validation set.
Why can't gradient descent tune the learning rate directly?
The training loss isn't usefully differentiable w.r.t. it (LR acts outside the loss; many hypers are discrete), and minimizing training loss over hypers would just pick whatever overfits — we need the held-out validation signal.
Why sample learning rate on a log scale?
Its effect is multiplicative; log-uniform sampling gives each decade equal probability. Sampling η=10u, u∼U(a,b) yields density p(η)∝1/η.
Which single hyperparameter has the largest impact and why?
Learning rate — it multiplies every gradient step, controlling whether training converges, diverges, or crawls.
Why does random search beat grid search?
Only a few hypers matter; for the same budget, random search tests the important dimension at many distinct values while grid wastes trials on unimportant repeats.
State the linear scaling rule for batch size.
Multiply batch size by k ⇒ multiply learning rate by k (add warmup for large k), to keep the expected parameter displacement per example roughly constant.
Why is weight decay called "decay"?
The L2 update becomes θ←(1−ηλ)θ−ηg; the factor (1−ηλ)<1 shrinks weights toward 0 each step.
Why must the test set be used only once?
Any tuning done using the test set leaks info into the model, overfitting it and biasing the reported score optimistically.
What is the LR range test?
Increase η geometrically each batch, plot loss vs logη; pick η near steepest descent, ~one order below where loss diverges.
Recall Feynman: explain to a 12-year-old
Imagine baking cakes. The recipe amounts (flour, sugar) are like weights — the oven
figures those out as it "learns" to bake. But oven temperature, baking time, and
cake size are things you decide before baking — those are hyperparameters. Set the
temperature too high and the cake burns (loss explodes); too low and it's raw forever (learns
too slowly). You can't let the oven pick its own temperature by tasting the same cake it's
baking (that's the training set) — you need a second tester (validation) to tell you the
temperature was good. And you keep one final judge (test set) who tastes only once so you can't
cheat by adjusting for them.
Dekho, ek neural net mein do tarah ke knobs hote hain. Parameters (weights aur biases)
model khud gradient descent se seekh leta hai. Lekin hyperparameters — jaise learning rate,
batch size, number of layers, dropout — ye tumhe training se pehle set karne padte hain.
Gradient descent inhe tune nahi kar sakta, isliye ek alag "outer loop" chahiye jo validation
set ke score dekh ke best value choose kare. Yaad rakho: training set se params fit karo,
validation set se hyperparameters choose karo, aur test set ko sirf ekdum end mein ek baar
chhoona — warna tum test pe overfit ho jaoge aur accuracy jhoothi lagegi.
Sabse important knob hai learning rate (η). Ye har gradient step ko multiply karta hai,
isliye agar bahut bada rakhoge to loss udd jayega (NaN), aur bahut chhota rakhoge to training
kachhue ki speed se chalegi. 80/20 rule: pehle sirf learning rate theek karo, baaki sab baad
mein. Ek smart trick hai LR range test — η ko chhote value se dhire-dhire badhao har
batch mein, aur loss vs logη ka graph banao; jaha loss sabse tezi se gir raha hai uske
paas, divergence point se ek order neeche, wahi accha η hai.
Ek aur important cheez: learning rate ko hamesha log scale pe search karo, kyunki uska
effect multiplicative hota hai — 0.001→0.002 utna hi farak laata hai jitna 0.01→0.02.
Aur random search grid search se better hai, kyunki sirf kuchh hi hyperparameters actually
matter karte hain; random search apna budget automatically important dimension pe kharch kar
deta hai. Weight decay (1−ηλ factor) weights ko chhota rakhta hai taaki overfitting
na ho. Bas yaad rakho recipe: overfit tiny batch → LR find karo → schedule → batch size →
regularization → architecture.