Qwen3-Coder 提供多种规格版本。今天我们隆重推出 Qwen3-Coder-30B-A3B-Instruct-FP8。这款精简模型在保持卓越性能与效率的同时,具备以下关键升级:

Qwen3-Coder-30B-A3B-Instruct-FP8 具有以下特性:
注意:本模型仅支持非思考模式,输出中不会生成<think></think>代码块。同时不再需要指定enable_thinking=False参数。
如需了解更多详细信息(包括基准测试评估、硬件要求及推理性能),请参阅我们的博客、GitHub及文档。
建议使用最新版本的transformers库。
若使用transformers<4.51.0版本,将会遇到以下错误:
KeyError: 'qwen3_moe'以下包含一段代码示例,演示如何使用模型根据给定输入生成内容。
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8"
# 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 = "Write a quick sort algorithm."
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=65536
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
content = tokenizer.decode(output_ids, skip_special_tokens=True)
print("content:", content)注意:如果遇到内存不足(OOM)问题,可考虑将上下文长度缩短至较小值,例如32,768。
为兼顾便捷性与性能,我们提供了Qwen3的fp8量化模型检查点,其名称以-FP8结尾。该量化方法采用块大小为128的细粒度fp8量化方案,您可在config.json中的quantization_config字段查看详细信息。
您可使用多种推理框架运行Qwen3-30B-A3B-Instruct-FP8模型(包括transformers、sglang和vllm),其使用方式与原始bfloat16模型一致。
但请注意以下已知问题:
transformers:
CUDA_LAUNCH_BLOCKING=1。Qwen3-Coder在工具调用方面表现卓越。
您可参照以下示例轻松定义或使用各类工具。
# Your tool implementation
def square_the_number(num: float) -> dict:
return num ** 2
# Define Tools
tools=[
{
"type":"function",
"function":{
"name": "square_the_number",
"description": "output the square of the number.",
"parameters": {
"type": "object",
"required": ["input_num"],
"properties": {
'input_num': {
'type': 'number',
'description': 'input_num is a number that will be squared'
}
},
}
}
}
]
import OpenAI
# Define LLM
client = OpenAI(
# Use a custom endpoint compatible with OpenAI API
base_url='http://localhost:8000/v1', # api_base
api_key="EMPTY"
)
messages = [{'role': 'user', 'content': 'square the number 1024'}]
completion = client.chat.completions.create(
messages=messages,
model="Qwen3-Coder-30B-A3B-Instruct-FP8",
max_tokens=65536,
tools=tools,
)
print(completion.choice[0])为获得最佳性能,我们推荐以下设置:
采样参数:
temperature=0.7、top_p=0.8、top_k=20、repetition_penalty=1.05适当输出长度:对于大多数查询,推荐使用 65,536 个令牌的输出长度,这对指令模型已足够
如果您认为我们的工作对您有帮助,欢迎引用我们的成果。
@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},
}