ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

need ignore_empty_think when training Qwen3.5?

Open bingnoi77 opened this issue 8 months ago • 5 comments

Checklist / 检查清单

  • [x] I have searched existing issues, and this is a new question or discussion topic. / 我已经搜索过现有的 issues,确认这是一个新的问题与讨论。

Question Description / 问题描述

当训练千问 3.5 纯文本的部分,例如同时使用Qwen3的推理和非推理语料,是否需要加上这个标签来跟原始的基座能力对齐? --loss_scale ignore_empty_think \

When training the Qwen 3.5 base model on pure text data—where both reasoning corpus and non-reasoning corpus coexist—do we need to add this label to align with the original base model capabilities?

bingnoi77 avatar Mar 05 '26 04:03 bingnoi77

因为我们发现当不做类似处理的时候,训完的模型会出现enable_thinking=false的时候,模型依旧会输出思考内容。This is because we found that without such processing, the trained model still outputs thinking content even when enable_thinking=false.

bingnoi avatar Mar 05 '26 06:03 bingnoi

Checklist / 检查清单

  • [x] I have searched existing issues, and this is a new question or discussion topic. / 我已经搜索过现有的 issues,确认这是一个新的问题与讨论。

Question Description / 问题描述

当训练千问 3.5 纯文本的部分,例如同时使用Qwen3的推理和非推理语料,是否需要加上这个标签来跟原始的基座能力对齐? --loss_scale ignore_empty_think \

When training the Qwen 3.5 base model on pure text data—where both reasoning corpus and non-reasoning corpus coexist—do we need to add this label to align with the original base model capabilities?

就是空思考部分 不计算损失。避免enable_thinking为True时,以为前缀时,不会因为非思考数据的</think>导致干扰。

Jintao-Huang avatar Mar 05 '26 07:03 Jintao-Huang

那加add_non_thinking_prefix true,但是不加ignore_empty_think,sft阶段会算<think>\n\n</think>这部分的loss吗。因为我们发现开了add_non_thinking_prefix true,但是不开ignore_empty_think,在Qwen3.5-35B的时候会造成模型非推模式也输出思考内容,但是在Qwen3.5-122B的时候却没有这种现象。

bingnoi77 avatar Mar 06 '26 02:03 bingnoi77

This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.

github-actions[bot] avatar Jun 05 '26 00:06 github-actions[bot]

补充一下:add_non_thinking_prefix 控制是否给无思考正文补空的 <think>...</think>;这段前缀是否算 loss,由 loss_scale 决定。训练混合思考数据时可以显式写:

--add_non_thinking_prefix true \
--loss_scale default+ignore_empty_think

这样无思考样本的空 think 段不算 loss,有内容的思考段仍参与训练。它不会单独保证模型在推理时关闭思考,推理侧还要确认实际送入模型的 chat template / enable_thinking 设置。

版本也有区别:当前文档说明 4.3.1 起混合思考模型默认追加 ignore_empty_think;旧版需要手动指定,不能只看 add_non_thinking_prefix=true 就判断空段是否参与训练。见参数说明。

yyh-sjtu avatar Nov 02 '26 18:11 yyh-sjtu