{ "lesson": "44-cosine-lr-warmup", "title": "Cosine LR with Linear Warmup", "questions": [ { "stage": "pre", "question": "Why does the cosine-with-warmup schedule start at zero rather than at lr_max?", "options": [ "Random tradition", "Because lr_max is illegal at step zero", "The first thousand updates are noisy; a linear ramp from zero to lr_max gives the optimizer a small effective step size while running estimates stabilise", "Because Adam requires it" ], "correct": 2, "explanation": "Warmup keeps brittle early updates small; the model otherwise either diverges or plateaus." }, { "stage": "check", "question": "Why is the schedule implemented as a single function over step rather than three glued segments?", "options": [ "A glued schedule loses one boundary the first time lr_max is changed; the single function evaluates the same closed-form expression and preserves continuity at warmup and total endpoints", "Linters require it", "Random", "Single functions are smaller" ], "correct": 0, "explanation": "Continuity at lr(warmup_steps) and lr(total_steps) follows from the closed form." }, { "stage": "check", "question": "What happens for step > total_steps in the schedule?", "options": [ "It returns nan", "It throws an exception", "It wraps around", "It pins at lr_min; the schedule does not extrapolate, and trainers that need to extend training change total_steps explicitly" ], "correct": 3, "explanation": "A pinned floor keeps an overshooting trainer in a documented state instead of crashing." }, { "stage": "check", "question": "Why log gradient L2 norm next to the learning rate?", "options": [ "Tradition", "The norm is the other half of training health: a divergent run spikes its norm before the loss; a too-aggressive peak shows up as a norm that stays high after warmup", "It looks pretty", "Adam requires it" ], "correct": 1, "explanation": "Co-logging makes pathological schedules visible at run time, not after the fact." }, { "stage": "post", "question": "Why configure warmup_steps as a fraction of total_steps in production?", "options": [ "Fractions are cleaner", "A fixed warmup count that suits a 20k-step run is essentially no warmup in a 200M-step run; the fraction (typical 1-3 percent) scales with training duration", "Hardware requirement", "Random preference" ], "correct": 1, "explanation": "Absolute warmup counts misbehave across training-duration scales." }, { "stage": "post", "question": "Why is a non-zero lr_min typical in production?", "options": [ "A floor near 10 percent of lr_max keeps the optimizer learning during the long tail; an lr_min of zero produces a curve that looks good and a model that has not finished training", "Numerical stability", "Backward compatibility", "Adam requires non-zero" ], "correct": 0, "explanation": "The tail of the schedule is where late-stage refinements land; zeroing it wastes that signal." } ] }