Diffusion for text with a masked diffusion language model (MDLM). Sentences from TinyStories are corrupted by masking words at random, and a small transformer learns to fill them back in. Sampling starts from a fully masked sentence and reveals words over a number of steps, in no fixed order.
Things to try
- Watch a sentence being generated: at every step the model guesses each masked word, and some of the guesses are kept.
- Compare the linear and cosine masking schedules: the plot at the bottom shows the masking probability and the loss weight over time.
- Use fewer sampling steps: more words are revealed at once, and the sentences get less coherent.
Related demos
All demos