Instructions to use Zigeng/dParallel_Dream_7B_Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zigeng/dParallel_Dream_7B_Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Zigeng/dParallel_Dream_7B_Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Zigeng/dParallel_Dream_7B_Instruct", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Zigeng/dParallel_Dream_7B_Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Zigeng/dParallel_Dream_7B_Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zigeng/dParallel_Dream_7B_Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Zigeng/dParallel_Dream_7B_Instruct
- SGLang
How to use Zigeng/dParallel_Dream_7B_Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Zigeng/dParallel_Dream_7B_Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zigeng/dParallel_Dream_7B_Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Zigeng/dParallel_Dream_7B_Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zigeng/dParallel_Dream_7B_Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Zigeng/dParallel_Dream_7B_Instruct with Docker Model Runner:
docker model run hf.co/Zigeng/dParallel_Dream_7B_Instruct
Update README.md
Browse files
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 |
+
<!--  -->
|
| 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 |
+

|
| 102 |
+
|
| 103 |
+
### Results on Dream-7B-Instruct:
|
| 104 |
+

|
| 105 |
+
|
| 106 |
+
### Better Speed-Accuracy Trade-off:
|
| 107 |
+

|
| 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 |
+
```
|