Skip to content

Warmup to cosine scheduler handoff can overshoot peak LR #32

Description

@morluto

Problem

At the warmup/cosine transition, the scheduler wrapper can delegate to CosineAnnealingLR.get_lr() while the cosine scheduler is in a chainable state with last_epoch == 0 and the optimizer LR already set to the warmup peak.

That state applies the recursive cosine update to the current peak LR instead of returning the epoch-0 peak value.

Impact

The learning rate can exceed the configured peak for one step. With eta_min = 0, the transition factor is:

2 / (1 + cos(pi / T_max))

For example, T_max = 10 overshoots by about 2.51%.

Fix

Fixed in PR #30 by special-casing the handoff to return the configured peak/base LRs directly, then letting the following scheduler step advance cosine normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions