DeepSeek-R1研究论文:Incentivizing Reasoning Capability in LLMs via RL

【免费下载链接】DeepSeek-R1 【免费下载链接】DeepSeek-R1 项目地址: https://gitcode.com/gh_mirrors/de/DeepSeek-R1

1. Introduction

DeepSeek-R1是一项突破性的研究成果,它通过强化学习(Reinforcement Learning, RL)来激励大型语言模型(Large Language Models, LLMs)的推理能力。该研究首次验证了仅通过RL就能激发LLMs的推理能力,而无需监督微调(Supervised Fine-Tuning, SFT)作为初步步骤。这一突破为未来的LLMs研究铺平了道路。

DeepSeek-R1系列模型包括DeepSeek-R1-Zero和DeepSeek-R1。其中,DeepSeek-R1-Zero是直接在基础模型上应用RL训练得到的,展现出了自验证、反思和生成长链思维(Chain-of-Thought, CoT)等强大能力。为了解决DeepSeek-R1-Zero存在的无限重复、可读性差和语言混合等问题,并进一步提升推理性能,研究人员在RL之前引入了冷启动数据,开发出了性能更优的DeepSeek-R1模型。

为支持研究社区,DeepSeek团队开源了DeepSeek-R1-Zero、DeepSeek-R1以及基于Llama和Qwen从DeepSeek-R1蒸馏得到的六个密集模型。其中,DeepSeek-R1-Distill-Qwen-32B在各种基准测试中表现优于OpenAI-o1-mini,为密集模型树立了新的技术标杆。

官方文档:README.md

2. Model Architecture and Training Pipeline

2.1 Model Architecture

DeepSeek-R1和DeepSeek-R1-Zero均基于DeepSeek-V3-Base模型构建。DeepSeek-V3采用了混合专家(Mixture of Experts, MoE)架构,总参数量为671B,激活参数量为37B,上下文长度为128K。这种架构设计使得模型在保持高性能的同时,有效控制了计算资源的消耗。

AI功能源码:DeepSeek-V3

2.2 Training Pipeline

DeepSeek-R1的训练管道包含两个RL阶段和两个SFT阶段:

  1. 第一阶段SFT:为模型的推理和非推理能力提供种子。
  2. 第一阶段RL:发现改进的推理模式。
  3. 第二阶段SFT:进一步优化模型性能。
  4. 第二阶段RL:与人类偏好对齐。

mermaid

这种多阶段的训练管道设计,旨在充分激发模型的推理能力,同时确保其输出符合人类偏好。

3. Model Summary

3.1 DeepSeek-R1 Models

Model #Total Params #Activated Params Context Length Download
DeepSeek-R1-Zero 671B 37B 128K HuggingFace
DeepSeek-R1 671B 37B 128K HuggingFace

3.2 DeepSeek-R1-Distill Models

Model Base Model Download
DeepSeek-R1-Distill-Qwen-1.5B Qwen2.5-Math-1.5B HuggingFace
DeepSeek-R1-Distill-Qwen-7B Qwen2.5-Math-7B HuggingFace
DeepSeek-R1-Distill-Llama-8B Llama-3.1-8B HuggingFace
DeepSeek-R1-Distill-Qwen-14B Qwen2.5-14B HuggingFace
DeepSeek-R1-Distill-Qwen-32B Qwen2.5-32B HuggingFace
DeepSeek-R1-Distill-Llama-70B Llama-3.3-70B-Instruct HuggingFace

这些蒸馏模型基于开源模型(如Qwen2.5和Llama3系列),使用DeepSeek-R1生成的样本进行微调,在保持较小参数量的同时,实现了优异的推理性能。

4. Evaluation Results

DeepSeek-R1在数学、代码和推理任务上的性能可与OpenAI-o1相媲美。以下是DeepSeek-R1与其他主流模型在各项基准测试中的对比结果:

Benchmark Results

4.1 Main Model Performance

Category Benchmark (Metric) Claude-3.5-Sonnet-1022 GPT-4o 0513 DeepSeek V3 OpenAI o1-mini OpenAI o1-1217 DeepSeek R1
Architecture - - MoE - - MoE
# Activated Params - - 37B - - 37B
# Total Params - - 671B - - 671B
English MMLU (Pass@1) 88.3 87.2 88.5 85.2 91.8 90.8
MMLU-Redux (EM) 88.9 88.0 89.1 86.7 - 92.9
MMLU-Pro (EM) 78.0 72.6 75.9 80.3 - 84.0
DROP (3-shot F1) 88.3 83.7 91.6 83.9 90.2 92.2
IF-Eval (Prompt Strict) 86.5 84.3 86.1 84.8 - 83.3
GPQA-Diamond (Pass@1) 65.0 49.9 59.1 60.0 75.7 71.5
SimpleQA (Correct) 28.4 38.2 24.9 7.0 47.0 30.1
FRAMES (Acc.) 72.5 80.5 73.3 76.9 - 82.5
AlpacaEval2.0 (LC-winrate) 52.0 51.1 70.0 57.8 - 87.6
ArenaHard (GPT-4-1106) 85.2 80.4 85.5 92.0 - 92.3
Code LiveCodeBench (Pass@1-COT) 33.8 34.2 - 53.8 63.4 65.9
Codeforces (Percentile) 20.3 23.6 58.7 93.4 96.6 96.3
Codeforces (Rating) 717 759 1134 1820 2061 2029
SWE Verified (Resolved) 50.8 38.8 42.0 41.6 48.9 49.2
Aider-Polyglot (Acc.) 45.3 16.0 49.6 32.9 61.7 53.3
Math AIME 2024 (Pass@1) 16.0 9.3 39.2 63.6 79.2 79.8
MATH-500 (Pass@1) 78.3 74.6 90.2 90.0 96.4 97.3
CNMO 2024 (Pass@1) 13.1 10.8 43.2 67.6 - 78.8
Chinese CLUEWSC (EM) 85.4 87.9 90.9 89.9 - 92.8
C-Eval (EM) 76.7 76.0 86.5 68.9 - 91.8
C-SimpleQA (Correct) 55.4 58.7 68.0 40.3 - 63.7

