TL;DR
HyFlash is a compact parallel drafter designed for on-device speculative decoding that efficiently balances long-range context modeling with fine-grained local interactions. By combining recurrent memory (Mamba-2) for historical context and local attention for drafting, it achieves significantly higher token acceptance and faster inference than full-attention models while maintaining a tiny, constant memory footprint.
What Problem Does This Paper Address?
Speculative decoding is a popular technique to speed up Large Language Model (LLM) inference. It uses a small, fast "drafter" model to propose a sequence of tokens, which a large "target" model then verifies in parallel. The challenge arises in on-device deployment (e.g., phones or laptops), where memory is extremely limited.
Drafters face a "capacity–context tension":
- Capacity: To stay within memory budgets, drafters must be very shallow (often just 2 layers).
- Context: To make good guesses, they need to understand both long-range dependencies (information from thousands of tokens ago) and local interactions (how the next few tokens relate to each other).
Standard approaches like windowed attention lose distant information, while full-context attention consumes too much memory and often overwhelms the limited modeling capacity of shallow drafters.
Methods
The authors introduce HyFlash, a hybrid architecture that incorporates a "prefix-memory prior." Instead of relying solely on attention, each HyFlash layer splits its work:
- Recurrent Memory (SSM): Using Mamba-2, HyFlash compresses historical target features into a fixed-size state. This serves as a "read-only" summary of the entire prefix.
- Local Attention: A sliding-window attention mechanism handles the most recent tokens and the interactions between the parallel draft positions.
- Persistent State: Unlike traditional recurrent models that update their state with every proposed token, HyFlash only updates its memory with committed tokens verified by the target model. During the drafting phase, the memory remains frozen, preventing "speculative noise" from corrupting the historical summary.
Datasets
The researchers evaluated HyFlash across a wide range of tasks using Qwen3-4B and Phi-4-reasoning (14B) as target models:
- Math: GSM8K, MATH-500, AIME25.
- Code: HumanEval, MBPP, LiveCodeBench (LCB).
- Chat: MT-Bench.
- Long Context: LongBench (including HotpotQA, QASPER, and GovReport) to test performance with up to 32K tokens.
- Training: They used the Open-PerfectBlend dataset (1.3 million samples) for drafter training.
Key Insights and Ideas
- Inductive Bias for Shallow Models: The most striking finding is that for very shallow drafters (1-2 layers), the hybrid architecture is actually better than full-context attention. The recurrent memory provides a structured "prior" that is easier for a small model to utilize than the raw, high-dimensional complexity of full attention.
- Separation of Concerns: By separating history (SSM) from local drafting (Attention), HyFlash avoids the quadratic memory growth of attention-only models while maintaining access to distant "evidence" in the text.
- Robustness to Quantization: HyFlash is highly practical; when quantized to 4-bit weights (INT4), it retains over 99% of its original performance while further increasing decoding speed.
Key Results
HyFlash consistently outperformed state-of-the-art parallel drafters like DFlash and DSpark:
- Speedup: On Phi-4-reasoning, HyFlash achieved a 2.58x speedup over standard autoregressive decoding, a 16.2% improvement over DSpark.
- Acceptance Length ($\tau$): HyFlash increased the average number of tokens accepted per round from 3.28 to 3.79 on Phi-4.
- Long Context Efficiency: In 32K context tasks, HyFlash maintained robust acceptance rates while full-context attention models saw significant degradation.
- Memory Footprint: In a typical configuration, HyFlash requires only 5 MiB for its logical context footprint, matching a small windowed attention buffer but providing the benefits of full-prefix awareness.
Limitations and Future Work
- Compressed Representation: The recurrent state is a compressed summary. While efficient, it does not provide the "exact" token-level access that full attention offers, which might be necessary for extremely precise retrieval tasks.
- Shallow Focus: The study primarily focused on 2-layer drafters. While they showed HyFlash scales well, the relative benefit over full attention might diminish as drafter depth increases significantly.
- Fixed Window Size: The current implementation uses a fixed attention window (e.g., 512 tokens). Future work could explore adaptive memory configurations or dynamic windowing to further optimize the capacity-context trade-off.
Summary updated