Safetensors
glm5_next_text
speculative-decoding
dfly2
angelspec
Ali1234588 commited on
Commit
d714f8e
·
verified ·
1 Parent(s): b61ed70

Add files using upload-large-folder tool

Browse files
LICENSE ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Tencent is pleased to support the open source community by making GLM-5.3-Flash-DFly2-B6 available.
2
+
3
+ Copyright (C) 2026 Tencent. All rights reserved.
4
+
5
+ GLM-5.3-Flash-DFly2-B6 is licensed under the Apache-2.0.
6
+
7
+
8
+ Terms of the Apache-2.0:
9
+ --------------------------------------------------------------------
10
+ Apache License
11
+ Version 2.0, January 2004
12
+ http://www.apache.org/licenses/
13
+
14
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
15
+
16
+ 1. Definitions.
17
+
18
+ "License" shall mean the terms and conditions for use, reproduction,
19
+ and distribution as defined by Sections 1 through 9 of this document.
20
+
21
+ "Licensor" shall mean the copyright owner or entity authorized by
22
+ the copyright owner that is granting the License.
23
+
24
+ "Legal Entity" shall mean the union of the acting entity and all
25
+ other entities that control, are controlled by, or are under common
26
+ control with that entity. For the purposes of this definition,
27
+ "control" means (i) the power, direct or indirect, to cause the
28
+ direction or management of such entity, whether by contract or
29
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
30
+ outstanding shares, or (iii) beneficial ownership of such entity.
31
+
32
+ "You" (or "Your") shall mean an individual or Legal Entity
33
+ exercising permissions granted by this License.
34
+
35
+ "Source" form shall mean the preferred form for making modifications,
36
+ including but not limited to software source code, documentation
37
+ source, and configuration files.
38
+
39
+ "Object" form shall mean any form resulting from mechanical
40
+ transformation or translation of a Source form, including but
41
+ not limited to compiled object code, generated documentation,
42
+ and conversions to other media types.
43
+
44
+ "Work" shall mean the work of authorship, whether in Source or
45
+ Object form, made available under the License, as indicated by a
46
+ copyright notice that is included in or attached to the work
47
+ (an example is provided in the Appendix below).
48
+
49
+ "Derivative Works" shall mean any work, whether in Source or Object
50
+ form, that is based on (or derived from) the Work and for which the
51
+ editorial revisions, annotations, elaborations, or other modifications
52
+ represent, as a whole, an original work of authorship. For the purposes
53
+ of this License, Derivative Works shall not include works that remain
54
+ separable from, or merely link (or bind by name) to the interfaces of,
55
+ the Work and Derivative Works thereof.
56
+
57
+ "Contribution" shall mean any work of authorship, including
58
+ the original version of the Work and any modifications or additions
59
+ to that Work or Derivative Works thereof, that is intentionally
60
+ submitted to Licensor for inclusion in the Work by the copyright owner
61
+ or by an individual or Legal Entity authorized to submit on behalf of
62
+ the copyright owner. For the purposes of this definition, "submitted"
63
+ means any form of electronic, verbal, or written communication sent
64
+ to the Licensor or its representatives, including but not limited to
65
+ communication on electronic mailing lists, source code control systems,
66
+ and issue tracking systems that are managed by, or on behalf of, the
67
+ Licensor for the purpose of discussing and improving the Work, but
68
+ excluding communication that is conspicuously marked or otherwise
69
+ designated in writing by the copyright owner as "Not a Contribution."
70
+
71
+ "Contributor" shall mean Licensor and any individual or Legal Entity
72
+ on behalf of whom a Contribution has been received by Licensor and
73
+ subsequently incorporated within the Work.
74
+
75
+ 2. Grant of Copyright License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ copyright license to reproduce, prepare Derivative Works of,
79
+ publicly display, publicly perform, sublicense, and distribute the
80
+ Work and such Derivative Works in Source or Object form.
81
+
82
+ 3. Grant of Patent License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ (except as stated in this section) patent license to make, have made,
86
+ use, offer to sell, sell, import, and otherwise transfer the Work,
87
+ where such license applies only to those patent claims licensable
88
+ by such Contributor that are necessarily infringed by their
89
+ Contribution(s) alone or by combination of their Contribution(s)
90
+ with the Work to which such Contribution(s) was submitted. If You
91
+ institute patent litigation against any entity (including a
92
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
93
+ or a Contribution incorporated within the Work constitutes direct
94
+ or contributory patent infringement, then any patent licenses
95
+ granted to You under this License for that Work shall terminate
96
+ as of the date such litigation is filed.
97
+
98
+ 4. Redistribution. You may reproduce and distribute copies of the
99
+ Work or Derivative Works thereof in any medium, with or without
100
+ modifications, and in Source or Object form, provided that You
101
+ meet the following conditions:
102
+
103
+ (a) You must give any other recipients of the Work or
104
+ Derivative Works a copy of this License; and
105
+
106
+ (b) You must cause any modified files to carry prominent notices
107
+ stating that You changed the files; and
108
+
109
+ (c) You must retain, in the Source form of any Derivative Works
110
+ that You distribute, all copyright, patent, trademark, and
111
+ attribution notices from the Source form of the Work,
112
+ excluding those notices that do not pertain to any part of
113
+ the Derivative Works; and
114
+
115
+ (d) If the Work includes a "NOTICE" text file as part of its
116
+ distribution, then any Derivative Works that You distribute must
117
+ include a readable copy of the attribution notices contained
118
+ within such NOTICE file, excluding those notices that do not
119
+ pertain to any part of the Derivative Works, in at least one
120
+ of the following places: within a NOTICE text file distributed
121
+ as part of the Derivative Works; within the Source form or
122
+ documentation, if provided along with the Derivative Works; or,
123
+ within a display generated by the Derivative Works, if and
124
+ wherever such third-party notices normally appear. The contents
125
+ of the NOTICE file are for informational purposes only and
126
+ do not modify the License. You may add Your own attribution
127
+ notices within Derivative Works that You distribute, alongside
128
+ or as an addendum to the NOTICE text from the Work, provided
129
+ that such additional attribution notices cannot be construed
130
+ as modifying the License.
131
+
132
+ You may add Your own copyright statement to Your modifications and
133
+ may provide additional or different license terms and conditions
134
+ for use, reproduction, or distribution of Your modifications, or
135
+ for any such Derivative Works as a whole, provided Your use,
136
+ reproduction, and distribution of the Work otherwise complies with
137
+ the conditions stated in this License.
138
+
139
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
140
+ any Contribution intentionally submitted for inclusion in the Work
141
+ by You to the Licensor shall be under the terms and conditions of
142
+ this License, without any additional terms or conditions.
143
+ Notwithstanding the above, nothing herein shall supersede or modify
144
+ the terms of any separate license agreement you may have executed
145
+ with Licensor regarding such Contributions.
146
+
147
+ 6. Trademarks. This License does not grant permission to use the trade
148
+ names, trademarks, service marks, or product names of the Licensor,
149
+ except as required for reasonable and customary use in describing the
150
+ origin of the Work and reproducing the content of the NOTICE file.
151
+
152
+ 7. Disclaimer of Warranty. Unless required by applicable law or
153
+ agreed to in writing, Licensor provides the Work (and each
154
+ Contributor provides its Contributions) on an "AS IS" BASIS,
155
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
156
+ implied, including, without limitation, any warranties or conditions
157
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
158
+ PARTICULAR PURPOSE. You are solely responsible for determining the
159
+ appropriateness of using or redistributing the Work and assume any
160
+ risks associated with Your exercise of permissions under this License.
161
+
162
+ 8. Limitation of Liability. In no event and under no legal theory,
163
+ whether in tort (including negligence), contract, or otherwise,
164
+ unless required by applicable law (such as deliberate and grossly
165
+ negligent acts) or agreed to in writing, shall any Contributor be
166
+ liable to You for damages, including any direct, indirect, special,
167
+ incidental, or consequential damages of any character arising as a
168
+ result of this License or out of the use or inability to use the
169
+ Work (including but not limited to damages for loss of goodwill,
170
+ work stoppage, computer failure or malfunction, or any and all
171
+ other commercial damages or losses), even if such Contributor
172
+ has been advised of the possibility of such damages.
173
+
174
+ 9. Accepting Warranty or Additional Liability. While redistributing
175
+ the Work or Derivative Works thereof, You may choose to offer,
176
+ and charge a fee for, acceptance of support, warranty, indemnity,
177
+ or other liability obligations and/or rights consistent with this
178
+ License. However, in accepting such obligations, You may act only
179
+ on Your own behalf and on Your sole responsibility, not on behalf
180
+ of any other Contributor, and only if You agree to indemnify,
181
+ defend, and hold each Contributor harmless for any liability
182
+ incurred by, or claims asserted against, such Contributor by reason
183
+ of your accepting any such warranty or additional liability.
184
+
185
+ END OF TERMS AND CONDITIONS
186
+
187
+ APPENDIX: How to apply the Apache License to your work.
188
+
189
+ To apply the Apache License to your work, attach the following
190
+ boilerplate notice, with the fields enclosed by brackets "[]"
191
+ replaced with your own identifying information. (Don't include
192
+ the brackets!) The text should be enclosed in the appropriate
193
+ comment syntax for the file format. We also recommend that a
194
+ file or class name and description of purpose be included on the
195
+ same "printed page" as the copyright notice for easier
196
+ identification within third-party archives.
197
+
198
+ Copyright [yyyy] [name of copyright owner]
199
+
200
+ Licensed under the Apache License, Version 2.0 (the "License");
201
+ you may not use this file except in compliance with the License.
202
+ You may obtain a copy of the License at
203
+
204
+ http://www.apache.org/licenses/LICENSE-2.0
205
+
206
+ Unless required by applicable law or agreed to in writing, software
207
+ distributed under the License is distributed on an "AS IS" BASIS,
208
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
+ See the License for the specific language governing permissions and
210
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - zai-org/GLM-5.3-Flash
5
+ tags:
6
+ - speculative-decoding
7
+ - dfly2
8
+ - angelspec
9
+ ---
10
+
11
+ <p align="center">
12
+ <picture>
13
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/Tencent/AngelSpec/blob/main/docs/_static/logo_banner_white.png?raw=true">
14
+ <img alt="AngelSpec" src="https://github.com/Tencent/AngelSpec/blob/main/docs/_static/logo_banner.png?raw=true" width="420">
15
+ </picture>
16
+ </p>
17
+
18
+ <h3 align="center">
19
+ A unified training framework for MTP and block-parallel speculative decoding.
20
+ </h3>
21
+
22
+ <p align="center">
23
+ ✒️ <a href="https://arxiv.org/abs/2607.25852">Technical Report</a>&nbsp&nbsp | &nbsp&nbsp📄 <a href="https://arxiv.org/abs/2611.34776">DFly2 Paper</a>&nbsp&nbsp | &nbsp&nbsp📖 <a href="https://angelspec.readthedocs.io">Documentation</a>&nbsp&nbsp | &nbsp&nbsp🤗 <a href="https://huggingface.co/collections/AngelSlim/angelspec">Hugging Face</a>&nbsp&nbsp | &nbsp&nbsp💻 <a href="https://github.com/Tencent/AngelSpec">GitHub</a>
24
+ <br>
25
+ </p>
26
+
27
+ # GLM-5.3-Flash DFly2 Drafter (Block Size 6)
28
+
29
+ ## Model Summary
30
+
31
+ This repository contains a **DFly2** speculative-decoding drafter for **GLM-5.3-Flash**, trained with **AngelSpec**. DFly2 is a block-parallel drafter for natively sparse targets: each of its three draft layers is paired with one of the target's DeepSeek Sparse Attention (DSA) layers and reads the KV that layer has already cached (**KV sharing**), at the positions that layer's indexer has already selected (**index sharing**). The drafter keeps no KV cache of its own, runs no indexer, and reads a fixed number of positions from anywhere in the context.
32
+
33
+ It should be deployed together with the GLM-5.3-Flash target model.
34
+
35
+ - **Target model:** [GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash)
36
+ - **Drafter type:** DFly2
37
+ - **Block size:** 6 (one anchor token + 5 draft tokens)
38
+ - **Training framework:** AngelSpec
39
+ - **Serving backend:** vLLM speculative decoding (support in progress)
40
+
41
+ <p align="center">
42
+ <img src="https://github.com/Tencent/AngelSpec/blob/main/docs/_static/dfly2.png?raw=true" alt="DFly2 overview: each draft layer reads the KV cache and the indexer top-k positions of a paired DSA layer of the target" width="75%">
43
+ </p>
44
+
45
+ ## Highlights
46
+
47
+ - **No KV cache of its own.** A three-layer drafter that kept a full cache of its own would add 3.0 KiB per token on top of the target's 11.7 KiB, raising the per-token KV to 1.26×. DFly2 adds none, so the same KV pool holds **1.19×** as many requests at 32K tokens. It needs no place on the prefill instances under prefill-decode disaggregation, and every prefix-cache hit of the target is also a drafter hit.
48
+ - **Fixed-size, query-aware reads.** Each draft step reads the positions the target's own sparse indexer selected for the token before the block. They can lie anywhere in the context, their number does not grow with it, and the drafter runs no indexer of its own.
49
+ - **Higher acceptance on every benchmark.** Against DFlash and DSpark trained on the same recipe and data, DFly2 accepts more tokens per step on every benchmark below, at both temperatures.
50
+ - **Generalizes past its 32K training length.** On the agentic sets, whose prompts mostly run longer, its average accepted length stays close to its general-purpose average (4.03 / 3.68 vs. 3.96 / 3.69 at T = 0 / 1), while DSpark's drops from 3.68 / 3.35 to 3.10 / 2.99.
51
+
52
+ ## Model Details
53
+
54
+ GLM-5.3-Flash interleaves 11 DSA layers with 34 linear-attention layers. DFly2 pairs with three of its DSA layers.
55
+
56
+ | Item | Value |
57
+ |---|---|
58
+ | Draft layers | 3 MoE layers, 128 routed experts each |
59
+ | Paired target layers (KV + index sharing) | 35, 39, 43 |
60
+ | Context read per draft step | Target's top-2048 selection at the row before the anchor, made over groups of adjacent positions |
61
+ | Initialization | Attention copied from the paired target layer; 128 of that layer's routed experts drawn at random, with their router rows and biases |
62
+ | Last-layer hidden injection | Target's last-layer hidden state, fused with the anchor embedding and gated into the anchor slot |
63
+ | Intra-block correction | Hidden correction plus a context attention and a gated prefix attention, slot by slot |
64
+ | Embedding / LM head | Shared with the target (not stored in this repository) |
65
+ | Precision | BF16 |
66
+
67
+ ## Training Data
68
+
69
+ The drafter is trained on **DFly-SFT**, a general-purpose instruction-tuning corpus of **989,861 conversations and 7.42B tokens**, all from public datasets. The conversations fall into ten capability domains, labeled by their source where it gives a label and by an LLM annotator otherwise. Samples are capped at 32,768 tokens and each domain is filled with its longest samples first, which makes the mixture long-form and reasoning-heavy: 61.6% of samples carry an explicit reasoning trace and 34.9% run past 8K tokens. The corpus is deduplicated globally and decontaminated against the twelve DeepSpec evaluation sets with an n-gram overlap test.
70
+
71
+ | Data type | Mix | Samples | Tokens | Median len. | Think |
72
+ |---|---:|---:|---:|---:|---:|
73
+ | Math (advanced) | 19.2% | 190,000 | 2.90B | 13,982 | 98.6% |
74
+ | Code (competitive) | 11.1% | 110,000 | 1.96B | 18,175 | 94.7% |
75
+ | Code (engineering) | 9.6% | 95,479 | 0.56B | 4,064 | 46.9% |
76
+ | Knowledge & STEM | 15.2% | 150,000 | 0.48B | 2,075 | 51.3% |
77
+ | Instruction following | 7.1% | 70,000 | 0.47B | 5,751 | 85.7% |
78
+ | Code (function-level) | 11.1% | 110,000 | 0.41B | 686 | 37.9% |
79
+ | Writing | 10.1% | 100,000 | 0.24B | 1,425 | 40.1% |
80
+ | Text transformation | 6.1% | 60,000 | 0.19B | 1,972 | 37.4% |
81
+ | Logical reasoning | 2.5% | 24,382 | 0.11B | 1,461 | 65.0% |
82
+ | Math (word problems) | 8.1% | 80,000 | 0.09B | 477 | 20.2% |
83
+ | **Total** | **100.0%** | **989,861** | **7.42B** | **3,621** | **61.6%** |
84
+
85
+ *Mix* is the share of samples. Token counts and lengths use the GLM-5.3-Flash tokenizer, and *Think* is the fraction of samples whose assistant turns carry an explicit reasoning trace.
86
+
87
+ <details>
88
+ <summary>Per-source composition</summary>
89
+
90
+ Each domain's share is given on its first row, and *Mix* is each source's share of the full 989,861-sample corpus.
91
+
92
+ | Data type | Dataset | Mix |
93
+ |---|---|---:|
94
+ | Math (advanced), 19.2% | OpenMathReasoning | 9.68% |
95
+ | | Dolci-Think-SFT-32B | 3.29% |
96
+ | | Step-3.5-Flash-SFT | 2.02% |
97
+ | | Nemotron-Math-v4 | 2.02% |
98
+ | | Nemotron-Math-v2 | 1.01% |
99
+ | | SYNTHETIC-2 (math) | 0.81% |
100
+ | | WildChat-4.8M | 0.20% |
101
+ | | Nemotron-Chat-v3 | 0.10% |
102
+ | | Arena-Human-Pref-140k | 0.06% |
103
+ | Code (competitive), 11.1% | Nemotron-CompProg (Python) | 4.80% |
104
+ | | Dolci-Think-SFT-32B | 1.91% |
105
+ | | CodeForces-CoTs | 1.62% |
106
+ | | Step-3.5-Flash-SFT | 1.41% |
107
+ | | SYNTHETIC-2 (code) | 0.71% |
108
+ | | Nemotron-CompProg (C++) | 0.51% |
109
+ | | WildChat-4.8M | 0.16% |
110
+ | Code (engineering), 9.6% | WildChat-4.8M | 4.74% |
111
+ | | Step-3.5-Flash-SFT | 3.96% |
112
+ | | Nemotron-Chat-v3 | 0.59% |
113
+ | | Arena-Human-Pref-140k | 0.36% |
114
+ | Knowledge & STEM, 15.2% | Step-3.5-Flash-SFT | 5.05% |
115
+ | | WildChat-4.8M | 4.83% |
116
+ | | Arena-Human-Pref-140k | 2.53% |
117
+ | | Nemotron-Chat-v3 | 2.02% |
118
+ | | Dolci-Think-SFT-32B | 0.72% |
119
+ | Instruction following, 7.1% | Dolci-Think-SFT-32B | 3.54% |
120
+ | | Nemotron-IF-v3 | 1.21% |
121
+ | | Step-3.5-Flash-SFT | 0.81% |
122
+ | | SYNTHETIC-2 (format) | 0.51% |
123
+ | | WildChat-4.8M | 0.51% |
124
+ | | AutoIF-61k | 0.51% |
125
+ | Code (function-level), 11.1% | OpenCodeInstruct | 6.30% |
126
+ | | Dolci-Think-SFT-32B | 3.20% |
127
+ | | Step-3.5-Flash-SFT | 0.90% |
128
+ | | WildChat-4.8M | 0.56% |
129
+ | | Nemotron-Chat-v3 | 0.13% |
130
+ | | Arena-Human-Pref-140k | 0.03% |
131
+ | Writing, 10.1% | WildChat-4.8M | 5.59% |
132
+ | | Step-3.5-Flash-SFT | 3.00% |
133
+ | | Nemotron-Chat-v3 | 1.08% |
134
+ | | Arena-Human-Pref-140k | 0.25% |
135
+ | | Charcard-Roleplay | 0.18% |
136
+ | Text transformation, 6.1% | WildChat-4.8M | 3.59% |
137
+ | | Step-3.5-Flash-SFT | 1.82% |
138
+ | | Nemotron-Chat-v3 | 0.45% |
139
+ | | Arena-Human-Pref-140k | 0.20% |
140
+ | Logical reasoning, 2.5% | UltraInteract-SFT | 0.62% |
141
+ | | SYNTHETIC-2 (output-pred.) | 0.54% |
142
+ | | R1-Brain-Teasers | 0.38% |
143
+ | | Step-3.5-Flash-SFT | 0.29% |
144
+ | | SYNTHETIC-2 (reasoning-gym) | 0.24% |
145
+ | | Nemotron-Chat-v3 | 0.22% |
146
+ | | WildChat-4.8M | 0.13% |
147
+ | | Arena-Human-Pref-140k | 0.04% |
148
+ | Math (word problems), 8.1% | Orca-Math-200k | 5.78% |
149
+ | | Step-3.5-Flash-SFT | 1.42% |
150
+ | | WildChat-4.8M | 0.61% |
151
+ | | Nemotron-Chat-v3 | 0.23% |
152
+ | | Arena-Human-Pref-140k | 0.04% |
153
+
154
+ </details>
155
+
156
+ ## Training Recipe
157
+
158
+ The same recipe trains DFly2 and every baseline below, on all three targets of the technical report.
159
+
160
+ | Hyperparameter | Value |
161
+ |---|---|
162
+ | Epochs | 3 |
163
+ | Global batch size | 256 |
164
+ | Sequence length | 32K |
165
+ | Optimizer | Muon |
166
+ | Objective | Per-slot LK distillation loss (KL + TV) against the target, weighted by D-PACE |
167
+ | Draft tokens per block (γ) | 5 |
168
+
169
+ Only the drafter is trained. At serving time the selection comes from the target's verify pass. Training has no verify pass, so it recomputes the selection with a frozen copy of each paired layer's indexer, and a draft layer sees the same latents and positions in training as at serving.
170
+
171
+ ## Evaluation: Accepted Length
172
+
173
+ Mean accepted length τ, counting the bonus token, in the 2K chat setting (thinking disabled, at most 2048 generated tokens). Each cell gives T = 0 / T = 1, and bold marks the best per column and temperature. Accepted length is measured on a single TP8 engine on NVIDIA H20 GPUs, as the mean of the last three runs.
174
+
175
+ All baselines are trained by us with the same recipe, data and number of steps as DFly2, on the same three-layer MoE stack (within 2% of its size). DFlash keeps its own KV cache over the whole context, DSpark bounds its own cache with a 128-token sliding window, and DFlash† is DFlash held to that same window. All methods draft a block of 5 tokens on vLLM.
176
+
177
+ ### General-purpose benchmarks
178
+
179
+ GSM8K, MATH-500 (MATH), AIME25, MBPP, HumanEval, LiveCodeBench (LCB) and MT-Bench, seven of the twelve evaluation sets that ship with DeepSpec.
180
+
181
+ | Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
182
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|
183
+ | DFlash | 3.93 / 3.65 | 3.73 / 3.29 | 3.25 / 2.77 | 3.76 / 3.38 | 3.84 / 3.44 | 2.91 / 2.64 | 2.58 / 2.34 | 3.43 / 3.07 |
184
+ | DFlash† | 4.00 / 3.73 | 3.83 / 3.38 | 3.36 / 2.92 | 3.79 / 3.43 | 3.74 / 3.40 | 2.99 / 2.73 | 2.66 / 2.35 | 3.48 / 3.13 |
185
+ | DSpark | 4.23 / 3.97 | 4.06 / 3.61 | 3.58 / 3.17 | 4.02 / 3.66 | 3.91 / 3.62 | 3.16 / 2.92 | 2.80 / 2.50 | 3.68 / 3.35 |
186
+ | DFly2 | **4.53** / **4.37** | **4.31** / **4.00** | **3.88** / **3.51** | **4.24** / **4.01** | **4.36** / **4.03** | **3.41** / **3.24** | **2.96** / **2.72** | **3.96** / **3.69** |
187
+
188
+ ### Long-context and agentic benchmarks
189
+
190
+ Long context: LongSpec 32K, CodeSpan 64K and LongSWE-Bench 128K (LSWE 128K). Agentic: AgentLongBench (ALB), MemoryAgentBench (MemAgent), the long-context multi-turn category of BFCL-v3, and LongSWE-Bench issues at 64K (SWE 64K). *Long Avg.* and *Agen. Avg.* average the three long-context and four agentic sets. Every drafter is trained at 32K.
191
+
192
+ | Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long Avg. | Agen. Avg. |
193
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
194
+ | DFlash | 2.55 / 2.17 | 3.12 / 2.48 | 2.92 / 2.64 | 3.12 / 1.92 | 2.79 / 2.50 | 2.99 / 2.75 | 2.91 / 2.60 | 2.86 / 2.43 | 2.95 / 2.44 |
195
+ | DFlash† | 2.69 / 2.23 | 3.22 / 2.60 | 2.97 / 2.65 | 3.50 / 3.45 | 2.68 / 2.48 | 3.00 / 2.73 | 2.86 / 2.61 | 2.96 / 2.50 | 3.01 / 2.82 |
196
+ | DSpark | 2.75 / 2.37 | 3.32 / 2.77 | 3.08 / 2.79 | 3.53 / 3.73 | 2.74 / 2.58 | 3.15 / 2.91 | 2.98 / 2.74 | 3.05 / 2.64 | 3.10 / 2.99 |
197
+ | DFly2 | **3.31** / **2.92** | **4.40** / **3.63** | **3.82** / **3.52** | **5.49** / **4.77** | **3.30** / **3.12** | **3.61** / **3.35** | **3.73** / **3.48** | **3.85** / **3.36** | **4.03** / **3.68** |
198
+
199
+ ## Evaluation: Speedup
200
+
201
+ Speedup over the target alone on NVIDIA H20 GPUs, greedy, at a concurrency of one, with prefill and decode on separate TP8 instances. Each cell gives decoding / end-to-end speedup, the latter including prefill, and bold marks the best per column and speedup. DFlash† reads a window at decode but still builds a full cache at prefill. DFly2 builds no cache of its own at prefill and leaves prefill speed unaffected.
202
+
203
+ ### General-purpose benchmarks
204
+
205
+ | Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
206
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|
207
+ | DFlash | 2.69× / 2.31× | 2.54× / 2.42× | 2.20× / 2.17× | 2.57× / 2.44× | 2.59× / 2.50× | 1.98× / 1.89× | 1.79× / 1.77× | 2.34× / 2.21× |
208
+ | DFlash† | 2.77× / 2.39× | 2.62× / 2.50× | 2.26× / 2.22× | 2.63× / 2.49× | 2.56× / 2.47× | 2.04× / 1.98× | 1.83× / 1.80× | 2.39× / 2.26× |
209
+ | DSpark | 2.85× / **2.42×** | 2.67× / 2.55× | 2.32× / 2.28× | **2.71×** / **2.57×** | 2.62× / 2.54× | 2.10× / 2.04× | 1.85× / 1.82× | 2.45× / 2.32× |
210
+ | DFly2 | **2.90×** / 2.40× | **2.71×** / **2.56×** | **2.43×** / **2.39×** | **2.71×** / 2.56× | **2.74×** / **2.64×** | **2.16×** / **2.10×** | **1.88×** / **1.85×** | **2.50×** / **2.36×** |
211
+
212
+ ### Long-context and agentic benchmarks
213
+
214
+ | Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long Avg. | Agen. Avg. |
215
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
216
+ | DFlash | 1.70× / 1.47× | 2.03× / 1.46× | 1.89× / 1.28× | 2.15× / 1.09× | 1.83× / **1.01×** | 2.02× / 1.16× | 1.88× / 1.36× | 1.87× / 1.40× | 1.97× / 1.15× |
217
+ | DFlash† | 1.86× / 1.56× | 2.12× / 1.48× | 2.04× / 1.28× | 2.45× / 1.07× | 1.92× / 0.97× | 2.08× / 1.09× | 1.99× / 1.50× | 2.00× / 1.44× | 2.11× / 1.16× |
218
+ | DSpark | 1.84× / 1.53× | 2.24× / 1.58× | 2.12× / 1.38× | 2.48× / 1.08× | 1.90× / 0.97× | 2.17× / 1.13× | 2.02× / 1.49× | 2.07× / 1.49× | 2.14× / 1.17× |
219
+ | DFly2 | **2.14×** / **1.75×** | **2.82×** / **1.79×** | **2.40×** / **1.39×** | **3.57×** / **1.10×** | **2.20×** / 0.98× | **2.34×** / **1.17×** | **2.35×** / **1.62×** | **2.45×** / **1.64×** | **2.61×** / **1.22×** |
220
+
221
+ ## Deployment
222
+
223
+ **vLLM: support in progress.** Serving instructions will be added here once DFly2 support is available in vLLM. The drafter is deployed together with the GLM-5.3-Flash target model and drafts 5 tokens per step (block size 6).
224
+
225
+ ## License
226
+
227
+ This drafter is released under the [Apache-2.0 License](LICENSE). The GLM-5.3-Flash target model is subject to its own license.
228
+
229
+ ## Technical Report
230
+
231
+ DFly2 and the results above are described in the DFly2 technical report:
232
+
233
+ > **DFly2: Turbocharging Long-Context Speculative Decoding by Sharing the Target's Sparsity**
234
+ > arXiv: https://arxiv.org/abs/2611.34776
235
+
236
+ The drafter is trained with AngelSpec. For the training framework, see:
237
+
238
+ > **AngelSpec: Towards Real-World High Performance Inference with Speculative Decoding**
239
+ > arXiv: https://arxiv.org/abs/2607.25852
config.json ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "attention_bias": false,
3
+ "attention_dropout": 0.0,
4
+ "dtype": "bfloat16",
5
+ "eos_token_id": [
6
+ 154820,
7
+ 154827,
8
+ 154829
9
+ ],
10
+ "first_k_dense_replace": 0,
11
+ "hc_eps": 1e-06,
12
+ "hc_mult": 4,
13
+ "hc_sinkhorn_iters": 20,
14
+ "head_dim": 0,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 4096,
17
+ "index_head_dim": 128,
18
+ "index_kpool": 4,
19
+ "index_kpool_always_select_tail": true,
20
+ "index_kpool_compress": true,
21
+ "index_n_heads": 32,
22
+ "index_topk": 2048,
23
+ "index_share_for_mtp_iteration": true,
24
+ "indexer_rope_interleave": true,
25
+ "indexer_types": [
26
+ "full",
27
+ "full",
28
+ "full",
29
+ "full",
30
+ "full",
31
+ "full",
32
+ "full",
33
+ "full",
34
+ "full",
35
+ "full",
36
+ "full",
37
+ "full",
38
+ "full",
39
+ "full",
40
+ "full",
41
+ "full",
42
+ "full",
43
+ "full",
44
+ "full",
45
+ "full",
46
+ "full",
47
+ "full",
48
+ "full",
49
+ "full",
50
+ "full",
51
+ "full",
52
+ "full",
53
+ "full",
54
+ "full",
55
+ "full",
56
+ "full",
57
+ "full",
58
+ "full",
59
+ "full",
60
+ "full",
61
+ "full",
62
+ "full",
63
+ "full",
64
+ "full",
65
+ "full",
66
+ "full",
67
+ "full",
68
+ "full",
69
+ "full",
70
+ "full"
71
+ ],
72
+ "initializer_range": 0.02,
73
+ "intermediate_size": 12288,
74
+ "kv_lora_rank": 512,
75
+ "max_position_embeddings": 1048576,
76
+ "mhc": true,
77
+ "mla_use_nope": true,
78
+ "model_type": "glm5_next_text",
79
+ "moe_intermediate_size": 2048,
80
+ "moe_router_dtype": "float32",
81
+ "n_group": 1,
82
+ "n_routed_experts": 128,
83
+ "n_shared_experts": 1,
84
+ "norm_topk_prob": true,
85
+ "num_attention_heads": 64,
86
+ "num_experts_per_tok": 3,
87
+ "num_hidden_layers": 3,
88
+ "num_key_value_heads": 64,
89
+ "num_nextn_predict_layers": 0,
90
+ "output_router_logits": false,
91
+ "pad_token_id": 154820,
92
+ "q_lora_rank": 1536,
93
+ "qk_head_dim": 256,
94
+ "qk_nope_head_dim": 256,
95
+ "qk_rope_head_dim": 0,
96
+ "rms_norm_eps": 1e-05,
97
+ "routed_scaling_factor": 2.5,
98
+ "router_aux_loss_coef": 0.001,
99
+ "scoring_func": "sigmoid",
100
+ "swiglu_limit": 10.0,
101
+ "tie_word_embeddings": false,
102
+ "topk_group": 1,
103
+ "topk_method": "noaux_tc",
104
+ "use_cache": true,
105
+ "v_head_dim": 256,
106
+ "vocab_size": 154880,
107
+ "architectures": [
108
+ "DFlyGlm53DraftModel"
109
+ ],
110
+ "mlp_layer_types": [
111
+ "sparse",
112
+ "sparse",
113
+ "sparse"
114
+ ],
115
+ "shared_expert_swiglu_clamp": true,
116
+ "dflash_config": {
117
+ "block_size": 6,
118
+ "mask_token_id": 154821,
119
+ "causal": true,
120
+ "target_kv_layers": [
121
+ 35,
122
+ 39,
123
+ 43
124
+ ],
125
+ "target_index_topk": 2048,
126
+ "mtp_fusion": "slot0",
127
+ "hidden_correction": {
128
+ "intermediate_size": 4096,
129
+ "attentive": {
130
+ "source_layer": -1,
131
+ "block_mode": "gated",
132
+ "block_kv_in": "hidden_embed"
133
+ }
134
+ }
135
+ }
136
+ }
model-00001-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b0c051ec74e613dbec4c85f06e772f30d1f23bbdca4158b6a84c4df66141748
3
+ size 5378247000
model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b5b270d37d36d80492febadd97805146454692f03b3c3e43150d85546d23e61
3
+ size 5368767356
model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7084f33991e5ea1e750fbce38e71f772c2239c1c35ca2da83146baf1649a72e
3
+ size 5369837284
model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53eb635b68a680ae4f2ca71d891402d1245c16d8b67b38802c9029fac8753739
3
+ size 4566583192
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff