Spark-X2.6-4B VQ, two stages (format version 3)
A text-only dense-VQ conversion of the Spark-X2.6-4B instruct checkpoint, encoded
with two VQ stages at dim 8, 8,192 codewords per stage and E4M3FN codebooks, plus
an 8-bit GVR8 residual plane that stays inside stage 1. The release is a directory
whose release.json names two GGUF parts. Standard llama.cpp, Ollama and
Transformers loaders do not read this format.
This is the higher-rate point of the two published VQ points on this checkpoint: 4.3122 bits per encoded weight and 10.1537 percent weight error, against 2.657 bits and 23.16 percent for the one-stage release.
This is a two-stage release, not an R13+8 one-stage release
The recipe id recorded in release.json is spark-x2.6-4b-base-r13r8. That is a
fixed family label, not a description of what this build encodes. What the build
actually did is stated three times and agreed on by all three:
| Statement | Value | Where |
|---|---|---|
| Recipe encoding | "stages": 2, "format": "v3" | recipe.json, encoding block |
| Release format version | 3 | release.json, format_version |
| Part contents | 360 GVQ1 blobs = 180 stage-1 + 180 stage-2; 180 GVR8; 540 books | vq-gguf check |
A one-stage release writes one GVQ1 per encoded matrix and one codebook stage.
This release writes a second GVQ1 per matrix, named <parent>.stage2, with its
own GVBC book and its own row gains, linked by the spark2_5.stages metadata
object (180 links). The reconstruction is
W[r, d] = gain1[r] * (C1[i1][d] + R8[j][d]) + gain2[r] * C2[i2][d]
The GVR8 residual is added inside stage 1, each stage applies its own gain, and
that order is the container's own per-stage addition, not a new arithmetic. The
byte format is in FORMAT.md; the recipe is in
RECIPE.md.
The release
| Part | Role | Residency | Tensors | Bytes | SHA-256 |
|---|---|---|---|---|---|
spark-x2.6-4b-vq8.gguf | trunk | resident | 1,189 | 2,043,237,120 (1.903 GiB) | 46ce871a02cb47ef091164a170891a5a839fea220fe02738b30f023b1074122f |
spark-x2.6-4b-vq8.embedding.gguf | embedding, read in rows | ssd-rows | 1 | 671,089,280 (0.625 GiB) | 97b070697b342b7e445109047ad0d9b8ad2b03a4c097b0b2adbd3a7884c8179b |
| Both parts | 1,190 | 2,714,326,400 (2.528 GiB) |
release.json carries the roles, sizes, hashes and source revision; files.json
and SHA256SUMS cover the rest. Hand the runtime the directory, never a single
part and never a concatenation.
At a glance
| Source | Spark-X2.6-4B instruct, model_type spark2_5, 4,112,079,360 parameters |
| Revision | The parts record 64ca8f2a295b8ceb2757b9d4749a6558c4759e5b; port.json states the local checkpoint copy was not pinned by a download record. See SOURCE.md. |
| Recipe | spark-x2.6-4b-base-r13r8 with encoding.stages = 2 (RECIPE.md, recipe.json) |
| Encoding | dim 8, 8,192 codewords, one codebook group, E4M3FN books, two stages, 8-bit GVR8 residual in stage 1, one f16 gain per row per stage |
| Encoded | 180 matrices: per layer the fused q/k/v (6144 x 2560), o_proj (2560 x 4096), gate_proj (10240 x 2560), up_proj (10240 x 2560) and down_proj (2560 x 10240) |
| Copied bit-exact | 73 tensors: 36 input norms, 36 post-attention norms, the final norm (F32). The 36 attention-output gates (16 x 2560) are in the trunk skeleton as BF16, and the token table is BF16 in its own part. |
| Context | 1,048,576 tokens: 27 sliding layers at window 512 and 9 full layers, in a three-sliding-then-one-full schedule |
| Tokens | BPE, 131,072 entries, tied to the output head; role markers `< |
| Chat | chat_template.jinja, verbatim from the checkpoint; thinking is on by default with enable_thinking, reasoning_effort in high / low |
| Runtime | Supported in the spark2_5 family of ds4 / ds4-server (JLFN/ds4-dfm-rs branch feat/spark2_5-family). Full two-stage VQ loading and reconstruction implemented with 100% GPU-resident FP8 weights and Tensor Core acceleration. |
Model structure
36 decoder layers, hidden 2,560, intermediate 10,240, 16 query heads, 4 KV heads, head dimension 256. Every tensor that is not VQ is either copied or part of the skeleton.
| Field | Value |
|---|---|
| Layers | 36: 27 sliding (window 512), 9 full, as config.layer_types states |
| Sliding attention | RoPE theta 1e4, full rotary (partial_rotary_factor 1.0), head_dim 256 |
| Full attention | RoPE theta 5e6, partial_rotary_factor 0.25 (64 of 256 channels), head_dim 256 |
| Attention output gate | self_attn.g_proj, 16 x 2,560: one score per head, sigmoid, multiplied into the attention output before out_proj |
| Activation | exact gelu, not the tanh approximation; the checkpoint refuses anything else |
| Norm | RMSNorm in fp32 over the last dimension, weight applied in fp32, result cast back |
| Vocabulary | 131,072, tied to the head |
| Logit softcap | none |
| RMS eps | 1e-6 |
| Native context | 1,048,576 (max_position_embeddings) |
What is encoded and what is not
| Part | Storage |
|---|---|
Attention q/k/v (fused), o_proj, MLP gate_proj, up_proj, down_proj in all 36 layers | Two-stage VQ: stage-1 and stage-2 GVQ1 (13-bit index each), one GVR8 residual, three books per matrix |
| Norms (73 tensors) | F32 copy in the trunk, bit-exact |
Attention output gate (g_proj, 36 tensors) | BF16, in the trunk skeleton; excluded from the payload because a 8,192-word book for a 16 x 2,560 matrix costs more than the matrix |
| Token embedding and tied head | BF16, in the embedding part, read a row at a time |
The 180 encoded matrices hold 3,774,873,600 weights. The 73 copies measure exactly 0 difference against the checkpoint.
Measured quality (weights)
Measured by vq-quality from the artifact containers against the source
checkpoint, and recomputed from raw sums rather than averaged per-tensor
percentages. The full report is quality.json, written for a
human in QUALITY.md. This is a weight-space figure, not a
quality verdict.
| Metric | Value |
|---|---|
| Aggregate weight relL2 | 10.1537 % |
| Cosine similarity | 0.994860 |
| Encoded matrices / weights | 180 / 3,774,873,600 |
| Copied tensors, bit-exact | 73 |
| Artifact payload | 2,034,748,964 B, of which 472,250,880 B is the GVR8 residual |
| Bits per encoded weight | 4.3122 |
| Stage 0 alone (no stage 2, no residual) | 39.0864 % |
| Both stages without the residual | 16.0792 % |
| Manifest drift | none; every per-tensor figure agrees to 0.0001 |
Layer 0: down_proj 9.6052 %, gate_proj 9.7093 %, up_proj 9.6217 %,
out_proj 9.7554 %, q_k_v_proj 10.2987 %.
The residual buys 5.9 points over the two stages alone; stage 2 buys 23.0 points over stage 1 alone. Rate context on the same two matrices and the same checkpoint: Q3_K is 3.4375 bpw at 15.27 / 15.15 percent, Q4_K is 4.5 bpw at 7.22 / 7.16 percent. This point is 0.87 points better than Q3_K and 2.9 points worse than a 4.4 percent larger Q4_K. It is a measured VQ point, not a rate win.
Codebook health: 360 books, all fully used except one book that leaves a single
slot unchosen. Nineteen codewords carry an exactly zero norm and all of them are
on stage-2 books: 18 are chosen by 2 to 13 segments each out of 3,276,800, and
one is never chosen. That is what the residual stage produces, not a defect: a
cluster of near-zero residuals has a centroid under the E4M3 subnormal floor, so
the stored codeword is the zero vector and is the right representative for the
segments that choose it. vq-quality reports fail: false with the same counts
as notes.
Serving and Runtime Support (ds4 / ds4-server)
The spark2_5 family in the ds4 inference engine implements full native support for this
two-stage VQ release:
- Two-stage container loader: reads
spark2_5.stages(180 links) andspark2_5.residuals(180 links), binding and loading both stage-1 and stage-2GVQ1streams and codebooks directly from the release directory. - Fast two-stage reconstruction: evaluates
W = gain1 * (C1[i1] + R8[j]) + gain2 * C2[i2]into GPU memory at model open. - 100% GPU-resident FP8 weights: all 180 VQ matrices, 36
g_projattention output gates, 73 RMSNorms, and the tied output head reside entirely in GPU memory (3.89 GiBtotal inw->spark_image), completely eliminating PCIe transfers during inference. - Tensor Core GEMM execution: prefill and decode use fast FP8 Tensor Core matrix
multiplications (
mma.sync.aligned.m16n8k32.row.col.f32.e4m3.e4m3), achieving exceptional throughput on modern GPUs. - E4M3 full-layer KV cache: native sliding-512 attention (27 layers) and full attention (9 layers) with dual RoPE and FP8 KV, easily scaling to 128K context on a single 12 GB card.
Benchmarks
Measured on NVIDIA GeForce RTX 4070 SUPER 12GB (sm_89, busy SM clock 2,475 MHz):
| Metric | Scalar CPU/Deq Baseline | ds4 Tensor Core FP8 | Speedup |
|---|---|---|---|
| Prefill Throughput | 690 tok/s | 4,889.3 tok/s | 7.1× |
| Time to First Token (512 prompt) | ~742 ms | ~104 ms | 7.1× |
| Decode Throughput | 20.6 tok/s | 84.4 tok/s | 4.1× |
| VRAM Footprint (Weights) | ~7.03 GiB (BF16) | 3.89 GiB (FP8 resident) | -45% |
| VRAM Footprint (128K context) | — | ~6.7 GiB total | Fits in 12GB |
Serving with ds4-server
Serve the model with OpenAI-compatible API endpoints using the common ds4-server command:
DS4_SPARK2_5_FULL_KV=fp8 DS4_SPARK2_5_PREFILL_CHUNK=1024 ./ds4-server \
-m /path/to/spark-x2.6-4b-vq-gguf \
--port 8099 \
--ctx 16384 \
--mem-floor-gb 1
Then query via standard OpenAI API clients:
curl http://127.0.0.1:8099/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "spark-x2.6-4b-vq-2s",
"messages": [{"role": "user", "content": "What is 42 * 7?"}],
"temperature": 0.7
}'
The server natively parses thinking tags (<think>...</think>), handles tool framing,
and streams responses with full SSE compliance.
Files
| Path | Contents | Size |
|---|---|---|
spark-x2.6-4b-vq8.gguf | Trunk: 360 GVQ1, 180 GVR8, 540 GVBC, 73 F32, 36 BF16; 1,189 tensors | 2,043,237,120 B |
spark-x2.6-4b-vq8.embedding.gguf | BF16 token table, 131,072 x 2,560; one tensor | 671,089,280 B |
release.json | Entry point: every part with role, residency, size and SHA-256 | |
files.json | Index of release.json, config.json and the parts | |
config.json | The checkpoint config, byte-identical to the copy the release index hashes | 2,035 B |
recipe.json | The recipe that selected and encoded the matrices (vq-recipe/3) | |
family.json | The vq-family/1 file for the artifact | |
port.json | The filled vq-port/1 contract, with its encoding block and the four gates | |
runtime/layout.json | vq-layout/1: release constants, the stage and residual maps, every tensor | |
quality.json, QUALITY.md | The measurement, machine-readable and written out | |
tokenizer.json, tokenizer_config.json, vocab.json, special_tokens_map.json, generation_config.json, chat_template.jinja | The checkpoint's own tokenizer and chat files, unchanged | |
RECIPE.md, FORMAT.md, SOURCE.md | Recipe, byte format, provenance | |
SHA256SUMS | Hashes of every file in this repository | |
LICENSE | The checkpoint's licence, carried over |
The Hub's GGUF panel parses one .gguf file at a time. Its size reading comes
from whichever part is selected, and its variant selector reads filenames; the
release is the directory and release.json, and the panel is not the runtime.
Limits
- Two-stage VQ format requires
ds4/ds4-server(spark2_5family, branchfeat/spark2_5-family). Standard llama.cpp, Ollama, and Hugging Face loaders do not support two-stage VQ containers. - Lossy by construction: 10.1537 percent mean relL2 over 180 matrices at 4.3122 bits per weight.
- Text only. The checkpoint declares vision and audio; the recipe skips both and this release carries neither.
- The recipe was built with no calibration corpus and no activation importance
(
calibration.mode: none), so every row gain is exactly 1.0 and the codeword carries the whole approximation. Calibration is the remaining lever, not a property of the format. recipe.jsonstill carries one stale explanatory sentence: undermeasurements.why_these_values.stagesit reads "a family matrix is one index stream; the refinement is the separate GVR8 residual, not a second stage". That text belongs to the one-stage recipe it was copied from. The file's ownencoding.stagesis 2, and the artifact, family file, port contract and both parts agree on two stages. SeeRECIPE.md.- A second stage is refused for expert stacks by the emitter, because the per-expert split would need its own stage-2 row partition. This checkpoint is dense, so nothing is lost here, but the restriction is real.
Credits and sources
- The Spark-X2.6-4B checkpoint and its licence (
LICENSE, carried over unchanged). - Conversion tooling: VQ_tools (
vq-convert,build-vq-gpu,vq-gguf,vq-quality,vq-port). - The VQ method follows YoungAi; the runtime is the
ds4spark2_5family. - This is an unofficial conversion, not a release of the checkpoint's authors.
Verification
vq-gguf check --file spark-x2.6-4b-vq8.gguf
# 360 GVQ1 matrices, 180 second stages, 180 GVR8 residuals and 540 codebooks
# pass the family rules (1189 tensors, 1.903 GiB)
vq-gguf check --file spark-x2.6-4b-vq8.embedding.gguf
# 0 GVQ1 matrices, 0 second stages, 0 GVR8 residuals and 0 codebooks
# pass the family rules (1 tensors, 0.625 GiB)
sha256sum -c SHA256SUMS
The port contract also passes against this package:
vq-port check --port port.json --roles artifact/MODEL.json --artifact artifact \
--checkpoint <checkpoint> --family family.json --recipe recipe.json \
--token-check <token-check.json> --release release.json
# 9 checks, 0 failed; 4 gates, 4 open
The four gates are the ones listed above, and "open" means declared and unverified, not passed.
Extras in the local package
The directory this repository was staged from also keeps the build inputs and tool documentation, which are not published here:
| Path | Contents |
|---|---|
artifact/ | The raw DQV3 container set the parts were repacked from: 253 entries, 254 files, 2,034,748,964 B, with its own release.json (schema vq-release/1), MODEL.json, manifest.txt and residuals.txt |
build.log | The encoder's per-tensor log, 180 matrices in 302.2 s |
quality.txt | The vq-quality report as text |
docs/ | The VQ_tools pages: gguf.md, quality.md, runtime-port.md, family-template.md, template.md, verification.md, layers.md |
template/ | The conversion template: the port and recipe templates, the token check, and the filled two-stage example under examples/spark-x2.6-4b-two-stage/ |