Skip to content
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

[Question] desirable_weight and undesirable_weight in KTOTrainer #1467

Closed
seanexp opened this issue Mar 22, 2024 · 4 comments
Closed

[Question] desirable_weight and undesirable_weight in KTOTrainer #1467

seanexp opened this issue Mar 22, 2024 · 4 comments

Comments

@seanexp
Copy link
Contributor

seanexp commented Mar 22, 2024

I found that KTOTrainer logs warning message if desirable_weight or undesirable_weight are not in ideal bounds.

However, KTOTrainer makes balanced dataset via interleave_datasets.

Given that the training dataset is balanced, the lower_bound and upper_bound calculation seems a bit awkward.

To my understanding the equation below

des_weight_lower_bound = round((len(undesirable) * self.undesirable_weight / len(desirable)) * 1, 2)

should be rewritten into

des_weight_lower_bound = round(self.undesirable_weight, 2)

as the ratio of len(undesirable) and len(desirable) equals 1 in interleaved_train_dataset.

Please correct me if I'm wrong. (cc. @kashif @kawine )
Thanks in advance!

@kawine
Copy link
Contributor

kawine commented Mar 22, 2024

Thanks for pointing this out @seanexp !

This looks like a bug, since I was under the (incorrect) impression that interleaving datasets with all_exhausted would preserve the relative size of the original datasets, which on second look, it appears to not do. Instead, it duplicates the data in an unpredictable way, which we don't want.

The interleaving is also unnecessary, at least in the current version of the code, so I'll make a PR to remove it.

@seanexp
Copy link
Contributor Author

seanexp commented Mar 23, 2024

Thanks! @kawine

@younesbelkada
Copy link
Contributor

Hi ! This should be fixed by #1499 I believe, do you think we can close this issue?

@seanexp
Copy link
Contributor Author

seanexp commented Apr 8, 2024

@younesbelkada Yes, I'll close this issue

@seanexp seanexp closed this as completed Apr 8, 2024
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

No branches or pull requests

3 participants