Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect loss spikes and high losses during training #1473

Merged
merged 85 commits into from
Aug 28, 2024

Conversation

joyce-chen-uni
Copy link
Contributor

@joyce-chen-uni joyce-chen-uni commented Aug 21, 2024

KillLossSpike callback that 1) compares the train loss against the running average loss, and 2) checks the magnitude of running losses at the end of every batch/training step. This is intended to catch 1) rapid steep spikes and 2) divergent runs respectively.

If we identify a spike or divergence, we log a message to the run metadata. This message is added to the TRAIN_UPDATED run event in MAPI, so it will be displayed to the user in the run events. The message recommends the user to stop and resubmit the run with a lower learning rate.

This change will make it easier to query spiky runs. We also log the loss window leading up to the identified spike for data analysis purposes.

Once we have collected enough data and feel confident about our cancellation threshold, we will switch to the hard user error LossSpikeError which cancels the run without retry and prompts the user to resubmit with a lower learning rate.

@joyce-chen-uni joyce-chen-uni force-pushed the main branch 2 times, most recently from fff5576 to e56b797 Compare August 25, 2024 23:47
@joyce-chen-uni joyce-chen-uni force-pushed the main branch 2 times, most recently from a25a19c to 44787df Compare August 26, 2024 06:39
Copy link
Collaborator

@dakinggg dakinggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks mostly good to me! a couple small comments

llmfoundry/callbacks/kill_loss_spike_callback.py Outdated Show resolved Hide resolved
@joyce-chen-uni joyce-chen-uni merged commit 0db4425 into mosaicml:main Aug 28, 2024
9 checks passed
@joyce-chen-uni joyce-chen-uni changed the title Track loss spikes and high losses during training Detect loss spikes and high losses during training Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants