今日,我们正式发布Qwen3-Coder-Next——一款专为编码智能体和本地开发场景设计的开源语言模型。该模型在以下关键方面实现了显著提升:


Qwen3-Coder-Next具备以下特性:
注意:本模型仅支持非思考模式,其输出不会生成</think>superscript:代码块。同时,不再需要指定enable_thinking=False参数。
有关基准测试评估、硬件要求及推理性能等更多详细信息,请参阅我们的博客、GitHub和文档。
建议您使用最新版本的 transformers。
以下代码片段展示了如何基于给定输入使用模型生成内容。
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-Coder-Next"
# 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。
对于本地使用,Ollama、LMStudio、MLX-LM、llama.cpp 和 KTransformers 等应用程序也已支持 Qwen3。
进行部署时,您可以使用最新的 sglang 或 vllm 来创建兼容 OpenAI 的 API 端点。
SGLang 是一个用于大型语言模型和视觉语言模型的快速服务框架。 SGLang 可用于启动具有兼容 OpenAI API 服务的服务器。
Qwen3-Coder-Next 需要 sglang>=v0.5.8,可通过以下方式安装:
pip install 'sglang[all]>=v0.5.8'有关更多详情,请参见其文档。
以下命令可用于在4块GPU上通过张量并行创建一个API端点,地址为http://localhost:30000/v1,最大上下文长度为256K tokens。
python -m sglang.launch_server --model Qwen/Qwen3-Coder-Next --port 30000 --tp-size 2 --tool-call-parser qwen3_coder[!Note] 默认上下文长度为 256K。如果服务器启动失败,请考虑将上下文长度减小,例如设为
32768。
vLLM 是一个用于大语言模型(LLMs)的高吞吐量且内存高效的推理和服务引擎。 vLLM 可用于启动具有 OpenAI 兼容 API 服务的服务器。
Qwen3-Coder-Next 需要 vllm>=0.15.0,可通过以下命令安装:
pip install 'vllm>=0.15.0'有关更多详细信息,请参见其文档。
以下命令可用于在 http://localhost:8000/v1 创建一个 API 端点,该端点使用 4 块 GPU 进行张量并行,最大上下文长度为 256K tokens。
vllm serve Qwen/Qwen3-Coder-Next --port 8000 --tensor-parallel-size 2 --enable-auto-tool-choice --tool-call-parser qwen3_coder[!Note] 默认上下文长度为 256K。如果服务器启动失败,请考虑将上下文长度减小,例如设置为
32768。
Qwen3-Coder-Next 在工具调用能力方面表现卓越。
您可以按照以下示例轻松定义或使用任何工具。
# 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'
}
},
}
}
}
]
from openai 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-Next",
max_tokens=65536,
tools=tools,
)
print(completion.choices[0])为实现最佳性能,我们建议使用以下采样参数:temperature=1.0、top_p=0.95、top_k=40。
如果您发现我们的研究工作对您有所帮助,欢迎引用我们的成果。
@techreport{qwen_qwen3_coder_next_tech_report,
title = {Qwen3-Coder-Next Technical Report},
author = {{Qwen Team}},
url = {https://github.com/QwenLM/Qwen3-Coder/blob/main/qwen3_coder_next_tech_report.pdf},
note = {Accessed: 2026-02-03}
}