feat: add SFT entropy logging and validation loss monitoring#1925
Open
none0663 wants to merge 3 commits into
Open
feat: add SFT entropy logging and validation loss monitoring#1925none0663 wants to merge 3 commits into
none0663 wants to merge 3 commits into
Conversation
Add two monitoring features for SFT training to detect overfitting: 1. Training entropy (--log-sft-entropy): - Computes token-level entropy under no_grad to avoid OOM - Logged as train/entropy to TensorBoard/WandB 2. Validation loss (--val-data + --val-interval): - Full DP-parallel val loss computation with dynamic batching - Token-weighted aggregation across ranks (not rank-mean) - CP-correct reduction via get_sum_of_sample_mean - Deadlock-safe: all ranks synchronize before collective ops - Runs initial val before training for baseline - Also logs val/entropy when --log-sft-entropy is set Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Divide local_tokens by cp_size before all_reduce to avoid overcounting when loss_masks are replicated across CP ranks. 2. Use max(0, start_rollout_id - 1) for baseline val step to avoid discontinuity and step collision on training resume. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. When val_data has fewer samples than dp_size, replicate to all ranks instead of leaving empty shards (which would skip val entirely). 2. Skip baseline val when it would collide with the first periodic val at the same step (val_interval=1 + start_rollout_id=0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.
Add two monitoring features for SFT training to detect overfitting:
Training entropy (--log-sft-entropy):
Validation loss (--val-data + --val-interval):