Categorical SDEs with Simplex Diffusion

Pierre H. Richemond, Sander Dieleman, Arnaud Doucet

Abstract

Diffusion models typically operate in the standard framework of generative modelling by producing continuously-valued datapoints. To this end, they rely on a progressive Gaussian smoothing of the original data distribution, which admits an SDE interpretation involving increments of a standard Brownian motion. However, some applications such as text generation or reinforcement learning might naturally be better served by diffusing categorical-valued data, i.e., lifting the diffusion to a space of probability distributions. To this end, this short theoretical note proposes Simplex Diffusion, a means to directly diffuse datapoints located on an n-dimensional probability simplex. We show how this relates to the Dirichlet distribution on the simplex and how the analogous SDE is realized thanks to a multi-dimensional Cox-Ingersoll-Ross process (abbreviated as CIR), previously used in economics and mathematical finance. Finally, we make remarks as to the numerical implementation of trajectories of the CIR process, and discuss some limitations of our approach.

Introduction

Generative modeling via diffusion has seen immense success in continuous domains like image and audio synthesis. These models rely on the progressive corruption of data with Gaussian noise, described by Stochastic Differential Equations (SDEs). However, applying these methods to categorical data—such as text tokens in language modeling or discrete actions in reinforcement learning—remains a challenge.

Standard approaches often map discrete categories into Euclidean space or use discrete-state Markov chains, which can lose the elegant mathematical properties of continuous-time SDEs. This paper introduces Simplex Diffusion, a theoretical framework that allows diffusion models to operate directly on the probability simplex (the space where all elements are non-negative and sum to one). By utilizing the Cox-Ingersoll-Ross (CIR) process, the authors bridge the gap between continuous SDEs and discrete categorical distributions.

The Simplex Diffusion Framework

The probability simplex is the natural space for categorical data, where each point represents a probability distribution over $n$ categories. To define a diffusion process on this manifold, the authors leverage a specific connection between the Gamma and Dirichlet distributions.

The Dirichlet-Gamma Connection

A Dirichlet distribution, which is the standard distribution for the simplex, can be constructed by sampling independent Gamma random variables and normalizing them. This observation is central to the proposed method: if we can define a diffusion process whose marginals are Gamma-distributed, we can project that process onto the simplex to achieve categorical diffusion.

The Cox-Ingersoll-Ross (CIR) Process

The authors identify the Cox-Ingersoll-Ross (CIR) process—a "square-root diffusion" commonly used in mathematical finance—as the ideal candidate. The CIR process is defined by an SDE that includes a mean-reversion term, ensuring the process stays within a positive range. Crucially, its stationary distribution is a Gamma distribution, making it the "missing link" for categorical diffusion.

By defining a multi-dimensional CIR process where each dimension corresponds to a category, the authors create a forward process that evolves toward a target distribution. When normalized, this process provides a principled way to "noise" categorical data while remaining on the simplex.

Training and Reverse Diffusion

The power of diffusion models lies in the ability to reverse the noise process. The authors derive several key mathematical components to make this operational:

  1. Time-Reversed SDE: The paper provides the derivation for the reverse-time SDE, allowing a neural network to learn to "denoise" a point on the simplex. This enables the model to move from a high-entropy (uniform) distribution back toward a "one-hot" vector representing a specific category.
  2. Maximum Likelihood Objective: A training objective is derived based on the KL-divergence of path measures, providing a theoretically sound way to train these models using score-matching-like techniques.
  3. Probability Flow ODE: Similar to continuous diffusion models, the authors derive an equivalent Ordinary Differential Equation (ODE) formulation. This allows for deterministic sampling and the use of "probability flow" techniques, which are often more efficient than SDE sampling.

Numerical Implementation and Stability

A significant contribution of this work is the focus on numerical stability. Simulating square-root diffusions can be challenging because numerical solvers may inadvertently push values below zero. The authors suggest:

  • Log-Domain Simulation: Formulating the ODE in the log-domain significantly improves stability.
  • Stabilization Parameters: Using a small $\epsilon$ parameter to prevent the process from hitting the boundaries of the simplex during discretization.

Discussion and Limitations

While Simplex Diffusion provides a rigorous foundation for categorical generative modeling, several challenges remain:

  • High-Dimensional Scaling: Scaling the process to large vocabularies (e.g., 50,000+ tokens) is difficult. In high dimensions, the distribution of ranks can become heavy-tailed, leading to numerical noise and potential outliers.
  • Non-Linearity: The relationship between the noisy probability vector and the original discrete token is non-linear, which may complicate the learning of the score function compared to standard Gaussian diffusion.

Conclusion

Simplex Diffusion offers a promising path forward for unifying discrete and continuous generative modeling. By grounding categorical diffusion in the well-understood mathematics of the CIR process, this framework allows researchers to apply the powerful tools of SDE-based generative AI to new, discrete domains. The next step in this research involves operationalizing these principles in large-scale deep learning architectures.

Summary updated

BibTeX
@inproceedings{richemond2023categorical,
  author = {Pierre H. Richemond and Sander Dieleman and Arnaud Doucet},
  title = {{Categorical SDEs with Simplex Diffusion}},
  booktitle = {SODS @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=6rETbXxGX5},
}
Figure