# 配方:自玩偏好优化 (SPPO) 最后更新:2025年5月28日。 verl 提供了论文 [《语言模型对齐的自玩偏好优化》(Self-Play Preference Optimization for Language Model Alignment)](https://arxiv.org/abs/2405.00675) 的社区实现配方。SPPO 可以在没有 GPT-4 等外部强信号(如响应或偏好)的情况下,显著提升大型语言模型(LLM)的性能。其效果优于使用迭代直接偏好优化(DPO)等方法训练的模型。SPPO 具有理论基础,确保 LLM 在一般、可能不传递的偏好下能够收敛到冯·诺依曼获胜者(即纳什均衡),并且通过在多个数据集上的广泛评估得到了实证验证。 论文作者:[Yue Wu](https://yuewu.us/)\*, [Zhiqing Sun](https://www.cs.cmu.edu/~zhiqings/)\*, [Huizhuo Yuan](https://scholar.google.com/citations?user=8foZzX4AAAAJ)\*, [Kaixuan Ji](https://scholar.google.com/citations?user=FOoKDukAAAAJ), [Yiming Yang](https://www.cs.cmu.edu/~yiming/), [Quanquan Gu](https://web.cs.ucla.edu/~qgu/) verl 实现作者:[Yuhao Yang](https://github.com/yhyang201), [Chenyang Zhao](https://github.com/zhaochenyang20) [[网页](https://uclaml.github.io/SPPO/)] [[Huggingface](https://huggingface.co/papers/2405.00675)] [[论文](https://arxiv.org/abs/2405.00675)][[原始实现](https://github.com/uclaml/SPPO)] ## 复现实验 我们在 MATH 数据集上评估了 SPPO 的性能。以 Qwen2.5-7B-Instruct 的初始得分 46.6 开始,经过 20 个 epoch 的训练后,我们达到了 65.6 的得分,在 [MATH 排行榜](https://paperswithcode.com/sota/math-word-problem-solving-on-math) 上名列前茅(约前 20%)。需要注意的是,verl 的内部评估指标可能与 Qwen2.5-7B-Instruct 的官方评估方法不完全一致。因此,为了保持一致性和公平比较,我们仅报告使用 verl 评估框架的结果。 ```bash git clone git@github.com:volcengine/verl.git cd verl python3 -m uv pip install -e ".[sglang]" export WANDB_API_KEY= python3 examples/data_preprocess/math_dataset.py --local-dir ~/data/math huggingface-cli download Qwen/Qwen2.5-7B-Instruct --local-dir $HOME/models/Qwen2.5-7B-Instruct export CUDA_VISIBLE_DEVICES=0,1,2,3 bash recipe/sppo/run_qwen2.5-7b_rm.sh ``` 请注意,安装有时可能会失败。如果遇到此问题,您可以通过运行以下命令手动安装: ```bash python3 -m uv pip install wheel python3 -m uv pip install packaging python3 -m uv pip install flash-attn --no-build-isolation --no-deps ``` ## 致谢 我们衷心感谢以下人员的贡献和指导: - [Yue Wu](https://yuewu.us/) - [Chendong Wang](https://cdwang96.github.io/) - [Yifan Zhang](https://github.com/yifanzhang-pro) - [Yongan Xiang](https://github.com/BearBiscuit05) - [Junrong Lin](https://github.com/ocss884) - [Yuxuan Tong](https://github.com/tongyx361) - [Guangming Shen](https://github.com/PeterSH6) - [Biao He](https://www.linkedin.com/in/biao-he/) - [Qingquan Song](https://qingquansong.github.io/) - [Quanquan Gu](https://web.cs.ucla.edu/~qgu/)