GLM-5.3-Flash-DFlash2-Agentic
A DFlash2 speculative decoding draft model for GLM-5.3-Flash, trained exclusively on English and Korean agentic coding trajectories. All training data was generated by GLM-5.3-Flash itself while driving Claude Code, Codex, and OpenCode to resolve real GitHub issues.
Because speculative decoding is lossless—the target model verifies every drafted token—output quality is identical to running the target model directly. The drafter only accelerates generation.
- Use case: Serving GLM-5.3-Flash behind coding agents (Claude Code, Codex, OpenCode, and similar tool-calling harnesses) in English or Korean.
- Architecture: Identical to incoai/GLM-5.3-Flash-DFlash2—a 5-layer non-causal block drafter (1.17B trainable parameters) that reads five target hidden layers and shares the target model's frozen token embeddings and LM head. It serves as a drop-in replacement for SGLang's
DFLASHspeculative decoding algorithm. - Results: Across live agent sessions on held-out repositories unseen during training, median per-turn decode throughput reaches 291 tok/s (2.31× over non-speculative decoding), outperforming both the general-purpose DFlash2 drafter (248 tok/s, 1.97×) and the built-in MTP head (239 tok/s, 1.89×), with equally strong performance in English and Korean.
Quick start (SGLang)
Tested with SGLang 0.5.21 on 2× NVIDIA B200 GPUs using the FP8 target model:
python -m sglang.launch_server \
--model-path zai-org/GLM-5.3-Flash \
--tp-size 2 --trust-remote-code \
--context-length 262144 --mem-fraction-static 0.93 \
--tool-call-parser glm47 --reasoning-parser glm45 \
--speculative-algorithm DFLASH \
--speculative-draft-model-path lablup/GLM-5.3-Flash-DFlash2-Agentic \
--speculative-draft-attention-backend fa4
Performance in live agent workflows
| Model | Overall | EN | KO | Claude Code | Codex | OpenCode | Solo turns | Accept len |
|---|---|---|---|---|---|---|---|---|
| DFlash2 (this model) | 291 (2.31×) | 284 (2.29×) | 297 (2.31×) | 271 (2.17×) | 309 (2.40×) | 297 (2.38×) | 353 (2.21×) | 4.80 |
| DFlash2 (incoai) | 248 (1.97×) | 259 (2.08×) | 240 (1.86×) | 264 (2.11×) | 223 (1.73×) | 252 (2.03×) | 288 (1.81×) | 4.28 |
| MTP (SGLang EAGLE, 5 steps) | 239 (1.89×) | 238 (1.91×) | 240 (1.87×) | 224 (1.79×) | 229 (1.78×) | 264 (2.12×) | 281 (1.76×) | 4.09 |
| No speculation | 126 | 124 | 129 | 125 | 129 | 124 | 159 | – |
Throughput values show the median per-turn decode speed (in tok/s) across all requests generating at least 16 output tokens. Values in parentheses indicate the speedup relative to non-speculative decoding in the same column.
Evaluation setup
- Tasks & sessions: Live end-to-end agent sessions rather than static prompt replays. We evaluated 54 GitHub issues drawn from 16 of the 23 held-out repositories across 3 harnesses (Claude Code, Codex, OpenCode) × 2 languages (English, Korean) × 9 programming language groups, using a mix of reasoning effort levels (
low,high,max). - Execution: Each harness worked to resolve the issue from a fresh repository checkout, running 4 concurrent sessions at a time with a 30-minute timeout per session. All four serving configurations were evaluated on the exact same set of issues.
- Serving environment: GLM-5.3-Flash (FP8) on SGLang 0.5.21 with TP2 across 2× B200 GPUs (
--max-running-requests 16 --chunked-prefill-size 4096).- MTP:
--speculative-algorithm EAGLE --speculative-num-steps 5 --speculative-eagle-topk 1 --speculative-num-draft-tokens 6(the fastest MTP configuration we found for this workload). - DFlash2 drafters:
--speculative-draft-attention-backend fa4.
- MTP:
- Metrics:
- Decode speed: Calculated per request as
(completion_tokens − 1) / (end_to_end_latency − ttft)from SGLang's request logs. - Accept len: SGLang's
spec_accept_length(the average number of tokens accepted per verification step), averaged across requests. - Solo turns: Requests that executed while no other concurrent requests were in flight.
- Decode speed: Calculated per request as
- Exclusions: Two sessions entered degenerate tool-call loops (one with this model and one with
incoai) and were excluded across all configurations, leaving 52 valid sessions. - Run conditions: This model was evaluated in a separate pass on the same hardware and issue set as the other three configurations. Because live agent harnesses use non-zero sampling temperatures, exact trajectories vary naturally from run to run.
Training data
All training data was collected by running live coding agents backed by GLM-5.3-Flash. The drafter is trained strictly on tokens generated by the target model under the exact prompt contexts the target model saw during execution.
| Metric | Value |
|---|---|
| GitHub repositories | 977 (across 31 programming languages) |
| Agent sessions (with logged requests) | 50,268 |
| Target-model requests | 2,178,249 |
| Training samples | 80,299 |
| Total context tokens in samples | 2.58B |
| Supervised (loss) tokens | 0.611B |
| Maximum sample length | 262,144 tokens |
- Repositories: Selected from 1,000 popular GitHub repositories ranked by star count with per-language quotas. The largest language groups are Python (128), TypeScript (106), JavaScript (76), Go (74), Rust (73), Java (60), C++ (59), C (40), C# (40), Ruby (30), Kotlin (29), and PHP (29).
- Train / eval split: 23 repositories (~2%, selected deterministically by hashing the repository name) were held out completely for evaluation. Per-repository sample counts for the 977 training repositories are listed in
training_repos.json, and overall dataset statistics along with the held-out repository list are available indata_summary.json. - Tasks: Up to 100 closed issues per repository that were originally resolved by a merged pull request. For each task, the repository was checked out at the commit corresponding to when the issue was filed.
- Bilingual sessions: Each issue was run twice—once with the original English prompt and once with a Korean translation produced by GLM-5.3-Flash (preserving code blocks, logs, and identifiers verbatim). The agent harness (Claude Code, Codex, or OpenCode) and reasoning effort (
low,high, ormax) were sampled per session. - Data collection: Each session ran the unmodified agent harness binary inside an isolated git worktree against an SGLang server (TP4, 90-minute timeout). Every completed inference request was logged along with its exact rendered prompt and generated token IDs.
- Sample construction: Consecutive requests whose prompts extend earlier turns are merged into a single multi-turn context chain (one training sample per chain). Training loss is computed only over the target model's generated tokens where they appear verbatim in the final context; re-rendered conversation history receives zero loss.
Target-model token breakdown (GLM-5.3-Flash)
Tokens processed and generated by GLM-5.3-Flash across all training sessions:
| Split | Sessions | Requests | Input tokens | Output tokens | Samples | Supervised tokens |
|---|---|---|---|---|---|---|
| Total | 50,268 | 2,178,249 | 91.90B | 610.95M | 80,299 | 610.56M |
| English | 25,151 | 1,073,677 | 45.03B | 294.29M | 40,103 | 293.90M |
| Korean | 25,117 | 1,104,572 | 46.87B | 316.66M | 39,994 | 316.20M |
| Claude Code | 16,757 | 799,868 | 34.94B | 278.35M | 39,029 | 277.79M |
| Codex | 16,682 | 695,268 | 29.34B | 145.45M | 16,999 | 145.44M |
| OpenCode | 16,829 | 683,113 | 27.61B | 187.15M | 24,069 | 186.87M |
| Effort: low | 16,699 | 548,492 | 17.65B | 105.75M | 20,424 | 105.56M |
| Effort: high | 16,736 | 739,352 | 30.20B | 186.05M | 24,981 | 185.76M |
| Effort: max | 16,833 | 890,405 | 44.05B | 319.15M | 34,692 | 318.78M |
- Input tokens reflect the full prompt length of every request, including prefix-cached tokens. Because agents resend the accumulating conversation history on each turn, total input tokens across requests are roughly 35× the 2.58B unique context tokens stored in the deduplicated training samples.
- Output tokens cover all tokens generated by GLM-5.3-Flash—including reasoning traces, tool calls, and code—nearly all of which (99.9%) are preserved as supervised training tokens.
Training details
Framework: SpecForge (commit 53398a8), using the DFlash training strategy and DFlash2 draft architecture in disaggregated online mode.
- A patched SGLang 0.5.21 server runs the frozen FP8 target model (TP2) to extract target hidden states on the fly for each training sample.
- Extracted hidden states are streamed directly to a 2-rank FSDP trainer over a Mooncake store.
- Because hidden states are never materialized to disk, training directly on full 262K-token contexts remains practical.
- Training ran on a single node equipped with 4× NVIDIA B200 GPUs using PyTorch 2.11 and Transformers 5.13.
| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW |
| Peak learning rate | 6e-4 |
| LR schedule | Cosine decay with 4% warmup |
| Gradient clipping | 1.0 |
| Feature capture | Online (re-captured every pass with freshly sampled anchors) |
| Effective batch size | 16 samples / step (2 ranks × 1 sample × 8 grad accum) |
| Tokens per step | ~1M context tokens (≤16K anchor blocks) |
| Anchors per sample | 1,024 |
| Max sample length | 262,144 tokens |
| Draft loss | DFlash loss with position decay γ = 7 |
| DFlash2 selector loss | Weight α = 1.0 (0.5% warmup, 1% ramp), strict top-k |
| Attention backend | FlexAttention |
| Precision | BF16 drafter, FP8 target |
| Sharding strategy | FSDP SHARD_GRAD_OP |
| Random seed | 42 |
Released checkpoint: Step 9,750. Average training metrics over steps 9,560–9,750:
- Training cross-entropy: 1.88
- Greedy accepted length (per 8-token block): 4.50
- Selector accepted length: 4.68
DFlash2 architecture & configuration
| Parameter | Value |
|---|---|
| Target model | GLM-5.3-Flash (320B total / 18B active MoE, 45 layers, hidden size 4096, vocab size 154,880) |
| Draft layers | 5 non-causal layers with sliding-window attention (window size 2048) |
| Hidden / FFN dimension | 4096 / 12288 |
| Attention heads / KV heads / head dim | 32 / 8 / 128 |
| Block size | 8 (1 anchor token + 7 draft tokens) |
Target layers read (target_layer_ids) |
5, 14, 24, 33, 42 |
| Conv kernel / group size | 2 / 16 |
| Candidate selector rank / top-k | 256 / 16 |
| Mask token ID | 154856 |
| Embeddings & LM head | Shared with target model (frozen) |
| Trainable parameters | 1.17B |
| Weights dtype | bfloat16 |
The model architecture is identical to incoai/GLM-5.3-Flash-DFlash2; only the training dataset and recipe differ. The relevant section of config.json is:
"dflash_config": {
"block_size": 8,
"conv_group_size": 16,
"conv_kernel_size": 2,
"mask_token_id": 154856,
"selector_rank": 256,
"selector_top_k": 16,
"target_layer_ids": [5, 14, 24, 33, 42]
}
Limitations
- Domain specialization: Because this drafter was trained exclusively on coding-agent trajectories, it underperforms the general-purpose drafter on non-coding workloads such as competitive math and open-ended chat.
License
This draft model is released under the MIT License. It requires GLM-5.3-Flash as the target model; please refer to the base model repository for its license terms.
Acknowledgements
- DFlash (z-lab) for the block-diffusion speculative decoding method
- incoai/GLM-5.3-Flash-DFlash2 for the DFlash2 model architecture and configuration
- SpecForge and SGLang for the training and serving frameworks
- Mooncake for high-throughput online feature transport
- The maintainers and contributors of the open-source repositories whose public issues made this dataset possible
- Downloads last month
- 3
Model tree for lablup/GLM-5.3-Flash-DFlash2-Agentic
Base model
zai-org/GLM-5.3-Flash