o
openharmony-models/Qwen3.6-27B-GGUF
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

阅读我们的 Qwen3.6 运行指南!

有关我们的量化基准,请参见 Unsloth Dynamic 2.0 GGUFs。

  • 支持开发者角色,使 Qwen3.6 能够在 Codex、OpenCode 等环境中运行!
  • 现在可以在 Unsloth Studio 中运行和微调 Qwen3.6。阅读我们的指南。
  • 工具调用改进:支持解析嵌套对象,提高工具调用成功率。
  • Qwen3.6 35B-A3B(4-bit GGUF)在 Unsloth Studio 中进行工具调用的示例:
qwen3.6 in unsloth studio

Qwen3.6-27B

Qwen Chat

[!Note] 本仓库包含采用 Hugging Face Transformers 格式的后训练模型的权重和配置文件。

这些制品与 Hugging Face Transformers、vLLM、SGLang、KTransformers 等工具兼容。

继 2 月份发布 Qwen3.5 系列之后,我们很高兴推出 Qwen3.6 的首个开源权重版本。Qwen3.6 基于社区的直接反馈构建,以稳定性和实际应用价值为核心,为开发者提供更直观、响应更迅速且真正高效的编码体验。

Qwen3.6 亮点

此版本带来了显著升级,尤其在以下方面:

  • 智能体编码能力:模型现在能更流畅、精准地处理前端工作流和仓库级推理任务。
  • 思维保留机制:我们引入了一项新功能,可保留历史对话中的推理上下文,从而简化迭代开发并降低额外开销。

Benchmark Results

更多详情,请参阅我们的博客文章 Qwen3.6-27B。

模型概述

  • 类型:带视觉编码器的因果语言模型
  • 训练阶段:预训练与后训练
  • 语言模型
    • 参数数量:270 亿
    • 隐藏层维度:5120
    • 词嵌入维度:248320(已填充)
    • 层数:64
    • 隐藏层结构:16 × (3 × (门控 DeltaNet → 前馈网络) → 1 × (门控注意力 → 前馈网络))
    • 门控 DeltaNet:
      • 线性注意力头数量:V 为 48,QK 为 16
      • 头维度:128
    • 门控注意力:
      • 注意力头数量:Q 为 24,KV 为 4
      • 头维度:256
      • 旋转位置嵌入维度:64
    • 前馈网络:
      • 中间层维度:17408
    • 语言模型输出:248320(已填充)
    • MTP:采用多步训练
  • 上下文长度:原生支持 262,144 tokens,可扩展至 1,010,000 tokens。

基准测试结果

语言能力

视觉语言能力

快速开始

为简化集成流程,我们建议通过 API 使用 Qwen3.6。以下是通过兼容 OpenAI 的 API 使用 Qwen3.6 的指南。

部署 Qwen3.6

Qwen3.6 可通过主流推理框架的 API 进行部署。 下面展示启动 Qwen3.6 模型的兼容 OpenAI API 服务器的示例命令。

[!Important] 不同框架的推理效率和吞吐量差异显著。 建议使用最新版本的框架,以确保最佳性能和兼容性。 对于生产工作负载或高吞吐量场景,强烈推荐使用专用的服务引擎,如 SGLang、KTransformers 或 vLLM。

[!Important] 模型默认上下文长度为 262,144 tokens。 如果遇到内存不足(OOM)错误,请考虑减小上下文窗口。 然而,由于 Qwen3.6 利用扩展上下文来处理复杂任务,我们建议保持至少 128K tokens 的上下文长度,以保留其思维能力。

SGLang

SGLang 是一个用于大型语言模型和视觉语言模型的快速服务框架。 Qwen3.6 推荐使用 sglang>=0.5.10,可在全新环境中通过以下命令安装:

uv pip install sglang[all]

有关更多详细信息,请参阅其文档。

