HyFlash: A Prefix-Memory Prior for On-Device Speculative Decoding
Organizations: Microsoft Applied Sciences Group
Abstract
Parallel block drafting accelerates speculative decoding by predicting multiple future positions in a single backbone pass, but on-device deployment constrains both drafter capacity and context storage. Under tight memory budgets, drafters must model long-range dependencies and fine-grained draft-position interactions without the growing KV-cache overhead of full-context attention. We propose HyFlash, a compact parallel drafter that introduces a prefix-memory prior to separate long-range context modeling from fine-grained draft-position interactions with limited capacity. Local attention captures recent context and draft-position interactions, while recurrent memory compresses historical target features into fixed-size states. This inductive bias enables effective local and long-range modeling with bounded draft-side memory. Experiments show that HyFlash achieves higher acceptance than full-context attention with substantially less KV storage and with larger gains for shallow drafters and long contexts.
Figures & tables
| Target | Drafter | Math | Code | Chat | |||||||||||||
| GSM8K | MATH-500 | AIME25 | HumanEval | MBPP | LCB | MT-Bench | Avg. | ||||||||||
| Speedup | Speedup | Speedup | Speedup | Speedup | Speedup | Speedup | Speedup | ||||||||||
| Q3-4B | DFlash | 1.89 | 3.19 | 1.80 | 3.28 | 1.64 | 3.12 | 1.70 | 3.02 | 1.63 | 2.89 | 1.36 | 2.75 | 1.53 | 2.63 | 1.64 | 2.98 |
| DSpark | 2.28 | 3.92 | 2.11 | 4.02 | 1.93 | 3.82 | 2.04 | 3.73 | 1.91 | 3.54 | 1.66 | 3.46 | 1.79 | 3.19 | 1.95 | 3.67 | |
| HyFlash | 2.53 | 4.38 | 2.30 | 4.48 | 2.16 | 4.38 | 2.23 | 4.13 | 2.08 | 3.94 | 1.82 | 3.83 | 1.98 | 3.59 | 2.15 | 4.10 | |
| P4-14B | DFlash | 2.09 | 3.13 | 2.38 | 3.58 | 2.04 | 3.10 | 2.21 | 3.26 | 2.20 | 3.17 | 1.75 | 2.78 | 1.62 | 2.28 | 2.03 | 3.04 |
| Context | HotpotQA | QASPER | GovReport | ||||||
| Full | SWA | Hy. | Full | SWA | Hy. | Full | SWA | Hy. | |
| 2K–4K | 2.78 | 2.72 | 3.02 | 2.61 | 2.45 | 2.70 | 2.43 | 1.88 | 2.50 |
| 4K–8K | 3.23 | 2.57 | 3.25 | 2.52 | 2.31 | 2.64 | 2.50 | 1.66 | 2.61 |
| 8K–16K | 1.24 | 2.25 | 3.11 | 1.79 | 2.12 | 2.77 | 1.19 | 1.57 | 2.60 |
| 16K–32K | 1.02 | 2.13 | 2.72 | 0.97 | 1.81 | 2.83 | 0.86 | 1.58 | 2.44 |
| Intervention | Nearby ( ) | Distance ( ) | Late-slot Acc. ( ) |
| HyFlash | 6.32 | 5.62 | 0.77 |
| Recurrent history | |||
| SSM: Last 512 | 6.32 | 3.09 | 0.77 |
| SSM: Last feature | 4.66 | 2.19 | 0.68 |
| Intra-block interactions | |||
| Cross-slot off | 5.68 | 4.95 | 0.71 |
| Method | MATH-500 | AIME25 | MBPP | LCB | ||||
| Spd. | Spd. | Spd. | Spd. | |||||
| BF16 | 2.87 | 4.21 | 2.52 | 3.78 | 2.95 | 4.12 | 2.18 | 3.36 |
| INT4 | 2.98 | 4.18 | 2.61 | 3.72 | 3.08 | 4.09 | 2.30 | 3.35 |
| Rel. (%) | 3.8 | 0.7 | 3.6 | 1.6 | 4.4 | 0.7 | 5.5 | 0.7 |
| Method | MATH-500 | AIME25 | MBPP | LCB | ||||
| Spd. | Spd. | Spd. | Spd. | |||||
| Mamba-2 | 2.87 | 4.21 | 2.52 | 3.78 | 2.95 | 4.12 | 2.18 | 3.36 |
| GDN-2 | 2.85 | 4.14 | 2.47 | 3.59 | 2.76 | 4.01 | 2.18 | 3.38 |
| Method | MATH-500 | AIME25 | MBPP | LCB | ||||
| Spd. | Spd. | Spd. | Spd. | |||||
| DSpark | 2.87 | 4.21 | 2.52 | 3.78 | 2.95 | 4.12 | 2.18 | 3.36 |
| DFlash2 | 2.92 | 4.48 | 2.61 | 3.94 | 3.05 | 4.30 | 2.26 | 3.58 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Platform (Processor) | RAM | Peak AI Compute |
| Microsoft Surface Laptop 7 (X Elite) | 16 GB | 45 TOPS |
| Apple Mac mini (M4) | 16 GB | 38 TOPS |
| ASUS Vivobook S 15 (X Elite) | 16 GB | 45 TOPS |
| NVIDIA Jetson Orin NX | 16 GB | 157 TOPS |
| NVIDIA Jetson Orin Nano Super | 8 GB | 67 TOPS |
| Qualcomm Snapdragon Dev Kit (X Elite) | 32 GB | 45 TOPS |
| Method | AIME25 | LCB | ||||||
| Fixed | Adaptive | Fixed | Adaptive | |||||
| Spd. | Spd. | Spd. | Spd. | |||||
| DSpark | 2.15 | 3.42 | 2.40 | 3.94 | 1.82 | 2.97 | 2.03 | 3.42 |
| HyFlash | 2.52 | 3.81 | 2.74 | 4.29 | 2.17 | 3.44 | 2.41 | 3.94 |
| Method | ||||||||
| Spd. | Spd. | Spd. | Spd. | |||||
| DSpark | 1.88 | 2.73 | 2.12 | 3.10 | 2.22 | 3.28 | 2.18 | 3.27 |
| DSpark + SWA | 1.55 | 2.28 | 1.93 | 2.89 | 2.09 | 3.15 | 2.03 | 3.04 |
| HyFlash | 1.95 | 2.89 | 2.45 | 3.68 | 2.58 | 3.79 | 2.62 | 3.98 |
| Method | MATH-500 | AIME25 | MBPP | LCB | ||||
| Spd. | Spd. | Spd. | Spd. | |||||
| Greedy | 3.35 | 4.86 | 2.90 | 4.29 | 4.09 | 5.77 | 3.13 | 4.69 |
| Moderate | 3.22 | 4.75 | 2.79 | 4.25 | 3.00 | 4.39 | 2.54 | 3.97 |
| Untruncated | 2.87 | 4.21 | 2.52 | 3.78 | 2.95 | 4.12 | 2.18 | 3.36 |
| Method | MATH-500 | AIME25 | MBPP | LCB | ||||
| Spd. | Spd. | Spd. | Spd. | |||||
| 4K | 2.87 | 4.21 | 2.52 | 3.78 | 2.95 | 4.12 | 2.18 | 3.36 |
| 16K | 2.00 | 5.46 | 1.41 | 2.95 | 1.64 | 3.69 | 1.78 | 4.15 |