Generative AI
23CSPE413
Textbooks:
1. Generative Deep Learning Teaching Machines to Paint, Write, Compose, and Play – David Foster 2nd Edition.
2. Rajan Gupta, Sanju Tiwari, Poonam Chaudhary by Generative AI: Techniques, Models and Applications (Springer, 2025)
Reference Books:
What is Generative Modeling?
Train a generative model on a dataset to learn the underlying patterns and relationships within the data. Once trained, the model can be sampled to generate new, realistic examples that were not present in the original dataset.
Example:
Suppose we train a model using horse images.
The model learns the structure, shape, and texture of horses. After training, it can generate completely new horse images that were not part of the dataset.
Figure 1-1. A generative model trained to generate realistic photos of horses
Probabilistic Nature of Generative Models
Generative Versus Discriminative Modeling
Discriminative modeling estimates p(y|x)
Discriminative models are like judges. They look at something and decide what it is.
Example:
Imagine you have images of animals.
The model learns:� “If I see this image, how likely is it a cat?”
Generative modeling estimates p(x)
Generative models are like artists. They don’t just recognize things—they create new ones.
Using the same animal dataset:
Generative Versus Discriminative Modeling
Figure 1-2. A discriminative model trained to predict if a given image is painted by Van Gogh
Figure 1-1. A generative model trained to generate realistic photos of horses
Aspect | Discriminative Models | Generative Models |
Goal | Predict labels | Generate new data |
What it learns | Decision boundary between classes | Underlying data distribution |
Probability modeled | P(y | x) | P(x) |
Input requirement | Requires labeled data | Can work with unlabeled data |
Output | Class label or probability | New data samples |
Focus | Distinguishing between classes | Understanding how data is formed |
Ability to generate data | Cannot generate new data | Can generate new data |
Learning approach | Learns boundaries directly | Learns full data structure |
Use cases | Classification, regression | Image generation, text generation, data synthesis |
Examples of models | Logistic Regression, SVM, Neural Classifiers | GANs, VAEs, Diffusion Models |
The Rise of Generative Modeling
Figure 1-3. Face generation using generative modeling has improved significantly over the last decade
Traditional RL:
Our First Generative Model
Task�“Generate one more point that looks like it belongs to this dataset.”
Instead of learning a complicated mathematical function, the model simply says:
“Any point inside this rectangle could be generated.”
Inside the orange box: points are allowed.
Outside the orange box: probability is zero.
(2.1,1.4) or (−0.8,0.5)
These new points were not in the training dataset, but they look as though they could have been.
The Generative Modeling Framework
Representation Learning
Example:
Real-world example:
Intuition Behind Representation Learning
Enough for someone to recognize them.
Real-world example:
Figure 1-7. The biscuit tin dataset
Think of it as a 2-dimensional map:
Every location (point) in this space represents a possible biscuit tin.
The model has learned that different locations correspond to different characteristics of the tin.
The cylinders represent biscuit tins generated by the model.
Notice that the tins have different:
For example:
So, moving around in the latent space changes the characteristics of the generated tin.
Solid vs dashed cylinders
Figure 1-8. The 2D latent space of biscuit tins and the function f that maps a point inthe latent space back to the original image domain
The blue dot is a particular point selected in the latent space.
We can represent it as:
z=(z1,z2)
For example:
z=(0.35,−0.72)
The exact values aren't important here.
It simply means:
"Choose this particular location in the latent space."
where:
z = point in latent space
f = generative/decoder function
x = generated object in the original data space
So the function
f(z)=x
takes a latent representation and converts it into an actual object.
Latent Space
●
│
│ z
▼
f
│
▼
Biscuit Tin
Instead of directly specifying:
"Generate a biscuit tin that is 5 cm tall and 10 cm wide."
we select a point in the latent space.
The learned function f knows how to convert that point into an appropriate object
Connection to an Autoencoder
Figure 1-9. The dog manifold in high-dimensional pixel space is mapped to a simpler
latent space that can be sampled from
Why Latent Space is Powerful ?
1. Raw Data (High-Dimensional)
2. Representation Learning (Key Idea)
�Pixels → Meaningful Features → Latent Vector
3. Latent Space
Generative Capability
Core Probability Theory
Five key terms
4. Likelihood
5. Maximum Likelihood Estimation (MLE)
Find the model that best explains the data we have seen
Imagine:
The best rectangle (MLE) is:
Connecting to Neural Networks
In AI models:
This is called Maximum Likelihood Estimation (MLE)
Loss Function
This is called: Negative Log-Likelihood (NLL)
Model Prediction | Probability (p(x)) | Log Value | Loss |
Good prediction | High (0.9) | log(0.9) ≈ -0.1 | Small loss |
Bad prediction | Low (0.01) | log(0.01) ≈ -4.6 | Large loss |
Generative Model Taxonomy
Goal of Generative Models
Generative Model Taxonomy
Three Main Approaches
A. Tractable Density Models (Explicit + Exact)
Key Ideas:
Examples:
B. Approximate Density Models (Explicit + Approximate)
Examples:
C. Implicit Density Models
density estimation
Characteristics of Generative Models
Generative models are machine learning models that learn the underlying patterns in data so they can create new, similar data. Their main characteristics include:
Advantages of Generative Models
Disadvantages of Generative Models
Challenges in Generative Models
Applications of Generative Models