littlebird13 commited on
Commit
c5f5f26
·
verified ·
1 Parent(s): 254a20c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +297 -3
README.md CHANGED
@@ -1,3 +1,297 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3-Next-80B-A3B-Instruct-FP8/blob/main/LICENSE
5
+ pipeline_tag: text-generation
6
+ base_model:
7
+ - Qwen/Qwen3-Next-80B-A3B-Instruct
8
+ ---
9
+
10
+ # Qwen3-Next-80B-A3B-Instruct-FP8
11
+ <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
12
+ <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
13
+ </a>
14
+
15
+ Over the past few months, we have observed increasingly clear trends toward scaling both total parameters and context lengths in the pursuit of more powerful and agentic artificial intelligence (AI).
16
+ We are excited to share our latest advancements in addressing these demands, centered on improving scaling efficiency through innovative model architecture.
17
+ We call this next-generation foundation models **Qwen3-Next**.
18
+
19
+ > [!Note]
20
+ > This repository contains the **FP8-quantized Qwen3-Next-80B-A3B-Instruct** model checkpoint for convenience and performance.
21
+ > The quantization method is "fine-grained fp8" quantization with block size of 128.
22
+ > You can find more details in the `quantization_config` field in `config.json`.
23
+ >
24
+ > In addition, the experimental results presented in this model card are obtained from the original bfloat16 model prior to FP8 quantization.
25
+
26
+ ## Highlights
27
+
28
+ **Qwen3-Next-80B-A3B-FP8** is the first installment in the Qwen3-Next series and features the following key enchancements:
29
+ - **Hybrid Attention**: Replaces standard attention with the combination of **Gated DeltaNet** and **Gated Attention**, enabling efficient context modeling for ultra-long context length.
30
+ - **High-Sparsity Mixture-of-Experts (MoE)**: Achieves an extreme low activation ratio in MoE layers, drastically reducing FLOPs per token while preserving model capacity.
31
+ - **Stability Optimizations**: Includes techniques such as **zero-centered and weight-decayed layernorm**, and other stabilizing enhancements for robust pre-training and post-training.
32
+ - **Multi-Token Prediction (MTP)**: Boosts pretraining model performance and accelerates inference.
33
+
34
+ We are seeing strong performance in terms of both parameter efficiency and inference speed for Qwen3-Next-80B-A3B:
35
+ - Qwen3-Next-80B-A3B-Base outperforms Qwen3-32B-Base on downstream tasks with 10% of the total training cost and with 10 times inference throughput for context over 32K tokens.
36
+ - Qwen3-Next-80B-A3B-Instruct performs on par with Qwen3-235B-A22B-Instruct-2507 on certain benchmarks, while demonstrating significant advantages in handling ultra-long-context tasks up to 256K tokens.
37
+
38
+ ![Qwen3-Next-80B-A3B-Instruct Benchmark Comparison](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-Next/Qwen3-Next-80B-A3B-Instruct.001.jpeg)
39
+
40
+ For more details, please refer to our blog post [Qwen3-Next](https://qwen.ai/blog?id=4074cca80393150c248e508aa62983f9cb7d27cd&from=research.latest-advancements-list).
41
+
42
+ ## Model Overview
43
+
44
+ > [!Note]
45
+ > **Qwen3-Next-80B-A3B-Instruct-FP8** supports only instruct (non-thinking) mode and does not generate ``<think></think>`` blocks in its output.
46
+
47
+ This repo contains the FP8 version of **Qwen3-Next-80B-A3B-Instruct**, which has the following features:
48
+ - Type: Causal Language Models
49
+ - Training Stage: Pretraining (15T tokens) & Post-training
50
+ - Number of Parameters: 80B in total and 3B activated
51
+ - Number of Paramaters (Non-Embedding): 79B
52
+ - Hidden Dimension: 2048
53
+ - Number of Layers: 48
54
+ - Hybrid Layout: 12 \* (3 \* (Gated DeltaNet -> MoE) -> 1 \* (Gated Attention -> MoE))
55
+ - Gated Attention:
56
+ - Number of Attention Heads: 16 for Q and 2 for KV
57
+ - Head Dimension: 256
58
+ - Rotary Position Embedding Dimension: 64
59
+ - Gated DeltaNet:
60
+ - Number of Linear Attention Heads: 32 for V and 16 for QK
61
+ - Head Dimension: 128
62
+ - Mixture of Experts:
63
+ - Number of Experts: 512
64
+ - Number of Activated Experts: 10
65
+ - Number of Shared Experts: 1
66
+ - Expert Intermediate Dimension: 512
67
+ - Context Length: 262,144 natively and extensible up to 1,010,000 tokens
68
+
69
+ <img src="https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-Next/model_architecture.png" height="384px" title="Qwen3-Next Model Architecture" />
70
+
71
+
72
+ ## Performance
73
+
74
+ | | Qwen3-30B-A3B-Instruct-2507 | Qwen3-32B Non-Thinking | Qwen3-235B-A22B-Instruct-2507 | Qwen3-Next-80B-A3B-Instruct |
75
+ |--- | --- | --- | --- | --- |
76
+ | **Knowledge** | | | | |
77
+ | MMLU-Pro | 78.4 | 71.9 | **83.0** | 80.6 |
78
+ | MMLU-Redux | 89.3 | 85.7 | **93.1** | 90.9 |
79
+ | GPQA | 70.4 | 54.6 | **77.5** | 72.9 |
80
+ | SuperGPQA | 53.4 | 43.2 | **62.6** | 58.8 |
81
+ | **Reasoning** | | | | |
82
+ | AIME25 | 61.3 | 20.2 | **70.3** | 69.5 |
83
+ | HMMT25 | 43.0 | 9.8 | **55.4** | 54.1 |
84
+ | LiveBench 20241125 | 69.0 | 59.8 | 75.4 | **75.8** |
85
+ | **Coding** | | | | |
86
+ | LiveCodeBench v6 (25.02-25.05) | 43.2 | 29.1 | 51.8 | **56.6** |
87
+ | MultiPL-E | 83.8 | 76.9 | **87.9** | 87.8 |
88
+ | Aider-Polyglot | 35.6 | 40.0 | **57.3** | 49.8 |
89
+ | **Alignment** | | | | |
90
+ | IFEval | 84.7 | 83.2 | **88.7** | 87.6 |
91
+ | Arena-Hard v2* | 69.0 | 34.1 | 79.2 | **82.7** |
92
+ | Creative Writing v3 | 86.0 | 78.3 | **87.5** | 85.3 |
93
+ | WritingBench | 85.5 | 75.4 | 85.2 | **87.3** |
94
+ | **Agent** | | | | |
95
+ | BFCL-v3 | 65.1 | 63.0 | **70.9** | 70.3 |
96
+ | TAU1-Retail | 59.1 | 40.1 | **71.3** | 60.9 |
97
+ | TAU1-Airline | 40.0 | 17.0 | **44.0** | 44.0 |
98
+ | TAU2-Retail | 57.0 | 48.8 | **74.6** | 57.3 |
99
+ | TAU2-Airline | 38.0 | 24.0 | **50.0** | 45.5 |
100
+ | TAU2-Telecom | 12.3 | 24.6 | **32.5** | 13.2 |
101
+ | **Multilingualism** | | | | |
102
+ | MultiIF | 67.9 | 70.7 | **77.5** | 75.8 |
103
+ | MMLU-ProX | 72.0 | 69.3 | **79.4** | 76.7 |
104
+ | INCLUDE | 71.9 | 70.9 | **79.5** | 78.9 |
105
+ | PolyMATH | 43.1 | 22.5 | **50.2** | 45.9 |
106
+
107
+ *: For reproducibility, we report the win rates evaluated by GPT-4.1.
108
+
109
+ ## Deployment
110
+
111
+ You can use Qwen3-Next-80B-A3B-Instruct-FP8 with serveral inference frameworks, including `sglang`, and `vllm`, as the original bfloat16 model.
112
+ The following guide demonstrates how to serve Qwen3-Next-80B-A3B-Instruct-FP8 via an OpenAI-compatible API endpoint using the latest `sglang` or `vllm`.
113
+
114
+ ### SGLang
115
+
116
+ [SGLang](https://github.com/sgl-project/sglang) is a fast serving framework for large language models and vision language models.
117
+ SGLang could be used to launch a server with OpenAI-compatible API service.
118
+
119
+ The latest main of `sglang` is required for Qwen3-Next-FP8, which can be installed using:
120
+ ```shell
121
+ pip install 'sglang[all] @ git+https://github.com/sgl-project/sglang.git@main'
122
+ ```
123
+ See [its documentation](https://docs.sglang.ai/get_started/install.html) for more details.
124
+
125
+ The following command can be used to create an API endpoint at `http://localhost:30000/v1` with maximum context length 256K tokens using tensor parallel on 4 GPUs.
126
+ ```shell
127
+ python -m sglang.launch_server --model-path Qwen/Qwen3-Next-80B-A3B-Instruct-FP8 --port 30000 --tp-size 4 --context-length 262144 --mem-fraction-static 0.8
128
+ ```
129
+
130
+ The following command is recommended for MTP with the rest settings the same as above:
131
+ ```shell
132
+ python -m sglang.launch_server --model-path Qwen/Qwen3-Next-80B-A3B-Instruct-FP8 --port 30000 --tp-size 4 --context-length 262144 --mem-fraction-static 0.8 --speculative-algo NEXTN --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4
133
+ ```
134
+
135
+ > [!Note]
136
+ > The default context length is 256K. Consider reducing the context length to a smaller value, e.g., `32768`, if the server fails to start.
137
+
138
+ Please also refer to SGLang's usage guide on [Qwen3-Next](https://docs.sglang.ai/basic_usage/qwen3.html).
139
+
140
+ ### vLLM
141
+
142
+ [vLLM](https://github.com/vllm-project/vllm) is a high-throughput and memory-efficient inference and serving engine for LLMs.
143
+ vLLM could be used to launch a server with OpenAI-compatible API service.
144
+
145
+ The latest main of `vllm` is required for Qwen3-Next-FP8, which can be installed using:
146
+ ```shell
147
+ pip install vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
148
+ ```
149
+ See [its documentation](https://docs.vllm.ai/en/stable/getting_started/installation/index.html) for more details.
150
+
151
+ The following command can be used to create an API endpoint at `http://localhost:8000/v1` with maximum context length 256K tokens using tensor parallel on 4 GPUs.
152
+ ```shell
153
+ vllm serve Qwen/Qwen3-Next-80B-A3B-Instruct-FP8 --port 8000 --tensor-parallel-size 4 --max-model-len 262144
154
+ ```
155
+
156
+ The following command is recommended for MTP with the rest settings the same as above:
157
+ ```shell
158
+ vllm serve Qwen/Qwen3-Next-80B-A3B-Instruct-FP8 --port 8000 --tensor-parallel-size 4 --max-model-len 262144 --speculative-config '{"method":"qwen3_next_mtp","num_speculative_tokens":2}'
159
+ ```
160
+
161
+ > [!Note]
162
+ > The default context length is 256K. Consider reducing the context length to a smaller value, e.g., `32768`, if the server fails to start.
163
+
164
+ Please also refer to vLLM's usage guide on [Qwen3-Next](https://docs.vllm.ai/projects/recipes/en/latest/Qwen/Qwen3-Next.html).
165
+
166
+ ## Agentic Use
167
+
168
+ Qwen3 excels in tool calling capabilities. We recommend using [Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) to make the best use of agentic ability of Qwen3. Qwen-Agent encapsulates tool-calling templates and tool-calling parsers internally, greatly reducing coding complexity.
169
+
170
+ To define the available tools, you can use the MCP configuration file, use the integrated tool of Qwen-Agent, or integrate other tools by yourself.
171
+ ```python
172
+ from qwen_agent.agents import Assistant
173
+
174
+ # Define LLM
175
+ llm_cfg = {
176
+ 'model': 'Qwen3-Next-80B-A3B-Instruct-FP8',
177
+
178
+ # Use a custom endpoint compatible with OpenAI API:
179
+ 'model_server': 'http://localhost:8000/v1', # api_base
180
+ 'api_key': 'EMPTY',
181
+ }
182
+
183
+ # Define Tools
184
+ tools = [
185
+ {'mcpServers': { # You can specify the MCP configuration file
186
+ 'time': {
187
+ 'command': 'uvx',
188
+ 'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
189
+ },
190
+ "fetch": {
191
+ "command": "uvx",
192
+ "args": ["mcp-server-fetch"]
193
+ }
194
+ }
195
+ },
196
+ 'code_interpreter', # Built-in tools
197
+ ]
198
+
199
+ # Define Agent
200
+ bot = Assistant(llm=llm_cfg, function_list=tools)
201
+
202
+ # Streaming generation
203
+ messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
204
+ for responses in bot.run(messages=messages):
205
+ pass
206
+ print(responses)
207
+ ```
208
+
209
+
210
+ ## Processing Ultra-Long Texts
211
+
212
+ Qwen3-Next natively supports context lengths of up to 262,144 tokens.
213
+ For conversations where the total length (including both input and output) significantly exceeds this limit, we recommend using RoPE scaling techniques to handle long texts effectively.
214
+ We have validated the model's performance on context lengths of up to 1 million tokens using the [YaRN](https://arxiv.org/abs/2309.00071) method.
215
+
216
+ YaRN is currently supported by several inference frameworks, e.g., `transformers`, `vllm` and `sglang`.
217
+ In general, there are two approaches to enabling YaRN for supported frameworks:
218
+
219
+ - Modifying the model files:
220
+ In the `config.json` file, add the `rope_scaling` fields:
221
+ ```json
222
+ {
223
+ ...,
224
+ "rope_scaling": {
225
+ "rope_type": "yarn",
226
+ "factor": 4.0,
227
+ "original_max_position_embeddings": 262144
228
+ }
229
+ }
230
+ ```
231
+
232
+ - Passing command line arguments:
233
+
234
+ For `vllm`, you can use
235
+ ```shell
236
+ VLLM_ALLOW_LONG_MAX_MODEL_LEN=1 vllm serve ... --rope-scaling '{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":262144}' --max-model-len 1010000
237
+ ```
238
+
239
+ For `sglang`, you can use
240
+ ```shell
241
+ SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 python -m sglang.launch_server ... --json-model-override-args '{"rope_scaling":{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":262144}}' --context-length 1010000
242
+ ```
243
+
244
+ > [!NOTE]
245
+ > 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.**
246
+ > We advise adding the `rope_scaling` configuration only when processing long contexts is required.
247
+ > It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 524,288 tokens, it would be better to set `factor` as 2.0.
248
+
249
+ #### Long-Context Performance
250
+
251
+ We test the model on an 1M version of the [RULER](https://arxiv.org/abs/2404.06654) benchmark.
252
+
253
+ | Model Name | Acc avg | 4k | 8k | 16k | 32k | 64k | 96k | 128k | 192k | 256k | 384k | 512k | 640k | 768k | 896k | 1000k |
254
+ |---------------------------------------------|---------|------|------|------|------|------|------|------|------|------|------|------|------|------|------|-------|
255
+ | Qwen3-30B-A3B-Instruct-2507 | 86.8 | 98.0 | 96.7 | 96.9 | 97.2 | 93.4 | 91.0 | 89.1 | 89.8 | 82.5 | 83.6 | 78.4 | 79.7 | 77.6 | 75.7 | 72.8 |
256
+ | Qwen3-235B-A22B-Instruct-2507 | 92.5 | 98.5 | 97.6 | 96.9 | 97.3 | 95.8 | 94.9 | 93.9 | 94.5 | 91.0 | 92.2 | 90.9 | 87.8 | 84.8 | 86.5 | 84.5 |
257
+ | Qwen3-Next-80B-A3B-Instruct | 91.8 | 98.5 | 99.0 | 98.0 | 98.7 | 97.6 | 95.0 | 96.0 | 94.0 | 93.5 | 91.7 | 86.9 | 85.5 | 81.7 | 80.3 | 80.3 |
258
+
259
+ * Qwen3-Next are evaluated with YaRN enabled. Qwen3-2507 models are evaluated with Dual Chunk Attention enabled.
260
+ * Since the evaluation is time-consuming, we use 260 samples for each length (13 sub-tasks, 20 samples for each).
261
+
262
+ ## Best Practices
263
+
264
+ To achieve optimal performance, we recommend the following settings:
265
+
266
+ 1. **Sampling Parameters**:
267
+ - We suggest using `Temperature=0.7`, `TopP=0.8`, `TopK=20`, and `MinP=0`.
268
+ - For supported frameworks, you can adjust the `presence_penalty` parameter between 0 and 2 to reduce endless repetitions. However, using a higher value may occasionally result in language mixing and a slight decrease in model performance.
269
+
270
+ 2. **Adequate Output Length**: We recommend using an output length of 16,384 tokens for most queries, which is adequate for instruct models.
271
+
272
+ 3. **Standardize Output Format**: We recommend using prompts to standardize model outputs when benchmarking.
273
+ - **Math Problems**: Include "Please reason step by step, and put your final answer within \boxed{}." in the prompt.
274
+ - **Multiple-Choice Questions**: Add the following JSON structure to the prompt to standardize responses: "Please show your choice in the `answer` field with only the choice letter, e.g., `"answer": "C"`."
275
+
276
+ ### Citation
277
+
278
+ If you find our work helpful, feel free to give us a cite.
279
+
280
+ ```
281
+ @misc{qwen3technicalreport,
282
+ title={Qwen3 Technical Report},
283
+ author={Qwen Team},
284
+ year={2025},
285
+ eprint={2505.09388},
286
+ archivePrefix={arXiv},
287
+ primaryClass={cs.CL},
288
+ url={https://arxiv.org/abs/2505.09388},
289
+ }
290
+
291
+ @article{qwen2.5-1m,
292
+ title={Qwen2.5-1M Technical Report},
293
+ author={An Yang and Bowen Yu and Chengyuan Li and Dayiheng Liu and Fei Huang and Haoyan Huang and Jiandong Jiang and Jianhong Tu and Jianwei Zhang and Jingren Zhou and Junyang Lin and Kai Dang and Kexin Yang and Le Yu and Mei Li and Minmin Sun and Qin Zhu and Rui Men and Tao He and Weijia Xu and Wenbiao Yin and Wenyuan Yu and Xiafei Qiu and Xingzhang Ren and Xinlong Yang and Yong Li and Zhiying Xu and Zipeng Zhang},
294
+ journal={arXiv preprint arXiv:2501.15383},
295
+ year={2025}
296
+ }
297
+ ```