我们推出Qwen3-235B-A22B非思考模式的升级版本Qwen3-235B-A22B-Instruct-2507,具有以下关键提升:

Qwen3-235B-A22B-Instruct-2507具备以下特性:
注:本模型仅支持非思考模式,输出中不会生成<think></think>区块。同时不再需要指定enable_thinking=False参数。
更多细节(包括基准测试、硬件需求及推理性能)请参阅我们的博客、GitHub及文档。
| Deepseek-V3-0324 | GPT-4o-0327 | Claude Opus 4 Non-thinking | Kimi K2 | Qwen3-235B-A22B Non-thinking | Qwen3-235B-A22B-Instruct-2507 | |
|---|---|---|---|---|---|---|
| 知识能力 | ||||||
| MMLU-Pro | 81.2 | 79.8 | 86.6 | 81.1 | 75.2 | 83.0 |
| MMLU-Redux | 90.4 | 91.3 | 94.2 | 92.7 | 89.2 | 93.1 |
| GPQA | 68.4 | 66.9 | 74.9 | 75.1 | 62.9 | 77.5 |
| SuperGPQA | 57.3 | 51.0 | 56.5 | 57.2 | 48.2 | 62.6 |
| SimpleQA | 27.2 | 40.3 | 22.8 | 31.0 | 12.2 | 54.3 |
| CSimpleQA | 71.1 | 60.2 | 68.0 | 74.5 | 60.8 | 84.3 |
| 推理能力 | ||||||
| AIME25 | 46.6 | 26.7 | 33.9 | 49.5 | 24.7 | 70.3 |
| HMMT25 | 27.5 | 7.9 | 15.9 | 38.8 | 10.0 | 55.4 |
| ARC-AGI | 9.0 | 8.8 | 30.3 | 13.3 | 4.3 | 41.8 |
| ZebraLogic | 83.4 | 52.6 | - | 89.0 | 37.7 | 95.0 |
| LiveBench 20241125 | 66.9 | 63.7 | 74.6 | 76.4 | 62.5 | 75.4 |
| 编程能力 | ||||||
| LiveCodeBench v6 (25.02-25.05) | 45.2 | 35.8 | 44.6 | 48.9 | 32.9 | 51.8 |
| MultiPL-E | 82.2 | 82.7 | 88.5 | 85.7 | 79.3 | 87.9 |
| Aider-Polyglot | 55.1 | 45.3 | 70.7 | 59.0 | 59.6 | 57.3 |
| 对齐能力 | ||||||
| IFEval | 82.3 | 83.9 | 87.4 | 89.8 | 83.2 | 88.7 |
| Arena-Hard v2* | 45.6 | 61.9 | 51.5 | 66.1 | 52.0 | 79.2 |
| Creative Writing v3 | 81.6 | 84.9 | 83.8 | 88.1 | 80.4 | 87.5 |
| WritingBench | 74.5 | 75.5 | 79.2 | 86.2 | 77.0 | 85.2 |
| 代理能力 | ||||||
| BFCL-v3 | 64.7 | 66.5 | 60.1 | 65.2 | 68.0 | 70.9 |
| TAU1-Retail | 49.6 | 60.3# | 81.4 | 70.7 | 65.2 | 71.3 |
| TAU1-Airline | 32.0 | 42.8# | 59.6 | 53.5 | 32.0 | 44.0 |
| TAU2-Retail | 71.1 | 66.7# | 75.5 | 70.6 | 64.9 | 74.6 |
| TAU2-Airline | 36.0 | 42.0# | 55.5 | 56.5 | 36.0 | 50.0 |
| TAU2-Telecom | 34.0 | 29.8# | 45.2 | 65.8 | 24.6 | 32.5 |
| 多语言能力 | ||||||
| MultiIF | 66.5 | 70.4 | - | 76.2 | 70.2 | 77.5 |
| MMLU-ProX | 75.8 | 76.2 | - | 74.5 | 73.2 | 79.4 |
| INCLUDE | 80.1 | 82.1 | - | 76.9 | 75.6 | 79.5 |
| PolyMATH | 32.2 | 25.5 | 30.0 | 44.8 | 27.0 | 50.2 |
*:为保障结果可复现性,本表采用GPT-4.1评估的胜率数据。
#:由于无法获取GPT-4o-0327原生函数调用API,相关结果由GPT-4o-20241120生成。
Qwen3-MoE 的代码已集成至最新版 Hugging Face transformers,建议您使用最新版本的 transformers。
若使用 transformers<4.51.0,您将遇到以下错误:
KeyError: 'qwen3_moe'以下是一段代码示例,展示了如何基于给定输入使用模型生成内容。
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-235B-A22B-Instruct-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=16384
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
content = tokenizer.decode(output_ids, skip_special_tokens=True)
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-Instruct-2507 --tp 8 --context-length 262144vllm serve Qwen/Qwen3-235B-A22B-Instruct-2507 --tensor-parallel-size 8 --max-model-len 262144注意:若遇到内存不足(OOM)问题,可尝试将上下文长度调整为更短值,例如32,768。
对于本地使用,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
llm_cfg = {
'model': 'Qwen3-235B-A22B-Instruct-2507',
# Use a custom endpoint compatible with OpenAI API:
'model_server': 'http://localhost:8000/v1', # api_base
'api_key': 'EMPTY',
}
# 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)为支持超长上下文处理(最高达100万tokens),我们整合了两项核心技术:
这些创新技术共同提升了256K tokens以上序列的生成质量与推理效率。在处理接近100万tokens的序列时,系统相比标准注意力实现可获得3倍加速。
完整技术细节详见Qwen2.5-1M技术报告。
[!注意]
要有效处理100万tokens上下文,用户需准备约1000 GB的GPU显存总量,涵盖模型权重、KV缓存存储及峰值激活内存需求。
下载模型后,将config.json内容替换为config_1m.json,该文件已包含长度外推与稀疏注意力的配置参数。
export MODELNAME=Qwen3-235B-A22B-Instruct-2507
huggingface-cli download Qwen/${MODELNAME} --local-dir ${MODELNAME}
mv ${MODELNAME}/config.json ${MODELNAME}/config.json.bak
mv ${MODELNAME}/config_1m.json ${MODELNAME}/config.json完成配置更新后,选择使用 vLLM 或 SGLang 来部署模型服务。
如需运行支持 100 万上下文的 Qwen 模型:
pip install -U vllm \
--torch-backend=auto \
--extra-index-url https://wheels.vllm.ai/nightly随后启用双分块闪存注意力机制启动服务器:
VLLM_ATTENTION_BACKEND=DUAL_CHUNK_FLASH_ATTN VLLM_USE_V1=0 \
vllm serve ./Qwen3-235B-A22B-Instruct-2507 \
--tensor-parallel-size 8 \
--max-model-len 1010000 \
--enable-chunked-prefill \
--max-num-batched-tokens 131072 \
--enforce-eager \
--max-num-seqs 1 \
--gpu-memory-utilization 0.85| 参数 | 作用 |
|---|---|
VLLM_ATTENTION_BACKEND=DUAL_CHUNK_FLASH_ATTN | 启用定制注意力内核以提升长上下文处理效率 |
--max-model-len 1010000 | 设置最大上下文长度为约100万token |
--enable-chunked-prefill | 支持超长输入的块状预填充(避免内存溢出) |
--max-num-batched-tokens 131072 | 控制预填充阶段的批处理大小,平衡吞吐量与内存占用 |
--enforce-eager | 禁用CUDA图捕获(双块注意力机制必需) |
--max-num-seqs 1 | 因极端内存消耗限制并发序列数 |
--gpu-memory-utilization 0.85 | 设置模型执行器占用的GPU内存比例 |
首先克隆并安装专用分支:
git clone https://github.com/sgl-project/sglang.git
cd sglang
pip install -e "python[all]"启动支持DCA的服务器:
python3 -m sglang.launch_server \
--model-path ./Qwen3-235B-A22B-Instruct-2507 \
--context-length 1010000 \
--mem-frac 0.75 \
--attention-backend dual_chunk_flash_attn \
--tp 8 \
--chunked-prefill-size 131072| 参数 | 作用 |
|---|---|
--attention-backend dual_chunk_flash_attn | 启用双分块闪存注意力机制 |
--context-length 1010000 | 设置最大输入长度 |
--mem-frac 0.75 | 静态内存分配比例(用于模型权重和KV缓存内存池)。若出现内存不足错误,可调低此值 |
--tp 8 | 张量并行度(需与模型分片配置匹配) |
--chunked-prefill-size 131072 | 长文本输入预填充分块大小(避免内存溢出) |
出现错误:"模型的最大序列长度(xxxxx)超过KV缓存的最大token容量" 或 "RuntimeError: 内存不足,请尝试增加--mem-fraction-static参数"
KV缓存预留显存不足
max_model_len或增加tensor_parallel_size与gpu_memory_utilization。也可减少max_num_batched_tokens,但会显著降低推理速度context-length或增加tp与mem-frac。也可减少chunked-prefill-size,但会显著降低推理速度出现错误:"torch.OutOfMemoryError: CUDA显存不足"
激活权重预留显存不足。可尝试降低gpu_memory_utilization或mem-frac,但可能影响KV缓存可用显存
出现错误:"输入提示(xxxxx tokens)+前瞻槽位(0)过长,超出块管理器容量" 或 "输入长度(xxx tokens)超过模型上下文限制(xxx tokens)"
输入文本过长。建议缩短序列或提升max_model_len/context-length
我们在100万token版本的RULER基准测试中进行评估:
| 模型名称 | 平均准确率 | 4k | 8k | 16k | 32k | 64k | 96k | 128k | 192k | 256k | 384k | 512k | 640k | 768k | 896k | 1000k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3-235B-A22B (非思考模式) | 83.9 | 97.7 | 96.1 | 97.5 | 96.1 | 94.2 | 90.3 | 88.5 | 85.0 | 82.1 | 79.2 | 74.4 | 70.0 | 71.0 | 68.5 | 68.0 |
| Qwen3-235B-A22B-Instruct-2507 (全注意力) | 92.5 | 98.5 | 97.6 | 96.9 | 97.3 | 95.8 | 94.9 | 93.9 | 94.5 | 91.0 | 92.2 | 90.9 | 87.8 | 84.8 | 86.5 | 84.5 |
| Qwen3-235B-A22B-Instruct-2507 (稀疏注意力) | 91.7 | 98.5 | 97.2 | 97.3 | 97.7 | 96.6 | 94.6 | 92.8 | 94.3 | 90.5 | 89.7 | 89.5 | 86.4 | 83.6 | 84.2 | 82.5 |
为获得最优性能,我们推荐以下设置:
采样参数:
Temperature=0.7、TopP=0.8、TopK=20 和 MinP=0。presence_penalty 参数调整为 0 至 2 之间的值以减少无休止的重复。但数值过高可能导致偶尔出现语言混杂现象,并轻微降低模型性能。合理输出长度:对于大多数查询,推荐输出长度为 16,384 tokens,这对指令模型已足够。
标准化输出格式:在基准测试时,建议通过提示词规范模型输出。
answer 字段中仅显示选项字母,例如 "answer": "C"。”如果您认为我们的工作有帮助,欢迎引用。
@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},
}
@article{qwen2.5-1m,
title={Qwen2.5-1M Technical Report},
author={An Yang and Bowen Yu and Chengyuan Li and Dayiheng Liu and Fei Huang and Haoyan Huang and Jiandong Jiang and Jianhong Tu and Jianwei Zhang and Jingren Zhou and Junyang Lin and Kai Dang and Kexin Yang and Le Yu and Mei Li and Minmin Sun and Qin Zhu and Rui Men and Tao He and Weijia Xu and Wenbiao Yin and Wenyuan Yu and Xiafei Qiu and Xingzhang Ren and Xinlong Yang and Yong Li and Zhiying Xu and Zipeng Zhang},
journal={arXiv preprint arXiv:2501.15383},
year={2025}
}