Giter Club home page Giter Club logo

rldf's Introduction

RLDF

The experimental code of paper "RLDF:Reinforcement Learning from Multi-role Debates as Feedback for Bias Mitigation in LLMs".

Introduction

Welcome to the repository for our paper "RLDF: Reinforcement Learning from Multi-role Debates as Feedback for Bias Mitigation in LLMs". This repository contains the implementation of the RLDF methodology, which is designed to reduce biases in large language models (LLMs) through reinforcement learning guided by multi-role debates.

  • Data Construction Scripts: Tools for generating datasets in both Self-Reflection and Teacher-Student modes.
  • Reward Model Training: Implementation of the reward model training process using the constructed datasets.
  • Reinforcement Learning Fine-Tuning: Scripts for fine-tuning the LLM using PPO, guided by the reward model.

Requirements

conda create --name 'RLDF' --file requirements.txt

conda activate 'RLDF'

Dataset and Models

  • The datasets used in our experiments are constructed through our provided code. You can generate the datasets using ‘API/data.py’ or ‘OSS/data.py’
  • Our main models used in the experiments are Llama2-7B ,ChatGLM3-6B, Qwen1.5-7B and Baichuan2-7B. These models need to be downloaded separately.

RL

  1. Reward Model Training

    1.1 pip install -r llama_factory_requirements.txt

     `conda activate llama_factory`
    
     `cd reward-model-training`
    

    1.2 Download LLaMA2-7b, Qwen1.5-7b, ChatGLM3-6B, Baichuan2-7B to "base-model" folder

    1.3 Run train_rm_multi_role.sh and train_sft_multi_role.sh separately.

    1.4 Run merge_rm_lora_multi_role.sh and merge_sft_lora_multi_role.sh separately.

  2. RL Finetuning

    2.1 pip install -r llm_requirements.txt
    conda activate llm
    cd rl-finetuning.

    2.2 Run rl-finetuning\src\run_llama2_7b_multi_role.sh

  3. Predict

    3.1 conda activate llama_factory
    cd reward-model-training.

    3.2 Run reward-model-training\do_predict_RLDF_multi_role.sh

rldf's People

Contributors

hunter-wrynn avatar

Watchers

 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.