[!NOTE] 包含 Unsloth 聊天模板修复!
对于llama.cpp,请使用--jinja参数
Unsloth Dynamic 2.0 实现了卓越的准确性,性能超越其他主流量化方法。
在过去三个月中,我们持续提升 Qwen3-235B-A22B 的思考能力,同时改进推理的质量与深度。我们荣幸地推出 Qwen3-235B-A22B-Thinking-2507,主要增强如下:
注意:本版本延长了思考时长。强烈建议用于高度复杂的推理任务。

Qwen3-235B-A22B-Thinking-2507 具有以下特性:
注意:本模型仅支持思考模式。
此外,为确保模型进入思考状态,默认对话模板会自动包含 </think>。因此,模型输出中仅包含 </think> 而无显式开头 </think> 标签属于正常现象。
更多详情,包括基准测试评估、硬件要求和推理性能,请参阅我们的 博客、GitHub 和 文档。
| Deepseek-R1-0528 | OpenAI O4-mini | OpenAI O3 | Gemini-2.5 Pro | Claude4 Opus Thinking | Qwen3-235B-A22B Thinking | Qwen3-235B-A22B-Thinking-2507 | |
|---|---|---|---|---|---|---|---|
| 知识 | |||||||
| MMLU-Pro | 85.0 | 81.9 | 85.9 | 85.6 | - | 82.8 | 84.4 |
| MMLU-Redux | 93.4 | 92.8 | 94.9 | 94.4 | 94.6 | 92.7 | 93.8 |
| GPQA | 81.0 | 81.4* | 83.3* | 86.4 | 79.6 | 71.1 | 81.1 |
| SuperGPQA | 61.7 | 56.4 | - | 62.3 | - | 60.7 | 64.9 |
| 推理 | |||||||
| AIME25 | 87.5 | 92.7* | 88.9* | 88.0 | 75.5 | 81.5 | 92.3 |
| HMMT25 | 79.4 | 66.7 | 77.5 | 82.5 | 58.3 | 62.5 | 83.9 |
| LiveBench 20241125 | 74.7 | 75.8 | 78.3 | 82.4 | 78.2 | 77.1 | 78.4 |
| HLE | 17.7# | 18.1* | 20.3 | 21.6 | 10.7 | 11.8# | 18.2# |
| 代码 | |||||||
| LiveCodeBench v6(25.02-25.05) | 68.7 | 71.8 | 58.6 | 72.5 | 48.9 | 55.7 | 74.1 |
| CFEval | 2099 | 1929 | 2043 | 2001 | - | 2056 | 2134 |
| OJBench | 33.6 | 33.3 | 25.4 | 38.9 | - | 25.6 | 32.5 |
| 对齐 | |||||||
| IFEval | 79.1 | 92.4 | 92.1 | 90.8 | 89.7 | 83.4 | 87.8 |
| Arena-Hard v2$ | 72.2 | 59.3 | 80.8 | 72.5 | 59.1 | 61.5 | 79.7 |
| Creative Writing v3 | 86.3 | 78.8 | 87.7 | 85.9 | 83.8 | 84.6 | 86.1 |
| WritingBench | 83.2 | 78.4 | 85.3 | 83.1 | 79.1 | 80.3 | 88.3 |
| 智能体 | |||||||
| BFCL-v3 | 63.8 | 67.2 | 72.4 | 67.2 | 61.8 | 70.8 | 71.9 |
| TAU2-Retail | 64.9 | 71.0 | 76.3 | 71.3 | - | 40.4 | 71.9 |
| TAU2-Airline | 60.0 | 59.0 | 70.0 | 60.0 | - | 30.0 | 58.0 |
| TAU2-Telecom | 33.3 | 42.0 | 60.5 | 37.4 | - | 21.9 | 45.6 |
| 多语言 | |||||||
| MultiIF | 63.5 | 78.0 | 80.3 | 77.8 | - | 71.9 | 80.6 |
| MMLU-ProX | 80.6 | 79.0 | 83.3 | 84.7 | - | 80.0 | 81.0 |
| INCLUDE | 79.4 | 80.8 | 86.6 | 85.1 | - | 78.7 | 81.0 |
| PolyMATH | 46.9 | 48.7 | 49.7 | 52.2 | - | 54.7 | 60.1 |
* 对于 OpenAI O4-mini 和 O3,我们采用中等推理力度,标有 * 的分数除外,这些分数使用高推理力度生成。
# 根据 HLE 的官方评估标准,标有 # 的分数指非多模态模型,仅在纯文本子集上进行评估。
$ 为保证可复现性,我们报告由 GPT-4.1 评估的胜率。
& 对于高难度任务(包括 PolyMATH 以及所有推理和代码任务),我们使用 81,920 tokens 的输出长度。其他所有任务的输出长度设为 32,768。
Qwen3-MoE 的代码已集成到最新版的 Hugging Face transformers 中,建议您使用最新版本的 transformers。
若使用 transformers<4.51.0,您将遇到以下错误:
KeyError: 'qwen3_moe'以下是一段代码片段,展示了如何使用模型根据给定输入生成内容。
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-235B-A22B-Thinking-2507"
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# conduct text completion
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
# parsing thinking content
try:
# rindex finding 151668 (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("thinking content:", thinking_content) # no opening <think> tag
print("content:", content)
在部署方面,您可以使用sglang>=0.4.6.post1或vllm>=0.8.5来创建兼容OpenAI的API端点:
python -m sglang.launch_server --model-path Qwen/Qwen3-235B-A22B-Thinking-2507 --tp 8 --context-length 262144 --reasoning-parser deepseek-r1vllm serve Qwen/Qwen3-235B-A22B-Thinking-2507 --tensor-parallel-size 8 --max-model-len 262144 --enable-reasoning --reasoning-parser deepseek_r1注意:如果遇到内存不足(OOM)问题,您可以考虑将上下文长度减小到一个更小的值。但由于模型在推理时可能需要更长的token序列,我们强烈建议在条件允许的情况下使用大于131,072的上下文长度。
在本地使用方面,Ollama、LMStudio、MLX-LM、llama.cpp和KTransformers等应用也已支持Qwen3。
Qwen3在工具调用能力方面表现出色。我们建议使用Qwen-Agent来充分发挥Qwen3的智能体能力。Qwen-Agent内部封装了工具调用模板和工具调用解析器,大幅降低了编码复杂度。
要定义可用工具,您可以使用MCP配置文件、使用Qwen-Agent的集成工具,或自行集成其他工具。
from qwen_agent.agents import Assistant
# Define LLM
# Using Alibaba Cloud Model Studio
llm_cfg = {
'model': 'qwen3-235b-a22b-thinking-2507',
'model_type': 'qwen_dashscope',
}
# Using OpenAI-compatible API endpoint. It is recommended to disable the reasoning and the tool call parsing
# functionality of the deployment frameworks and let Qwen-Agent automate the related operations. For example,
# `VLLM_USE_MODELSCOPE=true vllm serve Qwen/Qwen3-235B-A22B-Thinking-2507 --served-model-name Qwen3-235B-A22B-Thinking-2507 --tensor-parallel-size 8 --max-model-len 262144`.
#
# llm_cfg = {
# 'model': 'Qwen3-235B-A22B-Thinking-2507',
#
# # Use a custom endpoint compatible with OpenAI API:
# 'model_server': 'http://localhost:8000/v1', # api_base without reasoning and tool call parsing
# 'api_key': 'EMPTY',
# 'generate_cfg': {
# 'thought_in_content': True,
# },
# }
# Define Tools
tools = [
{'mcpServers': { # You can specify the MCP configuration file
'time': {
'command': 'uvx',
'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
},
"fetch": {
"command": "uvx",
"args": ["mcp-server-fetch"]
}
}
},
'code_interpreter', # Built-in tools
]
# Define Agent
bot = Assistant(llm=llm_cfg, function_list=tools)
# Streaming generation
messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
for responses in bot.run(messages=messages):
pass
print(responses)为实现最佳性能,我们建议采用以下设置:
采样参数:
Temperature=0.6、TopP=0.95、TopK=20 和 MinP=0。presence_penalty 参数调整为 0 到 2 之间,以减少无意义的重复。但需注意,较高的参数值偶尔可能导致语言混杂,并略微降低模型性能。充足的输出长度:对于大多数查询,建议使用 32,768 个 token 的输出长度。在数学和编程竞赛等高度复杂问题的基准测试中,建议将最大输出长度设置为 81,920 个 token。这能为模型提供足够的空间来生成详细且全面的响应,从而提升整体性能。
标准化输出格式:在进行基准测试时,建议通过提示词标准化模型输出。
answer 字段中仅用选项字母展示您的选择,例如:"answer": "C"。”历史记录中不含思考内容:在多轮对话中,历史模型输出应仅包含最终输出部分,无需包含思考过程。Jinja2 提供的聊天模板已实现此功能。但对于未直接使用 Jinja2 聊天模板的框架,需由开发人员确保遵循此最佳实践。
如果您认为我们的工作对您有所帮助,欢迎引用。
@misc{qwen3technicalreport,
title={Qwen3 Technical Report},
author={Qwen Team},
year={2025},
eprint={2505.09388},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2505.09388},
}