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

[Reward] initial CLoud Reward trainer #2432

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

[Reward] initial CLoud Reward trainer #2432

wants to merge 11 commits into from

Conversation

kashif
Copy link
Collaborator

@kashif kashif commented Dec 3, 2024

What does this PR do?

Adds an option to the RewardTrainer to implement the CLoud method.

@HuggingFaceDocBuilderDev

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.


[Critique-out-Loud reward models](https:/huggingface.co/papers/2408.11791) are reward models that can reason explicitly about the quality of an input through producing Chain-of-Thought like critiques of an input before predicting a reward. In classic reward model training, the reward model is trained as a reward head initialized on top of the base LLM. Without LM capabilities, classic reward models act as encoders and must predict rewards within a single forward pass through the model, meaning reasoning must happen implicitly. In contrast, CLoud reward models are trained to both produce explicit reasoning about quality and to score based on these critique reasoning traces.

To train a Critique-out-Loud reward model, you can use the `feedback_method="teacher"` and set the `lm_weight` to a high value.
Copy link
Member

Choose a reason for hiding this comment

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

How to set the lm_height to a high value? Maybe add a ref or a code example


To train a Critique-out-Loud reward model, you can use the `feedback_method="teacher"` and set the `lm_weight` to a high value.

The dataset should contain the columns `"prompt"`, `"chosen"`, `"rejected"` as well as the `"chosen_feedback` and `"rejected_feedback"` columns which contain the Chain-of-Thought like critiques for the chosen and rejected responses respectively generated by the same model or a different model. A script to generate such a dataset from a dataset of preferences is available in the `examples/datasets/critique_out_loud_vllm.py` file.
Copy link
Member

Choose a reason for hiding this comment

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

Add a link to the example

def test_train_with_feedback(self):
with tempfile.TemporaryDirectory() as tmp_dir:
# Create a dummy dataset with feedback
dummy_dataset_dict = {
Copy link
Member

Choose a reason for hiding this comment

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

Ok now I get why you want a tiny version: the zen dataset misses two columns.
I'll think about the best way to do it

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.

3 participants