Course contentsShow
← Security
Lesson 2841 of 3,05253. AI and ML SecurityFree lesson

DP-SGD and Private Training Algorithms

Differentially private stochastic gradient descent and techniques for training models with formal privacy guarantees.

DP-SGD and Private Training Algorithms

What you'll learn: How to train machine learning models with formal privacy guarantees using differentially private stochastic gradient descent.

The Core Problem

When you train a neural network, the model "remembers" patterns from training data—including potentially sensitive individual records. Standard gradient descent can leak private information about specific training examples through the model's weights. Differential privacy (DP) provides a mathematical framework to prevent this, and DP-SGD is the algorithm that makes it practical.

How DP-SGD Works

Think of DP-SGD as "noisy learning." During each training step:

  1. Clip gradients per example: Instead of computing one big gradient from the entire batch, calculate each training example's gradient separately and limit its magnitude (clip it). This bounds how much any single person's data can influence the model.

  2. Add calibrated noise: After averaging the clipped gradients, add carefully calibrated random noise (typically Gaussian) before updating weights. The noise obscures individual contributions.

  3. Track privacy budget: Every training step "spends" some privacy budget (measured by epsilon ε). Once exhausted, training must stop to maintain guarantees.

The Privacy-Utility Tradeoff

More noise means stronger privacy but potentially lower accuracy. The clipping threshold and noise scale must be tuned carefully. Modern private training algorithms improve on basic DP-SGD through better gradient estimation, adaptive clipping, and public data augmentation.

Unlike security-by-obscurity, DP-SGD provides provable guarantees: even if an attacker knows the entire training dataset except one record, they cannot reliably determine whether that record was included.

Key Takeaway: DP-SGD enables training machine learning models with mathematical privacy guarantees by clipping per-example gradients and adding calibrated noise during optimization, trading some accuracy for formal protection against privacy attacks.