What is the issue?
Format is ignored when think is disabled for qwen3.5 series
I put an example here, and set temperature to 0, so that anyone can try to reproduce.
Ollama version: 0.17.6
Model: qwen3.5:35b-a3b (3460ffeede54)
I believe this can be achieved with 1) a proper output token probability masking, and 2) an empty thinking tag <think>\n\n</think>\n\n in template when thinking is disabled.
https://huggingface.co/Qwen/Qwen3.5-35B-A3B/blob/main/chat_template.jinja#L149
It appears to be ollama is expecting the end of thinking token, before it engages the probability masking for formatting. But since the tag is already closed in the template, the model actually never outputs that. As result, the masking is never applied.
Relevant output
[think = True, format = None]
Normal since format is not enabled.
response = client.chat(
model = 'qwen3.5:35b-a3b',
messages=[{'role': 'user', 'content': 'why is the sky blue'}],
think=True,
options={
'temperature': 0
}
)
print('Thinking exists?', 'thinking' in response['message'])
print('===')
print(response['message']['content'])
Thinking exists? True
===
The sky is blue due to a phenomenon called **Rayleigh scattering**. Here is a simple breakdown of how it works:
**1. Sunlight looks white, but isn't**
...
[think = False, format = None]
Again, normal since format is not enabled.
response = client.chat(
model = 'qwen3.5:35b-a3b',
messages=[{'role': 'user', 'content': 'why is the sky blue'}],
think=False,
options={
'temperature': 0
}
)
print('Thinking exists?', 'thinking' in response['message'])
print('===')
print(response['message']['content'])
Thinking exists? False
===
The sky appears blue due to a phenomenon called **Rayleigh scattering**.
Here is how it works:
...
[think = True, format = 'json']
Normal, which proves format alone is working if thinking enabled.
response = client.chat(
model = 'qwen3.5:35b-a3b',
messages=[{'role': 'user', 'content': 'why is the sky blue'}],
think=True,
format='json',
options={
'temperature': 0
}
)
print('Thinking exists?', 'thinking' in response['message'])
print('===')
print(response['message']['content'])
Thinking exists? True
===
{"answer":"The sky is blue due to a phenomenon called
...
[think = False, format = 'json']
It is not returning json in this case, which shows format is ignored only when thinking is disabled.
response = client.chat(
model = 'qwen3.5:35b-a3b',
messages=[{'role': 'user', 'content': 'why is the sky blue'}],
think=False,
format='json',
options={
'temperature': 0
}
)
print('Thinking exists?', 'thinking' in response['message'])
print('===')
print(response['message']['content'])
Thinking exists? False
===
The sky appears blue due to a phenomenon called **Rayleigh scattering**.
Here is how it works:
...
Ollama version
0.17.6
What is the issue?
Format is ignored when think is disabled for qwen3.5 series
I put an example here, and set temperature to 0, so that anyone can try to reproduce.
Ollama version: 0.17.6
Model: qwen3.5:35b-a3b (3460ffeede54)
I believe this can be achieved with 1) a proper output token probability masking, and 2) an empty thinking tag
<think>\n\n</think>\n\nin template when thinking is disabled.https://huggingface.co/Qwen/Qwen3.5-35B-A3B/blob/main/chat_template.jinja#L149
It appears to be ollama is expecting the end of thinking token, before it engages the probability masking for formatting. But since the tag is already closed in the template, the model actually never outputs that. As result, the masking is never applied.
Relevant output
[think = True, format = None]
Normal since format is not enabled.
[think = False, format = None]
Again, normal since format is not enabled.
[think = True, format = 'json']
Normal, which proves format alone is working if thinking enabled.
[think = False, format = 'json']
It is not returning json in this case, which shows format is ignored only when thinking is disabled.
Ollama version
0.17.6