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 倍,达到 630B tokens,而 128K 扩展阶段的训练量则扩展了 3.3 倍,达到 209B tokens。
此外,DeepSeek-V3.1 在训练时,模型权重和激活值均采用 UE8M0 FP8 数据格式,以确保与微缩放数据格式的兼容性。更多详情请参考 DeepGEMM。
| 模型 | 总参数量 | 激活参数量 | 上下文长度 | 下载链接 |
|---|---|---|---|---|
| DeepSeek-V3.1-Base | 671B | 37B | 128K | HuggingFace | ModelScope |
| DeepSeek-V3.1 | 671B | 37B | 128K | HuggingFace | ModelScope |
对话模板的详细信息描述于 tokenizer_config.json 和 assets/chat_template.jinja 文件中。以下是简要说明。
前缀:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>
在给定前缀的情况下,DeepSeek V3.1 以非思考模式生成查询回复。与 DeepSeek V3 不同,它新增了一个额外的标记 <RichMediaReference>。
上下文:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>{response}<|end▁of▁sentence|>...<|User|>{query}<|Assistant|>superscript:{response}<|end▁of▁sentence|>
前缀:
<|User|>{query}<|Assistant|></think>
通过将上下文与前缀拼接,即可得到该查询的正确提示词。
前缀:
<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|>superscript:
思考模式的前缀与 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(评分) | - | - | 2091 | 1930 | |
| Aider-Polyglot(准确率) | 68.4 | 55.1 | 76.3 | 71.6 | |
| 代码智能体 | |||||
| SWE Verified(智能体模式) | 66.0 | 45.4 | - | 44.6 | |
| SWE-bench 多语言(智能体模式) | 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 与我们联系。