Lightning-AI / Lightning-AI/litgpt

get_lr depends on iteration but not step

Open
#926 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
13.7k
Forks
1.5k
Avg merge
15h 37m
Merged PRs (30d)
1

Description

[get_lr](https://github.com/Lightning-AI/lit-gpt/blob/01ae9d37ef464b90de2aa6d00df3c985c65cbc56/pretrain/redpajama.py#L308) depends on iteration (one forward and backward pass) but not step (one optimizer step).

This could be a problem when we have gradient accumulation (where 1 step= n iterations). Here we would change the learning rate n times before calling one optimizer.step()

Is there a particular reason why we chose to make get_lr depends on iter? @awaelchli

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with get_lr in pretrain/redpajama.py at the linked revision and trace how iteration, optimizer steps, and gradient accumulation are used together. Confirm the learning-rate behavior when multiple iterations make up one optimizer step; done means the behavior matches the intended step-based schedule or the reason for iteration-based scheduling is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.