shimmyshimmer commited on
Commit
eb6951f
·
verified ·
1 Parent(s): 0ac5de2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +224 -3
README.md CHANGED
@@ -1,3 +1,224 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: transformers
4
+ base_model:
5
+ - deepseek-ai/DeepSeek-V3.1
6
+ tags:
7
+ - deepseek
8
+ - unsloth
9
+ ---
10
+ # DeepSeek-V3.1
11
+
12
+ <!-- markdownlint-disable first-line-h1 -->
13
+ <!-- markdownlint-disable html -->
14
+ <!-- markdownlint-disable no-duplicate-header -->
15
+
16
+ <div align="center">
17
+ <img src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/logo.svg?raw=true" width="60%" alt="DeepSeek-V3" />
18
+ </div>
19
+ <hr>
20
+ <div align="center" style="line-height: 1;">
21
+ <a href="https://www.deepseek.com/" target="_blank" style="margin: 2px;">
22
+ <img alt="Homepage" src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/badge.svg?raw=true" style="display: inline-block; vertical-align: middle;"/>
23
+ </a>
24
+ <a href="https://chat.deepseek.com/" target="_blank" style="margin: 2px;">
25
+ <img alt="Chat" src="https://img.shields.io/badge/🤖%20Chat-DeepSeek%20V3-536af5?color=536af5&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
26
+ </a>
27
+ <a href="https://huggingface.co/deepseek-ai" target="_blank" style="margin: 2px;">
28
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DeepSeek%20AI-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
29
+ </a>
30
+ </div>
31
+
32
+ <div align="center" style="line-height: 1;">
33
+ <a href="https://discord.gg/Tc7c45Zzu5" target="_blank" style="margin: 2px;">
34
+ <img alt="Discord" src="https://img.shields.io/badge/Discord-DeepSeek%20AI-7289da?logo=discord&logoColor=white&color=7289da" style="display: inline-block; vertical-align: middle;"/>
35
+ </a>
36
+ <a href="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/qr.jpeg?raw=true" target="_blank" style="margin: 2px;">
37
+ <img alt="Wechat" src="https://img.shields.io/badge/WeChat-DeepSeek%20AI-brightgreen?logo=wechat&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
38
+ </a>
39
+ <a href="https://twitter.com/deepseek_ai" target="_blank" style="margin: 2px;">
40
+ <img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-deepseek_ai-white?logo=x&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
41
+ </a>
42
+ </div>
43
+
44
+ <div align="center" style="line-height: 1;">
45
+ <a href="LICENSE" style="margin: 2px;">
46
+ <img alt="License" src="https://img.shields.io/badge/License-MIT-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
47
+ </a>
48
+ </div>
49
+
50
+ ## Introduction
51
+
52
+ DeepSeek-V3.1 is a hybrid model that supports both thinking mode and non-thinking mode. Compared to the previous version, this upgrade brings improvements in multiple aspects:
53
+
54
+ - **Hybrid thinking mode**: One model supports both thinking mode and non-thinking mode by changing the chat template.
55
+
56
+ - **Smarter tool calling**: Through post-training optimization, the model's performance in tool usage and agent tasks has significantly improved.
57
+
58
+ - **Higher thinking efficiency**: DeepSeek-V3.1-Think achieves comparable answer quality to DeepSeek-R1-0528, while responding more quickly.
59
+
60
+ DeepSeek-V3.1 is post-trained on the top of DeepSeek-V3.1-Base, which is built upon the original V3 base checkpoint through a two-phase long context extension approach, following the methodology outlined in the original DeepSeek-V3 report. We have expanded our dataset by collecting additional long documents and substantially extending both training phases. The 32K extension phase has been increased 10-fold to 630B tokens, while the 128K extension phase has been extended by 3.3x to 209B tokens. Additionally, DeepSeek-V3.1 is trained using the UE8M0 FP8 scale data format to ensure compatibility with microscaling data formats.
61
+
62
+ ## Model Downloads
63
+
64
+ <div align="center">
65
+
66
+ | **Model** | **#Total Params** | **#Activated Params** | **Context Length** | **Download** |
67
+ | :------------: | :------------: | :------------: | :------------: | :------------: |
68
+ | DeepSeek-V3.1-Base | 671B | 37B | 128K | [HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-V3.1-Base) \| [ModelScope](https://modelscope.cn/models/deepseek-ai/DeepSeek-V3.1-Base) |
69
+ | DeepSeek-V3.1 | 671B | 37B | 128K | [HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-V3.1) \| [ModelScope](https://modelscope.cn/models/deepseek-ai/DeepSeek-V3.1) |
70
+
71
+ </div>
72
+
73
+ ## Chat Template
74
+
75
+ The details of our chat template is described in `tokenizer_config.json` and `assets/chat_template.jinja`. Here is a brief description.
76
+
77
+ ### Non-Thinking
78
+
79
+ #### First-Turn
80
+
81
+ Prefix:
82
+ `<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>`
83
+
84
+ With the given prefix, DeepSeek V3.1 generates responses to queries in non-thinking mode. Unlike DeepSeek V3, it introduces an additional token `</think>`.
85
+
86
+ #### Multi-Turn
87
+ Context:
88
+ `<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>{response}<|end▁of▁sentence|>...<|User|>{query}<|Assistant|></think>{response}<|end▁of▁sentence|>`
89
+
90
+ Prefix:
91
+ `<|User|>{query}<|Assistant��></think>`
92
+
93
+ By concatenating the context and the prefix, we obtain the correct prompt for the query.
94
+
95
+ ### Thinking
96
+
97
+ #### First-Turn
98
+ Prefix:
99
+ `<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|><think>`
100
+
101
+ The prefix of thinking mode is similar to DeepSeek-R1.
102
+
103
+
104
+ #### Multi-Turn
105
+ Context:
106
+ `<|begin▁of▁sentence|>{system prompt}<|User|>{query}<|Assistant|></think>{response}<|end▁of▁sentence|>...<|User|>{query}<|Assistant|></think>{response}<|end▁of▁sentence|>`
107
+
108
+ Prefix:
109
+ `<|User|>{query}<|Assistant|><think>`
110
+
111
+ The multi-turn template is the same with non-thinking multi-turn chat template. It means the thinking token in the last turn will be dropped but the `</think>` is retained in every turn of context.
112
+
113
+ ### ToolCall
114
+ Toolcall is supported in non-thinking mode. The format is:
115
+
116
+ `<|begin▁of▁sentence|>{system prompt}{tool_description}<|User|>{query}<|Assistant|></think>` where the tool_description is
117
+
118
+ ```
119
+ ## Tools
120
+ You have access to the following tools:
121
+
122
+ ### {tool_name1}
123
+ Description: {description}
124
+
125
+ Parameters: {json.dumps(parameters)}
126
+
127
+ IMPORTANT: ALWAYS adhere to this exact format for tool use:
128
+ <|tool▁calls▁begin|><|tool▁call▁begin|>tool_call_name<|tool▁sep|>tool_call_arguments<|tool▁call▁end|>{{additional_tool_calls}}<|tool▁calls▁end|>
129
+
130
+ Where:
131
+ - `tool_call_name` must be an exact match to one of the available tools
132
+ - `tool_call_arguments` must be valid JSON that strictly follows the tool's Parameters Schema
133
+ - For multiple tool calls, chain them directly without separators or spaces
134
+ ```
135
+
136
+ ### Code-Agent
137
+ We support various code agent frameworks. Please refer to the above toolcall format to create your own code agents. An example is shown in `assets/code_agent_trajectory.html`.
138
+
139
+ ### Search-Agent
140
+ We design a specific format for searching toolcall in thinking mode, to support search agent.
141
+
142
+ For complex questions that require accessing external or up-to-date information, DeepSeek-V3.1 can leverage a user-provided search tool through a multi-turn tool-calling process.
143
+
144
+ Please refer to the `assets/search_tool_trajectory.html` and `assets/search_python_tool_trajectory.html` for the detailed template.
145
+
146
+ ## Evaluation
147
+ | Category | Benchmark (Metric) | DeepSeek V3.1-NonThinking | DeepSeek V3 0324 | DeepSeek V3.1-Thinking | DeepSeek R1 0528
148
+ |----------|----------------------------------|-----------------|---|---|---|
149
+ | General |
150
+ | | MMLU-Redux (EM) | 91.8 | 90.5 | 93.7 | 93.4
151
+ | | MMLU-Pro (EM) | 83.7 | 81.2 | 84.8 | 85.0
152
+ | | GPQA-Diamond (Pass@1) | 74.9 | 68.4 | 80.1 | 81.0
153
+ | | Humanity's Last Exam (Pass@1) | - | - | 15.9 | 17.7
154
+ |Search Agent|
155
+ | | BrowseComp | - | - | 30.0 | 8.9
156
+ | | BrowseComp_zh | - | - | 49.2 | 35.7
157
+ | | Humanity's Last Exam (Python + Search) |- | - | 29.8 | 24.8
158
+ | | SimpleQA | - | - | 93.4 | 92.3
159
+ | Code |
160
+ | | LiveCodeBench (2408-2505) (Pass@1) | 56.4 | 43.0 | 74.8 | 73.3
161
+ | | Codeforces-Div1 (Rating) | - | - | 2091 | 1930
162
+ | | Aider-Polyglot (Acc.) | 68.4 | 55.1 | 76.3 | 71.6
163
+ | Code Agent|
164
+ | | SWE Verified (Agent mode) | 66.0 | 45.4 | - | 44.6
165
+ | | SWE-bench Multilingual (Agent mode) | 54.5 | 29.3 | - | 30.5
166
+ | | Terminal-bench (Terminus 1 framework) | 31.3 | 13.3 | - | 5.7
167
+ | Math |
168
+ | | AIME 2024 (Pass@1) | 66.3 | 59.4 | 93.1 | 91.4
169
+ | | AIME 2025 (Pass@1) | 49.8 | 51.3 | 88.4 | 87.5
170
+ | | HMMT 2025 (Pass@1) | 33.5 | 29.2 | 84.2 | 79.4 |
171
+
172
+ Note:
173
+ - Search agents are evaluated with our internal search framework, which uses a commercial search API + webpage filter + 128K context window. Seach agent results of R1-0528 are evaluated with a pre-defined workflow.
174
+
175
+ - SWE-bench is evaluated with our internal code agent framework.
176
+
177
+ - HLE is evaluated with the text-only subset.
178
+
179
+ ### Usage Example
180
+
181
+ ```python
182
+ import transformers
183
+
184
+ tokenizer = transformers.AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V3.1")
185
+
186
+ messages = [
187
+ {"role": "system", "content": "You are a helpful assistant"},
188
+ {"role": "user", "content": "Who are you?"},
189
+ {"role": "assistant", "content": "<think>Hmm</think>I am DeepSeek"},
190
+ {"role": "user", "content": "1+1=?"}
191
+ ]
192
+
193
+ tokenizer.apply_chat_template(messages, tokenize=False, thinking=True, add_generation_prompt=True)
194
+ # '<|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>'
195
+
196
+ tokenizer.apply_chat_template(messages, tokenize=False, thinking=False, add_generation_prompt=True)
197
+ # '<|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>'
198
+ ```
199
+
200
+ ## How to Run Locally
201
+
202
+ The model structure of DeepSeek-V3.1 is the same as DeepSeek-V3. Please visit [DeepSeek-V3](https://github.com/deepseek-ai/DeepSeek-V3) repo for more information about running this model locally.
203
+
204
+ ## License
205
+
206
+ This repository and the model weights are licensed under the [MIT License](LICENSE).
207
+
208
+ ## Citation
209
+
210
+ ```
211
+ @misc{deepseekai2024deepseekv3technicalreport,
212
+ title={DeepSeek-V3 Technical Report},
213
+ author={DeepSeek-AI},
214
+ year={2024},
215
+ eprint={2412.19437},
216
+ archivePrefix={arXiv},
217
+ primaryClass={cs.CL},
218
+ url={https://arxiv.org/abs/2412.19437},
219
+ }
220
+ ```
221
+
222
+ ## Contact
223
+
224
+ If you have any questions, please raise an issue or contact us at [[email protected]]([email protected]).