Classical ML

Generative vs Discriminative Models

Contrasting joint probability distribution learning against direct decision boundary estimation.

🟡 intermediate4 min readtheory
Generative and Discriminative models represent the two foundational approaches to probabilistic machine learning. Discriminative Models estimate conditional probability P(Y | X) directly, learning decision boundaries to classify inputs into classes (Logistic Regression, SVM, BERT). Generative Models estimate joint probability P(X, Y) = P(X | Y) P(Y), modeling how data features X are generated for each class Y (Naive Bayes, VAEs, GANs, GPT).

The Fundamental Probabilistic Split

Every probabilistic machine learning model operates on inputs $X$ and labels $Y$.

The key distinction is how the model models the probability distributions:

┌──────────────────────────┬──────────────────────────┐
│ 1. DISCRIMINATIVE MODELS │ 2. GENERATIVE MODELS     │
├──────────────────────────┼──────────────────────────┤
│ Estimates P(Y | X).      │ Estimates P(X, Y) =      │
│ Learns DECISION BOUNDARY │ P(X | Y) * P(Y).         │
│ separating classes.      │ Learns HOW DATA IS MADE  │
│ Cannot generate data!    │ for each class.          │
│ Logistic Regression, SVM │ Naive Bayes, VAEs, GANs  │
└──────────────────────────┴──────────────────────────┘

1. Discriminative Models: "Where is the boundary?"

Discriminative models model the conditional probability $P(Y \mid X)$ directly.

They do not care how features $X$ were generated or what individual classes look like in isolation. They care only about drawing a boundary that separates Class 0 from Class 1.

  Discriminative Perception:
  "I don't know what makes a cat a cat. All I know is that if a picture has triangular ears and whiskers, it is 99% likely to be a cat rather than a dog!"

2. Generative Models: "How was this data generated?"

Generative models model the joint probability distribution $P(X, Y)$.

Using Bayes' Rule, they model the likelihood of observing features $X$ given class $Y$ ($P(X \mid Y)$) alongside class prior $P(Y)$:

$$P(Y \mid X) = \frac{P(X \mid Y) P(Y)}{P(X)}$$

  Generative Perception:
  "I have learned a detailed statistical template for what a Cat looks like P(X | Cat) and what a Dog looks like P(X | Dog). To classify a new image, I compare which template matches better!"

Classical Pairing: Naive Bayes vs Logistic Regression

FeatureNaive Bayes (Generative)Logistic Regression (Discriminative)
Probability FormModels $P(X \mid Y) P(Y)$Models $P(Y \mid X)$ directly
Feature IndependenceAssumes features $X_i$ are independentNo feature independence assumption
Small Data BehaviorConverges faster with small datasetsRequires more data to reach asymptotic performance
Asymptotic AccuracyLower asymptotic accuracy limitHigher asymptotic accuracy limit

Say this out loud

Discriminative models estimate conditional probability P(Y | X) directly, learning decision boundaries to separate classes. Generative models estimate joint probability P(X,Y) = P(X | Y) P(Y), modeling how data features are generated for each class. Discriminative models excel at classification, while Generative models can synthesize brand new data points.

Followups to expect

  1. Is GPT a Generative or Discriminative model? GPT is a Generative model. It models the joint distribution of sequence tokens $P(X_1, X_2, \dots, X_N)$, allowing it to sample new synthetic text tokens step by step.
  2. Why does Logistic Regression outperform Naive Bayes on large datasets? Ng & Jordan (2001) proved that Naive Bayes reaches its asymptotic error threshold faster with less data, but Logistic Regression achieves a lower final error rate as dataset size approaches infinity.

Check yourself

Question 1 of 3

What probability distribution do Discriminative Models estimate directly when classifying input features X into target labels Y?

More in Classical ML

See all →
Bias–Variance Tradeoff4 minOverfitting vs Underfitting3 minLinear Regression4 min