以下操作将在 http://localhost:8000/v1 创建 API 端点:

  • 标准版:可使用以下命令创建最大上下文长度为 262,144 tokens 的 API 端点,并在 8 块 GPU 上使用张量并行。

    python -m sglang.launch_server --model-path Qwen/Qwen3.6-27B --port 8000 --tp-size 8 --mem-fraction-static 0.8 --context-length 262144 --reasoning-parser qwen3
  • 工具调用:若要支持工具调用,可使用以下命令。

    python -m sglang.launch_server --model-path Qwen/Qwen3.6-27B --port 8000 --tp-size 8 --mem-fraction-static 0.8 --context-length 262144 --reasoning-parser qwen3 --tool-call-parser qwen3_coder
  • 多令牌预测(MTP):推荐使用以下命令进行 MTP:

    python -m sglang.launch_server --model-path Qwen/Qwen3.6-27B --port 8000 --tp-size 8 --mem-fraction-static 0.8 --context-length 262144 --reasoning-parser qwen3 --speculative-algo NEXTN --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4

有关详细的部署指南,请参阅 SGLang Qwen3.5 实践指南。

vLLM

vLLM 是一个用于大语言模型(LLMs)的高吞吐量且内存高效的推理和服务引擎。 Qwen3.6 推荐使用 vllm>=0.19.0,可在全新环境中通过以下命令安装:

uv pip install vllm --torch-backend=auto

有关更多详细信息,请参见其文档。

以下操作将在 http://localhost:8000/v1 创建 API 端点:

  • 标准版:可使用以下命令创建 API 端点,该端点支持最大上下文长度为 262,144 个 token,并通过 8 块 GPU 进行张量并行。

    vllm serve Qwen/Qwen3.6-27B --port 8000 --tensor-parallel-size 8 --max-model-len 262144 --reasoning-parser qwen3 
  • 工具调用:要支持工具使用,可使用以下命令。

    vllm serve Qwen/Qwen3.6-27B --port 8000 --tensor-parallel-size 8 --max-model-len 262144 --reasoning-parser qwen3 --enable-auto-tool-choice --tool-call-parser qwen3_coder 
  • 多 token 预测(MTP):对于 MTP,建议使用以下命令:

    vllm serve Qwen/Qwen3.6-27B --port 8000 --tensor-parallel-size 8 --max-model-len 262144 --reasoning-parser qwen3 --speculative-config '{"method":"qwen3_next_mtp","num_speculative_tokens":2}'
  • 纯文本模式:以下命令会跳过视觉编码器和多模态分析,以释放内存用于额外的 KV 缓存:

    vllm serve Qwen/Qwen3.6-27B --port 8000 --tensor-parallel-size 8 --max-model-len 262144 --reasoning-parser qwen3 --language-model-only

有关详细的部署指南,请参见 vLLM Qwen3.5 部署指南。

KTransformers

KTransformers 是一个灵活的框架,可通过 CPU-GPU 异构计算体验前沿的 LLM 推理优化。 要使用 KTransformers 运行 Qwen3.6,请参见 KTransformers 部署指南。

Hugging Face Transformers

Hugging Face Transformers 包含一个轻量级服务器,可用于快速测试和中等负载部署。 运行 Qwen3.6 需要最新版本的 transformers:

pip install "transformers[serving]"

有关更多详情,请参见其文档。同时,请确保已安装 torchvision 和 pillow。

然后,运行 transformers serve 以启动服务器,其 API 端点位于 http://localhost:8000/v1;如果有可用的加速器,服务器会将模型部署到加速器上:

transformers serve Qwen/Qwen3.6-27B --port 8000 --continuous-batching

通过聊天补全 API 使用 Qwen3.6

聊天补全 API 可通过标准 HTTP 请求或 OpenAI SDK 访问。 这里,我们展示使用 OpenAI Python SDK 的示例。

开始前,请确保已安装该 SDK,并配置好 API 密钥和 API 基础 URL,例如:

pip install -U openai

# Set the following accordingly
export OPENAI_BASE_URL="http://localhost:8000/v1"
export OPENAI_API_KEY="EMPTY"

[!Tip] 我们建议使用以下一组采样参数进行生成

  • 一般任务的思考模式:temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0
  • 精确编码任务(如 WebDev)的思考模式:temperature=0.6, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0
  • 指令(或非思考)模式:temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0

请注意,不同推理框架对采样参数的支持情况有所不同。

[!Important] Qwen3.6 模型默认以思考模式运行,在生成最终响应前会先产生以 </think>\n...</think>\n\n 为标识的思考内容。 若要禁用思考内容并获取直接响应,请参考此处的示例。

Text-Only Input

from openai import OpenAI
# Configured by environment variables
client = OpenAI()

messages = [
    {"role": "user", "content": "Type \"I love Qwen3.6\" backwards"},
]

chat_response = client.chat.completions.create(
    model="Qwen/Qwen3.6-27B",
    messages=messages,
    max_tokens=81920,
    temperature=1.0,
    top_p=0.95,
    presence_penalty=0.0,
    extra_body={
        "top_k": 20,
    }, 
)
print("Chat response:", chat_response)

图像输入

from openai import OpenAI
# Configured by environment variables
client = OpenAI()

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "image_url",
                "image_url": {
                    "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/CI_Demo/mathv-1327.jpg"
                }
            },
            {
                "type": "text",
                "text": "The centres of the four illustrated circles are in the corners of the square. The two big circles touch each other and also the two little circles. With which factor do you have to multiply the radii of the little circles to obtain the radius of the big circles?\nChoices:\n(A) $\\frac{2}{9}$\n(B) $\\sqrt{5}$\n(C) $0.8 \\cdot \\pi$\n(D) 2.5\n(E) $1+\\sqrt{2}$"
            }
        ]
    }
]

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-27B",
    messages=messages,
    max_tokens=81920,
    temperature=1.0,
    top_p=0.95,
    presence_penalty=0.0,
    extra_body={
        "top_k": 20,
    }, 
)
print("Chat response:", chat_response)

视频输入

from openai import OpenAI
# Configured by environment variables
client = OpenAI()

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "video_url",
                "video_url": {
                    "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/video/N1cdUjctpG8.mp4"
                }
            },
            {
                "type": "text",
                "text": "How many porcelain jars were discovered in the niches located in the primary chamber of the tomb?"
            }
        ]
    }
]

# When vLLM is launched with `--media-io-kwargs '{"video": {"num_frames": -1}}'`,
# video frame sampling can be configured via `extra_body` (e.g., by setting `fps`).
# This feature is currently supported only in vLLM.
#
# By default, `fps=2` and `do_sample_frames=True`.
# With `do_sample_frames=True`, you can customize the `fps` value to set your desired video sampling rate.
response = client.chat.completions.create(
    model="Qwen/Qwen3.6-27B",
    messages=messages,
    max_tokens=81920,
    temperature=1.0,
    top_p=0.95,
    presence_penalty=0.0,
    extra_body={
        "top_k": 20,
        "mm_processor_kwargs": {"fps": 2, "do_sample_frames": True},
    }, 
)

print("Chat response:", chat_response)

指令(或非思考)模式

[!Important] Qwen3.6 不正式支持 Qwen3 的软切换,即 /think 和 /nothink。

Qwen3.6 默认会在生成响应前进行思考。 您可以通过配置 API 参数让模型直接生成响应,无需思考。 例如,

from openai import OpenAI
# Configured by environment variables
client = OpenAI()

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "image_url",
                "image_url": {
                    "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.6/demo/RealWorld/RealWorld-04.png"
                }
            },
            {
                "type": "text",
                "text": "Where is this?"
            }
        ]
    }
]

chat_response = client.chat.completions.create(
    model="Qwen/Qwen3.6-27B",
    messages=messages,
    max_tokens=32768,
    temperature=1.0,
    top_p=1.0,
    presence_penalty=2.0,
    extra_body={
        "top_k": 40,
        "chat_template_kwargs": {"enable_thinking": False},
    }, 
)
print("Chat response:", chat_response)

[!Note] 若您使用的是阿里云 Model Studio 的 API,除了修改 model 外,请使用 "enable_thinking": False,而非 "chat_template_kwargs": {"enable_thinking": False}。

保留思考过程

默认情况下,仅保留处理最新用户消息时生成的思考块,形成通常所说的交错思考模式。 Qwen3.6 经过额外训练,能够保留并利用历史消息中的思考轨迹。 您可以通过设置 preserve_thinking 选项来启用此功能:

from openai import OpenAI
# Configured by environment variables
client = OpenAI()

messages = [...]

chat_response = client.chat.completions.create(
    model="Qwen/Qwen3.6-27B",
    messages=messages,
    max_tokens=32768,
    temperature=0.6,
    top_p=0.95,
    presence_penalty=0.0,
    extra_body={
        "top_k": 20,
        "chat_template_kwargs": {"preserve_thinking": True},
    }, 
)
print("Chat response:", chat_response)

[!Note] 若您使用阿里云 Model Studio 的 API,除了修改 model 外,请使用 "preserve_thinking": True,而非 "chat_template_kwargs": {"preserve_thinking": False}。

此功能在智能体场景中尤为实用,通过保留完整的推理上下文,可增强决策的一致性,并且在多数情况下能减少冗余推理,从而降低总体的 Token 消耗。此外,它还能提升 KV 缓存的利用率,在思考模式与非思考模式下均优化推理效率。

智能体使用

Qwen3.6 在工具调用能力方面表现出色。

Qwen-Agent

我们建议使用 Qwen-Agent,以快速基于 Qwen3.6 构建智能体应用。

您可以通过 MCP 配置文件定义可用工具,也可使用 Qwen-Agent 的集成工具,或自行集成其他工具。

import os
from qwen_agent.agents import Assistant

# Define LLM
# Using Alibaba Cloud Model Studio
llm_cfg = {
    # Use the OpenAI-compatible model service provided by DashScope:
    'model': 'Qwen3.6-27B',
    'model_type': 'qwenvl_oai',
    'model_server': 'https://dashscope.aliyuncs.com/compatible-mode/v1',
    'api_key': os.getenv('DASHSCOPE_API_KEY'),

    'generate_cfg': {
        'use_raw_api': True,
        # When using Dash Scope OAI API, pass the parameter of whether to enable thinking mode in this way
        'extra_body': {
            'enable_thinking': True,
            'preserve_thinking': True,
        },
    },
}

# Using OpenAI-compatible API endpoint.
# functionality of the deployment frameworks and let Qwen-Agent automate the related operations.
#
# llm_cfg = {
#     # Use your own model service compatible with OpenAI API by vLLM/SGLang:
#     'model': 'Qwen/Qwen3.6-27B',
#     'model_type': 'qwenvl_oai',
#     'model_server': 'http://localhost:8000/v1',  # api_base
#     'api_key': 'EMPTY',
#
#     'generate_cfg': {
#         'use_raw_api': True,
#         # When using vLLM/SGLang OAI API, pass the parameter of whether to enable thinking mode in this way
#         'extra_body': {
#             'chat_template_kwargs': {'enable_thinking': True, 'preserve_thinking': True}
#         },
#     },
# }

# Define Tools
tools = [
    {'mcpServers': {  # You can specify the MCP configuration file
            "filesystem": {
                "command": "npx",
                "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/xxxx/Desktop"]
            }
        }
    }
]

# Define Agent
bot = Assistant(llm=llm_cfg, function_list=tools)

# Streaming generation
messages = [{'role': 'user', 'content': 'Help me organize my desktop.'}]
for responses in bot.run(messages=messages):
    pass
print(responses)

# Streaming generation
messages = [{'role': 'user', 'content': 'Develop a dog website and save it on the desktop'}]
for responses in bot.run(messages=messages):
    pass
print(responses)

Qwen Code

Qwen Code 是一款面向终端的开源 AI 助手,专为 Qwen 模型优化。它能帮助您理解大型代码库、自动化繁琐工作,从而加快开发交付速度。

更多信息,请参考 Qwen Code。

超长文本处理

Qwen3.6 原生支持最长 262,144 tokens 的上下文长度。 对于总长度(包括输入和输出)超过此限制的长文本任务,我们建议使用 RoPE 缩放技术(如 YaRN)来有效处理长文本。

目前已有多个推理框架支持 YaRN,例如 transformers、vllm、ktransformers 和 sglang。 通常,在支持的框架中启用 YaRN 有两种方法:

  • 修改模型配置文件: 在 config.json 文件中,将 text_config 里的 rope_parameters 字段修改为:

    {
        "mrope_interleaved": true,
        "mrope_section": [
            11,
            11,
            10
        ],
        "rope_type": "yarn",
        "rope_theta": 10000000,
        "partial_rotary_factor": 0.25,
        "factor": 4.0,
        "original_max_position_embeddings": 262144,
    }
  • 通过命令行参数:

    对于 vllm,您可以使用

    VLLM_ALLOW_LONG_MAX_MODEL_LEN=1 vllm serve ... --hf-overrides '{"text_config": {"rope_parameters": {"mrope_interleaved": true, "mrope_section": [11, 11, 10], "rope_type": "yarn", "rope_theta": 10000000, "partial_rotary_factor": 0.25, "factor": 4.0, "original_max_position_embeddings": 262144}}}' --max-model-len 1010000  

    对于 sglang 和 ktransformers,您可以使用

    SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 python -m sglang.launch_server ... --json-model-override-args '{"text_config": {"rope_parameters": {"mrope_interleaved": true, "mrope_section": [11, 11, 10], "rope_type": "yarn", "rope_theta": 10000000, "partial_rotary_factor": 0.25, "factor": 4.0, "original_max_position_embeddings": 262144}}}' --context-length 1010000

[!NOTE] 所有主流开源框架均实现了静态 YaRN,这意味着缩放因子不随输入长度变化,可能会影响短文本的性能。 我们建议仅在需要处理长上下文时才修改 rope_parameters 配置。 同时,建议根据需求调整 factor。例如,如果您的应用场景中典型的上下文长度为 524,288 tokens,将 factor 设置为 2.0 会更合适。

最佳实践

为实现最佳性能,我们建议采用以下设置:

  1. 采样参数:

    • 建议根据模式和任务类型使用以下采样参数集:
      • 通用任务思考模式:
        temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,presence_penalty=0.0,repetition_penalty=1.0
      • 精确编码任务思考模式(如Web开发):
        temperature=0.6,top_p=0.95,top_k=20,min_p=0.0,presence_penalty=0.0,repetition_penalty=1.0
      • 指令(或非思考)模式:
        temperature=0.7,top_p=0.80,top_k=20,min_p=0.0,presence_penalty=1.5,repetition_penalty=1.0
    • 对于支持的框架,可将presence_penalty参数在0到2之间调整以减少无限重复。但较高的取值偶尔可能导致语言混用,并略微降低模型性能。
  2. 充足的输出长度:对于大多数查询,建议使用32,768个token的输出长度。在对数学和编程竞赛等高度复杂问题进行基准测试时,建议将最大输出长度设置为81,920个token。这为模型生成详细全面的响应提供了足够空间,从而提升整体性能。

  3. 标准化输出格式:进行基准测试时,建议使用提示词标准化模型输出。

    • 数学问题:在提示词中包含“请逐步推理,并将最终答案放在\boxed{}内。”
    • 多项选择题:在提示词中添加以下JSON结构以标准化响应:“请在answer字段中仅用选项字母显示您的选择,例如:"answer": "C"。”
  4. 长视频理解:为优化纯文本和图像的推理效率,已发布的video_preprocessor_config.json中的size参数采用保守配置。建议将视频预处理配置文件中的longest_edge参数设置为469,762,048(对应224k视频token),以支持小时级视频的更高帧率采样,从而获得更优性能。例如:

    {"longest_edge": 469762048, "shortest_edge": 4096}

    或者,通过引擎启动参数覆盖默认值。实现细节请参考:vLLM / SGLang。

引用

如果您觉得我们的工作对您有帮助,欢迎引用我们的成果。

@misc{Qwen3.6-27B,
    title  = {{Qwen3.6-27B}: Flagship-Level Coding in a {27B} Dense Model},
    author = {{Qwen Team}},
    month  = {April},
    year   = {2026},
    url    = {https://qwen.ai/blog?id=qwen3.6-27b}
}