fix: match qwen3-thinking double-newline in train_on_responses_only response pattern - #6926
Conversation
…ttern The Qwen3-thinking chat template generates `<think>\n\n` (double newline) after the think tag, but `train_on_responses_only` was looking for `<think>\n` (single newline). `\n\n` is token 271 while `\n` is token 198 -- different tokens, so the pattern match in `train_on_responses_only` fails, masking ALL tokens and dropping 100% of training samples. Update the response pattern from `<think>\n` to `<think>\n\n` to match what the actual qwen3-thinking template generates. Fixes unslothai#6919
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
could repro this on my end too @Etherll |
|
Just added a comment here #6919 (comment) that this approach (matching double newline) breaks things if I think matching It also might just be easiest to set |
I agree |
…esponse pattern (unslothai#6926) * fix: match qwen3-thinking chat template double-newline in response pattern The Qwen3-thinking chat template generates `<think>\n\n` (double newline) after the think tag, but `train_on_responses_only` was looking for `<think>\n` (single newline). `\n\n` is token 271 while `\n` is token 198 -- different tokens, so the pattern match in `train_on_responses_only` fails, masking ALL tokens and dropping 100% of training samples. Update the response pattern from `<think>\n` to `<think>\n\n` to match what the actual qwen3-thinking template generates. Fixes unslothai#6919 * fix qwen3 thinking response marker --------- Co-authored-by: Ayushman Paul <ayushman@HP> Co-authored-by: Etherll <61019402+Etherll@users.noreply.github.com>
What broke
The Qwen3-thinking chat template produces
<think>\n\n(double newline) after the<think>tag. The tokenizer merges\n\ninto token ID 271, while\nalone is token ID 198.train_on_responses_onlyin the Studio was searching for<think>\n(token 198) as the response start pattern. Since the actual tokenized text contains token 271 at that position, the pattern never matched. Every training sample had ALL tokens masked as-100, causing 100% of samples to be dropped.Minimal repro
Fix
One-character change in
model_mappings.pythat is to add the missing\nto match the actual template output:File:
studio/backend/utils/datasets/model_mappings.py:490Branch:
fix/6919-qwen3-thinking-response-patternFixes #6919