RLHFlow/LLaMA3-iterative-DPO-final

Model

41

stars

9

commits

4

repos using this model

1

linked in READMEs

Oct 14, 2024

updated

conversational
endpoints_compatible
llama
safetensors
text-generation
text-generation-inference
transformers

README

LLaMA3-iterative-DPO-final

Introduction

We release an unofficial checkpoint of a state-of-the-art instruct model of its class, LLaMA3-iterative-DPO-final. On all three widely-used instruct model benchmarks: Alpaca-Eval-V2, MT-Bench, Chat-Arena-Hard, our model outperforms all models of similar size (e.g., LLaMA-3-8B-it), most large open-sourced models (e.g., Mixtral-8x7B-it), and strong proprietary models (e.g., GPT-3.5-turbo-0613). The model is trained with open-sourced datasets without any additional human-/GPT4-labeling.

Even better, we provide a detailed recipe to reproduce the model. Enjoy!

Model Releases

See the collection of the training set, reward/preference model, SFT model.

  • SFT model
  • Reward model
  • This model is more like the concise version in the report. We are still working on the model realeasing due to some license issue....

Dataset

Training methods

We have developed a simple and efficient online RLHF recipe for LLM instruct training. Our recipe is DPO-based and thus much cheaper and simpler to train and tune compared to PPO-based approaches. Unlike widely-used offline DPO, the online component of our approach effectively mitigates distribution shifts during policy optimization. For a detailed exposition, please refer to our accompanying technical report.

Chat Benchmarks

ModelSizeMethodLC Alpaca-Eval-V2MT-BenchChat-Arena-Hard
Small Open-Sourced Models
Gemma-7B-it7BSFT10.46.387.5
Zephyr-7B-beta7BVanilla DPO13.17.34-
Mistral-7B-v0.2-it7BSFT17.17.5112.6
Open-Chat-01067BSFT15.67.8-
Starling-7B-beta7BPPO25.88.1223.0
LLaMA-3-8B-it8BRS+DPO+PPO22.98.1620.6
Ours
Ours (SFT baseline)8BSFT10.27.695.6
Ours (DPO baseline)8BVanilla DPO22.58.1722.4
Ours (Online RLHF)8BIterative DPO37.28.4629.1
Large Open-Sourced Models
Vicuna-33b-v1.333BSFT17.67.128.6
Yi-34B-Chat34BSFT27.2-23.1
Mixtral-8x7B-it45B*SFT23.78.3023.4
Tulu-2-DPO-70B70BVanilla DPO21.27.8915.0
LLaMA-3-70B-it70BRS+DPO+PPO34.48.9541.1
Mixtral-8x22B-it141B*SFT30.98.6636.4
Proprietary Models
GPT-3.5-turbo-1106--19.38.3518.9
GPT-3.5-turbo-0613--22.78.3924.8
GPT-4-0613--30.29.1837.9
Claude-3-Opus--40.59.0060.4
GPT-4 Turbo (04/09)--55.0-82.6

Academic Benchmarks

ModelSizeMethodGSM-8KMMLUHumanEvalTruthfulQAARCMBPP
LLaMA-3-8B-it8BRS+DPO+PPO79.666.061.643.959.561.1
Ours (SFT baseline)8BSFT74.264.765.253.461.462.3
Ours (DPO baseline)8BVanilla DPO79.864.563.461.865.260.3
Ours (Iterative RLHF)8BIterative DPO80.765.364.660.464.360.8

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

device = "cuda" 

model = AutoModelForCausalLM.from_pretrained("RLHFlow/LLaMA3-iterative-DPO-final")
tokenizer = AutoTokenizer.from_pretrained("RLHFlow/LLaMA3-iterative-DPO-final")

messages = [
    {"role": "user", "content": "I'm trying to teach myself to have nicer handwriting. Can you help?"},
]

model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")

model_inputs = model_inputs.to(device)
model.to(device)

output_tokens = model.generate(model_inputs, max_new_tokens=1024, do_sample=True)
model_outputs = tokenizer.batch_decode(output_tokens)
print(model_outputs[0])

Limitations

RLHFlow/LLaMA3-iterative-DPO-final is an unofficial checkpoint developed to illustrate the power of online iterative RLHF and is for research purpose. While safety and ethical considerations are integral to our alignment process, there remains the possibility that the model could generate offensive or unethical content, particularly under adversarial conditions. We are committed to continuous improvement in our models to minimize such risks and encourage responsible usage.

Citation

Please cite our techical report if you find our model is useful for your research or product.

@misc{dong2024rlhf,
      title={RLHF Workflow: From Reward Modeling to Online RLHF}, 
      author={Hanze Dong and Wei Xiong and Bo Pang and Haoxiang Wang and Han Zhao and Yingbo Zhou and Nan Jiang and Doyen Sahoo and Caiming Xiong and Tong Zhang},
      year={2024},
      eprint={2405.07863},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

@misc{xiong2024iterative,
      title={Iterative Preference Learning from Human Feedback: Bridging Theory and Practice for RLHF under KL-Constraint}, 
      author={Wei Xiong and Hanze Dong and Chenlu Ye and Ziqi Wang and Han Zhong and Heng Ji and Nan Jiang and Tong Zhang},
      year={2024},
      eprint={2312.11456},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

Contributors

weqweasdas

7 commits

Haoxiang-Wang

2 commits

RLHFlow/LLaMA3-iterative-DPO-final

Model

41

stars

9

commits

4

repos using this model

1

linked in READMEs

Oct 14, 2024

updated

conversational
endpoints_compatible
llama
safetensors
text-generation
text-generation-inference
transformers

README

LLaMA3-iterative-DPO-final

Introduction

We release an unofficial checkpoint of a state-of-the-art instruct model of its class, LLaMA3-iterative-DPO-final. On all three widely-used instruct model benchmarks: Alpaca-Eval-V2, MT-Bench, Chat-Arena-Hard, our model outperforms all models of similar size (e.g., LLaMA-3-8B-it), most large open-sourced models (e.g., Mixtral-8x7B-it), and strong proprietary models (e.g., GPT-3.5-turbo-0613). The model is trained with open-sourced datasets without any additional human-/GPT4-labeling.

Even better, we provide a detailed recipe to reproduce the model. Enjoy!

Model Releases

See the collection of the training set, reward/preference model, SFT model.

  • SFT model
  • Reward model
  • This model is more like the concise version in the report. We are still working on the model realeasing due to some license issue....

Dataset

Training methods

We have developed a simple and efficient online RLHF recipe for LLM instruct training. Our recipe is DPO-based and thus much cheaper and simpler to train and tune compared to PPO-based approaches. Unlike widely-used offline DPO, the online component of our approach effectively mitigates distribution shifts during policy optimization. For a detailed exposition, please refer to our accompanying technical report.

Chat Benchmarks

ModelSizeMethodLC Alpaca-Eval-V2MT-BenchChat-Arena-Hard
Small Open-Sourced Models
Gemma-7B-it7BSFT10.46.387.5
Zephyr-7B-beta7BVanilla DPO13.17.34-
Mistral-7B-v0.2-it7BSFT17.17.5112.6
Open-Chat-01067BSFT15.67.8-
Starling-7B-beta7BPPO25.88.1223.0
LLaMA-3-8B-it8BRS+DPO+PPO22.98.1620.6
Ours
Ours (SFT baseline)8BSFT10.27.695.6
Ours (DPO baseline)8BVanilla DPO22.58.1722.4
Ours (Online RLHF)8BIterative DPO37.28.4629.1
Large Open-Sourced Models
Vicuna-33b-v1.333BSFT17.67.128.6
Yi-34B-Chat34BSFT27.2-23.1
Mixtral-8x7B-it45B*SFT23.78.3023.4
Tulu-2-DPO-70B70BVanilla DPO21.27.8915.0
LLaMA-3-70B-it70BRS+DPO+PPO34.48.9541.1
Mixtral-8x22B-it141B*SFT30.98.6636.4
Proprietary Models
GPT-3.5-turbo-1106--19.38.3518.9
GPT-3.5-turbo-0613--22.78.3924.8
GPT-4-0613--30.29.1837.9
Claude-3-Opus--40.59.0060.4
GPT-4 Turbo (04/09)--55.0-82.6

Academic Benchmarks

ModelSizeMethodGSM-8KMMLUHumanEvalTruthfulQAARCMBPP
LLaMA-3-8B-it8BRS+DPO+PPO79.666.061.643.959.561.1
Ours (SFT baseline)8BSFT74.264.765.253.461.462.3
Ours (DPO baseline)8BVanilla DPO79.864.563.461.865.260.3
Ours (Iterative RLHF)8BIterative DPO80.765.364.660.464.360.8

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

device = "cuda" 

model = AutoModelForCausalLM.from_pretrained("RLHFlow/LLaMA3-iterative-DPO-final")
tokenizer = AutoTokenizer.from_pretrained("RLHFlow/LLaMA3-iterative-DPO-final")

messages = [
    {"role": "user", "content": "I'm trying to teach myself to have nicer handwriting. Can you help?"},
]

model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")

model_inputs = model_inputs.to(device)
model.to(device)

output_tokens = model.generate(model_inputs, max_new_tokens=1024, do_sample=True)
model_outputs = tokenizer.batch_decode(output_tokens)
print(model_outputs[0])

Limitations

RLHFlow/LLaMA3-iterative-DPO-final is an unofficial checkpoint developed to illustrate the power of online iterative RLHF and is for research purpose. While safety and ethical considerations are integral to our alignment process, there remains the possibility that the model could generate offensive or unethical content, particularly under adversarial conditions. We are committed to continuous improvement in our models to minimize such risks and encourage responsible usage.

Citation

Please cite our techical report if you find our model is useful for your research or product.

@misc{dong2024rlhf,
      title={RLHF Workflow: From Reward Modeling to Online RLHF}, 
      author={Hanze Dong and Wei Xiong and Bo Pang and Haoxiang Wang and Han Zhao and Yingbo Zhou and Nan Jiang and Doyen Sahoo and Caiming Xiong and Tong Zhang},
      year={2024},
      eprint={2405.07863},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

@misc{xiong2024iterative,
      title={Iterative Preference Learning from Human Feedback: Bridging Theory and Practice for RLHF under KL-Constraint}, 
      author={Wei Xiong and Hanze Dong and Chenlu Ye and Ziqi Wang and Han Zhong and Heng Ji and Nan Jiang and Tong Zhang},
      year={2024},
      eprint={2312.11456},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

Contributors

weqweasdas

7 commits

Haoxiang-Wang

2 commits