Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- Skylion007/openwebtext
|
5 |
+
tags:
|
6 |
+
- diffusion
|
7 |
+
---
|
8 |
+
|
9 |
+
# Generalized Interpolating Discrete Diffusion
|
10 |
+
|
11 |
+
By Dimitri von Rütte, Janis Fluri, Yuhui Ding, Antonio Orvieto, Bernhard Schölkopf, Thomas Hofmann
|
12 |
+
|
13 |
+
<div style="display: flex; gap: 8px;">
|
14 |
+
<a href="https://www.arxiv.org/abs/2503.04482"><img alt="arXiv" src="https://img.shields.io/badge/arXiv-2503.04482-d22c2c.svg"></a>
|
15 |
+
<a href="https://colab.research.google.com/drive/1Xv4RyZhXHkIpIZeMYahl_4kMthLxKdg_?usp=sharing"><img alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"></a>
|
16 |
+
<a href="https://github.com/dvruette/gidd"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-GIDD-blue"></a>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
---
|
20 |
+
|
21 |
+

|
22 |
+
|
23 |
+
We present Generalized Interpolating Discrete Diffusion (GIDD), a novel framework for training discrete diffusion models.
|
24 |
+
GIDD can be seen as a generalization of the popular masked diffusion paradigm (MDM) to any diffusion process that can be written as a linear interpolation between a data distribution and some (time-variable) mixing distribution.
|
25 |
+
We demonstrate the flexibility of GIDD by training models on a hybrid diffusion process that combines masking and uniform noise.
|
26 |
+
The model therefore is trained to not only "fill in the blanks" (i.e. the masked tokens), but also to consider the correctness of already-filled-in tokens and, if necessary, replace incorrect tokens with more plausible ones.
|
27 |
+
We show that GIDD models trained on hybrid noise have better sample quality (generative PPL) than mask-only models, and that they are able to identify and correct their own mistakes in generated samples through a self-correction step.
|
28 |
+
This repository contains all training and evaluation code necessary for reproducing the results in the paper.
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
### Pretrained Checkpoints
|
33 |
+
Our trained checkpoints are available under the following links. All of them have been trained on 131B tokens from the [OpenWebText](https://huggingface.co/datasets/Skylion007/openwebtext) dataset with the [GPT-2 tokenizer](https://huggingface.co/openai-community/gpt2).
|
34 |
+
|
35 |
+
| Model | Small (169.6M) | Base (424.5M) |
|
36 |
+
|-------|-------|------|
|
37 |
+
| GIDD+ (p_u = 0.0) | [dvruette/gidd-small-p_unif-0.0](https://huggingface.co/dvruette/gidd-small-p_unif-0.0) | [dvruette/gidd-base-p_unif-0.0](https://huggingface.co/dvruette/gidd-base-p_unif-0.0) |
|
38 |
+
| GIDD+ (p_u = 0.1) | [dvruette/gidd-small-p_unif-0.1](https://huggingface.co/dvruette/gidd-small-p_unif-0.1) | dvruette/gidd-base-p_unif-0.1 |
|
39 |
+
| GIDD+ (p_u = 0.2) | [dvruette/gidd-small-p_unif-0.2](https://huggingface.co/dvruette/gidd-small-p_unif-0.2) | [dvruette/gidd-base-p_unif-0.2](https://huggingface.co/dvruette/gidd-base-p_unif-0.2) |
|
40 |
+
|
41 |
+
|
42 |
+
## Use the Model
|
43 |
+
|
44 |
+
1. Install the GIDD repo:
|
45 |
+
```bash
|
46 |
+
pip install git+https://github.com/dvruette/gidd
|
47 |
+
```
|
48 |
+
|
49 |
+
2. For quickly downloading a trained model and playing around with it, the `GiddPipeline` class is most convenient:
|
50 |
+
|
51 |
+
```python
|
52 |
+
from gidd import GiddPipeline
|
53 |
+
|
54 |
+
# Download a pretrained model from HuggingFace
|
55 |
+
pipe = GiddPipeline.from_pretrained("dvruette/gidd-base-p_unif-0.1", trust_remote_code=True)
|
56 |
+
|
57 |
+
# Generate samples
|
58 |
+
texts = pipe.generate(num_samples=4, num_inference_steps=128)
|
59 |
+
|
60 |
+
# Run self-correction step
|
61 |
+
corrected_texts = pipe.self_correction(texts, num_inference_steps=128, early_stopping=True, temperature=0.1)
|
62 |
+
|
63 |
+
print(corrected_texts)
|
64 |
+
```
|
65 |
+
|