---desc: ​​deepseek-ai/DeepSeek-R1​,推测基于MoE或密集架构强化逻辑推理与多任务泛化能力,支持长文本理解与复杂问题解析。适配高性能服务器及分布式集群,兼容4/8-bit量化技术,适用科研分析、智能决策等高阶场景. support_training: 0 license: Apache License 2.0 dev_type:- notebook---# DeepSeek-R1## 1. 介绍我们介绍了我们的第一代推理模型,DeepSeek-R1 -Zero和DeepSeek-R1. DeepSeek-R1 -Zero是一个通过大规模强化学习(RL)训练的模型,没有监督微调(SFT)作为初始步骤,在推理方面表现出显著的性能。有了RL,DeepSeek-R1 -Zero自然会出现许多强大而有趣的推理行为。然而,DeepSeek-R1 -Zero遇到了诸如无休止的重复、可读性差和语言混合等挑战。为了解决这些问题并进一步提高推理性能,我们引入了DeepSeek-R1,它在RL之前合并了冷启动数据。DeepSeek-R1在数学、代码和推理任务方面的性能与OpenAI-o1相当。为了支持研究社区,我们开源了DeepSeek-R1 -Zero、DeepSeek-R1和六个基于Llama和Qwen的DeepSeok-R1的密集模型。DeepSeek-R1 -Distill-Qwen- 32B在各种基准测试中优于OpenAI-o1 -mini,为密集模型实现了新的最先进的结果。## 2. 模型摘要---**后训练:基础模型上的大规模强化学习**- 我们直接将强化学习(RL)应用于基础模型,而不依赖于监督微调(SFT)作为初始步骤。这种方法允许模型探索解决复杂问题的思维链(CoT),从而开发出DeepSeek-R1 -Zero.DeepSeek-R1 -Zero展示了自我验证、反射和生成长CoTs等功能,这是研究界的一个重要里程碑。值得注意的是,这是第一个公开的研究来验证LLM的推理能力可以完全通过RL来激励,而不需要SFT.这一突破为该领域的未来发展铺平了道路。- 我们引入我们的管道来开发DeepSeek-R1. 该管道包含两个RL阶段,旨在发现改进的推理模式并与人类偏好保持一致,以及两个SFT阶段,作为模型推理和非推理能力的种子。我们相信,该管道将通过创造更好的模式使行业受益。---**蒸馏:较小的模型也可以很强大**- 我们证明了较大模型的推理模式可以被提取到较小的模型中,与通过RL在小模型上发现的推理模式相比,具有更好的性能。开源DeepSeek-R1及其API将有利于研究社区在未来提取更好的小型模型。- 使用DeepSeek-R1生成的推理数据,我们对研究界广泛使用的几个密集模型进行了微调。评估结果表明,提取的较小密集模型在基准上表现得非常好。我们将基于Qwen2.5和Llama3系列的1.5B、7B、8B、14B、32B和70B检查点开源到社区。## 3. 模型下载### DeepSeek-R1型号<div align="center">| **模型** | **总参数数** | **激活参数数** | **上下文长度** | **下载** || :------------: | :------------: | :------------: | :------------: | :------------: || DeepSeek-R1-Zero | 671B | 37B | 128K | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26221?modelId=26221) || DeepSeek-R1 | 671B | 37B | 128K | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26219?modelId=26219) |</div>### DeepSeek-R1-Distill 模型<div align="center">| **模型** | **基础模型** | **下载** || :------------: | :------------: | :------------: || DeepSeek-R1-Distill-Qwen-1.5B | [Qwen2.5-Math-1.5B](https://aistudio.baidu.com/modelsdetail/26305?modelId=26305) | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26234?modelId=26234) || DeepSeek-R1-Distill-Qwen-7B | [Qwen2.5-Math-7B](https://aistudio.baidu.com/modelsdetail/26307?modelId=26307) | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26236?modelId=26236) || DeepSeek-R1-Distill-Llama-8B | [Llama-3.1-8B](https://aistudio.baidu.com/modelsdetail/25956?modelId=25956) | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26232?modelId=26232) || DeepSeek-R1-Distill-Qwen-14B | [Qwen2.5-14B](https://aistudio.baidu.com/modelsdetail/26294?modelId=26294) | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26233?modelId=26233) || DeepSeek-R1-Distill-Qwen-32B | [Qwen2.5-32B](https://aistudio.baidu.com/modelsdetail/26297?modelId=26297) | [🚀 PP飞桨](https://aistudio.baidu.com/modelsdetail/26235?modelId=26235) || DeepSeek-R1-Distill-Llama-70B | [Llama-3.3-70B-Instruct](https://aistudio.baidu.com/modelsdetail/26124?modelId=26124) | [🚀PP飞桨](https://aistudio.baidu.com/modelsdetail/26231?modelId=26231) |</div>DeepSeek-R1 -Distill模型基于开源模型进行微调,使用DeepSeek-R1生成的样本。我们稍微更改了它们的配置和标记器。请使用我们的设置来运行这些模型。## 4. 评估结果### DeepSeek-R1评估对于我们的所有模型,最大生成长度设置为32,768个令牌。对于需要采样的基准测试,我们使用的温度为$0.6$,top-p值为$0.95$,并为每个查询生成64个响应来估计pass@1。<div align="center">| Category | Benchmark (Metric) |克劳德 - 3.5 - 十四行诗 - 1022| GPT-4o 0513 | DeepSeek V3 | OpenAI o1-mini | OpenAI o1-1217 | DeepSeek R1 ||----------|-------------------|----------------------|------------|--------------|----------------|------------|--------------|| |建筑| - | - | MoE | - | - | MoE || |#激活参数| - | - | 37B | - | - | 37B || |#总参数| - | - | 671B | - | - | 671B || English |MMLU(通过@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** || |下降(3杆F1)| 88.3 | 83.7 | 91.6 | 83.9 | 90.2 | **92.2** || |IF-Eval(严格提示)| **86.5** | 84.3 | 86.1 | 84.8 | - | 83.3 || |GPQA- 菱形(通过@1)| 65.0 | 49.9 | 59.1 | 60.0 | **75.7** | 71.5 || |SimpleQA(正确)| 28.4 | 38.2 | 24.9 | 7.0 | **47.0** | 30.1 || |框架(附件)| 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(通过@1 -COT)| 33.8 | 34.2 | - | 53.8 | 63.4 | **65.9** || |Codeforces(百分比)| 20.3 | 23.6 | 58.7 | 93.4 | **96.6** | 96.3 || |Codeforces(评级)| 717 | 759 | 1134 | 1820 | **2061** | 2029 || |SWE已验证(已解决)| **50.8** | 38.8 | 42.0 | 41.6 | 48.9 | 49.2 || |多语言助手(Acc.)| 45.3 | 16.0 | 49.6 | 32.9 | **61.7** | 53.3 || Math |AIME 2024(通过@1)| 16.0 | 9.3 | 39.2 | 63.6 | 79.2 | **79.8** || |数学 - 500(通过@1)| 78.3 | 74.6 | 90.2 | 90.0 | 96.4 | **97.3** || |CNMO 2024(合格@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(正确)| 55.4 | 58.7 | **68.0** | 40.3 | - | 63.7 |</div>### 提取模型评估<div align="center">|模型| 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 ||克劳德 - 3.5 - 十四行诗 - 1022| 16.0 | 26.7 | 78.3 | 65.0 | 38.9 | 717 ||o1 - 迷你| 63.6 | 80.0 | 90.0 | 60.0 | 53.8 | **1820** ||QwQ- 32B- 预览| 44.0 | 60.0 | 90.6 | 54.5 | 41.9 | 1316 ||DeepSeek-R1 - 蒸馏 -Qwen- 1.5B| 28.9 | 52.7 | 83.9 | 33.8 | 16.9 | 954 ||DeepSeek-R1 - 蒸馏 -Qwen- 7B| 55.5 | 83.3 | 92.8 | 49.1 | 37.6 | 1189 ||DeepSeek-R1 - 蒸馏 -Qwen- 14B| 69.7 | 80.0 | 93.9 | 59.1 | 53.1 | 1481 ||DeepSeek-R1 - 蒸馏 -Qwen- 32B| **72.6** | 83.3 | 94.3 | 62.1 | 57.2 | 1691 ||DeepSeek-R1 - 蒸馏 -Llama- 8B| 50.4 | 80.0 | 89.1 | 49.0 | 39.6 | 1205 ||DeepSeek-R1 - 蒸馏 -Llama- 70B| 70.0 | **86.7** | **94.5** | **65.2** | **57.5** | 1633 |</div>## 5. API平台我们还在星河社区上提供与OpenAI兼容的API:[星河社区提供的大模型API服务](https://ai.baidu.com/ai-doc/AISTUDIO/rm344erns)## 6. 如何在本地运行### DeepSeek-R1 -Distill模型DeepSeek-R1 -Distill模型可以以与Qwen或Llama模型相同的方式使用。你可以通过以下代码,对DeepSeek-R1 -Distill进行调用:```pythonfrom paddlenlp.transformers import AutoModelForCausalLM, AutoTokenizer# 加载模型和分词器model_name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B"model = AutoModelForCausalLM.from_pretrained( model_name, dtype="bfloat16", # 根据硬件支持选择精度 tensor_parallel_degree=2, # 张量并行度 max_seq_len=32768)tokenizer = AutoTokenizer.from_pretrained(model_name)# 推理示例input_text = "中国的首都是哪里?"inputs = tokenizer(input_text, return_tensors="pd")outputs = model.generate( **inputs, max_length=100, decode_strategy="sampling", temperature=0.7)print(tokenizer.decode(outputs[0]))```### 使用建议**我们建议在使用DeepSeek-R1系列型号(包括基准测试)时遵循以下配置,以实现预期性能:**1. 将温度设置在0.5 - 0.7(建议0.6)的范围内,以防止无休止的重复或不连贯的输出。2. **避免添加系统提示;所有说明都应包含在用户提示中。**3. 对于数学问题,建议在提示中包含一条指令,例如:“请逐步推理,并将你的最终答案放在\box {} 中。”4. 在评估模型性能时,建议进行多次测试并对结果进行平均。此外,我们观察到DeepSeek-R1系列模型在响应某些查询时倾向于绕过思维模式(即输出“\\<think\>n\n</think\>”),这可能会对模型的性能产生不利影响。**To ensure that the model engages in thorough reasoning, we recommend enforcing the model to initiate its response with "\<think\>\n" at the beginning of every output.**### 官方提示在官方的DeepSeek web/app中,我们没有使用系统提示,而是为文件上传和网页搜索设计了两个特定的提示,以获得更好的用户体验。此外,web/app中的温度为0.6。对于文件上传,请按照模板创建提示,其中 {文件_名称}、 {文件_内容}和 {问题} 为参数。```file_template = \"""[file name]: {file_name}[file content begin]{file_content}[file content end]{question}"""```对于Web搜索, {搜索_结果}、 {当前_日期}和 {问题} 是参数。对于中文查询,我们使用提示:```search_answer_zh_template = \'''# 以下内容是基于用户发送的消息的搜索结果:{search_results}在我给你的搜索结果中,每个结果都是[webpage X begin]...[webpage X end]格式的,X代表每篇文章的数字索引。请在适当的情况下在句子末尾引用上下文。请按照引用编号[citation:X]的格式在答案中对应部分引用上下文。如果一句话源自多个上下文,请列出所有相关的引用编号,例如[citation:3][citation:5],切记不要将引用集中在最后返回引用编号,而是在答案对应部分列出。在回答时,请注意以下几点:- 今天是{cur_date}。- 并非搜索结果的所有内容都与用户的问题密切相关,你需要结合问题,对搜索结果进行甄别、筛选。- 对于列举类的问题(如列举所有航班信息),尽量将答案控制在10个要点以内,并告诉用户可以查看搜索来源、获得完整信息。优先提供信息完整、最相关的列举项;如非必要,不要主动告诉用户搜索结果未提供的内容。- 对于创作类的问题(如写论文),请务必在正文的段落中引用对应的参考编号,例如[citation:3][citation:5],不能只在文章末尾引用。你需要解读并概括用户的题目要求,选择合适的格式,充分利用搜索结果并抽取重要信息,生成符合用户要求、极具思想深度、富有创造力与专业性的答案。你的创作篇幅需要尽可能延长,对于每一个要点的论述要推测用户的意图,给出尽可能多角度的回答要点,且务必信息量大、论述详尽。- 如果回答很长,请尽量结构化、分段落总结。如果需要分点作答,尽量控制在5个点以内,并合并相关的内容。- 对于客观类的问答,如果问题的答案非常简短,可以适当补充一到两句相关信息,以丰富内容。- 你需要根据用户要求和回答内容选择合适、美观的回答格式,确保可读性强。- 你的回答应该综合多个相关网页来回答,不能重复引用一个网页。- 除非用户要求,否则你回答的语言需要和用户提问的语言保持一致。# 用户消息为:{question}'''```对于英语查询,我们使用提示符:```search_answer_en_template = \'''# The following contents are the search results related to the user's message:{search_results}In the search results I provide to you, each result is formatted as [webpage X begin]...[webpage X end], where X represents the numerical index of each article. Please cite the context at the end of the relevant sentence when appropriate. Use the citation format [citation:X] in the corresponding part of your answer. If a sentence is derived from multiple contexts, list all relevant citation numbers, such as [citation:3][citation:5]. Be sure not to cluster all citations at the end; instead, include them in the corresponding parts of the answer.When responding, please keep the following points in mind:- Today is {cur_date}.- Not all content in the search results is closely related to the user's question. You need to evaluate and filter the search results based on the question.- For listing-type questions (e.g., listing all flight information), try to limit the answer to 10 key points and inform the user that they can refer to the search sources for complete information. Prioritize providing the most complete and relevant items in the list. Avoid mentioning content not provided in the search results unless necessary.- For creative tasks (e.g., writing an essay), ensure that references are cited within the body of the text, such as [citation:3][citation:5], rather than only at the end of the text. You need to interpret and summarize the user's requirements, choose an appropriate format, fully utilize the search results, extract key information, and generate an answer that is insightful, creative, and professional. Extend the length of your response as much as possible, addressing each point in detail and from multiple perspectives, ensuring the content is rich and thorough.- If the response is lengthy, structure it well and summarize it in paragraphs. If a point-by-point format is needed, try to limit it to 5 points and merge related content.- For objective Q&A, if the answer is very brief, you may add one or two related sentences to enrich the content.- Choose an appropriate and visually appealing format for your response based on the user's requirements and the content of the answer, ensuring strong readability.- Your answer should synthesize information from multiple relevant webpages and avoid repeatedly citing the same webpage.- Unless the user requests otherwise, your response should be in the same language as the user's question.# The user's message is:{question}'''```## 7. 许可证此代码库和模型权重是根据许可的[MIT](https://github.com/deepseek-ai/DeepSeek-R1/blob/main/LICENSE)。DeepSeek-R1系列支持商业用途,允许任何修改和衍生工作,包括但不限于用于培训其他LLM的蒸馏。## 8. 引文```bibtex@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}, }```