Skip to content

Fixing entropy calculation #85

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

Merged
merged 9 commits into from
Jun 18, 2025
Merged

Fixing entropy calculation #85

merged 9 commits into from
Jun 18, 2025

Conversation

abaheti95
Copy link
Collaborator

@abaheti95 abaheti95 commented Jun 5, 2025

I made a mistake when logging entropy by only looking at the actions rather than the entire distribution.
This fixes that mistake and now does correct entropy calculation

mlflow of old and new entropy logging

Update

I've modified the PR to include more functionalities:

  1. Getting the sequence and token entropy of the sequences
  2. seq entropy becomes the loss term
  3. Token entropy is used to get different percentiles of token entropies throughout the batch

@abaheti95 abaheti95 marked this pull request as ready for review June 5, 2025 22:38
@abaheti95 abaheti95 requested a review from jdchang1 June 5, 2025 22:38
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.

Since fixing a bug in a narrow, fairly self contained piece of the codebase, lets add unit tests while we're here?

@gupta-abhay
Copy link
Collaborator

Since fixing a bug in a narrow, fairly self contained piece of the codebase, lets add unit tests while we're here?

+1 to this

@abaheti95 abaheti95 force-pushed the ashu/entropy_fix branch 2 times, most recently from 510e13a to 2ae4962 Compare June 11, 2025 20:48
@abaheti95 abaheti95 marked this pull request as draft June 11, 2025 23:13
@abaheti95 abaheti95 marked this pull request as ready for review June 12, 2025 00:28
@abaheti95
Copy link
Collaborator Author

Okay... modified the code to calculate both token and sequence entropies and added unit tests for both.
Also added piping for entropy loss from @jdchang1 's entropy loss branch

Copy link
Collaborator

@jdchang1 jdchang1 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the fix and tests

Copy link
Collaborator

@gupta-abhay gupta-abhay left a comment

Choose a reason for hiding this comment

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

mostly lg, some nits!

@abaheti95 abaheti95 merged commit 22dd44e into main Jun 18, 2025
4 checks passed
@abaheti95 abaheti95 deleted the ashu/entropy_fix branch June 18, 2025 22:43
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.

4 participants