nwoolmer commited on
Commit
20dc856
Β·
verified Β·
1 Parent(s): e59182a

Document DSpark 3-stage speculative drafter sidecar

Browse files
Files changed (1) hide show
  1. README.md +28 -2
README.md CHANGED
@@ -15,6 +15,8 @@ tags:
15
  - deepseek
16
  - deepseek-v4
17
  - mtp
 
 
18
  ---
19
 
20
  # hipfire DeepSeek V4 Flash (mq2lloyd)
@@ -52,10 +54,33 @@ The runtime SWA K and V state (window = 128) is **F32** and is allocated live at
52
  |------|------|---------|
53
  | `deepseek-v4-flash.mq2lloyd` | 86,184,307,283 B (β‰ˆ86.2 GB) | Main model β€” 43 layers, 256 routed + 1 shared expert per layer, attention, embed, lm_head |
54
  | `deepseek-v4-flash-mtp.mq2lloyd` | 1,998,047,355 B (β‰ˆ2.0 GB) | Single MTP layer (`num_nextn_predict_layers = 1`), opened automatically when present alongside the main file. Used for optional speculative decode. |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  ## Loading
57
 
58
- This model is registered in [hipfire's CLI registry](https://github.com/Kaden-Schutt/hipfire/blob/master/cli/registry.json) under `deepseek-v4-flash` (aliases: `deepseek4`, `deepseek-v4`). The registry entry pulls both the main file and the MTP companion together.
59
 
60
  ```bash
61
  # 1. Install hipfire (one-time):
@@ -84,6 +109,7 @@ cargo build --release -p hipfire-arch-deepseek4 --example deepseek4_chat
84
  # Pull the files (uses `hf` CLI or hipfire's registry-driven pull above):
85
  hf download nwoolmer/hipfire-deepseek-v4-flash \
86
  deepseek-v4-flash.mq2lloyd deepseek-v4-flash-mtp.mq2lloyd \
 
87
  --local-dir ~/.hipfire/models/
88
 
89
  # Direct chat binary (DSML chat template, EOS stop, multi-turn KV):
@@ -142,7 +168,7 @@ Cold-process load β€” weight upload from both HFQ files β€” is **~44 s** on the
142
 
143
  - **GPU**: AMD RDNA3 / RDNA3.5 with HIP + WMMA. **Validated on gfx1151 (Radeon 8060S, Strix Halo)** for this build of the V4F weights. The engine has gfx1100 (RX 7900-class) kernels in tree but they were not exercised against this specific file; RDNA1/2 (gfx1010 / gfx103x) and gfx12 are tracked targets of the broader hipfire project but not recommended for running this model.
144
  - **OS**: Linux with `amdgpu` kernel driver. Built and measured against **ROCm 7.2.1 / HIP 7.2**.
145
- - **Memory**: 86.2 GB for the main file + ~2 GB for the MTP companion + several GB working set during decode. Strix Halo class systems with 128 GB UMA are the comfortable target; discrete-GPU configs need ~96 GB+ of VRAM.
146
  - **Tested context length**: end-to-end inference was exercised at prompts up to ~1.2 k tokens and generations up to 256 tokens. Upstream's stated max position (1 048 576 via YaRN) was not exercised here.
147
 
148
  ## License
 
15
  - deepseek
16
  - deepseek-v4
17
  - mtp
18
+ - dspark
19
+ - speculative-decoding
20
  ---
21
 
22
  # hipfire DeepSeek V4 Flash (mq2lloyd)
 
54
  |------|------|---------|
55
  | `deepseek-v4-flash.mq2lloyd` | 86,184,307,283 B (β‰ˆ86.2 GB) | Main model β€” 43 layers, 256 routed + 1 shared expert per layer, attention, embed, lm_head |
56
  | `deepseek-v4-flash-mtp.mq2lloyd` | 1,998,047,355 B (β‰ˆ2.0 GB) | Single MTP layer (`num_nextn_predict_layers = 1`), opened automatically when present alongside the main file. Used for optional speculative decode. |
57
+ | `deepseek-v4-flash-dspark.mq2lloyd` | 5,996,334,814 B (β‰ˆ6.0 GB) | **DSpark 3-stage speculative drafter** (`mtp.0/1/2`), opened automatically via the `<stem>-dspark.<ext>` sibling convention. Wins over the single MTP head under `--spec dspark` / `--spec auto`. See the DSpark section below. |
58
+
59
+ ## DSpark speculative drafter (`-dspark` sidecar)
60
+
61
+ `deepseek-v4-flash-dspark.mq2lloyd` is an optional multi-token draft module that replaces the single in-trunk MTP head with a **3-stage chain** (`mtp.0 β†’ mtp.1 β†’ mtp.2`) proposing a block of 5 tokens per step. It is additive to the main file and to the MTP companion β€” attach whichever you want; DSpark auto-wins over MTP when both are present.
62
+
63
+ Verified by enumerating the file's tensor table (`hfq_dump`): **2 376 tensors, arch_id = 9**, same mixed-precision scheme as the main file:
64
+
65
+ ```
66
+ 2304 qt=19 (MQ2G256Lloyd) – 256 routed experts Γ— 3 (w1/w2/w3) Γ— 3 draft stages
67
+ 31 qt=3 (Q8F16) – per-stage attention, shared experts, main_proj, markov heads, confidence head
68
+ 41 qt=1 (F16) – norms, mHC gating (hc_head_*), main_norm
69
+ ```
70
+
71
+ The three stages are near-symmetric full DeepSeek-V4 blocks (791 / 789 / 796 tensors) with role-specific heads:
72
+
73
+ - **`mtp.0`** β€” owns the embed/main-hidden entry: `main_proj` (Linear 12288β†’4096, no bias) + `main_norm` (RMS). Draft input comes from `main_proj` + a noise block (`dspark_noise_token_id = 128799`), not the MTP head's `e_proj`/`h_proj` mixing.
74
+ - **`mtp.1`** β€” middle draft block.
75
+ - **`mtp.2`** β€” owns the output heads: `hc_head_{base,fn,scale}`, `markov_head.{markov_w1, markov_w2}` (Embed 129280β†’256 / Linear 256β†’129280) for the Markov token-bias prior, and `confidence_head.proj` (Linear 4352β†’1, fp32) driving confidence-truncated acceptance.
76
+
77
+ Config (from the file's metadata blob): `dspark_block_size = 5`, `dspark_target_layer_ids = [40, 41, 42]`, `dspark_markov_rank = 256`, `dspark_noise_token_id = 128799`.
78
+
79
+ Enable it with `hipfire run deepseek-v4-flash --spec dspark` (force) or `--spec auto` (DSpark preferred when the sidecar is present). Acceptance can be tuned with `--dspark-conf-threshold <0..1>` (deepseek4 default 0.3).
80
 
81
  ## Loading
82
 
83
+ This model is registered in [hipfire's CLI registry](https://github.com/Kaden-Schutt/hipfire/blob/master/cli/registry.json) under `deepseek-v4-flash` (aliases: `deepseek4`, `deepseek-v4`). The registry entry pulls the main file together with both the MTP and DSpark companions.
84
 
85
  ```bash
86
  # 1. Install hipfire (one-time):
 
109
  # Pull the files (uses `hf` CLI or hipfire's registry-driven pull above):
110
  hf download nwoolmer/hipfire-deepseek-v4-flash \
111
  deepseek-v4-flash.mq2lloyd deepseek-v4-flash-mtp.mq2lloyd \
112
+ deepseek-v4-flash-dspark.mq2lloyd \
113
  --local-dir ~/.hipfire/models/
114
 
115
  # Direct chat binary (DSML chat template, EOS stop, multi-turn KV):
 
168
 
169
  - **GPU**: AMD RDNA3 / RDNA3.5 with HIP + WMMA. **Validated on gfx1151 (Radeon 8060S, Strix Halo)** for this build of the V4F weights. The engine has gfx1100 (RX 7900-class) kernels in tree but they were not exercised against this specific file; RDNA1/2 (gfx1010 / gfx103x) and gfx12 are tracked targets of the broader hipfire project but not recommended for running this model.
170
  - **OS**: Linux with `amdgpu` kernel driver. Built and measured against **ROCm 7.2.1 / HIP 7.2**.
171
+ - **Memory**: 86.2 GB for the main file + ~2 GB for the MTP companion + ~6 GB for the optional DSpark drafter + several GB working set during decode. Strix Halo class systems with 128 GB UMA are the comfortable target; discrete-GPU configs need ~96 GB+ of VRAM.
172
  - **Tested context length**: end-to-end inference was exercised at prompts up to ~1.2 k tokens and generations up to 256 tokens. Upstream's stated max position (1 048 576 via YaRN) was not exercised here.
173
 
174
  ## License