Train.Lr_scheduleHost-side learning-rate schedules: pure functions from the step number to a float, fed to the device via scheduled_learning_rate (or any host-written scalar). All schedules start with a linear warmup over warmup_steps steps (base_lr * (step+1) / warmup_steps; no warmup when 0) and decay toward base_lr *. final_frac at total_steps. Steps beyond total_steps clamp to the final value.
type kind = | Constantbase_lr after warmup; final_frac is ignored.
| CosineHalf-cosine from base_lr down to base_lr *. final_frac.
| LinearStraight line from base_lr down to base_lr *. final_frac.
| Wsd of {}Warmup-stable-decay (arXiv:2405.18392): hold base_lr until the final decay_frac fraction of total_steps (llm.c uses 0.2), then decay as 1 - sqrt(ratio).
type t = {kind : kind;base_lr : Base.float;warmup_steps : Base.int;total_steps : Base.int;final_frac : Base.float;The final learning rate as a fraction of base_lr.
}val learning_rate : t -> step:Base__Int.t -> Base__Float.tThe learning rate at step (0-based).