Demo data: three made-up repos and three people, recorded by the real Trail hooks.About TrailGitHub
93 lines · 1.9 KBRaw

Conversation behind 60e503f20a08: Lower LR and lengthen warmup to stop divergence

User

The 7B LoRA fine-tune keeps blowing up around step 400. Logs are in logs/run-17.log. Fix it.

Assistant (thinking)

run-17: grad_norm jumps from 1.2 to 48.7 at step 380, NaN by 400. Warmup ends at step 100, so we're at full LR 3e-4 for ~300 steps before it blows up. LR too hot for r=64 LoRA on this data, and warmup too short. Try 2e-4 first, it's the smaller change.

Tool call: Bash

{
 "command": "python train.py --lr 2e-4 --run run-18",
 "description": "Retry with lower LR"
}

Tool result

step 520 loss 2.33 grad_norm 31.0
step 540 loss nan
DIVERGED

Assistant (thinking)

2e-4 only delays it (diverges at 540). The short warmup is the bigger issue. Go to 1e-4 AND warmup 500. Rejected: switching to Adafactor, too big a change for this fix.

Tool call: Bash

{
 "command": "python train.py --lr 1e-4 --warmup 500 --run run-19",
 "description": "Lower LR and longer warmup"
}

Tool result

step 1000 loss 1.79 grad_norm 0.9
eval_loss 1.82
DONE

Tool call: Edit

{
 "file_path": "/home/dev/code/ml-pipeline/train.py",
 "old_string": "LR = 3e-4",
 "new_string": "LR = 1e-4  # 3e-4 and 2e-4 diverged (run-17, run-18)"
}

Tool result

The file train.py has been updated.

Tool call: Edit

{
 "file_path": "/home/dev/code/ml-pipeline/train.py",
 "old_string": "WARMUP_STEPS = 100",
 "new_string": "WARMUP_STEPS = 500"
}

Tool result

The file train.py has been updated.

Assistant

Fixed: LR 3e-4 to 1e-4 and warmup 100 to 500. run-19 is stable to step 1000 with eval loss 1.82 (baseline 2.31). 2e-4 alone still diverged at step 540 (run-18).

Tool call: Bash

{
 "command": "git commit -am \"Lower LR and lengthen warmup to stop divergence\"",
 "description": "Commit"
}