Giter VIP home page Giter VIP logo

cyberagentailab / filtered-dpo Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 0.0 104 KB

Introducing Filtered Direct Preference Optimization (fDPO) that enhances language model alignment with human preferences by discarding lower-quality samples compared to those generated by the learning model

Home Page: https://arxiv.org/abs/2404.13846

License: MIT License

Shell 22.96% Python 77.04%
alignment dpo rlhf

filtered-dpo's Introduction

Filtered Direct Preference Optimization

tl;dr

Introducing Filtered Direct Preference Optimization (fDPO) that enhances language model alignment with human preferences by discarding lower-quality samples compared to those generated by the learning model

Prerequisites

Get Started

To set up your local environment, start by copying the example environment file:

cp .env.example .env

Next, you need to edit the .env file to include your Hugging Face API token. Replace the placeholder value with your actual token:

HF_HUB_TOKEN="your_hugging_face_token_here"

If you do not already have a Hugging Face account or API token, you will need to create an account on Hugging Face and then generate an API token from your account settings.

Once your .env file is set up, apply the configuration to your environment using direnv:

direnv allow .

Installation

poetry install

Obtain Access to Datasets and Models

To use the datasets and models listed below, you must apply for access privileges on their respective Hugging Face repository pages. Please follow the links provided, and on each page, click the “Apply” button to submit your access request. This process is necessary to ensure compliance with the data usage policies and intellectual property rights associated with each resource.

  • Dataset - Follow this link to apply for access to the dataset.
  • Model - Follow this link to apply for access to the model.

Usage

Test training

Execution time of about an hour in the notebook.

bash scripts/test.sh 

Train 160m model

Execution time of several hours using A100 80G

# $seed in {1, 2, 3}
seed=1
bash scripts/160m/fdpo_mix.sh ${seed}

Train 1.4b model

Execution time of about a day using A100 80G

# $seed in {1, 2, 3}
seed=1
bash scripts/1.4b/fdpo_mix.sh ${seed}

Checking Experimental Results

The verification of experiment logs and creation of reports follow the standard of Transformers .

Reference

Morimura, T., Sakamoto, M., Jinnai, Y., Abe, K., and Ariu, K., Filtered Direct Preference Optimization. arXiv preprint arXiv:2404.13846, 2024.

Bibtex:

@misc{morimura2024filtered,
      title={Filtered Direct Preference Optimization}, 
      author={Tetsuro Morimura and Mitsuki Sakamoto and Yuu Jinnai and Kenshi Abe and Kaito Ariu},
      year={2024},
      eprint={2404.13846},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

filtered-dpo's People

Contributors

mitssuki-sakamoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.