Tokenizer
×Encode each prompt as a sequence of token IDs.
- out
- [B batch, T positions]
Explanation
The reference generator wraps each prompt in the tokenizer’s chat template (generate.py 150), but this release ships none (its card, README 98): the card builds the prompt string with encode_messages from encoding/encoding_dsv32.py and encodes it with the tokenizer (README 75–92). Token IDs index a vocabulary of 129,280 entries; counts the tokens.
Sources
In codetokenizer.apply_chat_template
Direct evidence
The reference generator loads the checkpoint’s tokenizer with Hugging Face AutoTokenizer and encodes each prompt through its chat template. The tokenizer’s vocabulary and rules ship with the checkpoint; these sources do not include them.
generate.py 117–150 ↗ · deepseek-ai/DeepSeek-V3.2 @ a7e62ac04ecb
Excerpt
tokenizer = AutoTokenizer.from_pretrained(ckpt_path)… lines 118–149 omitted …
prompt_tokens = [tokenizer.apply_chat_template([{"role": "user", "content": prompt}], add_generation_prompt=True) for prompt in prompts]The model card: the release ships no Jinja chat template; a prompt string is built from the messages by encode_messages in encoding/encoding_dsv32.py and encoded with the tokenizer.
README.md 69–98 ↗ · deepseek-ai/DeepSeek-V3.2 @ a7e62ac04ecb
Excerpt
To assist the community in understanding and adapting to this new template, we have provided a dedicated `encoding` folder, which contains Python scripts and test cases demonstrating how to encode messages in OpenAI-compatible format into input strings for the model and how to parse the model's text output.… lines 70–74 omitted …
# encoding/encoding_dsv32.py
from encoding_dsv32 import encode_messages, parse_message_from_completion_text
tokenizer = transformers.AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V3.2")
messages = [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "Hello! I am DeepSeek.", "reasoning_content": "thinking..."},
{"role": "user", "content": "1+1=?"}
]
encode_config = dict(thinking_mode="thinking", drop_thinking=True, add_default_bos_token=True)
# messages -> string
prompt = encode_messages(messages, **encode_config)
# Output: "<|begin▁of▁sentence|><|User|>hello<|Assistant|></think>Hello! I am DeepSeek.<|end▁of▁sentence|><|User|>1+1=?<|Assistant|><think>"
# string -> tokens
tokens = tokenizer.encode(prompt)… lines 93–97 omitted …
1. This release does not include a Jinja-format chat template. Please refer to the Python code mentioned above.The released 671B configuration: width, layers, dense layers, heads, experts and routing, MLA ranks and head widths, indexer heads and top-k.
config_671B_v3.2.json 1–26 ↗ · deepseek-ai/DeepSeek-V3.2 @ a7e62ac04ecb
Excerpt
{
"vocab_size": 129280,
"dim": 7168,
"inter_dim": 18432,
"moe_inter_dim": 2048,
"n_layers": 61,
"n_dense_layers": 3,
"n_heads": 128,
"n_routed_experts": 256,
"n_shared_experts": 1,
"n_activated_experts": 8,
"n_expert_groups": 8,
"n_limited_groups": 4,
"route_scale": 2.5,
"score_func": "sigmoid",
"q_lora_rank": 1536,
"kv_lora_rank": 512,
"qk_nope_head_dim": 128,
"qk_rope_head_dim": 64,
"v_head_dim": 128,
"dtype": "fp8",
"scale_fmt": "ue8m0",
"index_n_heads": 64,
"index_head_dim": 128,
"index_topk": 2048
}