Back to library
AI
best practice

Switch to Non-Thinking Mode for Direct Code Output

Use Qwen3-Instruct-2507 for clean, direct code generation output.

Upgrade to Qwen3-Instruct-2507 and ensure your transformers library is version 4.51.0 or higher to receive direct code outputs without 'thinking' blocks.

Qwen

The Scenario

You are integrating Qwen3 into an automated pipeline or script where you need clean code output without internal reasoning steps ('thinking mode').

Before & after

The old way

Developers often have to manually strip 'thought' tags or reasoning blocks from model outputs before pasting them into an editor, costing 2–3 minutes per interaction.

With AI

By updating your environment, you can run Qwen3-Instruct-2507 and get direct code responses without manual clean-up in under 1 minute.

The Prompt

# Ensure transformers>=4.51.0 is installed
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-235B-A22B-Instruct-2507"
# No need to set enable_thinking=False for this specific version
[PASTE_YOUR_CODING_PROMPT_HERE]

Qwen3-Instruct-2507 is optimized for direct instruction following without the 'thinking' overhead, provided you have the latest transformer weights and library versions.

Source

Qwen Code Blog: AI Coding Updates and Guides | Qwen Code Docs
"Qwen3-Instruct-2507 supports only non-thinking mode and does not generate blocks in its output."