bugger.
All challenges/Pythoneasyllm-learning-rate-schedule-v1
THE INVESTIGATION

Warmup and cosine learning-rate decay

Implement a resumable linear-warmup and cosine-decay schedule.

LLM ArchitectureML systems

What’s going wrong

Original LLM Architecture lab. Implement the missing behavior in solve(data) and keep the supplied JSON interface. Use Python’s standard library.

Input steps contains nonnegative integer update indices. Use base_lr × step/warmup when step < warmup. From warmup through total, interpolate from base_lr to min_lr by cosine with fraction (step−warmup)/(total−warmup). At and beyond total return min_lr. Require 0 ≤ warmup < total and 0 ≤ min_lr ≤ base_lr. Return rates in input order.

Small, well-formed JSON inputs and standard-library Python arithmetic. Keep full precision during computation. The supplied output wrapper rounds results to six decimal places.

Expected behavior

Implement a resumable linear-warmup and cosine-decay schedule.

Reproduction

01 Warmup and decay meet at the peak
{"steps":[0,1,2,3,5,8],"warmup":2,"total":6,"base_lr":1,"min_lr":0.1}
[0,0.5,1,0.868198,0.231802,0.1]
02 Steps beyond the horizon stay at the floor
{"steps":[4,5],"warmup":0,"total":4,"base_lr":0.01,"min_lr":0.001}
[0.001,0.001]
03 No warmup starts at the peak
{"steps":[0,1,2],"warmup":0,"total":2,"base_lr":1,"min_lr":0}
[1,0.5,0]

Before you begin

  • Python functions, lists and dictionaries

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.