Skip to content

[train] Add importance weight diagnostics and fix IS loss overflow#1261

Draft
tyler-griggs wants to merge 2 commits intomainfrom
tgriggs/iw-diagnostics
Draft

[train] Add importance weight diagnostics and fix IS loss overflow#1261
tyler-griggs wants to merge 2 commits intomainfrom
tgriggs/iw-diagnostics

Conversation

@tyler-griggs
Copy link
Member

Summary

  • compute_iw_metrics(): logs ratio mean/std/max/min for CISPO and IS losses
  • Fix importance_sampling_loss: use safe_exp_delta (was only loss using raw torch.exp)
  • importance_sampling_loss now uses reduce_loss and apply_off_policy_correction
  • Add CISPO to repopulate_registry

Test plan

  • Existing loss tests pass
  • IW metrics appear in logged output with CISPO/IS losses

🤖 Generated with Claude Code

- Add compute_iw_metrics() for monitoring IW health (ratio mean/std/max/min)
- Integrate IW metrics into CISPO and importance_sampling losses
- Fix importance_sampling_loss: use safe_exp_delta (was only loss using
  raw torch.exp, risking inf * 0 = nan in off-policy scenarios)
- Make importance_sampling_loss use reduce_loss and apply_off_policy_correction
  (matching the pattern of all other loss functions)
- Add CISPO to repopulate_registry

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests verify correct loss computation, IW diagnostic metrics, and
numerical safety (safe_exp_delta prevents overflow for extreme ratios).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant