🚀 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}
}