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

paired kto support #1069

Merged
merged 5 commits into from
Jan 9, 2024
Merged

paired kto support #1069

merged 5 commits into from
Jan 9, 2024

Conversation

winglian
Copy link
Collaborator

@winglian winglian commented Jan 9, 2024

No description provided.

Copy link
Collaborator

@hamelsmu hamelsmu left a comment

Choose a reason for hiding this comment

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

Want to add something on the README about this?

@kashif
Copy link

kashif commented Jan 9, 2024

so as mentioned, this is going to unlock the "paired"-kto loss with respect to the DPO dataset, meaning that the batch will have a prompt twice, once for the preferred and once for the unpreferred generation. This means that the KL term in the KTO will have a biased approximation, so kindly keep that in mind

@winglian winglian changed the title kto support paired kto support Jan 9, 2024
@kashif
Copy link

kashif commented Jan 9, 2024

you will also potentially need to pin the TRL version to after this was added >=0.7.5

@winglian
Copy link
Collaborator Author

winglian commented Jan 9, 2024

you will also potentially need to pin the TRL version to after this was added

Seems like 0.7.9 was recently released 4 hours ago, so this should be sufficient?

@kashif
Copy link

kashif commented Jan 9, 2024

yes

requirements.txt Outdated Show resolved Hide resolved
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
@winglian winglian merged commit d7057cc into main Jan 9, 2024
6 checks passed
@teknium1
Copy link
Contributor

teknium1 commented Jan 9, 2024

What does a dataset for KTO look like

@kashif
Copy link

kashif commented Jan 9, 2024

@teknium1 in the DPOTrainer its the same as the DPO one... however for the proper KTO trainer in TRL we went with the convention:

{
       'prompt': List[str],
        'completion': List[str],
        'label': List[bool],
}

@winglian winglian deleted the dpo-kto branch January 23, 2024 12:33
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.

None yet

4 participants