Views
No views yet
[!Note] This repository contains FP8-quantized 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.The quantization method is fine-grained fp8 quantization with block size of 128, and its performance metrics are nearly identical to those of the original model.
[!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.
reasoning_effort, and reasoning context from historical messages is retained via preserve_thinking.[!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.
[!Important] Qwen3.8 models operate in thinking mode by default, generating thinking content signified by<think>\n...</think>\n\nbefore 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.0Please note that the support for sampling parameters varies according to inference frameworks.
reasoning_effort, which can be used to adjust reasoning depth and control cost:xhigh (default): for complex tasks demanding thorough analysismedium: balancing accuracy and speedlow: efficient reasoning optimizing for speed and costpreserve_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.
1pip install -U openai
2
3# Set the following accordingly
4export OPENAI_BASE_URL='your-base-url'
5export OPENAI_API_KEY='your-api-key'1from openai import OpenAI
2# Configured by environment variables
3client = OpenAI()
4
5messages = [{"role": "user", "content": "Write a Python function to merge two sorted linked lists."}]
6
7completion = client.chat.completions.create(
8 model="Qwen/Qwen3.8-27B-FP8",
9 messages=messages,
10 extra_body={
11 "chat_template_kwargs": {
12 "enable_thinking": True, # on by default
13 "preserve_thinking": True, # on by default
14 },
15 },
16 reasoning_effort="xhigh", # xhigh by default; supported levels are xhigh, medium, and low
17 stream=True,
18 stream_options={"include_usage": True},
19)
20
21reasoning_content = ""
22answer_content = ""
23is_answering = False
24print("\n" + "=" * 20 + "Reasoning" + "=" * 20 + "\n")
25
26for chunk in completion:
27 if not chunk.choices:
28 print("\nUsage:")
29 print(chunk.usage)
30 continue
31
32 delta = chunk.choices[0].delta
33
34 if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
35 if not is_answering:
36 print(delta.reasoning_content, end="", flush=True)
37 reasoning_content += delta.reasoning_content
38
39 if hasattr(delta, "content") and delta.content:
40 if not is_answering:
41 print("\n" + "=" * 20 + "Answer" + "=" * 20 + "\n")
42 is_answering = True
43 print(delta.content, end="", flush=True)
44 answer_content += delta.content1from openai import OpenAI
2# Configured by environment variables
3client = OpenAI()
4
5messages = [
6 {
7 "role": "user",
8 "content": [
9 {
10 "type": "image_url",
11 "image_url": {
12 "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/CI_Demo/mathv-1327.jpg"
13 }
14 },
15 {
16 "type": "text",
17 "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}$"
18 }
19 ]
20 }
21]
22
23chat_response = client.chat.completions.create(
24 model="Qwen/Qwen3.8-27B-FP8",
25 messages=messages,
26)
27print("Chat response:", chat_response)1from openai import OpenAI
2# Configured by environment variables
3client = OpenAI()
4
5messages = [
6 {
7 "role": "user",
8 "content": [
9 {
10 "type": "video_url",
11 "video_url": {
12 "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/video/N1cdUjctpG8.mp4"
13 }
14 },
15 {
16 "type": "text",
17 "text": "How many porcelain jars were discovered in the niches located in the primary chamber of the tomb?"
18 }
19 ]
20 }
21]
22
23# When vLLM is launched with `--media-io-kwargs '{"video": {"num_frames": -1}}'`,
24# video frame sampling can be configured via `extra_body` (e.g., by setting `fps`).
25# This feature is currently supported only in vLLM.
26#
27# By default, `fps=2` and `do_sample_frames=True`.
28# With `do_sample_frames=True`, you can customize the `fps` value to set your desired video sampling rate.
29chat_response = client.chat.completions.create(
30 model="Qwen/Qwen3.8-27B-FP8",
31 messages=messages,
32 extra_body={
33 "mm_processor_kwargs": {"fps": 2, "do_sample_frames": True},
34 },
35)
36
37print("Chat response:", chat_response)1from openai import OpenAI
2# Configured by environment variables
3client = OpenAI()
4
5messages = [
6 {
7 "role": "user",
8 "content": [
9 {
10 "type": "image_url",
11 "image_url": {
12 "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.6/demo/RealWorld/RealWorld-04.png"
13 }
14 },
15 {
16 "type": "text",
17 "text": "Where is this?"
18 }
19 ]
20 }
21]
22
23chat_response = client.chat.completions.create(
24 model="Qwen/Qwen3.8-27B-FP8",
25 messages=messages,
26 temperature=0.7,
27 top_p=0.8,
28 presence_penalty=1.5,
29 extra_body={
30 "top_k": 20,
31 "chat_template_kwargs": {"enable_thinking": False},
32 },
33)
34print("Chat response:", chat_response)[!Note] If you are using APIs from Qwen Cloud, in addition to changingmodel, please use"enable_thinking": Falseinstead of"chat_template_kwargs": {"enable_thinking": False}.
preserve_thinking to False:1from openai import OpenAI
2
3# Configured by environment variables
4client = OpenAI()
5messages = [...]
6chat_response = client.chat.completions.create(
7 model="Qwen/Qwen3.8-27B-FP8",
8 messages=messages,
9 extra_body={
10 "chat_template_kwargs": {"preserve_thinking": False},
11 },
12)
13print("Chat response:", chat_response)[!Note] If you are using APIs from Qwen Cloud, in addition to changingmodel, please use"preserve_thinking": Falsedirectly instead of wrapping it inchat_template_kwargs.
temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0presence_penalty 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.config.json file, change the rope_parameters fields in text_config to:1{
2 "mrope_interleaved": true,
3 "mrope_section": [
4 11,
5 11,
6 10
7 ],
8 "rope_type": "yarn",
9 "rope_theta": 10000000,
10 "partial_rotary_factor": 0.25,
11 "factor": 4.0,
12 "original_max_position_embeddings": 262144,
13}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 1000000 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 1000000TOKENSPEED_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 tokenspeed 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 1000000 [!NOTE] All the notable open-source frameworks implement static YaRN, which means the scaling factor remains constant regardless of input length, potentially impacting performance on shorter texts. We advise modifying therope_parametersconfiguration only when processing long contexts is required. It is also recommended to modify thefactoras needed. For example, if the typical context length for your application is 524,288 tokens, it would be better to setfactoras 2.0.
size parameter in the released video_preprocessor_config.json is conservatively configured. It is recommended to set the longest_edge parameter in the video_preprocessor_config file to 469,762,048 (corresponding to 224k video tokens) to enable higher frame-rate sampling for hour-scale videos and thereby achieve superior performance. For example,{"longest_edge": 469762048, "shortest_edge": 4096}1@misc{qwen38,
2 title = {{Qwen3.8-Max}: A New Bar for Coding and Cowork},
3 url = {https://qwen.ai/blog?id=qwen3.8},
4 author = {{Qwen Team}},
5 month = {August},
6 year = {2026}
7}