ngquocvinh commited on
Commit
a87d833
·
verified ·
1 Parent(s): 51c662f

Add Spark-X2.5 1.7B GGUF quantizations

Browse files
.gitattributes CHANGED
@@ -33,3 +33,15 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Spark-X2.5-1.7B-IQ1_M.gguf filter=lfs diff=lfs merge=lfs -text
37
+ Spark-X2.5-1.7B-IQ2_XS.gguf filter=lfs diff=lfs merge=lfs -text
38
+ Spark-X2.5-1.7B-Q1_0.gguf filter=lfs diff=lfs merge=lfs -text
39
+ Spark-X2.5-1.7B-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
40
+ Spark-X2.5-1.7B-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
41
+ Spark-X2.5-1.7B-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
42
+ Spark-X2.5-1.7B-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
43
+ Spark-X2.5-1.7B-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
44
+ Spark-X2.5-1.7B-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
45
+ reproducibility/spark25_1.7b_combined.imatrix.gguf filter=lfs diff=lfs merge=lfs -text
46
+ reproducibility/spark25_1.7b_vn_code_agent.imatrix.gguf filter=lfs diff=lfs merge=lfs -text
47
+ reproducibility/spark25_1.7b_wiki.imatrix.gguf filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 XHToken
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: XHToken/Spark-X2.5-1.7B
4
+ library_name: llama.cpp
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - gguf
8
+ - llama.cpp
9
+ - spark2_5
10
+ - quantized
11
+ - text-generation
12
+ ---
13
+
14
+ # Spark-X2.5-1.7B GGUF
15
+
16
+ Unofficial community GGUF quantizations of
17
+ [XHToken/Spark-X2.5-1.7B](https://huggingface.co/XHToken/Spark-X2.5-1.7B).
18
+ This repository contains nine quantized files for local inference. No
19
+ training or fine-tuning was performed.
20
+
21
+ ## Files
22
+
23
+ | Quantization | Size | GPU0 generation | Recommendation |
24
+ |---|---:|---:|---|
25
+ | Q8_0 | 1.70 GiB | 175.54 tok/s | High quality |
26
+ | Q6_K | 1.31 GiB | 199.07 tok/s | High quality |
27
+ | Q5_K_M | 1.17 GiB | 223.04 tok/s | Daily use |
28
+ | Q4_K_M | 1.03 GiB | 241.87 tok/s | Recommended default |
29
+ | Q3_K_M | 0.87 GiB | 203.60 tok/s | Lower memory |
30
+ | Q2_K | 0.74 GiB | 231.70 tok/s | Aggressive |
31
+ | IQ2_XS | 0.61 GiB | 245.03 tok/s | Experimental |
32
+ | IQ1_M | 0.54 GiB | 252.02 tok/s | Experimental |
33
+ | Q1_0 | 0.40 GiB | 336.65 tok/s | Experimental / legacy |
34
+
35
+ The speed figures are single-stream `llama-bench` readings on one NVIDIA
36
+ A10M, with 256 prompt tokens, 64 generated tokens, 64 CPU threads, 99 GPU
37
+ layers, and three repetitions. They are not quality scores or universal
38
+ hardware benchmarks.
39
+
40
+ Q1/Q2 and the IQ variants can lose instruction following, reasoning, and
41
+ tool-call reliability. Validate the chosen file on the workload that matters
42
+ to you.
43
+
44
+ ## Quick start
45
+
46
+ Use the Spark-compatible build of
47
+ [XHToken/llama.cpp](https://github.com/XHToken/llama.cpp):
48
+
49
+ ```bash
50
+ ./build/bin/llama-cli \
51
+ -m Spark-X2.5-1.7B-Q4_K_M.gguf \
52
+ -p "Explain GGUF quantization in one paragraph." \
53
+ -c 4096 \
54
+ --single-turn
55
+ ```
56
+
57
+ The tokenizer and chat template metadata are embedded in each GGUF. The
58
+ native context limit is advertised upstream as up to 1M tokens, but that
59
+ requires substantial KV-cache memory and was not validated here.
60
+
61
+ ## Build and validation
62
+
63
+ The files were converted and quantized with XHToken's Spark-enabled
64
+ llama.cpp at commit `4a3635c32fc9f044c2bde9ebeabf50c7e1ec5991`.
65
+
66
+ - BF16 conversion: PASS
67
+ - CPU smoke test: 9/9 PASS
68
+ - GPU0 smoke test: 9/9 PASS
69
+ - GPU0 benchmark: 10 configurations, three repetitions each
70
+ - Perplexity comparison: BF16 plus nine quantizations
71
+
72
+ The quantized outputs were generated directly from the official
73
+ `Spark-X2.5-1.7B.gguf` conversion. Q8_0 uses no importance matrix; all other
74
+ files use the model-specific combined matrix included under
75
+ `reproducibility/`.
76
+
77
+ Portable scripts, manifests, calibration matrices, and validation summaries
78
+ are in [`reproducibility/`](reproducibility/). The original BF16 source and
79
+ the llama.cpp build are not duplicated in this repo; set `SOURCE` and
80
+ `LLAMA_CPP` when reproducing locally.
81
+
82
+ ## License and attribution
83
+
84
+ The upstream model is released under Apache License 2.0. Preserve the
85
+ upstream attribution and license when redistributing these derivative files.
86
+ This is an unofficial quantization and is not endorsed by XHToken/SparkLLM.
87
+
88
+ Checksums are available in [`SHA256SUMS.txt`](SHA256SUMS.txt).
89
+
90
+ If this quantization saved you time, VRAM, or compute cost, consider leaving
91
+ a small tip. It helps fund future quantizations.
92
+
93
+ ☕ [Support me on Ko-fi](https://ko-fi.com/ngquocvinh)
SHA256SUMS.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ 09ca0c14edf63de5f903569082b21151413bbded716218fc4b8a6e2932c743de Spark-X2.5-1.7B-IQ1_M.gguf
2
+ e74f48b63553292b39e84af754d5f0b46eec794e17a8ec98f5df0aaf10b020c3 Spark-X2.5-1.7B-IQ2_XS.gguf
3
+ ac3774c91e8cd21134a25f6fe528b81eb134f5da9b97f5f947e75f0de73a6e07 Spark-X2.5-1.7B-Q1_0.gguf
4
+ 7da639353647e73533422484e21b074e5ac0eb6a7de6827bf716105a5b1aee59 Spark-X2.5-1.7B-Q2_K.gguf
5
+ 18a86766ed0c2ed91ac265b2871641b638ce40e8084132df483e315e1ef86060 Spark-X2.5-1.7B-Q3_K_M.gguf
6
+ bddd0ac6f86f67280dc6a9c79eb3bb739bb3d63b050dffc908fcc3d6728b2d0d Spark-X2.5-1.7B-Q4_K_M.gguf
7
+ 7d25d301cc02b5c9603f35ddd9d80e74ea9926ae3312b52eb509e7c89f862a66 Spark-X2.5-1.7B-Q5_K_M.gguf
8
+ 551a8627287e2f99a257fe9f27d44e7553088c0e4e07da7ef0a1c13b60f7db70 Spark-X2.5-1.7B-Q6_K.gguf
9
+ c81e5c973366cbd12472d66992e629352a9d0c304633b9f1c917297a05bb30ae Spark-X2.5-1.7B-Q8_0.gguf
Spark-X2.5-1.7B-IQ1_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09ca0c14edf63de5f903569082b21151413bbded716218fc4b8a6e2932c743de
3
+ size 574820096
Spark-X2.5-1.7B-IQ2_XS.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e74f48b63553292b39e84af754d5f0b46eec794e17a8ec98f5df0aaf10b020c3
3
+ size 656157952
Spark-X2.5-1.7B-Q1_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac3774c91e8cd21134a25f6fe528b81eb134f5da9b97f5f947e75f0de73a6e07
3
+ size 428425984
Spark-X2.5-1.7B-Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7da639353647e73533422484e21b074e5ac0eb6a7de6827bf716105a5b1aee59
3
+ size 790237952
Spark-X2.5-1.7B-Q3_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18a86766ed0c2ed91ac265b2871641b638ce40e8084132df483e315e1ef86060
3
+ size 937380096
Spark-X2.5-1.7B-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bddd0ac6f86f67280dc6a9c79eb3bb739bb3d63b050dffc908fcc3d6728b2d0d
3
+ size 1107457792
Spark-X2.5-1.7B-Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d25d301cc02b5c9603f35ddd9d80e74ea9926ae3312b52eb509e7c89f862a66
3
+ size 1252480768
Spark-X2.5-1.7B-Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:551a8627287e2f99a257fe9f27d44e7553088c0e4e07da7ef0a1c13b60f7db70
3
+ size 1406567680
Spark-X2.5-1.7B-Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c81e5c973366cbd12472d66992e629352a9d0c304633b9f1c917297a05bb30ae
3
+ size 1820112352
chat_template.jinja ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#- 0826版本 -#}
2
+ {%- if not messages %}
3
+ {{- raise_exception('No messages provided.') }}
4
+ {%- endif %}
5
+ {%- set enable_thinking = enable_thinking | default(true) %}
6
+
7
+ {#- Render a string or a list of text blocks. -#}
8
+ {%- macro render_content(content, context_name) %}
9
+ {%- if content is string %}
10
+ {{- content }}
11
+ {%- elif content is none or content is undefined %}
12
+ {{- '' }}
13
+ {%- elif content is iterable and content is not mapping %}
14
+ {%- for block in content %}
15
+ {%- if block.type == 'text' %}
16
+ {{- block.text }}
17
+ {%- else %}
18
+ {{- raise_exception('Unsupported ' ~ context_name ~ ' content block type: ' ~ (block.type | string)) }}
19
+ {%- endif %}
20
+ {%- endfor %}
21
+ {%- else %}
22
+ {{- raise_exception(context_name ~ ' content must be a string or a list of text blocks') }}
23
+ {%- endif %}
24
+ {%- endmacro %}
25
+
26
+ {#- Default system prompt -#}
27
+ {%- set default_system = "you are a helpful assistant." %}
28
+
29
+ {#- The first message-level system is placed in the initial system block. -#}
30
+ {%- set ns = namespace(initial_system='') %}
31
+ {%- if messages[0].role == "system" %}
32
+ {%- set ns.initial_system = render_content(messages[0].content, 'system') %}
33
+ {%- endif %}
34
+
35
+ {#- System block -#}
36
+ {{- '<|start▁of▁sentence|><|System|>' + '\n' + default_system }}
37
+ {%- if tools %}
38
+ {{- '## Tools' + '\n' + 'You have access to the following functions:' + '\n' + '<tools>' }}
39
+ {%- for tool in tools %}
40
+ {{- '\n' + tool.function | tojson}}
41
+ {%- endfor %}
42
+ {{- '\n' + '</tools>' }}
43
+ {%- endif %}
44
+ {%- if ns.initial_system %}
45
+ {{- '\n\n' + ns.initial_system }}
46
+ {%- endif %}
47
+ {{- '<|end▁of▁sentence|>'}}
48
+
49
+ {#- Conversation turns -#}
50
+ {%- for message in messages %}
51
+ {%- if message.role == "system" %}
52
+ {#- The first system message was consumed by the initial block. -#}
53
+ {%- if not loop.first %}
54
+ {{- '<|start▁of▁sentence|><|System|>\n' + render_content(message.content, 'system') + '<|end▁of▁sentence|>' }}
55
+ {%- endif %}
56
+ {%- elif message.role == "user" %}
57
+ {{- '<|start▁of▁sentence|><|User|>' + render_content(message.content, 'user') + '<|end▁of▁sentence|>' }}
58
+ {%- elif message.role == "assistant" %}
59
+ {%- set assistant_content = render_content(message.content, 'assistant') %}
60
+ {%- if message.reasoning_content is defined and message.reasoning_content %}
61
+ {%- set reasoning_content = message.reasoning_content %}
62
+ {%- else %}
63
+ {%- set reasoning_content = '' %}
64
+ {%- endif %}
65
+ {{- '<|start▁of▁sentence|><|Bot|>'}}
66
+ {%- if reasoning_content %}
67
+ {{- '<think>' + reasoning_content + '</think>'}}
68
+ {%- else %}
69
+ {{- '</think>' }}
70
+ {%- endif %}
71
+ {%- if assistant_content %}
72
+ {{- assistant_content }}
73
+ {%- endif %}
74
+ {%- if message.tool_calls is defined and message.tool_calls is not none %}
75
+ {%- for tool_call in message.tool_calls %}
76
+ {%- if tool_call.function.arguments is not mapping %}
77
+ {{- raise_exception('tool_call.function.arguments must be a dictionary; normalize JSON strings before apply_chat_template') }}
78
+ {%- endif %}
79
+ {%- set args = tool_call.function.arguments %}
80
+ {{- '<tool_call>' + tool_call.function.name }}
81
+ {%- for k, v in args.items() %}
82
+ {{- '<arg_key>' ~ k ~ '</arg_key><arg_value>' ~ (v if v is string else v | tojson) ~ '</arg_value>' }}
83
+ {%- endfor %}
84
+ {{- '</tool_call>' }}
85
+ {%- endfor %}
86
+ {%- endif %}
87
+ {{- '<|end▁of▁sentence|>' }}
88
+ {%- elif message.role == "tool" %}
89
+ {%- if loop.previtem is undefined or loop.previtem.role != "tool" %}
90
+ {{- '<|start▁of▁sentence|><|Tool|>' }}
91
+ {%- endif %}
92
+ {{- '<tool_response>' ~ message.content ~ '</tool_response>' }}
93
+ {%- if loop.nextitem is undefined or loop.nextitem.role != "tool" %}
94
+ {{- '<|end▁of▁sentence|>' }}
95
+ {%- endif %}
96
+ {%- else %}
97
+ {{- raise_exception('Unsupported message role: ' ~ message.role) }}
98
+ {%- endif %}
99
+ {%- endfor %}
100
+
101
+ {#- Generation prompt -#}
102
+ {%- if add_generation_prompt %}
103
+ {{- '<|start▁of▁sentence|><|Bot|>' }}
104
+ {%- if enable_thinking is defined and enable_thinking %}
105
+ {{- '<think>' }}
106
+ {%- endif %}
107
+ {%- if enable_thinking is defined and not enable_thinking %}
108
+ {{- '</think>' }}
109
+ {%- endif %}
110
+ {%- endif %}
reproducibility/README.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Spark-X2.5-1.7B reproducibility
2
+
3
+ This directory contains the reproducible conversion, calibration,
4
+ quantization, smoke-test, and benchmark scripts for Spark-X2.5-1.7B.
5
+
6
+ ## Source and conversion
7
+
8
+ - Source: `../source-hf-1.7b/`
9
+ - Converted source: `../source-official-bf16-1.7b/Spark-X2.5-1.7B.gguf`
10
+ - Converter: `../tools-llama.cpp-spark/convert_hf_to_gguf.py`
11
+ - llama.cpp commit: `4a3635c32fc9f044c2bde9ebeabf50c7e1ec5991`
12
+ - Architecture: `Spark2_5ForCausalLM` / `spark2_5`
13
+
14
+ The converter dry-run and full conversion both completed successfully. The
15
+ source uses a 1,048,576-token native position limit and a 512-token sliding
16
+ window; the serving profile intentionally caps active context at 65,536.
17
+
18
+ ## Calibration and quantization
19
+
20
+ The imatrix is model-specific and combines:
21
+
22
+ - 5 chunks from `../calibration/spark25_vn_code_agent.txt`
23
+ - 96 chunks from `../calibration/wikitext-2-raw/wiki.test.raw`
24
+ - 101 chunks total in `spark25_1.7b_combined.imatrix.gguf`
25
+
26
+ Run the ladder with:
27
+
28
+ ```sh
29
+ bash quantize_ladder.sh
30
+ bash smoke_test_ladder.sh
31
+ bash perplexity_ladder.sh
32
+ ```
33
+
34
+ GPU0 smoke and benchmark require the GPU0 model services to be stopped first:
35
+
36
+ ```sh
37
+ bash gpu_smoke_test_ladder.sh
38
+ bash benchmark_gpu0.sh
39
+ ```
40
+
41
+ The scripts use the local XHToken Spark build and do not reuse the 4B
42
+ imatrix.
reproducibility/benchmark_gpu0.sh ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
5
+ PACKAGE_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
6
+ WORKSPACE_ROOT="${WORKSPACE_ROOT:-$PACKAGE_ROOT/..}"
7
+ LLAMA_CPP="${LLAMA_CPP:-$WORKSPACE_ROOT/tools-llama.cpp-spark}"
8
+ BENCH="${BENCH:-$LLAMA_CPP/build/bin/llama-bench}"
9
+ SOURCE="${SOURCE:-$WORKSPACE_ROOT/source-official-bf16-1.7b/Spark-X2.5-1.7B.gguf}"
10
+ MODEL_DIR="${MODEL_DIR:-$PACKAGE_ROOT}"
11
+ THREADS="${THREADS:-64}"
12
+ REPETITIONS="${REPETITIONS:-3}"
13
+ OUTDIR="${OUTDIR:-$WORKSPACE_ROOT/reports/spark-1.7b/benchmark-gpu0}"
14
+ RAW="$OUTDIR/llama-bench-raw"
15
+
16
+ mkdir -p "$RAW"
17
+
18
+ models=(
19
+ "BF16|$SOURCE"
20
+ "Q8_0|$MODEL_DIR/Spark-X2.5-1.7B-Q8_0.gguf"
21
+ "Q6_K|$MODEL_DIR/Spark-X2.5-1.7B-Q6_K.gguf"
22
+ "Q5_K_M|$MODEL_DIR/Spark-X2.5-1.7B-Q5_K_M.gguf"
23
+ "Q4_K_M|$MODEL_DIR/Spark-X2.5-1.7B-Q4_K_M.gguf"
24
+ "Q3_K_M|$MODEL_DIR/Spark-X2.5-1.7B-Q3_K_M.gguf"
25
+ "Q2_K|$MODEL_DIR/Spark-X2.5-1.7B-Q2_K.gguf"
26
+ "IQ2_XS|$MODEL_DIR/Spark-X2.5-1.7B-IQ2_XS.gguf"
27
+ "IQ1_M|$MODEL_DIR/Spark-X2.5-1.7B-IQ1_M.gguf"
28
+ "Q1_0|$MODEL_DIR/Spark-X2.5-1.7B-Q1_0.gguf"
29
+ )
30
+
31
+ for item in "${models[@]}"; do
32
+ label="${item%%|*}"
33
+ model="${item#*|}"
34
+ echo "benchmarking GPU0 $label"
35
+ CUDA_VISIBLE_DEVICES=0 "$BENCH" \
36
+ -m "$model" \
37
+ -p 256 \
38
+ -n 64 \
39
+ -r "$REPETITIONS" \
40
+ -b 512 \
41
+ -ub 512 \
42
+ -t "$THREADS" \
43
+ -ngl 99 \
44
+ --device CUDA0 \
45
+ -o csv \
46
+ >"$RAW/$label.csv" \
47
+ 2>"$RAW/$label.stderr"
48
+ done
49
+
50
+ LLAMA_BENCH_REPETITIONS="$REPETITIONS" python3 "${SUMMARIZER:-$WORKSPACE_ROOT/reproducibility/summarize_bench.py}" "$RAW" "$OUTDIR/speed-summary.tsv"
51
+ echo "benchmark artifacts: $OUTDIR"
reproducibility/gpu_smoke_test_ladder.sh ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -u
3
+
4
+ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
5
+ PACKAGE_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
6
+ LLAMA_CPP="${LLAMA_CPP:-$PACKAGE_ROOT/../tools-llama.cpp-spark}"
7
+ CLI="${CLI:-$LLAMA_CPP/build/bin/llama-cli}"
8
+ MODEL_DIR="${MODEL_DIR:-$PACKAGE_ROOT}"
9
+ LOGDIR="${LOGDIR:-$PACKAGE_ROOT/../reports/spark-1.7b/smoke-tests-gpu0}"
10
+ SUMMARY="${SUMMARY:-$PACKAGE_ROOT/../reports/spark-1.7b/smoke-test-gpu0.tsv}"
11
+
12
+ mkdir -p "$LOGDIR"
13
+ printf 'model\tstatus\tlog\n' > "$SUMMARY"
14
+
15
+ models=(
16
+ Spark-X2.5-1.7B-Q8_0.gguf
17
+ Spark-X2.5-1.7B-Q6_K.gguf
18
+ Spark-X2.5-1.7B-Q5_K_M.gguf
19
+ Spark-X2.5-1.7B-Q4_K_M.gguf
20
+ Spark-X2.5-1.7B-Q3_K_M.gguf
21
+ Spark-X2.5-1.7B-Q2_K.gguf
22
+ Spark-X2.5-1.7B-IQ2_XS.gguf
23
+ Spark-X2.5-1.7B-IQ1_M.gguf
24
+ Spark-X2.5-1.7B-Q1_0.gguf
25
+ )
26
+
27
+ for model in "${models[@]}"; do
28
+ log="$LOGDIR/${model%.gguf}.log"
29
+ echo "testing GPU0 $model"
30
+ if CUDA_VISIBLE_DEVICES=0 timeout 180 "$CLI" \
31
+ -m "$MODEL_DIR/$model" \
32
+ -p 'Trả lời ngắn bằng tiếng Việt: GGUF là gì?' \
33
+ -n 48 \
34
+ -c 2048 \
35
+ -dev CUDA0 \
36
+ -ngl 99 \
37
+ --single-turn \
38
+ --simple-io \
39
+ --no-display-prompt \
40
+ --temp 0.2 \
41
+ --top-p 0.95 \
42
+ --seed 42 \
43
+ --log-verbosity 1 >"$log" 2>&1; then
44
+ status=PASS
45
+ else
46
+ status=FAIL
47
+ fi
48
+ printf '%s\t%s\t%s\n' "$model" "$status" "$log" >> "$SUMMARY"
49
+ echo "$status $model"
50
+ done
reproducibility/perplexity_ladder.sh ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
5
+ PACKAGE_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
6
+ WORKSPACE_ROOT="${WORKSPACE_ROOT:-$PACKAGE_ROOT/..}"
7
+ LLAMA_CPP="${LLAMA_CPP:-$WORKSPACE_ROOT/tools-llama.cpp-spark}"
8
+ PPL="${PPL:-$LLAMA_CPP/build/bin/llama-perplexity}"
9
+ SOURCE="${SOURCE:-$WORKSPACE_ROOT/source-official-bf16-1.7b/Spark-X2.5-1.7B.gguf}"
10
+ MODEL_DIR="${MODEL_DIR:-$PACKAGE_ROOT}"
11
+ CALIBRATION_FILE="${CALIBRATION_FILE:-$WORKSPACE_ROOT/calibration/wikitext-2-raw/wiki.test.raw}"
12
+ THREADS="${THREADS:-64}"
13
+ OUTDIR="${OUTDIR:-$WORKSPACE_ROOT/reports/spark-1.7b/perplexity}"
14
+ LOGDIR="$OUTDIR/logs"
15
+
16
+ mkdir -p "$LOGDIR"
17
+
18
+ models=(
19
+ "Spark-X2.5-1.7B|$SOURCE"
20
+ "Spark-X2.5-1.7B-Q8_0|$MODEL_DIR/Spark-X2.5-1.7B-Q8_0.gguf"
21
+ "Spark-X2.5-1.7B-Q6_K|$MODEL_DIR/Spark-X2.5-1.7B-Q6_K.gguf"
22
+ "Spark-X2.5-1.7B-Q5_K_M|$MODEL_DIR/Spark-X2.5-1.7B-Q5_K_M.gguf"
23
+ "Spark-X2.5-1.7B-Q4_K_M|$MODEL_DIR/Spark-X2.5-1.7B-Q4_K_M.gguf"
24
+ "Spark-X2.5-1.7B-Q3_K_M|$MODEL_DIR/Spark-X2.5-1.7B-Q3_K_M.gguf"
25
+ "Spark-X2.5-1.7B-Q2_K|$MODEL_DIR/Spark-X2.5-1.7B-Q2_K.gguf"
26
+ "Spark-X2.5-1.7B-IQ2_XS|$MODEL_DIR/Spark-X2.5-1.7B-IQ2_XS.gguf"
27
+ "Spark-X2.5-1.7B-IQ1_M|$MODEL_DIR/Spark-X2.5-1.7B-IQ1_M.gguf"
28
+ "Spark-X2.5-1.7B-Q1_0|$MODEL_DIR/Spark-X2.5-1.7B-Q1_0.gguf"
29
+ )
30
+
31
+ for item in "${models[@]}"; do
32
+ label="${item%%|*}"
33
+ model="${item#*|}"
34
+ echo "perplexity $label"
35
+ timeout 900 "$PPL" \
36
+ -m "$model" \
37
+ -f "$CALIBRATION_FILE" \
38
+ -c 512 \
39
+ -b 512 \
40
+ --chunks 4 \
41
+ -t "$THREADS" \
42
+ -tb "$THREADS" \
43
+ -ngl 0 \
44
+ --device none \
45
+ --no-warmup \
46
+ --log-verbosity 1 \
47
+ >"$LOGDIR/$label.log" 2>&1 || true
48
+ done
49
+
50
+ python3 "${SUMMARIZER:-$WORKSPACE_ROOT/reproducibility/summarize_ppl.py}" "$LOGDIR" "$OUTDIR/perplexity-summary.tsv"
51
+ echo "perplexity artifacts: $OUTDIR"
reproducibility/quantize_ladder.sh ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
5
+ PACKAGE_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
6
+ WORKSPACE_ROOT="${WORKSPACE_ROOT:-$PACKAGE_ROOT}"
7
+ LLAMA_CPP="${LLAMA_CPP:-$WORKSPACE_ROOT/tools-llama.cpp-spark}"
8
+ QUANTIZER="${QUANTIZER:-$LLAMA_CPP/build/bin/llama-quantize}"
9
+ SOURCE="${SOURCE:-$WORKSPACE_ROOT/source-official-bf16-1.7b/Spark-X2.5-1.7B.gguf}"
10
+ IMATRIX="${IMATRIX:-$SCRIPT_DIR/spark25_1.7b_combined.imatrix.gguf}"
11
+ OUTDIR="${OUTDIR:-$PACKAGE_ROOT}"
12
+ LOGDIR="${LOGDIR:-$WORKSPACE_ROOT/reports/spark-1.7b/quantize-logs}"
13
+ THREADS="${THREADS:-64}"
14
+
15
+ [[ -s "$SOURCE" ]] || { echo "Missing SOURCE: $SOURCE" >&2; exit 1; }
16
+ [[ -x "$QUANTIZER" ]] || { echo "Missing QUANTIZER: $QUANTIZER" >&2; exit 1; }
17
+ [[ -s "$IMATRIX" ]] || { echo "Missing IMATRIX: $IMATRIX" >&2; exit 1; }
18
+
19
+ mkdir -p "$OUTDIR" "$LOGDIR"
20
+
21
+ run_quant() {
22
+ local type="$1"
23
+ local suffix="$2"
24
+ local output="$OUTDIR/Spark-X2.5-1.7B-${suffix}.gguf"
25
+ local log="$LOGDIR/${suffix}.log"
26
+
27
+ if [[ -s "$output" ]]; then
28
+ echo "skip $suffix (already exists)"
29
+ return 0
30
+ fi
31
+
32
+ echo "start $suffix"
33
+ if [[ "$type" == "Q8_0" ]]; then
34
+ "$QUANTIZER" "$SOURCE" "$output" "$type" "$THREADS" >"$log" 2>&1
35
+ else
36
+ "$QUANTIZER" --imatrix "$IMATRIX" "$SOURCE" "$output" "$type" "$THREADS" >"$log" 2>&1
37
+ fi
38
+ echo "done $suffix"
39
+ }
40
+
41
+ run_quant Q8_0 Q8_0
42
+ run_quant Q6_K Q6_K
43
+ run_quant Q5_K_M Q5_K_M
44
+ run_quant Q4_K_M Q4_K_M
45
+ run_quant Q3_K_M Q3_K_M
46
+ run_quant Q2_K Q2_K
47
+ run_quant IQ2_XS IQ2_XS
48
+ run_quant IQ1_M IQ1_M
49
+ run_quant Q1_0 Q1_0
reproducibility/smoke_test_ladder.sh ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -u
3
+
4
+ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
5
+ PACKAGE_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
6
+ LLAMA_CPP="${LLAMA_CPP:-$PACKAGE_ROOT/../tools-llama.cpp-spark}"
7
+ CLI="${CLI:-$LLAMA_CPP/build/bin/llama-cli}"
8
+ MODEL_DIR="${MODEL_DIR:-$PACKAGE_ROOT}"
9
+ LOGDIR="${LOGDIR:-$PACKAGE_ROOT/../reports/spark-1.7b/smoke-tests-cpu}"
10
+ SUMMARY="${SUMMARY:-$PACKAGE_ROOT/../reports/spark-1.7b/smoke-test-cpu.tsv}"
11
+
12
+ mkdir -p "$LOGDIR"
13
+ printf 'model\tstatus\tlog\n' > "$SUMMARY"
14
+
15
+ models=(
16
+ Spark-X2.5-1.7B-Q8_0.gguf
17
+ Spark-X2.5-1.7B-Q6_K.gguf
18
+ Spark-X2.5-1.7B-Q5_K_M.gguf
19
+ Spark-X2.5-1.7B-Q4_K_M.gguf
20
+ Spark-X2.5-1.7B-Q3_K_M.gguf
21
+ Spark-X2.5-1.7B-Q2_K.gguf
22
+ Spark-X2.5-1.7B-IQ2_XS.gguf
23
+ Spark-X2.5-1.7B-IQ1_M.gguf
24
+ Spark-X2.5-1.7B-Q1_0.gguf
25
+ )
26
+
27
+ for model in "${models[@]}"; do
28
+ log="$LOGDIR/${model%.gguf}.log"
29
+ echo "testing $model"
30
+ if timeout 180 "$CLI" \
31
+ -m "$MODEL_DIR/$model" \
32
+ -p 'Trả lời ngắn bằng tiếng Việt: GGUF là gì?' \
33
+ -n 48 \
34
+ -c 2048 \
35
+ -dev none \
36
+ --single-turn \
37
+ --simple-io \
38
+ --no-display-prompt \
39
+ --temp 0.2 \
40
+ --top-p 0.95 \
41
+ --seed 42 \
42
+ --log-verbosity 1 >"$log" 2>&1; then
43
+ status=PASS
44
+ else
45
+ status=FAIL
46
+ fi
47
+ printf '%s\t%s\t%s\n' "$model" "$status" "$log" >> "$SUMMARY"
48
+ echo "$status $model"
49
+ done
reproducibility/spark25_1.7b_combined.imatrix.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59825b29e1f0f956f903b74483635dad888b92a7539666adb280414a0a97d4f6
3
+ size 1918688
reproducibility/spark25_1.7b_vn_code_agent.imatrix.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0714c70a5e8646afd87a83cc62255aed90568c75a674cc5c9a5f691dd39480a8
3
+ size 1918624
reproducibility/spark25_1.7b_wiki.imatrix.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c861c45a059447a8a94b1d74e7557c675cc9d2daa8b68c4c88c5f26fd70ae89a
3
+ size 1918624