Code RoomLearning rate warmup off-by-one
HardPrep Room Coding #4221

Learning rate warmup off-by-one

Vibe & agenticAlgorithms & data structuresSenior–Staff~18 min

An AI wrote this LR-warmup training loop. It trains, but the learning rate never reaches its peak and the final step is skipped. Find the off-by-one(s).

Implement
warmup_lr_schedule(total_steps: int, warmup_steps: int, base_lr: float) → list[float]
Examples
in[6,4,1]out[0.25,0.5,0.75,1,1,1]
in[3,5,0.5]out[0.1,0.2,0.3]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 18 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.