MLX
speculative-decoding
vllm

Run this model with HF Jobs

Run apple/dStreamer on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/apple/dStreamer. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/apple/dStreamer on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 4,613 Bytes
0d378ce
 
 
 
 
 
 
 
 
4a3efaf
0d378ce
 
4a3efaf
0d378ce
4a3efaf
 
 
 
 
 
 
 
b2ff663
 
 
 
 
 
 
 
 
 
 
4a3efaf
 
 
 
b2ff663
 
 
 
 
 
 
 
 
 
 
4a3efaf
 
0d378ce
 
 
 
 
 
 
 
4a3efaf
0d378ce
 
 
 
 
 
4a3efaf
0d378ce
 
 
 
 
 
4a3efaf
0d378ce
 
 
 
 
 
 
 
4a3efaf
 
 
 
 
 
0d378ce
 
 
4a3efaf
 
 
 
 
 
 
 
0d378ce
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
license: other
license_name: apple-amlr
license_link: LICENSE
base_model: Qwen/Qwen3-4B
tags:
  - speculative-decoding
  - vllm
  - mlx
  - arxiv:2612.04814
---

<h1 align="center">DStreamer</h1>

<p align="center"><b>Acceptance-Aligned Diffusion Streaming for High-Throughput Serving and Online RLVR</b></p>

<p align="center">
  <a href="https://arxiv.org/abs/2612.04814"><img src="https://img.shields.io/badge/Paper-arXiv%3A2612.04814-b31b1b"></a>
  <a href="https://github.com/apple-aiml-research/ml-dStreamer"><img src="https://img.shields.io/badge/Code-GitHub-181717?logo=github"></a>
  <a href="https://apple-aiml-research.github.io/ml-dStreamer/"><img src="https://img.shields.io/badge/Blog-interactive-3fb950"></a>
</p>

DStreamer is a lossless, diffusion-based speculative decoding method. Its drafter is a small adapter
that reads the target model's KV cache and drafts a whole window in one pass, so it needs **no draft
KV cache**. Output is identical to the target model's own decoding. The drafter is trained with diffusion
initialization, consistency distillation and acceptance-aligned reinforcement learning.

## Online RLVR: 1.93–2.15× faster training

During RLVR the policy keeps changing, so **DStreamer++** keeps updating the drafter on the same
rollouts. Rollouts stay exact samples from the current policy: **1.93–2.15×** end-to-end speedup on
Qwen3-4B, 8B and 14B, with final policy quality preserved.

<p align="center">
  <a href="https://apple-aiml-research.github.io/ml-dStreamer/"><img src="https://raw.githubusercontent.com/apple-aiml-research/ml-dStreamer/main/assets/rlvr.gif" width="94%" alt="Online RLVR: a frozen drafter's speedup decays as the policy changes; DStreamer++ keeps it, and the training reward is unchanged"></a>
</p>

## Serving throughput

Qwen3-4B under vLLM continuous batching on GSM8K, with concurrency swept from 64 to 1024. Each curve plots
aggregate system throughput against per-request output rate. DStreamer traces the outer frontier relative
to EAGLE-3 and DFlash (block sizes 4 and 16) across the evaluated range. At matched per-request rate it
reaches up to **3.8×** the aggregate throughput of autoregressive decoding, with **zero draft KV cache**:
the adapter reads the target model's own KV cache.

<p align="center">
  <img src="https://huggingface.co/apple/dStreamer/resolve/main/assets/serving_frontier.png" width="80%" alt="Serving frontier on GSM8K, Qwen3-4B in vLLM: system throughput vs per-request throughput for DStreamer, DFlash, EAGLE-3 and autoregressive decoding at concurrencies 64 to 1024">
</p>

## Checkpoints

| folder | contents | use with |
|---|---|---|
| `qwen3-4b-k4/` | `adapter.pt`, `config.json`: 8-layer adapter, 4-token window | vLLM serving, PyTorch decoding, RLVR (`--mode frozen` / `online`) |
| `qwen3-4b-gru-k16/` | `adapter.pt`, `head.pt`, `config.json`: 4-layer adapter with a GRU draft head, 16-token window | MLX on Apple silicon |

Target model: [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B), non-thinking chat format.

## Quick start

```bash
git clone https://github.com/apple-aiml-research/ml-dStreamer && cd ml-dStreamer
huggingface-cli download apple/dStreamer --local-dir checkpoints
```

**vLLM serving:**

```bash
bash vllm-port/setup.sh
bash vllm-port/scripts/run_dstreamer_vllm.sh --adapter checkpoints/qwen3-4b-k4/adapter.pt --cudagraphs
```


**Apple silicon (MLX):**

```bash
pip install mlx mlx-lm
PYTHONPATH=. python mlx_port/inference/benchmark_rnn_head.py --model Qwen/Qwen3-4B \
    --ckpt-dir checkpoints/qwen3-4b-gru-k16 --prompts data/toy/gsm8k_qwen3_4b_greedy.jsonl --limit 4
```

<p align="center">
  <img src="https://raw.githubusercontent.com/apple-aiml-research/ml-dStreamer/main/assets/demo_mlx.gif" width="94%" alt="Autoregressive decoding vs DStreamer on an Apple M3 Max">
</p>

Training (diffusion initialization, distillation, drafter RL) and RLVR with `--mode ar | frozen | online`
are documented in the [repository](https://github.com/apple-aiml-research/ml-dStreamer).

## Citation

```bibtex
@article{bhendawade2026dstreamer,
  title   = {DStreamer: Acceptance-Aligned Diffusion Streaming for High-Throughput Serving and Online RLVR},
  author  = {Bhendawade, Nikhil and Bartels, Chris and Boominathan, Lokesh and Moosavi Dezfooli, Seyed Mohsen and Nabi, Moin and Belousova, Irina},
  journal = {arXiv preprint arXiv:2612.04814},
  year    = {2026}
}
```

## License

The model weights are released under the Apple Machine Learning Research Model License; see
[LICENSE](LICENSE). The code in the GitHub repository is under the Apple Sample Code License.