DeepSeek-R1 蒸馏前后 Qwen Tokenizer 的变化

DeepSeek-R1 蒸馏前后 Qwen Tokenizer 的变化

作者:木尧

原文:https://zhuanlan.zhihu.com/p/23524663411

图片

根据 DeepSeek-R1 的论文,DeepSeek-R1-Distill-Qwen-32B 是基于 Qwen2.5-32B 预训练 base 模型进行蒸馏 SFT 训练,而不是基于 Qwen2.5-32B-Instruct 的 chat 模型。

Qwen2.5-32B

:https://modelscope.cn/models/Qwen/Qwen2.5-32B
Qwen2.5-32B-Instruct:https://modelscope.cn/models/Qwen/Qwen2.5-32B-Instruct
DeepSeek-R1-Distill-Qwen-32B:https://modelscope.cn/models/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B

接下来对比这三个开源模型的几个主要配置文件,并分析 tokenizer 的异同,最后实测 chat 模版及 special token。

配置对比:config.json

图片

结论:相比 base 模型,DeepSeek 蒸馏前后无变化。

配置对比:tokenizer_config.json

结论:蒸馏前后,tokenizer 配置文件变化较大,如图。

    • 更改了 bos_token、eos_token、pad_token

    • tokenizer_class 由 Qwen2Tokenizer 更改为 LlamaTokenizerFast

    • chat_templete 也沿用了 DeepSeek 的模版

图片

补充:Qwen 本身 base 和 instruct 模型相比基本一致,除了 instruct 模型在 chat_template 里的默认 system 里加了“You are Qwen, created by Alibaba Cloud. ”

先看下 Qwen 的 chat 模版

{%- iftools%}
    {
  {-'<|im_start|>system\n'}}
    {%- ifmessages[0]['role']=='system'%}
        {
  {-messages[0]['content']}}
    {%- else%}
        {
  {-'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.'}}
    {%- endif%}
    {
  {-"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>"}}
    {%- fortoolintools%}
        {
  {-"\n"}}
        {
  {-tool|tojson}}
    {%- endfor%}
    {
  {-"\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

强化学习曾小健

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值