Giter Site home page Giter Site logo

moss-rlhf's Introduction

MOSS-RLHF

MOSS-RLHF & "Secrets of RLHF in Large Language Models Part I: PPO"
๐Ÿ‘‰ [Technical report] [Open-source code]

MOSS

Code License Data License Model License

๐ŸŒ  Introduction

Due to the challenges of reward design, environment interaction, and agent training, coupled with huge trial and error cost of large language models, there is a significant barrier for AI researchers to motivate the development of technical alignment and safe landing of LLMs. The stable training of RLHF has still been a puzzle. In this technical report, we intend to help researchers to train their models stably with human feedback.

Contributions are summarized as follows:

  1. We release competitive Chinese and English reward models, respectively, which have good cross-model generalization ability, alleviating the cost of relabeling human preference data;
  2. We conduct in-depth analysis on the inner workings of PPO algorithm and propose the PPO-max algorithm to ensure stable model training;
  3. We release the complete PPO-max codes to ensure that the LLMs in the current SFT stage can be better aligned with humans.
MOSS-RLHF
MOSS-RLHF

๐Ÿงพ Open-source List

  • A 7B Chinese reward model based on openChineseLlama.
  • A 7B English reward model based on Llama-7B.
  • Open source code for RL training in large language models.
  • ...

โœจ Start training your own model!

Run code in a few steps.

๐Ÿ”ฉ Requirements & Setup

This repository works on Python 3.8 and PyTorch 1.13.1.

We recommend using the conda virtual environment to run the code.

Step 1: create a new Python virtual environment

conda update conda -n base -c defaults
conda create -n rlhf python=3.8
conda activate rlhf

Step 2: install PyTorch and TensorBoard

conda install pytorch==1.13.1 pytorch-cuda=11.7 tensorboard -c pytorch -c nvidia

Step 3: install the remaining dependencies

conda install datasets accelerate safetensors chardet cchardet -c huggingface -c conda-forge
pip3 install transformers sentencepiece einops triton==1.0.0 rouge jionlp==1.4.14 nltk sacrebleu cpm_kernels

apt install libaio-dev
DS_BUILD_OPS=1 pip install deepspeed

๐Ÿ‘‰ Start Training

TODO, To be finalised before 15. July 2023

Citation

@article{zheng2023secrets,
  title={Secrets of RLHF in Large Language Models Part I: PPO}, 
  author={Rui Zheng and Shihan Dou and Songyang Gao and Yuan Hua and Wei Shen and Binghai Wang and Yan Liu and Senjie Jin and Qin Liu and Yuhao Zhou and Limao Xiong and Lu Chen and Zhiheng Xi and Nuo Xu and Wenbin Lai and Minghao Zhu and Cheng Chang and Zhangyue Yin and Rongxiang Weng and Wensen Cheng and Haoran Huang and Tianxiang Sun and Hang Yan and Tao Gui and Qi Zhang and Xipeng Qiu and Xuanjing Huang},
  year={2023}
}

moss-rlhf's People

Contributors

ablustrund avatar ciaranzhou avatar x54-729 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.