Generative Artificial Intelligence: An Eagle-eye View of Diffusion Models

Aditya Kakde
3 min readJan 27, 2024


Generative Artificial Intelligence (AI) has witnessed remarkable strides, particularly with the advent of diffusion models. These models, excelling in image generation, have become integral to broader tools like text-to-image generators and large language models. This article serves as a comprehensive introduction to diffusion models, catering specifically to applied mathematicians and statisticians. We offer computational examples, delve into the underlying mathematical formulations, and establish connections with partial differential equation (PDE) diffusion models. Aimed at advanced undergraduate and postgraduate students, this material encourages independent study and serves as a valuable resource for educators in stochastic processes, inference, machine learning, PDEs, or scientific computing.

1. Motivation:

Generative AI models aim to create outputs resembling their training examples. In this exploration, we concentrate on denoising diffusion probabilistic models, known as diffusion models. These models, counterintuitively, enhance performance by introducing noise during training and learning to reverse the process. The article introduces the reader to this concept, offering illustrative computational examples and highlighting its significance in the current generative AI landscape.

2. Illustration:

A diffusion model endeavors to generate realistic-looking images by iteratively adding and removing noise. Trained on datasets like MNIST, these models showcase their prowess in creating synthetic examples resembling handwritten digits. The article presents visuals to elucidate the forward and backward processes involved in the training phase. Notably, it emphasizes the stochastic and unpredictable nature of the denoising process.

3. Forward Pass:

This section dives into the forward process of diffusion models, emphasizing the role of Gaussian random variables. The mathematical intricacies of transitioning between images and noise are explored, providing a foundation for understanding the subsequent backward process.

Forward Pass

4. Backward Pass:

The reverse process, essential for generating new outputs, is dissected in this section. Leveraging conditional probability theory, the article details the product rule to compute the probability of the previous state given the current state and initial condition. The use of neural networks in predicting noise for denoising is introduced, and the backward process is formulated accordingly.

5. Algorithms :

The training and sampling algorithms are delineated in this section. The training process employs a stochastic gradient method, updating network parameters based on a least-squares loss function. The sampling algorithm showcases the iterative denoising process, providing a systematic approach to generate synthetic examples.

Algorithm 1 : Training with the Forward Pass
Algorithm 2 : Sampling with the Backward Pass

In conclusion, this article unravels the complexity of diffusion models in generative AI, offering a balanced blend of theoretical foundations and practical applications. With an eye towards advancing the knowledge of aspiring mathematicians and statisticians, it bridges the gap between theory and implementation in the ever-evolving landscape of generative artificial intelligence.



Aditya Kakde

Food Lover | Tech Enthusiast | Data Science and Machine Learning Developer | Kaggler