DeepSeek-V3.1

介绍

DeepSeek-V3.1 是一个支持思考模式和非思考模式的混合模型。与之前的版本相比,这次升级在多个方面带来了改进:

  • 混合思考模式:通过更改聊天模板,一个模型可以同时支持思考模式和非思考模式。
  • 更智能的工具调用:通过后训练优化,模型在工具使用和代理任务方面的性能显著提高。
  • 更高的思考效率:DeepSeek-V3.1-Think 在回答质量上与 DeepSeek-R1-0528 相当,但响应速度更快。

DeepSeek-V3.1 是在 DeepSeek-V3.1-Base 的基础上进行后训练得到的,后者通过两阶段长上下文扩展方法基于原始 V3 基础检查点构建,遵循了原始 DeepSeek-V3 报告中概述的方法。我们通过收集额外的长文档并大幅扩展两个训练阶段来扩大了我们的数据集。32K 扩展阶段已增加了 10 倍至 630B tokens,而 128K 扩展阶段则增加了 3.3 倍至 209B tokens。此外,DeepSeek-V3.1 使用 UE8M0 FP8 格式的数据进行训练,以确保与微缩放数据格式兼容。

模型下载

模型总参数数激活参数数上下文长度下载
DeepSeek-V3.1-Base671B37B128KHuggingFace | ModelScope
DeepSeek-V3.1671B37B128KHuggingFace | ModelScope

聊天模板

我们的聊天模板详情见 tokenizer_config.json 和 assets/chat_template.jinja。这里是一个简要描述。

非思考模式

第一回合

前缀: <|begin▁of▁sentence|>{系统提示}<|User|>{查询}<|Assistant|> </think>

给定此前缀,DeepSeek V3.1 在非思考模式下生成对查询的响应。与 DeepSeek V3 不同,它引入了一个额外的标记 </think>

多回合

上下文: <|begin▁of▁sentence|>{系统提示}<|User|>{查询}<|Assistant|> </think>{响应}<|end▁of▁sentence|>...<|User|>{查询}<|Assistant|> </think>{响应}<|end▁of▁sentence|>

前缀: <|User|>{查询}<|Assistant|> </think>

通过将上下文和前缀连接起来,我们获得了正确的查询提示。

思考模式

第一回合

前缀: <|begin▁of▁sentence|>{系统提示}<|User|>{查询}<|Assistant|><think>

思考模式的前缀类似于 DeepSeek-R1。

多回合

上下文: <|begin▁of▁sentence|>{系统提示}<|User|>{查询}<|Assistant|> </think>{响应}<|end▁of▁sentence|>...<|User|>{查询}<|Assistant|> </think>{响应}<|end▁of▁sentence|>

前缀: <|User|>{查询}<|Assistant|><think>

多回合模板与非思考模式下的多回合聊天模板相同。这意味着最后一轮中的思考标记将被删除,但在每轮上下文中都保留 </think>

工具调用

工具调用支持在非思考模式下使用。格式为:

<|begin▁of▁sentence|>{系统提示}\n\n{工具描述}<|User|>{查询}<|Assistant|> </think> 其中工具描述是

## 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-非思考DeepSeek V3 0324DeepSeek V3.1-思考DeepSeek R1 0528
通用
MMLU-Redux (EM)91.890.593.793.4
MMLU-Pro (EM)83.781.284.885.0
GPQA-Diamond (Pass@1)74.968.480.181.0
人类最后的考试 (Pass@1)15.917.7
搜索代理
BrowseComp30.08.9
BrowseComp_zh49.235.7
人类最后的考试 (Python + 搜索)29.824.8
SimpleQA93.492.3
代码
LiveCodeBench (2408-2505) (Pass@1)56.443.074.873.3
Codeforces-Div1 (评分)20911930
Aider-Polyglot (准确率)68.455.176.371.6
代码代理
SWE 验证 (代理模式)66.045.444.6
SWE-bench 多语言 (代理模式)54.529.330.5
Terminal-bench (Terminus 1 框架)31.313.35.7
数学
AIME 2024 (Pass@1)66.359.493.191.4
AIME 2025 (Pass@1)49.851.388.487.5
HMMT 2025 (Pass@1)33.529.284.279.4

注释:

  • 搜索代理使用我们的内部搜索框架进行评估,该框架使用商业搜索 API + 网页过滤器 + 128K 上下文窗口。R1-0528 的搜索代理结果是通过预定义的工作流进行评估的。
  • SWE-bench 使用我们的内部代码代理框架进行评估。
  • HLE 使用仅文本子集进行评估。

使用示例

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 仓库。

许可

本仓库和模型权重根据 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}, 
}

联系我们

如果您有任何问题,请提出问题或通过 service@deepseek.com 与我们联系。

原创文章,转载请注明: 转载自诺德美地科技

本文链接地址: DeepSeek-V3.1

发表评论