GLM-5.2-DSpark

This repository releases a DSpark draft model for GLM-5.2, trained and published by AlayaNeW. It is a speculator, not a standalone LLM: pair it with a GLM-5.2 target (BF16 or FP8) in SGLang or vLLM.

Architecture

Field Value
Architecture Qwen3DSparkModel (qwen3_dspark)
Draft layers 5 (4× sliding attention + 1× full attention)
Hidden size / head dim 6144 / 128
Attention MHA, 64 Q heads, 64 KV heads
Sliding window 1024
Block size $\gamma$ 8
Target layers (KV inject) [1, 20, 38, 56, 75] (GLM-5.2 has 78 layers)
Markov head vanilla, rank 512
Confidence head enabled (with Markov features)
Vocab 154880 (same as GLM-5.2)
Precision bfloat16

The training data is a mixture of code, reasoning, Chinese alignment, and long-context corpora. Answers were regenerated by GLM-5.2 to build the target cache. The draft was trained from scratch at 8k sequence length using DeepSpec

Quick Start

Requires a recent SGLang or vLLM build with native DSpark support. This draft is for GLM-5.2 only.

Serve with SGLang

export SGLANG_ENABLE_SPEC_V2=1

sglang serve \
  --model-path zai-org/GLM-5.2-FP8 \
  --trust-remote-code \
  --tp-size 8 \
  --reasoning-parser glm45 \
  --tool-call-parser glm47 \
  --context-length 202752 \
  --mem-fraction-static 0.85 \
  --cuda-graph-max-bs 256 \
  --disable-shared-experts-fusion \
  --host 0.0.0.0 \
  --port 8100 \
  --speculative-algorithm DSPARK \
  --speculative-draft-model-path AlayaNeW/GLM-5.2-DSpark \
  --speculative-dspark-block-size 8

Serve with vLLM

vllm serve zai-org/GLM-5.2-FP8 \
  --trust-remote-code \
  --tensor-parallel-size 8 \
  --tool-call-parser glm47 \
  --enable-auto-tool-choice \
  --reasoning-parser glm45 \
  --max-model-len 202752 \
  --max-num-seqs 256 \
  --gpu-memory-utilization 0.85 \
  --max-cudagraph-capture-size 256 \
  --host 0.0.0.0 \
  --port 8100 \
  --served-model-name GLM-5.2 \
  --speculative-config '{
    "method": "dspark",
    "model": "AlayaNeW/GLM-5.2-DSpark",
    "num_speculative_tokens": 8,
    "draft_sample_method": "probabilistic"
  }'

This draft includes a confidence head. vLLM can enable adaptive verification (load-aware verify budget; losslessness unchanged):

  --speculative-config '{
    "method": "dspark",
    "model": "AlayaNeW/GLM-5.2-DSpark",
    "num_speculative_tokens": 8,
    "draft_sample_method": "probabilistic",
    "enable_adaptive_verification": true
  }'

Call the server

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8100/v1", api_key="EMPTY")
resp = client.chat.completions.create(
    model="GLM-5.2",
    messages=[{"role": "user", "content": "Write a Python function that checks if a number is prime."}],
    max_tokens=1024,
    extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
print(resp.choices[0].message.content)

Evaluation

  • Runtime: SGLang on 8 NVIDIA B200 GPUs (TP8)
  • Speculation block size: 8 (--speculative-dspark-block-size 8, --speculative-num-draft-tokens 9 = block size + 1)
  • Sampling: temperature 0.7, top-p 0.95 (thinking disabled)

Acceptance length is the per-request mean of completion tokens divided by verification steps. Higher is better.

Speed-Bench: Low Entropy

Context Len AL Pos 0 Pos 1 Pos 2 Pos 3 Pos 4 Pos 5 Pos 6 Pos 7
1k 4.75 84.28 68.72 55.81 45.87 38.09 31.93 26.92 22.64
2k 4.65 83.64 68.00 54.98 44.79 36.68 30.42 25.46 21.44
8k 4.80 84.33 69.57 57.15 47.40 39.39 32.68 27.13 22.37
16k 4.74 84.25 69.18 56.59 46.36 38.09 31.65 26.26 21.70
32k 4.52 83.30 67.37 53.97 43.12 34.85 28.13 22.76 18.37

Speed-Bench: Qualitative

Category AL Pos 0 Pos 1 Pos 2 Pos 3 Pos 4 Pos 5 Pos 6 Pos 7
coding 4.34 84.21 66.83 51.88 40.30 31.43 24.66 19.54 15.67
stem 3.60 76.62 56.13 40.20 29.33 21.70 15.98 11.66 8.36
humanities 3.54 76.44 55.38 39.23 28.25 20.62 15.22 11.12 8.09
math 3.72 77.59 57.41 42.00 30.99 23.25 17.50 13.29 9.96
multilingual 5.05 84.59 70.43 59.02 50.43 43.45 37.50 32.31 27.60
qa 3.71 76.26 55.80 41.32 31.14 23.98 18.26 13.96 10.72
rag 5.35 87.21 74.31 64.01 55.02 47.85 41.40 35.39 30.29
roleplay 2.80 67.73 41.69 25.42 16.09 11.13 7.80 5.82 4.53
reasoning 4.19 80.65 62.19 47.78 37.65 29.79 24.06 19.99 16.51
summarization 4.53 84.10 67.37 54.29 43.26 34.78 28.23 22.50 18.14
writing 3.27 72.69 49.30 33.60 23.86 17.54 13.19 10.04 7.65

Citation

If you use this draft model, please cite AlayaNeW/GLM-5.2-DSpark:

@misc{alayanew2026glm52dspark,
  title={GLM-5.2-DSpark},
  author={AlayaNeW},
  year={2026},
  howpublished={\url{https://huggingface.co/AlayaNeW/GLM-5.2-DSpark}}
}
Downloads last month
-
Safetensors
Model size
4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for AlayaNeW/GLM-5.2-DSpark

Base model

zai-org/GLM-5.2
Finetuned
(25)
this model

Paper for AlayaNeW/GLM-5.2-DSpark