🚀 gemma-2-9b-it-SimPO 模型卡片
SimPO(簡單偏好優化)是一種離線偏好優化算法,旨在利用偏好優化數據集來改進大語言模型(LLM)的訓練。SimPO使獎勵函數與生成可能性保持一致,無需參考模型,並引入目標獎勵裕度來提升性能。更多詳細信息,請參考我們的預印本和GitHub倉庫。
🚀 快速開始
以下是如何開始使用該模型的示例代碼:
import torch
from transformers import pipeline
model_id = "princeton-nlp/gemma-2-9b-it-SimPO"
generator = pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda",
)
outputs = generator([{"role": "user", "content": "What's the difference between llamas and alpacas?"}],
do_sample=False,
eos_token_id=[generator.tokenizer.convert_tokens_to_ids("<end_of_turn>"), generator.tokenizer.eos_token_id],
max_new_tokens=200)
print(outputs[0]['generated_text'])
✨ 主要特性
- SimPO算法可有效提升大語言模型在偏好優化數據集上的訓練效果。
- 使獎勵函數與生成可能性對齊,無需參考模型。
- 引入目標獎勵裕度,提升模型性能。
📦 安裝指南
文檔未提供具體安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
import torch
from transformers import pipeline
model_id = "princeton-nlp/gemma-2-9b-it-SimPO"
generator = pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda",
)
outputs = generator([{"role": "user", "content": "What's the difference between llamas and alpacas?"}],
do_sample=False,
eos_token_id=[generator.tokenizer.convert_tokens_to_ids("<end_of_turn>"), generator.tokenizer.eos_token_id],
max_new_tokens=200)
print(outputs[0]['generated_text'])
📚 詳細文檔
模型詳情
模型描述
我們使用SimPO目標,在princeton-nlp/gemma2-ultrafeedback-armorm數據集上對google/gemma-2-9b-it進行了微調。
模型來源
- 倉庫地址:https://github.com/princeton-nlp/SimPO
- 論文地址:https://arxiv.org/pdf/2405.14734
訓練詳情
訓練數據
我們使用princeton-nlp/gemma2-ultrafeedback-armorm作為偏好優化數據集。
訓練超參數
所用的超參數可在訓練腳本中找到。
速度、大小和時間
在8xH100 GPU上,對google/gemma-2-9b-it在princeton-nlp/gemma2-ultrafeedback-armorm數據集上進行微調大約需要100分鐘。
評估結果
🔧 技術細節
模型架構和目標
模型架構基於google/gemma-2-9b-it。我們使用了在預印本中提出的SimPO訓練目標。
硬件
我們使用8xH100 GPU進行模型訓練。
軟件
訓練使用了alignment-handbook庫。
📄 許可證
該模型使用MIT許可證。
📖 引用
gemma模型
@article{gemma_2024,
title={Gemma},
url={https://www.kaggle.com/m/3301},
DOI={10.34740/KAGGLE/M/3301},
publisher={Kaggle},
author={Gemma Team},
year={2024}
}
SimPO論文
@article{meng2024simpo,
title={{SimPO}: Simple preference optimization with a reference-free reward},
author={Meng, Yu and Xia, Mengzhou and Chen, Danqi},
journal={arXiv preprint arXiv:2405.14734},
year={2024}
}
UltraFeedback論文
@article{cui2023ultrafeedback,
title={{UltraFeedback}: Boosting language models with high-quality feedback},
author={Cui, Ganqu and Yuan, Lifan and Ding, Ning and Yao, Guanming and Zhu, Wei and Ni, Yuan and Xie, Guotong and Liu, Zhiyuan and Sun, Maosong},
journal={arXiv preprint arXiv:2310.01377},
year={2023}
}
ArmoRM論文
@article{wang2024interpretable,
title={Interpretable Preferences via Multi-Objective Reward Modeling and Mixture-of-Experts},
author={Wang, Haoxiang and Xiong, Wei and Xie, Tengyang and Zhao, Han and Zhang, Tong},
journal={arXiv preprint arXiv:2406.12845},
year={2024}
}