NVIDIA / NVIDIA/apex

Debugging sudden gradient overflows?

Open
#192 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Fused optimizer support
Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

I'm implementing a BERT-like model in FP16 and training works well for the first few thousand iterations, but both with dynamic loss scale (scaling factor goes all the way down to 1) and static factor of 128, at some point I reach a gradient overflow error at each iteration that is inescapable. The loss up to that point is a reasonable and small scalar (around 4) and it kind of happens out of nowhere. I haven't been able to reproduce the exact cause.

What are some good ways to track down the source of this error, and what are some possible causes you might be familiar with? I'm still on the old API but from what I understand switching to the new one shouldn't fix this problem one way or another.

Thanks!

Contributor guide

No contributing guide indexed for this repository

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

No files, tests, or concrete entry points are named. Start by reducing the BERT-like FP16 training case to a reproducible example and inspect the old API's loss-scaling path around the first overflow. The issue does not provide enough detail to define a repository change or completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.