Zigeng commited on
Commit
9369e8a
Β·
verified Β·
1 Parent(s): 9032b6b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md CHANGED
@@ -1,3 +1,109 @@
1
  ---
 
 
2
  license: apache-2.0
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model:
3
+ - inclusionAI/LLaDA2.0-mini
4
  license: apache-2.0
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
  ---
8
+
9
+ <div align="center">
10
+ <h1>πŸš€ DMax: Aggressive Parallel Decoding for dLLMs</h1>
11
+ <div align="center">
12
+ <a href="https://github.com/czg1225/DMax/blob/main/LICENSE">
13
+ <img alt="Apache" src="https://img.shields.io/badge/License-Apache-4E94CE.svg">
14
+ </a>
15
+ <a href="https://arxiv.org/abs/2604.08302">
16
+ <img src="https://img.shields.io/badge/Paper-Arxiv-darkred.svg" alt="Paper">
17
+ </a>
18
+ <a href="https://github.com/czg1225/DMax">
19
+ <img src="https://img.shields.io/badge/GitHub-Code-blue.svg?logo=github&" alt="GitHub">
20
+ </a>
21
+ </div>
22
+ </div>
23
+
24
+ DMax is a new paradigm for efficient diffusion language models (dLLMs) that enables aggressive decoding parallelism while preserving generation quality. This repository hosts **DMax-16B**, a highly parallel general-purpose diffusion language model (dLLM) capable of handling code generation, mathematical reasoning, and daily conversation.
25
+
26
+
27
+ ## πŸ’ͺ Highlights
28
+
29
+ - **Aggressive Decoding Parallelism**: Achieves 6.0 TPF on math and reasoning tasks and 6.6 TPF on code tasks while preserving accuracy.
30
+ - **Self-Revising dLLM**: Extends a pretrained MDLM into a UDLM with an intrinsic ability to revise its own erroneous predictions during decoding.
31
+ - **Soft Parallel Decoding**: Uses interpolation between mask and token embeddings to propagate confidence priors from previous steps.
32
+
33
+ <div align="center">
34
+ <img src="assets/tradeoff.png" width="100%" />
35
+ <br>
36
+ <em>Superior Parallelism-Accuracy Trade-off, Increased TPF with Maintained Accuracy.</em>
37
+ </div>
38
+
39
+
40
+ ## πŸ’» Model and Datasets
41
+
42
+ | Model | Description | Source Model | Link |
43
+ | --- | --- | --- | --- |
44
+ | πŸ€– DMax-16B | Highly parallel general-purpose dLLM. | LLaDA-2.0-mini | [HF](https://huggingface.co/Zigeng/DMax-16B) |
45
+ | πŸ€– DMax-Math-16B | Highly parallel dLLM for math and reasoning. | LLaDA-2.0-mini | [HF](https://huggingface.co/Zigeng/DMax-Math-16B) |
46
+ | πŸ€– DMax-Coder-16B | Highly parallel dLLM for code generation. | LLaDA-2.0-mini | [HF](https://huggingface.co/Zigeng/DMax-Coder-16B) |
47
+
48
+ | Dataset | Description | Link |
49
+ | --- | --- | --- |
50
+ | πŸ“Š DMax-Math-Training-Data | math trajectories generated by LLaDA-2.0-mini | [HF](https://huggingface.co/datasets/Zigeng/DMax-LLaDA-2.0-Mini-Math-Trajectories) |
51
+ | πŸ“Š DMax-Code-Training-Data | code trajectories generated by LLaDA-2.0-mini | [HF](https://huggingface.co/datasets/Zigeng/DMax-LLaDA-2.0-Mini-Code-Trajectories) |
52
+
53
+
54
+
55
+ ## πŸš€ Quick Start
56
+
57
+ ```python
58
+ import torch
59
+ from transformers import AutoModelForCausalLM
60
+ from transformers import AutoTokenizer
61
+
62
+ model = AutoModelForCausalLM.from_pretrained(
63
+ "Zigeng/DMax-16B", trust_remote_code=True, device_map="cuda:0"
64
+ )
65
+ model = model.to(torch.bfloat16)
66
+ model.eval()
67
+ tokenizer = AutoTokenizer.from_pretrained("Zigeng/DMax-16B", trust_remote_code=True)
68
+
69
+ prompt = "A robe takes 2 bolts of blue fiber and half that much white fiber. How many bolts in total does it take?" + "
70
+ Let's think step by step
71
+ "
72
+
73
+ input_ids = tokenizer.apply_chat_template(
74
+ [{"role": "user", "content": prompt}],
75
+ add_generation_prompt=True,
76
+ tokenize=True,
77
+ return_tensors="pt",
78
+ )
79
+
80
+ nfe, generated_tokens = model.generate_spd(
81
+ inputs=input_ids,
82
+ gen_length=2048,
83
+ block_length=32,
84
+ threshold=0.5,
85
+ )
86
+
87
+ generated_answer = tokenizer.decode(
88
+ generated_tokens[0],
89
+ skip_special_tokens=True,
90
+ )
91
+
92
+ print(generated_answer)
93
+ print("nfe:",nfe,"token length",len(generated_tokens[0]))
94
+ ```
95
+
96
+ ## πŸ“– Experimental Results
97
+
98
+ ![trade-off](assets/exp.png)
99
+
100
+ ## πŸ“š Citation
101
+
102
+ ```bibtex
103
+ @article{chen2026dmax,
104
+ title={DMax: Aggressive Parallel Decoding for dLLMs},
105
+ author={Chen, Zigeng and Fang, Gongfan and Ma, Xinyin and Yu, Ruonan and Wang, Xinchao},
106
+ journal={arXiv preprint arXiv:2604.08302},
107
+ year={2026}
108
+ }
109
+