Skip to content

[Bug] Qwen3.5-9B (GGUF): enableThinking=false via API ignored — reasoning_content consumes all max_tokens, content empty #1990

Description

@Deepwater1000

Environment

  • LM Studio: 0.4.15+2
  • OS: macOS (Apple Silicon M4)
  • Model: qwen3.5-9b (Q4_K_M GGUF, 5.2GB)
  • Backend: llama.cpp

Bug Description

When sending a simple text-generation request to the local OpenAI-compatible API (/v1/chat/completions), enableThinking: false is completely ignored. The model still outputs reasoning_content (thinking), and when max_tokens is limited, the thinking process consumes all tokens, leaving message.content empty.

This breaks any downstream consumer that reads message.content for non-structured-output use cases (e.g., summarization, compression, classification).

Reproduction

1. enableThinking: false via API — FAILS

curl -s -X POST http://localhost:1234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.5-9b",
    "messages": [
      {"role": "system", "content": "直接输出结果,不要思考,简洁回答。"},
      {"role": "user", "content": "1+1等于几?"}
    ],
    "max_tokens": 100,
    "temperature": 0.1,
    "enableThinking": false
  }'

Response:

{
  "choices": [{
    "message": {
      "content": "",
      "reasoning_content": "Thinking Process:\n1. Analyze the Request..."
    }
  }],
  "usage": {
    "completion_tokens": 100,
    "completion_tokens_details": {
      "reasoning_tokens": 99
    }
  }
}
  • content = empty
  • reasoning_tokens = 99 out of 100 tokens
  • The only reason content is empty is that max_tokens ran out during thinking

2. chat_template_kwargs workaround — ALSO FAILS

Following the workaround from #1559:

curl -s -X POST http://localhost:1234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.5-9b",
    "messages": [
      {"role": "user", "content": "写一句关于春天的诗"}
    ],
    "max_tokens": 100,
    "temperature": 0.1,
    "chat_template_kwargs": {"enable_thinking": false}
  }'

Result: Same behavior — reasoning_content still present, content empty.

3. defaultValue: false in model.yaml — ALSO FAILS

Edited ~/.lmstudio/hub/models/qwen/qwen3.5-9b/model.yaml:

customFields:
  - key: enableThinking
    defaultValue: false  # ← explicitly set to false

Then reloaded the model. API behavior unchanged — thinking still fires.

Root Cause Analysis

Even with all three layers of suppression (API parameter, chat_template_kwargs, defaultValue in model.yaml), the Qwen3.5 model still generates a \<think>...\ block and outputs it as reasoning_content in the API response.

The key distinction from existing issues:

Our bug is different: This is plain text generation (no response_format). The symptom is:

When max_tokens is set, thinking eats the entire token budget, leaving content empty.

This is catastrophic for automated pipelines that rely on message.content — summarization scripts, classification pipelines, compression agents, etc.

Expected Behavior

When enableThinking: false is set (by any means — API param, chat_template_kwargs, or model.yaml defaultValue), the model should:

  1. Not produce any <think> blocks or reasoning_content
  2. Output the final response directly in message.content

If suppressing thinking is technically impossible for Qwen3.5, then at minimum LM Studio should:

  • Honor a token budget split: reserve some tokens for content even if thinking overflows
  • Or document clearly that enableThinking: false has no effect on Qwen3.5

Workaround Found by Community

Changing chat template to ChatML in LM Studio Developer → Inference → Prompt Template suppresses thinking, but this is a blunt workaround that may break vision/tool-use capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions