Skip to content

fix: complete the eval metrics Truth_Ratio calculation mentioned in the paper#163

Merged
molereddy merged 2 commits into
locuslab:mainfrom
Yohjishong:change_Truth_Ratio
Dec 24, 2025
Merged

fix: complete the eval metrics Truth_Ratio calculation mentioned in the paper#163
molereddy merged 2 commits into
locuslab:mainfrom
Yohjishong:change_Truth_Ratio

Conversation

@Yohjishong

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #160

Now, the "aggregator" is expanded to three types: "closer_to_1_better", "true_better", "prob_mean".

You can modify the “aggregator” in the file "configs/eval/tofu_metrics/forget_Truth_Ratio.yaml" to change the method to calculate the Truth_Ratio.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Have you gone through the contributions guide?
  • Are your changes documented? Read documentation guidelines here.

@molereddy molereddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for adding this. Few small comments to clean things up and clarify some comments, and we can merge this in.


handler: truth_ratio
aggregator: closer_to_1_better
aggregator: prob_mean

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This edit can be removed. The prob_mean is best added only as an option as it is not the way truth ratio is usually used in the literature, which follows how the TOFU paper implemented it.

Comment thread src/evals/metrics/memorization.py Outdated
# Original definition: wrong / correct
truth_ratios = wrong_prob / (correct_prob + 1e-10)
else:
# New definition: correct / (correct + wrong)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

better call this as the definition from OpenUnlearning than "new"

Comment thread src/evals/metrics/memorization.py
Comment thread src/evals/metrics/memorization.py Outdated
truth_ratios = wrong_prob / (correct_prob + 1e-10)

if use_original_ratio:
# Original definition: wrong / correct

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

better call this as the definition from TOFU paper for clarity

Comment thread src/evals/metrics/memorization.py Outdated
@molereddy

Copy link
Copy Markdown
Collaborator

Also, make sure the lint tests pass. Instructions for formatter setup here: https://github.com/locuslab/open-unlearning/blob/main/docs/contributing.md#create-a-pull-request

@Yohjishong

Copy link
Copy Markdown
Contributor Author

Thank you for your guidance. I have changed and commited again. It has "make quality" in my own computer.

@molereddy molereddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot!!

@molereddy molereddy merged commit d3d7cf9 into locuslab:main Dec 24, 2025
1 check passed
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.

Truth Ratio implementation question

2 participants