[GH-ISSUE #10448] Qwen 3 requires removing <think>...</think> from previous messages #6869

Closed
opened 2026-04-12 18:42:26 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @taha-yassine on GitHub (Apr 28, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10448

What is the issue?

From the Hugging Face page:

No Thinking Content in History: In multi-turn conversations, the historical model output should only include the final output part and does not need to include the thinking content. It is implemented in the provided chat template in Jinja2. However, for frameworks that do not directly use the Jinja2 chat template, it is up to the developers to ensure that the best practice is followed.

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @taha-yassine on GitHub (Apr 28, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10448 ### What is the issue? From the Hugging Face page: >No Thinking Content in History: In multi-turn conversations, the historical model output should only include the final output part and does not need to include the thinking content. It is implemented in the provided chat template in Jinja2. However, for frameworks that do not directly use the Jinja2 chat template, it is up to the developers to ensure that the best practice is followed. ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-12 18:42:26 -05:00
Author
Owner

@rick-github commented on GitHub (Apr 28, 2025):

#8511

<!-- gh-comment-id:2837027908 --> @rick-github commented on GitHub (Apr 28, 2025): #8511
Author
Owner

@yebanliuying commented on GitHub (Apr 30, 2025):

It is necessary to handle think related content, otherwise for building an intelligent agent, it is just outputting a piece of content unrelated to the business

<!-- gh-comment-id:2840854541 --> @yebanliuying commented on GitHub (Apr 30, 2025): It is necessary to handle think related content, otherwise for building an intelligent agent, it is just outputting a piece of content unrelated to the business
Author
Owner

@rick-github commented on GitHub (Apr 30, 2025):

#10490

<!-- gh-comment-id:2841542032 --> @rick-github commented on GitHub (Apr 30, 2025): #10490
Author
Owner

@EaglePPP commented on GitHub (May 3, 2025):

#10490

I see that the PR is merged to main and published to version 0.6.7
How do we use it?
I have tested with qwen3 0.6 1.7 4b 8b, direct input doesnt work.

<!-- gh-comment-id:2848578951 --> @EaglePPP commented on GitHub (May 3, 2025): > [#10490](https://github.com/ollama/ollama/pull/10490) I see that the PR is merged to main and published to version 0.6.7 How do we use it? I have tested with qwen3 0.6 1.7 4b 8b, direct input doesnt work.
Author
Owner

@rick-github commented on GitHub (May 3, 2025):

There are no steps necessary to use it, it's now part of the prompt processing. If you want to see it in action, enable debugging in the server with OLLAMA_DEBUG=1 and compare the prompts from a chat session in 0.6.6 with a chat session in 0.6.7.

0.6.6

$ ollama:0.6.6 run qwen3:14b
>>> hello
<think>
Okay, the user said "hello". I need to respond appropriately. Let me check the guidelines. The response should be friendly and open-ended. Maybe ask how I can assist them. Keep it simple and welcoming. 
Avoid any technical jargon. Make sure to use proper punctuation and a friendly tone. Alright, something like "Hello! How can I assist you today?" That should work.
</think>

Hello! How can I assist you today? 😊

>>> bye
<think>
Okay, the user said "bye". I need to respond politely. Let me think. They might be ending the conversation, so a friendly goodbye is appropriate. Maybe add an emoji to keep it warm. "Have a great day! 😊" 
That sounds good. It's concise and positive. I should make sure not to add anything else since they're saying goodbye. Alright, that's the response.
</think>

Have a great day! 😊

>>> 
$ docker compose logs ollama | grep "chat request" | tail -1
ollama  | time=2025-05-03T14:23:52.863Z level=DEBUG source=routes.go:1523 msg="chat request" images=0 prompt="<|im_start|>user\nhello<|im_end|>\n
 <|im_start|>assistant\n<think>\nOkay, the user said \"hello\". I need to respond appropriately. Let me check the guidelines. The response should be friendly and open-ended. Maybe ask how I can assist them. Keep it simple and welcoming. Avoid any technical jargon. Make sure to use proper punctuation and a friendly tone. Alright, something like \"Hello! How can I assist you today?\" That should work.\n</think>\n\nHello! How can I assist you today? 😊<|im_end|>\n<|im_start|>user\nbye<|im_end|>\n<|im_start|>assistant\n"

0.6.7

$ ollama:0.6.7 run qwen3:14b
>>> hello
<think>
Okay, the user said "hello". I need to respond appropriately. Let me check the guidelines. The response should be friendly and open-ended. Maybe ask how I can assist them. Keep it simple and welcoming. 
Avoid any technical jargon. Make sure to use proper grammar and punctuation. Alright, that should work.
</think>

Hello! How can I assist you today? 😊

>>> bye
<think>
Okay, the user just said "bye" after I greeted them. I need to respond appropriately. Since they're ending the conversation, I should keep it friendly and open-ended in case they come back later. Maybe 
something like "See you later! Feel free to reach out if you need anything. Have a great day! 😊" That's polite and leaves the door open for future interactions. I should make sure the emoji is friendly 
but not overbearing. Also, check for any typos or errors. Yeah, that should work.
</think>

See you later! Feel free to reach out if you need anything. Have a great day! 😊

>>> 
$ docker compose logs ollama | grep "chat request" | tail -1
ollama  | time=2025-05-03T14:25:38.744Z level=DEBUG source=routes.go:1525 msg="chat request" images=0 prompt="<|im_start|>user\nhello<|im_end|>\n
<|im_start|>assistant\nHello! How can I assist you today? 😊<|im_end|>\n<|im_start|>user\nbye<|im_end|>\n<|im_start|>assistant\n"
<!-- gh-comment-id:2848651636 --> @rick-github commented on GitHub (May 3, 2025): There are no steps necessary to use it, it's now part of the prompt processing. If you want to see it in action, enable debugging in the server with `OLLAMA_DEBUG=1` and compare the prompts from a chat session in 0.6.6 with a chat session in 0.6.7. 0.6.6 ```console $ ollama:0.6.6 run qwen3:14b >>> hello <think> Okay, the user said "hello". I need to respond appropriately. Let me check the guidelines. The response should be friendly and open-ended. Maybe ask how I can assist them. Keep it simple and welcoming. Avoid any technical jargon. Make sure to use proper punctuation and a friendly tone. Alright, something like "Hello! How can I assist you today?" That should work. </think> Hello! How can I assist you today? 😊 >>> bye <think> Okay, the user said "bye". I need to respond politely. Let me think. They might be ending the conversation, so a friendly goodbye is appropriate. Maybe add an emoji to keep it warm. "Have a great day! 😊" That sounds good. It's concise and positive. I should make sure not to add anything else since they're saying goodbye. Alright, that's the response. </think> Have a great day! 😊 >>> $ docker compose logs ollama | grep "chat request" | tail -1 ollama | time=2025-05-03T14:23:52.863Z level=DEBUG source=routes.go:1523 msg="chat request" images=0 prompt="<|im_start|>user\nhello<|im_end|>\n <|im_start|>assistant\n<think>\nOkay, the user said \"hello\". I need to respond appropriately. Let me check the guidelines. The response should be friendly and open-ended. Maybe ask how I can assist them. Keep it simple and welcoming. Avoid any technical jargon. Make sure to use proper punctuation and a friendly tone. Alright, something like \"Hello! How can I assist you today?\" That should work.\n</think>\n\nHello! How can I assist you today? 😊<|im_end|>\n<|im_start|>user\nbye<|im_end|>\n<|im_start|>assistant\n" ``` 0.6.7 ```console $ ollama:0.6.7 run qwen3:14b >>> hello <think> Okay, the user said "hello". I need to respond appropriately. Let me check the guidelines. The response should be friendly and open-ended. Maybe ask how I can assist them. Keep it simple and welcoming. Avoid any technical jargon. Make sure to use proper grammar and punctuation. Alright, that should work. </think> Hello! How can I assist you today? 😊 >>> bye <think> Okay, the user just said "bye" after I greeted them. I need to respond appropriately. Since they're ending the conversation, I should keep it friendly and open-ended in case they come back later. Maybe something like "See you later! Feel free to reach out if you need anything. Have a great day! 😊" That's polite and leaves the door open for future interactions. I should make sure the emoji is friendly but not overbearing. Also, check for any typos or errors. Yeah, that should work. </think> See you later! Feel free to reach out if you need anything. Have a great day! 😊 >>> $ docker compose logs ollama | grep "chat request" | tail -1 ollama | time=2025-05-03T14:25:38.744Z level=DEBUG source=routes.go:1525 msg="chat request" images=0 prompt="<|im_start|>user\nhello<|im_end|>\n <|im_start|>assistant\nHello! How can I assist you today? 😊<|im_end|>\n<|im_start|>user\nbye<|im_end|>\n<|im_start|>assistant\n" ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6869