DeepSeek-V3.1 是一款混合模型,同时支持思考模式与非思考模式。相较于上一版本,本次升级在多个方面带来了改进:
混合思考模式:通过切换对话模板,单一模型即可支持思考模式与非思考模式。
更智能的工具调用:经过训练后优化,模型在工具使用和智能体任务上的表现得到显著提升。
更高的思考效率:DeepSeek-V3.1-Think 能够达到与 DeepSeek-R1-0528 相当的回答质量,同时响应速度更快。
DeepSeek-V3.1 是在 DeepSeek-V3.1-Base 的基础上进行训练后优化得到的。DeepSeek-V3.1-Base 则是在原始 V3 基础模型 checkpoint 之上,遵循原始 DeepSeek-V3 报告中阐述的方法,通过两阶段长上下文扩展方案构建而成。我们通过收集额外的长文档并大幅扩展两个训练阶段来扩充数据集。32K 扩展阶段的训练数据量增加了 10 倍,达到 6300 亿 tokens;128K 扩展阶段的训练数据量扩展了 3.3 倍,达到 2090 亿 tokens。
此外,DeepSeek-V3.1 在训练时,模型权重和激活值均采用 UE8M0 FP8 精度数据格式,以确保与微缩放数据格式的兼容性。更多详情请参考 DeepGEMM。
| 模型 | 总参数量 | 激活参数量 | 上下文长度 | 下载链接 |
|---|---|---|---|---|
| DeepSeek-V3.1-Base | 6710 亿 | 370 亿 | 128K | HuggingFace | ModelScope |
| DeepSeek-V3.1 | 6710 亿 | 370 亿 | 128K | HuggingFace | ModelScope |
对话模板的详细信息描述于 tokenizer_config.json 和 assets/chat_template.jinja 文件中。以下是简要说明。
前缀:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>
借助给定的前缀,DeepSeek V3.1 能够以非思考模式对查询生成响应。与 DeepSeek V3 不同,该版本新增了一个额外的标记 </think>。
上下文:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|>superscript:{response}<|end▁of▁sentence|>...<|User|>{query}<|Assistant|>superscript:{response}<|end▁of▁sentence|>
前缀:
<|User|>{query}<|Assistant|>superscript:
通过将上下文与前缀进行拼接,我们即可得到该查询对应的正确提示词。
前缀:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>
思考模式的前缀与 DeepSeek-R1 类似。
上下文:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|>superscript:{response}<|end▁of▁sentence|>...<|User|>{query}<|Assistant|>superscript:{response}<|end▁of▁sentence|>
前缀:
<|User|>{query}<|Assistant|>superscript:
多轮对话模板与非思考模式下的多轮对话模板相同。这意味着最后一轮中的思考标记会被去除,但 </think> 会保留在上下文中的每一轮对话里。
非思考模式支持工具调用功能。其格式如下:
<|begin▁of▁sentence|>{system prompt}\n\n{tool_description}<|User|>{query}<|Assistant|>superscript: ,其中 tool_description 为
## Tools
You have access to the following tools:
### {tool_name1}
Description: {description}
Parameters: {json.dumps(parameters)}
IMPORTANT: ALWAYS adhere to this exact format for tool use:
<|tool▁calls▁begin|><|tool▁call▁begin|>tool_call_name<|tool▁sep|>tool_call_arguments<|tool▁call▁end|>{additional_tool_calls}<|tool▁calls▁end|>
Where:
- `tool_call_name` must be an exact match to one of the available tools
- `tool_call_arguments` must be valid JSON that strictly follows the tool's Parameters Schema
- For multiple tool calls, chain them directly without separators or spaces我们支持多种代码智能体框架。请参考上述工具调用格式创建您自己的代码智能体。示例可参见assets/code_agent_trajectory.html。
为支持搜索智能体,我们在思考模式中设计了特定的搜索工具调用格式。
对于需要访问外部信息或最新资讯的复杂问题,DeepSeek-V3.1 可通过多轮工具调用流程,利用用户提供的搜索工具来获取答案。
详细模板请参考assets/search_tool_trajectory.html和assets/search_python_tool_trajectory.html。
| 类别 | 评测基准(指标) | DeepSeek V3.1-NonThinking | DeepSeek V3 0324 | DeepSeek V3.1-Thinking | DeepSeek R1 0528 |
|---|---|---|---|---|---|
| 通用能力 | |||||
| MMLU-Redux(精确匹配) | 91.8 | 90.5 | 93.7 | 93.4 | |
| MMLU-Pro(精确匹配) | 83.7 | 81.2 | 84.8 | 85.0 | |
| GPQA-Diamond(Pass@1) | 74.9 | 68.4 | 80.1 | 81.0 | |
| Humanity's Last Exam(Pass@1) | - | - | 15.9 | 17.7 | |
| 搜索智能体 | |||||
| BrowseComp | - | - | 30.0 | 8.9 | |
| BrowseComp_zh | - | - | 49.2 | 35.7 | |
| Humanity's Last Exam(Python + 搜索) | - | - | 29.8 | 24.8 | |
| SimpleQA | - | - | 93.4 | 92.3 | |
| 代码能力 | |||||
| LiveCodeBench(2408-2505)(Pass@1) | 56.4 | 43.0 | 74.8 | 73.3 | |
| Codeforces-Div1(Rating) | - | - | 2091 | 1930 | |
| Aider-Polyglot(准确率) | 68.4 | 55.1 | 76.3 | 71.6 | |
| 代码智能体 | |||||
| SWE Verified(智能体模式) | 66.0 | 45.4 | - | 44.6 | |
| SWE-bench Multilingual(智能体模式) | 54.5 | 29.3 | - | 30.5 | |
| Terminal-bench(Terminus 1 框架) | 31.3 | 13.3 | - | 5.7 | |
| 数学能力 | |||||
| AIME 2024(Pass@1) | 66.3 | 59.4 | 93.1 | 91.4 | |
| AIME 2025(Pass@1) | 49.8 | 51.3 | 88.4 | 87.5 | |
| HMMT 2025(Pass@1) | 33.5 | 29.2 | 84.2 | 79.4 |
注:
import transformers
tokenizer = transformers.AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V3.1")
messages = [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Who are you?"},
{"role": "assistant", "content": "<think>Hmm</think>I am DeepSeek"},
{"role": "user", "content": "1+1=?"}
]
tokenizer.apply_chat_template(messages, tokenize=False, thinking=True, add_generation_prompt=True)
# '<|begin▁of▁sentence|>You are a helpful assistant<|User|>Who are you?<|Assistant|></think>I am DeepSeek<|end▁of▁sentence|><|User|>1+1=?<|Assistant|><think>'
tokenizer.apply_chat_template(messages, tokenize=False, thinking=False, add_generation_prompt=True)
# '<|begin▁of▁sentence|>You are a helpful assistant<|User|>Who are you?<|Assistant|></think>I am DeepSeek<|end▁of▁sentence|><|User|>1+1=?<|Assistant|></think>'DeepSeek-V3.1 的模型结构与 DeepSeek-V3 一致。有关本地运行此模型的更多信息,请访问 DeepSeek-V3 代码库。
使用建议:
mlp.gate.e_score_correction_bias 参数应采用 FP32 精度加载和计算。本代码库及模型权重采用 MIT 许可证 授权。
@misc{deepseekai2024deepseekv3technicalreport,
title={DeepSeek-V3 Technical Report},
author={DeepSeek-AI},
year={2024},
eprint={2412.19437},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.19437},
}若您有任何疑问,请提交 issue 或通过 service@deepseek.com 与我们联系。