Skip to content

Adam.step bias‑correction may underflow for large step counts #11

Description

@github-actions

File: leanpass/optim.py

The bias‑corrected moments are computed as self.m[i] / (1 - self.b1 ** self.t) and similarly for v. For large self.t (e.g., >1e5) self.b1 ** self.t underflows to 0, making the denominator exactly 1 and losing the bias correction. While not a crash, it deviates from the algorithm and can affect convergence.

Fix: Compute the denominator using np.power(self.b1, self.t, dtype=np.float64) or keep a running bias_correction1 *= self.b1 and use 1 - bias_correction1. This preserves precision for many steps.

File: leanpass/optim.py

Filed automatically by ai-issue-scan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions