Phase 4: Privacy-Preserving AI · 50 min · Python · numpy · scikit-learn
Differential Privacy — The Math of Privacy
Differential privacy is a promise: the output would be almost the same whether or not your data was in it.
Hiring signal: Differential privacy appears in 60%+ of RAI postings. Being able to explain epsilon (ε), the privacy budget, and the accuracy-privacy tradeoff with measured numbers is a distinguishing skill for RAI engineering candidates.
What you will learn
- Explain the formal definition of differential privacy (ε-DP)
- Explain the Laplace mechanism and how noise is calibrated to epsilon
- Demonstrate the privacy-utility tradeoff with different epsilon values
- Articulate the privacy budget concept and composition rules
The Problem
In Lesson 1, you saw that models leak training data through membership inference. The fix is to make the model's output insensitive to any single individual's data — so that an attacker can't tell whether a specific person was in the training set. This is what differential privacy (DP) provides, with a mathematical guarantee.
The Formal Definition
A randomized algorithm $M$ is $\varepsilon$-differentially private if, for all datasets $D_1$ and $D_2$ that differ in at most one element (one person's data), and for all possible outputs $S$:
$$P(M(D_1) \in S) \leq e^{\varepsilon} \times P(M(D_2) \in S)$$
In plain English: the probability of any output is at most $e^{\varepsilon}$ times higher with your data than without it. When $\varepsilon$ is small (close to 0), $e^{\varepsilon} \approx 1 + \varepsilon$, meaning the output barely changes whether or not your data is included.
| Epsilon (ε) | Privacy Level | Typical Accuracy Impact | Use Case |
|---|
| 0.1 | Very strong | Significant (5-10% drop) | Medical research with strict privacy |
| 0.5 | Strong | Moderate (3-5% drop) | Census data, government statistics |
| 1.0 | Moderate | Small (1-3% drop) | Commercial ML with privacy requirements |
| 3.0 | Weak | Minimal (<1% drop) | Less sensitive applications |
| 10+ | Very weak | Negligible | Privacy in name only |
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers The Laplace Mechanism, The Privacy Budget, Building the DP Demo, What's Next — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy