Skip to content

If the model generates </think> token in the thoughts it breaks the generation #7066

Closed

Description

@Eridict

Note: Please do not remove the questions. Answer beside them.

  1. Did you update? pip install --upgrade unsloth unsloth_zoo
  2. Yes, updated 10.7.2026
  3. Colab or Kaggle or local / cloud
  4. local
  5. Number GPUs used, use nvidia-smi
  6. 1, 5070Ti, mobile version
  7. Which notebook? Please link!
  8. Which Unsloth version, TRL version, transformers version, PyTorch version?
  9. v0.1.481-beta, trl who knows, transformers 5.5/5.3 pre-installed as installer says, pytorch whoknows torchao 0.17 installed by the curl update of unsloth
    Inference.

Model cannot deal with scripts like training scripts with included within, breaks thinking blocks and the whole chat at times. tested with Qwen3.6 35b a3b Q8

Image

Activity

  1. Eridict commented on Jul 18, 2026

    @Eridict
    Author

    Little update, the chat also does not like generating things like <|im_start|>, using it to make scripts for these sorts of things is not viable.

  2. Souravrajvi0 commented on Jul 22, 2026

    @Souravrajvi0
    Contributor

    Thanks for the extra detail about <|im_start|> — we did take that into account in the fix.

    PR: #7334

    What this PR covers

    • Literal </think> (and <think>) breaking the thinking block — the main report / screenshot case.
    • <|im_start|> / <|im_end|> in user / system / tool text: those markers are neutralized before the prompt is built, so pasting ChatML-style script text into the chat no longer injects real turn delimiters into the template / thinking path.

    What it does not fully solve yet

    If the model itself generates raw <|im_start|> / <|im_end|> inside an assistant answer (e.g. writing a training script), that can still interact badly with stop sequences or the next turn’s chat template. That’s a related but separate “control tokens in model output” problem from the mid-thought </think> close. Happy to follow up on that path if it still breaks for you after this PR.

    If you can try the PR build (or the next Studio release that includes it) with:

    1. a user message that contains </think>, and
    2. a prompt/script paste that contains <|im_start|>,

    and report whether thinking/chat still breaks, that would help a lot.

  3. added a commit that references this issue on Jul 23, 2026
    f49e2ae
  4. added 9 commits that reference this issue on Jul 24, 2026
    43a497c
    40aa31f
    ed609f1
    5a3e3fb
    dea1a95
    e16cf4c
    11974cf
    4108c47
    ca4bdc8
  5. 35 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions