How this was quantized
Round-to-nearest (RTN), no calibration data. Every weight is rounded
independently to the nearest INT8 level using a symmetric per-group scale. There
is no Hessian, no error compensation, and no forward pass over a dataset.
That is a deliberate choice, not a shortcut around missing data. GPTQ's error
compensation exists to rescue 4-bit quantization, where rounding error is
large enough that redistributing it across the remaining weights pays for
itself. At 8 bits there is very little left to rescue: measured on this model,
the relative Frobenius error of the quantized weights is 0.567%. The gap
between RTN and a fully calibrated GPTQ at this width is small.
The only refinement over naive RTN is in choosing the scale: instead of
max/127, ~21 candidate shrink factors in [0.80, 1.00] are searched per group
and the one minimising squared error is kept.
Note on the format. quantization_config.quant_method is "gptq" because
that is the file layout (qweight packed into int32, per-group scales,
qzeros, g_idx) which is what the inference kernels know how to read. The
algorithm that produced the values is RTN. If you need calibrated GPTQ,
this is not that.
Settings, and why
Table with columns: Setting, Value, Reason| Setting | Value | Reason |
|---|
bits | 8 | weight-only; activations stay FP16 |
group_size | 32 | finer groups measurably lower the error (0.567% at g32 on this model) for ~1.6 GiB |
sym | true | vLLM's AutoGPTQConfig.TYPE_MAP only accepts (4, True) and (8, True) |
What is quantized, and what is not
Quantized (400 tensors): mlp.{gate,up,down}_proj,
linear_attn.{in_proj_qkv,in_proj_z,out_proj}, self_attn.{q,k,v,o}_proj.
Left in BF16: the vision tower, embeddings, lm_head, all norms,
conv1d / A_log / dt_bias, the MTP block, and
linear_attn.in_proj_a / in_proj_b. Those last two are [48, 5120] gate and
decay projections for the Gated DeltaNet, quantizing them would save about 1 MB
across the whole model while perturbing the parameters that govern its
linear-memory decay.
Measured error
Relative Frobenius error, ‖W_q − W‖ / ‖W‖, measured on the actual 3.8
tensors after quantization (dequantize each group, compare to the BF16
original):
Table with columns: layer, tensor, error| layer | tensor | error |
|---|
| L0 | mlp.gate_proj | 0.558% |
| L0 | mlp.down_proj | 0.563% |
| L0 | linear_attn.out_proj | 0.582% |
| L3 | self_attn.q_proj | 0.564% |
| L3 |
Stable from the first to the last layer. In absolute terms this preserves
weights to the third or fourth decimal: a weight of -0.204102 becomes
-0.204902. Mean absolute error per weight is ~170× smaller than the mean
weight magnitude.
Serving
Verified on 4 × AMD Radeon RX 7900 XTX (gfx1100, RDNA3) with vLLM 0.25.1 built
from source for gfx1100.
vllm serve <path> \
--dtype float16 \
--tensor-parallel-size 4 \
--kv-cache-dtype fp8 \
--enable-prefix-caching \
--enable-chunked-prefill \
--max-model-len 524288 \
--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": 2.0, "original_max_position_embeddings": 262144}}}'
quant_method: gptq is picked up automatically from config.json; no explicit
--quantization flag is needed. The YaRN override (factor 2.0) extends the
262,144-token native context to 524,288; drop it and lower --max-model-len
if you do not need the extended window (static YaRN can cost quality on short
texts).
--dtype float16 is required, not a preference. On ROCm the only kernel
that implements INT8 (uint8b128) mixed-precision linear layers is Exllama, and
it rejects anything but FP16 activations. With --dtype auto (which resolves to
bfloat16) startup fails with:
ValueError: Failed to find a kernel that can implement the WNA16 linear layer.
ExllamaLinearKernel cannot implement due to: Exllama only supports float16 activations
On CUDA the usual Marlin/Machete paths apply and this constraint does not.
Known limitation. FP16 has a much narrower dynamic range than the BF16 the
base model was trained in, and Qwen activation outliers can overflow it. On the
MoE sibling of this model, serving in FP16 degenerated on long reasoning traces
(repetition loops, then token-level garbage) and switching to BF16 fixed it.
Here BF16 is not an option on ROCm, because Exllama is the only kernel that
implements INT8 linear layers and it requires FP16. If you hit degeneration on
long generations, that is the first thing to suspect, not the quantization.
On CUDA, where Marlin accepts BF16, the issue does not arise.
Measured on 4 × RX 7900 XTX
- weights: ~7.8 GiB per card at TP=4
- KV cache: 7.92 GiB per card with
--kv-cache-dtype fp8, prefix caching and
chunked prefill enabled
- 808,725 tokens of KV cache; served at
--max-model-len 524288 with 1.54×
concurrency
Caveats
Quality was verified by generation — the model produces coherent, correct output
— but no benchmark comparison against the original BF16 weights has been
run. Weight reconstruction error does not map linearly to output quality. If
your workload is sensitive, measure it.
Original model card — Qwen/Qwen3.8-27B
library_name: transformers
license: apache-2.0
pipeline_tag: image-text-to-text
Qwen3.8-27B
[!Note]
This repository contains model weights and configuration files for the post-trained model in the Hugging Face Transformers format.
These artifacts are compatible with Hugging Face Transformers, vLLM, SGLang, TokenSpeed, etc.
[!Tip]
For users seeking managed, scalable inference without infrastructure maintenance, the official Qwen API service is provided by Qwen Cloud.
In particular, Qwen3.8-27B will be available as a hosted version with more production features, e.g., 1M context length by default, official built-in tools. For more information, please refer to the Qwen3.8-27B Overview. The service is coming soon. Stay tuned for updates.
Following the widespread community adoption of the Qwen3.5 and Qwen3.6 series, we are pleased to introduce Qwen3.8, the most capable generation in the Qwen open-model family to date.
Built on the architectural foundation of Qwen3.5, Qwen3.8 delivers substantial gains across coding, professional work, research, and long-horizon agentic tasks. Qwen3.8-27B brings these advances to a compact, deployment-friendly dense model: a native vision-language model that understands images and videos, with flexible thinking control, designed to carry complex, multi-step tasks through to completion with greater reliability.
Qwen3.8 Highlights
Qwen3.8-27B features the following enhancements:
- Core Capabilities: Comprehensive improvements across coding, professional work, research, and long-horizon agentic tasks.
- Agent Execution: Stronger autonomous planning and better handling of environment feedback, leading to more reliable end-to-end task completion.
- Downstream Compatibility: Broader support for popular harnesses and development tools, making it easier to integrate into your existing stack.
- Flexible Thinking Control: Thinking mode is on by default and can be disabled per request; reasoning depth can be tuned with
reasoning_effort, and reasoning context from historical messages is retained via preserve_thinking.
- Vision-Language Understanding: Native support for image and video understanding, from STEM diagrams and documents to hour-scale videos.
Model Overview
- Type: Causal Language Model with Vision Encoder
- Training Stage: Pre-training & Post-training
- Language Model
- Number of Parameters: 27B
- Hidden Dimension: 5120
- Token Embedding: 248,320 (Padded)
- Number of Layers: 64
- Hidden Layout: 16 × (3 × (Gated DeltaNet → FFN) → 1 × (Gated Attention → FFN))
- Gated DeltaNet:
- Number of Linear Attention Heads: 48 for V and 16 for QK
- Head Dimension: 128
- Gated Attention:
- Number of Attention Heads: 24 for Q and 4 for KV
- Head Dimension: 256
- Rotary Position Embedding Dimension: 64
Benchmark Results
Text Performance
Quickstart
For streamlined integration, we recommend using Qwen3.8 via APIs.
Serving Qwen3.8
[!Important]
Inference efficiency and throughput vary significantly across frameworks.
We recommend using the latest framework versions to ensure optimal performance and compatibility.
For production workloads or high-throughput scenarios, dedicated serving engines such as SGLang, vLLM, or TokenSpeed are recommended.
Qwen3.8 can be deployed with popular inference frameworks, e.g.:
API Usage
[!Important]
Qwen3.8 models operate in thinking mode by default, generating thinking content signified by <think>\n...</think>\n\n before producing the final response.
To disable thinking content and obtain a direct response, refer to the examples here.
[!Tip]
We recommend using the following sets of sampling parameters for generation:
- Thinking Mode:
temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0
- Instruct (or non-thinking) mode:
temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
Please note that the support for sampling parameters varies according to inference frameworks.
Qwen3.8 comes with official support for reasoning_effort, which can be used to adjust reasoning depth and control cost:
xhigh (default): for complex tasks demanding thorough analysis
medium: balancing accuracy and speed
low: efficient reasoning optimizing for speed and cost
In addition, preserve_thinking is enabled by default for all workloads for the best out-of-the-box experience. To disable preserved thinking, refer to the examples here.
[!Tip]
In multi-turn agentic tasks, lower reasoning effort does not always reduce overall task completion time. Although it may produce faster per-turn responses, it can also lead to insufficient analysis, more failures, and repeated retries, which may increase total latency and token consumption.
Chat Completions API
The Chat Completions API can be used with most inference frameworks, as well as Qwen Cloud.
Before starting, make sure the OpenAI Python SDK is installed and the API key and the API base URL are configured, e.g.:
pip install -U openai
# Set the following accordingly
export OPENAI_BASE_URL='your-base-url'
export OPENAI_API_KEY='your-api-key'
Text-Only Input
from openai import OpenAI
client = OpenAI()
messages = [{"role": "user", "content": "Write a Python function to merge two sorted linked lists."}]
completion = client.chat.completions.create(
model="Qwen/Qwen3.8-27B",
messages=messages,
extra_body={
"chat_template_kwargs": {
"enable_thinking": True,
"preserve_thinking": True,
},
},
reasoning_effort="xhigh",
stream=True,
stream_options={"include_usage": True},
)
reasoning_content = ""
answer_content = ""
is_answering = False
print("\n" + "=" * 20 + "Reasoning" + "=" * 20 + "\n")
for chunk in completion:
if not chunk.choices:
print("\nUsage:")
print(chunk.usage)
continue
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
if not is_answering:
print(delta.reasoning_content, end="", flush=True)
reasoning_content += delta.reasoning_content
elif hasattr(delta, "reasoning") and delta.reasoning is not None:
if not is_answering:
print(delta.reasoning, end="", flush=True)
reasoning_content += delta.reasoning
if hasattr(delta, "content") and delta.content:
if not is_answering:
print("\n" + "=" * 20 + "Answer" + "=" * 20 + "\n")
is_answering = True
print(delta.content, end="", flush=True)
answer_content += delta.content
messages.append({
"role": "assistant",
"content": answer_content,
"reasoning_content": reasoning_content,
"reasoning": reasoning_content,
})
from openai import OpenAI
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}$"
}
]
}
]
chat_response = client.chat.completions.create(
model="Qwen/Qwen3.8-27B",
messages=messages,
)
print("Chat response:", chat_response)
from openai import OpenAI
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?"
}
]
}
]
chat_response = client.chat.completions.create(
model="Qwen/Qwen3.8-27B",
messages=messages,
)
print("Chat response:", chat_response)
Instruct (or Non-Thinking) Mode
Qwen3.8-27B will think by default before responding.
You can obtain a direct response from the model without thinking by configuring the API parameters.
For example,
from openai import OpenAI
client = OpenAI()
messages = [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/RealWorld/RealWorld-04.png"
}
},
{
"type": "text",
"text": "Where is this?"
}
]
}
]
chat_response = client.chat.completions.create(
model="Qwen/Qwen3.8-27B",
messages=messages,
temperature=0.7,
top_p=0.8,
presence_penalty=1.5,
extra_body={
"top_k": 20,
"chat_template_kwargs": {"enable_thinking": False},
},
)
print("Chat response:", chat_response)
[!Note]
If you are using APIs from Qwen Cloud, in addition to changing model, please use "enable_thinking": False instead of "chat_template_kwargs": {"enable_thinking": False}.
Disable Preserved Thinking
By default, Qwen3.8 retains thinking blocks from all historical messages, maintaining a complete reasoning trace across the conversation. This behavior, known as preserved thinking, ensures full context continuity and is especially beneficial for agent scenarios where decision consistency and reduced redundant reasoning are critical. It also improves KV cache utilization, optimizing inference efficiency in both thinking and non-thinking modes.
If you prefer to retain only the thinking blocks from the latest user message, you can disable this behavior by setting preserve_thinking to False:
from openai import OpenAI
client = OpenAI()
messages = [...]
chat_response = client.chat.completions.create(
model="Qwen/Qwen3.8-27B",
messages=messages,
extra_body={
"chat_template_kwargs": {"preserve_thinking": False},
},
)
print("Chat response:", chat_response)
[!Note]
If you are using APIs from Qwen Cloud, in addition to changing model, please use "preserve_thinking": False directly instead of wrapping it in chat_template_kwargs.
Best Practices
To achieve optimal performance, we recommend the following settings:
-
Sampling Parameters: We suggest using the following sets of sampling parameters:
- Thinking Mode:
temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0
- Instruct (or non-thinking) mode:
temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
For supported frameworks, you can adjust the parameter between 0 and 2 to reduce endless repetition. However, using a higher value may occasionally result in language mixing and a slight decrease in model performance.
Citation
If you find our work helpful, feel free to give us a cite.
@misc{qwen38,
title = {{Qwen3.8-Max}: A New Bar for Coding and Cowork},
url = {https://qwen.ai/blog?id=qwen3.8},
author = {{Qwen Team}},
month = {August},
year = {2026}
}