Zigeng commited on
Commit
7902b26
Β·
verified Β·
1 Parent(s): e44ca33

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -3
README.md CHANGED
@@ -1,3 +1,121 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: text-generation
4
+ library_name: transformers
5
+ ---
6
+
7
+ <div align="center">
8
+ <h1>πŸš€ dParallel: Learnable Parallel Decoding for dLLMs</h1>
9
+ <div align="center">
10
+ <a href="https://opensource.org/license/mit-0">
11
+ <img alt="MIT" src="https://img.shields.io/badge/License-MIT-4E94CE.svg">
12
+ </a>
13
+ <a href="https://arxiv.org/pdf/2509.26488">
14
+ <img src="https://img.shields.io/badge/Paper-Arxiv-darkred.svg" alt="Paper">
15
+ </a>
16
+ <a href="https://github.com/czg1225/dParallel">
17
+ <img src="https://img.shields.io/badge/GitHub-Code-blue.svg?logo=github&" alt="GitHub">
18
+ </a>
19
+ </div>
20
+ </div>
21
+
22
+
23
+ > **dParallel: Learnable Parallel Decoding for dLLMs**
24
+ > [Zigeng Chen](https://github.com/czg1225), [Gongfan Fang](https://fangggf.github.io/), [Xinyin Ma](https://horseee.github.io/), [Ruonan Yu](https://scholar.google.com/citations?user=UHP95egAAAAJ&hl=en), [Xinchao Wang](https://sites.google.com/site/sitexinchaowang/)
25
+ > [xML Lab](https://sites.google.com/view/xml-nus), National University of Singapore
26
+
27
+
28
+ ## πŸ’‘ Introduction
29
+ We introduce dParallel, a simple and effective method that unlocks the inherent parallelism of dLLMs for fast sampling. We identify that the key bottleneck to parallel decoding arises from the sequential certainty convergence for masked tokens. Building on this insight, we introduce the core of our approach: certainty-forcing distillation, a novel training strategy that distills the model to follow its original sampling trajectories while enforcing it to achieve high certainty on masked tokens more rapidly and in parallel. Extensive experiments across various benchmarks demonstrate that our method can dramatically reduce the number of decoding steps while maintaining performance. When applied to the LLaDA-8B-Instruct model, dParallel reduces decoding steps from 256 to 30 on GSM8K, achieving an 8.5x speedup without performance degradation. On the MBPP benchmark, it cuts decoding steps from 256 to 24, resulting in a 10.5x speedup while maintaining accuracy.
30
+
31
+ <!-- ![figure](assets/intro.png) -->
32
+ <div align="center">
33
+ <img src="assets/method.png" width="100%" ></img>
34
+ <br>
35
+ <em>
36
+ Overview of proposed certainty-forcing distillation.
37
+ </em>
38
+ </div>
39
+ <br>
40
+
41
+
42
+ ## πŸ’» Model and Datasets
43
+ <table>
44
+ <table>
45
+ <thead>
46
+ </thead>
47
+ <tbody>
48
+ <tr>
49
+ <td>πŸ“„ <strong>Paper</strong></td>
50
+ <td><a href="https://arxiv.org/pdf/2509.26488">ArXiv-Link</a></td>
51
+ </tr>
52
+ <tr>
53
+ <td>πŸ€– <strong>LLaDA Model</strong></td>
54
+ <td><a href="https://huggingface.co/Zigeng/dParallel-LLaDA-8B-instruct">dParallel-LLaDA-8B-instruct</a></td>
55
+ </tr>
56
+ <tr>
57
+ <td>πŸ€– <strong>Dream Model</strong></td>
58
+ <td><a href="https://huggingface.co/Zigeng/dParallel_Dream_7B_Instruct">dParallel-Dream-7B-instruct</a></td>
59
+ </tr>
60
+ <tr>
61
+ <td>πŸ“Š <strong>LLaDA Data</strong></td>
62
+ <td><a href="https://huggingface.co/datasets/Zigeng/dParallel_LLaDA_Distill_Data">
63
+ dParallel-LLaDA-Distill Dataset</a></td>
64
+ </tr>
65
+ <tr>
66
+ <td>πŸ“Š <strong>Dream Data</strong></td>
67
+ <td><a href="https://huggingface.co/datasets/Zigeng/dParallel_Dream_Distill_Data">
68
+ dParallel-Dream-Distill Dataset</a></td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+
73
+
74
+ ## πŸš€ Quick Start:
75
+ ```python
76
+ from transformers import AutoTokenizer
77
+ from model.modeling_llada import LLaDAModelLM
78
+ from generate import generate
79
+ import torch
80
+
81
+ device = 'cuda'
82
+ model = LLaDAModelLM.from_pretrained('Zigeng/dParallel-LLaDA-8B-instruct', trust_remote_code=True, torch_dtype=torch.bfloat16).to(device).eval()
83
+ tokenizer = AutoTokenizer.from_pretrained('Zigeng/dParallel-LLaDA-8B-instruct', trust_remote_code=True)
84
+
85
+ prompt = "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? Please reason step by step, and put your final answer within \\boxed{}."
86
+
87
+ m = [{"role": "user", "content": prompt}, ]
88
+ prompt = tokenizer.apply_chat_template(m, add_generation_prompt=True, tokenize=False)
89
+
90
+ input_ids = tokenizer(prompt)['input_ids']
91
+ input_ids = torch.tensor(input_ids).to(device).unsqueeze(0)
92
+
93
+ out = generate(model, input_ids, steps=256, gen_length=256, block_length=32, temperature=0., threshold=0.5,remasking='low_confidence')
94
+ print("Response:",tokenizer.batch_decode(out[0][:, input_ids.shape[1]:], skip_special_tokens=True)[0])
95
+ print("NFE:",out[1])
96
+ ```
97
+
98
+
99
+ ## πŸ“– Experimental Results
100
+ ### Results on LLaDA-8B-Instruct:
101
+ ![llada-exp](assets/llada_exp.png)
102
+
103
+ ### Results on Dream-7B-Instruct:
104
+ ![dream-exp](assets/dream_exp.png)
105
+
106
+ ### Better Speed-Accuracy Trade-off:
107
+ ![trade-off](assets/trade-off.png)
108
+
109
+ ## β˜€οΈ Acknowledgement
110
+ Our code builds on [LLaDA](https://github.com/ML-GSAI/LLaDA), [Dream](https://github.com/DreamLM/Dream), [Fast-dLLM](https://github.com/NVlabs/Fast-dLLM/tree/main), and [dKV-Cache](https://github.com/horseee/dkv-cache), and we acknowledge these great works for laying the groundwork that made our approach possible.
111
+
112
+ ## Citation
113
+ If our research assists your work, please give us a star ⭐ or cite us using:
114
+ ```
115
+ @article{chen2025dparallel,
116
+ title={dParallel: Learnable Parallel Decoding for dLLMs},
117
+ author={Chen, Zigeng and Fang, Gongfan and Ma, Xinyin and Yu, Ruonan and Wang, Xinchao},
118
+ journal={arXiv preprint arXiv:2509.26488},
119
+ year={2025}
120
+ }
121
+ ```