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

feat: Added reward model according to paper. #78

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

Conversation

ahmeterdempmk
Copy link

This PR implements the reward model training pipeline for DeepSeek-R1, adding key functionality for preference learning and model comparison.

Changes

  • Addedreward_model.py implementing reward model training pipeline
  • IntroducedRewardModelScriptArguments class for handling training configuration
  • Implemented dataset preparation withprepare_comparison_dataset function
  • Added support for better/worse response comparison training
  • Integrated with HuggingFace's Trainer for model training
  • Added model saving and Hub pushing capabilities

Implementation Details

  • Uses AutoModelForSequenceClassification for reward modeling
  • Supports configurable dataset columns for comparisons
  • Implements efficient batch processing with proper tokenization
  • Handles model checkpointing and evaluation

Testing

The implementation has been tested with:

  • Dataset preparation and tokenization
  • Model training pipeline
  • Hub integration for model sharing

Next Steps

  • Add evaluation metrics for reward model performance
  • Implement additional data preprocessing options
  • Add documentation for training configuration

processed_dataset = prepare_comparison_dataset(dataset, tokenizer, script_args)

# Initialize trainer
trainer = Trainer(
Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Any reason for not using the RewardTrainer?

Copy link
Author

Choose a reason for hiding this comment

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

Because the implementation focuses on direct preference comparison training with better/worse response pairs, which is effectively handled by the standard Trainer with our custom dataset preparation.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, but that's exactly what the RewardTrainer does, isn't it?

@qgallouedec
Copy link
Member

Can you also explain which part of the paper this addition corresponds to? It seems to me that the idea behind the RL of DeepSeek-R1 is to free it from reward models.

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.

2 participants