Open
Conversation
…557) - Add support for lower sequence length Co-authored-by: Hemanth Reddy K <h.kamireddy@yuvohealth.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements LossContinuityGuard — a lightweight guard that detects loss discontinuities after checkpoint resume. Loss jumps after resume indicate that some training state (optimizer moments, LR scheduler, model weights) was not correctly restored. This guard records a rolling window of optimizer-step losses before each checkpoint, saves the window statistics into the checkpoint metadata (
client_state), and automatically verifies continuity for the firstwindow_sizesteps after resume.Changes:
dist.all_reduce(guarded bydist.is_initialized()).client_state["loss_guard"].How it works at resume:
Zero latency impact: observe() is a Python
list.append(float)— completely invisible against GPU-bound fused Triton kernels.Checklist
tests/test_loss_continuity_guard_integration.py— 2 end-to-end integration tests usinggpt2+wikitext-2-raw-v1via HuggingFace, verifying a clean resume passes and a corrupted-weights resume is detectedresume_recovery-loss_continuitysrc/llm/alongside existing modules (loss_spike_recovery.py, etc.)client_statedict pattern already established in checkpoint.py and pretrainer.py