Qwen 3#
阿里通义千问第三代模型(2025 年 4 月发布),支持混合思考模式,覆盖 0.6B 到 235B 参数规模。
模型规格#
| 模型 | 参数量 | 类型 | 特点 |
|---|---|---|---|
| Qwen3-235B-A22B | 235B(激活 22B) | MoE | 旗舰模型 |
| Qwen3-32B | 32B | Dense | 平衡性能与成本 |
| Qwen3-14B | 14B | Dense | 中等规模 |
| Qwen3-8B | 8B | Dense | 轻量高效 |
| Qwen3-4B | 4B | Dense | 端侧部署 |
| Qwen3-1.7B | 1.7B | Dense | 超轻量 |
| Qwen3-0.6B | 0.6B | Dense | 极简场景 |
核心特性#
混合思考模式#
- 思考模式:输出前进行深度推理(类似 o1),适合复杂问题
- 非思考模式:快速响应,适合简单对话
- 通过
/think或/no_think切换
MoE 架构(235B)#
- 总参数 235B,每次推理仅激活 22B
- 推理成本接近 22B Dense 模型
- 效果接近更大规模模型
快速使用#
Transformers#
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-8B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
messages = [{"role": "user", "content": "什么是量子计算?"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
vLLM 部署#
vllm serve Qwen/Qwen3-8B --max-model-len 8192
Ollama#
ollama run qwen3:8b