4.2 Distilled Model Performance

Model AIME 2024 pass@1 AIME 2024 cons@64 MATH-500 pass@1 GPQA Diamond pass@1 LiveCodeBench pass@1 CodeForces rating
GPT-4o-0513 9.3 13.4 74.6 49.9 32.9 759
Claude-3.5-Sonnet-1022 16.0 26.7 78.3 65.0 38.9 717
o1-mini 63.6 80.0 90.0 60.0 53.8 1820
QwQ-32B-Preview 44.0 60.0 90.6 54.5 41.9 1316
DeepSeek-R1-Distill-Qwen-1.5B 28.9 52.7 83.9 33.8 16.9 954
DeepSeek-R1-Distill-Qwen-7B 55.5 83.3 92.8 49.1 37.6 1189
DeepSeek-R1-Distill-Qwen-14B 69.7 80.0 93.9 59.1 53.1 1481
DeepSeek-R1-Distill-Qwen-32B 72.6 83.3 94.3 62.1 57.2 1691
DeepSeek-R1-Distill-Llama-8B 50.4 80.0 89.1 49.0 39.6 1205
DeepSeek-R1-Distill-Llama-70B 70.0 86.7 94.5 65.2 57.5 1633

从上述结果可以看出,DeepSeek-R1在数学、代码和推理任务上均表现出优异性能,尤其在MMLU、DROP、LiveCodeBench等多项基准测试中名列前茅。蒸馏模型DeepSeek-R1-Distill-Qwen-32B和DeepSeek-R1-Distill-Llama-70B也展现出了令人印象深刻的性能,证明了蒸馏技术在保留原始模型性能方面的有效性。

社区教程:README.md

5. How to Run Locally

5.1 DeepSeek-R1 Models

运行DeepSeek-R1系列模型前,请先参考DeepSeek-V3仓库获取详细的模型架构信息和运行指南。目前,Hugging Face的Transformers库尚未直接支持DeepSeek-R1模型。

5.2 DeepSeek-R1-Distill Models

DeepSeek-R1-Distill模型可以像Qwen或Llama模型一样使用。例如,您可以使用vLLM轻松启动服务:

vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-32B --tensor-parallel-size 2 --max-model-len 32768 --enforce-eager

或者使用SGLang启动服务:

python3 -m sglang.launch_server --model deepseek-ai/DeepSeek-R1-Distill-Qwen-32B --trust-remote-code --tp 2

5.3 Usage Recommendations

为获得最佳性能,使用DeepSeek-R1系列模型时建议遵循以下配置:

  1. 将温度设置在0.5-0.7范围内(推荐0.6),以防止无限重复或不连贯的输出。
  2. 避免添加系统提示;所有指令都应包含在用户提示中。
  3. 对于数学问题,建议在提示中包含类似"请逐步推理,并将最终答案放在\boxed{}中。"的指令。
  4. 评估模型性能时,建议进行多次测试并取平均值。

此外,为确保模型进行充分推理,建议强制模型在每个输出的开头以"<think>\n"开始响应。

6. License

DeepSeek-R1代码仓库和模型权重均采用MIT License授权。DeepSeek-R1系列支持商业使用,允许任何修改和衍生作品,包括但不限于蒸馏以训练其他LLMs。请注意:

  • DeepSeek-R1-Distill-Qwen-1.5B、DeepSeek-R1-Distill-Qwen-7B、DeepSeek-R1-Distill-Qwen-14B和DeepSeek-R1-Distill-Qwen-32B衍生自Qwen-2.5系列,其原始许可证为Apache 2.0 License
  • DeepSeek-R1-Distill-Llama-8B衍生自Llama3.1-8B-Base,原始许可证为Llama3.1 license
  • DeepSeek-R1-Distill-Llama-70B衍生自Llama3.3-70B-Instruct,原始许可证为Llama3.3 license

7. Citation

如果您在研究中使用了DeepSeek-R1,请引用以下论文:

@misc{deepseekai2025deepseekr1incentivizingreasoningcapability,
      title={DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning}, 
      author={DeepSeek-AI},
      year={2025},
      eprint={2501.12948},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2501.12948}, 
}

8. Contact

如有任何问题,请提交issue或联系我们:service@deepseek.com。

【免费下载链接】DeepSeek-R1 【免费下载链接】DeepSeek-R1 项目地址: https://gitcode.com/gh_mirrors/de/DeepSeek-R1

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