我们推出了Qwen3-30B-A3B非思考模式的更新版本,命名为Qwen3-30B-A3B-Instruct-2507,主要增强功能如下:

Qwen3-30B-A3B-Instruct-2507具有以下特点:
注意:此模型仅支持非思考模式,不会在输出中生成</think>superscript:块。同时,不再需要指定enable_thinking=False。
有关基准测试评估、硬件要求和推理性能等更多详细信息,请参阅我们的博客、GitHub和文档。
| Deepseek-V3-0324 | GPT-4o-0327 | Gemini-2.5-Flash Non-Thinking | Qwen3-235B-A22B Non-Thinking | Qwen3-30B-A3B Non-Thinking | Qwen3-30B-A3B-Instruct-2507 | |
|---|---|---|---|---|---|---|
| 知识能力 | ||||||
| MMLU-Pro | 81.2 | 79.8 | 81.1 | 75.2 | 69.1 | 78.4 |
| MMLU-Redux | 90.4 | 91.3 | 90.6 | 89.2 | 84.1 | 89.3 |
| GPQA | 68.4 | 66.9 | 78.3 | 62.9 | 54.8 | 70.4 |
| SuperGPQA | 57.3 | 51.0 | 54.6 | 48.2 | 42.2 | 53.4 |
| 推理能力 | ||||||
| AIME25 | 46.6 | 26.7 | 61.6 | 24.7 | 21.6 | 61.3 |
| HMMT25 | 27.5 | 7.9 | 45.8 | 10.0 | 12.0 | 43.0 |
| ZebraLogic | 83.4 | 52.6 | 57.9 | 37.7 | 33.2 | 90.0 |
| LiveBench 20241125 | 66.9 | 63.7 | 69.1 | 62.5 | 59.4 | 69.0 |
| 编码能力 | ||||||
| LiveCodeBench v6 (25.02-25.05) | 45.2 | 35.8 | 40.1 | 32.9 | 29.0 | 43.2 |
| MultiPL-E | 82.2 | 82.7 | 77.7 | 79.3 | 74.6 | 83.8 |
| Aider-Polyglot | 55.1 | 45.3 | 44.0 | 59.6 | 24.4 | 35.6 |
| 对齐能力 | ||||||
| IFEval | 82.3 | 83.9 | 84.3 | 83.2 | 83.7 | 84.7 |
| Arena-Hard v2* | 45.6 | 61.9 | 58.3 | 52.0 | 24.8 | 69.0 |
| Creative Writing v3 | 81.6 | 84.9 | 84.6 | 80.4 | 68.1 | 86.0 |
| WritingBench | 74.5 | 75.5 | 80.5 | 77.0 | 72.2 | 85.5 |
| 智能体能力 | ||||||
| BFCL-v3 | 64.7 | 66.5 | 66.1 | 68.0 | 58.6 | 65.1 |
| TAU1-Retail | 49.6 | 60.3# | 65.2 | 65.2 | 38.3 | 59.1 |
| TAU1-Airline | 32.0 | 42.8# | 48.0 | 32.0 | 18.0 | 40.0 |
| TAU2-Retail | 71.1 | 66.7# | 64.3 | 64.9 | 31.6 | 57.0 |
| TAU2-Airline | 36.0 | 42.0# | 42.5 | 36.0 | 18.0 | 38.0 |
| TAU2-Telecom | 34.0 | 29.8# | 16.9 | 24.6 | 18.4 | 12.3 |
| 多语言能力 | ||||||
| MultiIF | 66.5 | 70.4 | 69.4 | 70.2 | 70.8 | 67.9 |
| MMLU-ProX | 75.8 | 76.2 | 78.3 | 73.2 | 65.1 | 72.0 |
| INCLUDE | 80.1 | 82.1 | 83.8 | 75.6 | 67.8 | 71.9 |
| PolyMATH | 32.2 | 25.5 | 41.9 | 27.0 | 23.3 | 43.1 |
*:为保证可复现性,我们报告由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-30B-A3B-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-30B-A3B-Instruct-2507 --context-length 262144vllm serve Qwen/Qwen3-30B-A3B-Instruct-2507 --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-30B-A3B-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万token),我们集成了两项关键技术:
这些创新共同显著提升了256K token以上序列的生成质量和推理效率。在接近100万token的序列上,该系统相比标准注意力实现可实现高达3倍的速度提升。
完整技术细节,请参见Qwen2.5-1M技术报告。
[!NOTE] 若要有效处理100万token上下文,用户需配备约240 GB的总GPU内存。这部分内存将用于存储模型权重、KV缓存以及满足峰值激活内存需求。
下载模型并将您的config.json内容替换为config_1m.json,后者包含了长度外推和稀疏注意力的相关配置。
export MODELNAME=Qwen3-30B-A3B-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 来部署模型。
如需运行支持 1M 上下文的 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-30B-A3B-Instruct-2507 \
--tensor-parallel-size 4 \
--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 万 tokens |
--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-30B-A3B-Instruct-2507 \
--context-length 1010000 \
--mem-frac 0.75 \
--attention-backend dual_chunk_flash_attn \
--tp 4 \
--chunked-prefill-size 131072| 参数 | 用途 |
|---|---|
--attention-backend dual_chunk_flash_attn | 激活双分块闪存注意力 |
--context-length 1010000 | 定义最大输入长度 |
--mem-frac 0.75 | 用于静态分配的内存比例(模型权重和KV缓存内存池)。如果遇到内存不足错误,请使用较小的值。 |
--tp 4 | 张量并行大小(与模型分片匹配) |
--chunked-prefill-size 131072 | 用于处理长输入而不发生内存溢出的预填充分块大小 |
遇到错误:“The model's max sequence length (xxxxx) is larger than the maximum number of tokens that can be stored in the KV cache.”(模型的最大序列长度(xxxxx)大于可存储在KV缓存中的最大令牌数。)或 “RuntimeError: Not enough memory. Please try to increase --mem-fraction-static.”(运行时错误:内存不足。请尝试增加 --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 out of memory.”(torch内存不足错误:CUDA内存不足。)
为激活权重预留的显存不足。您可以尝试降低 gpu_memory_utilization 或 mem-frac,但请注意这可能会减少可用于KV缓存的显存。
遇到错误:“Input prompt (xxxxx tokens) + lookahead slots (0) is too long and exceeds the capacity of the block manager.”(输入提示(xxxxx个令牌)+ 前瞻槽位(0)过长,超出了块管理器的容量。)或 “The input (xxx tokens) is longer than the model's context length (xxx tokens).”(输入(xxx个令牌)长于模型的上下文长度(xxx个令牌)。)
输入过长。考虑使用较短的序列或增加 max_model_len 或 context-length。
我们在 RULER 基准测试的100万版本上对模型进行了测试。
| 模型名称 | 平均准确率 | 4千 | 8千 | 16千 | 32千 | 64千 | 96千 | 128千 | 192千 | 256千 | 384千 | 512千 | 640千 | 768千 | 896千 | 1000千 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3-30B-A3B (Non-Thinking) | 72.0 | 97.1 | 96.1 | 95.0 | 92.2 | 82.6 | 79.7 | 76.9 | 70.2 | 66.3 | 61.9 | 55.4 | 52.6 | 51.5 | 52.0 | 50.9 |
| Qwen3-30B-A3B-Instruct-2507 (Full Attention) | 86.8 | 98.0 | 96.7 | 96.9 | 97.2 | 93.4 | 91.0 | 89.1 | 89.8 | 82.5 | 83.6 | 78.4 | 79.7 | 77.6 | 75.7 | 72.8 |
| Qwen3-30B-A3B-Instruct-2507 (Sparse Attention) | 86.8 | 98.0 | 97.1 | 96.3 | 95.1 | 93.6 | 92.5 | 88.1 | 87.7 | 82.9 | 85.7 | 80.7 | 80.0 | 76.9 | 75.5 | 72.2 |
为实现最佳性能,我们建议采用以下设置:
采样参数:
Temperature=0.7、TopP=0.8、TopK=20 和 MinP=0。presence_penalty 参数调整为 0 到 2 之间,以减少无意义的重复。但需注意,较高的参数值偶尔可能导致语言混杂,并略微降低模型性能。充足的输出长度:对于大多数查询,建议使用 16,384 个 token 的输出长度,这对于指令模型而言已足够。
标准化输出格式:在进行基准测试时,建议通过提示词标准化模型输出。
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},
}