-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add PAPOTrainer for preference-based optimization #4334
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
Add PAPOTrainer for preference-based optimization #4334
Conversation
|
Thanks for your contribution. Can you mode this new trainer to trl.experimental instead? Ideally, we would also have a small mention in the paper index section of the documentation |
renamed: trl/trainer/papo_config.py -> trl/experimental/papo/papo_config.py renamed: trl/trainer/papo_trainer.py -> trl/experimental/papo/papo_trainer.py modified: trl/trainer/__init__.py
Thank you for your advice. I have moved this new trainer to trl.experimental and also added PAPO info in paper index. |
…/trl-papo into feat/trainer-papo
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
qgallouedec
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Thank you for your help! |
What does this PR do?
This PR introduces a new trainer named
PAPOTrainer, which extendsGRPOTrainerto support the PAPO (Preference Alignment via Policy Optimization) algorithm.Motivation
PAPO is a variant of GRPO that incorporates a contrastive preference optimization mechanism to improve stability when positive samples are sparse. But the official code use verl. To make it convenient for everyone to use, I implemented the TRL version of the code based on the PAPO formula, and it runs successfully.
Implementation Details
trl/trainer/papo_trainer.pytrl/trainer/papo_config.py__init__.pyto includePAPOTrainerpytest tests/trainer/test_papo_trainer.py -v🧪 Example Usage
https://github.com/SolarWindRider/avr/blob/main/train_papo.py
I have tested my trainer[with PEFT and FSDP] on Ascend910C and H20[single node with 8 cards].
Checklist
pytest