Privacy-Enhancing Technologies
Differential privacy, federated learning, synthetic data, and the limits of each.
Differential privacy
An algorithm \(M\) satisfies \((\varepsilon, \delta)\)-differential privacy if, for every pair of neighbouring datasets \(D\) and \(D’\) and every set of outputs \(S\):
$$P[M(D) \in S] \le e^{\varepsilon}\, P[M(D’) \in S] + \delta$$
The Laplace mechanism for a simple count
import numpy as np
def dp_count(values, predicate, epsilon, rng=np.random.default_rng()):
true = sum(1 for v in values if predicate(v))
return true + rng.laplace(scale=1.0 / epsilon) # the sensitivity of a count = 1DP-SGD with Opacus
# pip install opacus
from opacus import PrivacyEngine
engine = PrivacyEngine()
model, optimizer, train_loader = engine.make_private(
module=model, optimizer=optimizer, data_loader=train_loader,
noise_multiplier=1.1, max_grad_norm=1.0)
# ... the usual training loop ...
print(engine.get_epsilon(delta=1e-5))Comparison
| Technique | Protects against | Does not protect against |
|---|---|---|
| Differential privacy | Inferring an individual's presence in the data | Group patterns, and its cost to accuracy |
| Federated learning | Transferring raw data | Information leaking through the updates |
| Secure aggregation | Seeing each participant's update individually | What the final model reveals |
| Synthetic data | Sharing the original records directly | Memorization and reproduction without guarantees |
| Homomorphic encryption and secure computation | Exposing data during computation | High computational cost |
The value of ε alone is not enough to judge; also state δ, the privacy unit (record or person), and the accounting method.
Lesson terms
- Differentially private training
- A version of stochastic gradient descent that clips each example's gradient and adds Gaussian noise to achieve differential privacy.
- Differential privacy
- A mathematical guarantee that the distribution of an algorithm's outputs changes only by a limited amount (controlled by the parameter ε) when one person's record is added or removed.
- Privacy budget
- The value of ε that sets the maximum information leakage, which accumulates with every query or training epoch.
Abstract
Differential privacy gives a mathematical guarantee that an algorithm's outputs do not change much when one person is added or removed, and it is controlled by the budget ε. It can be applied to training with DP-SGD, which clips the gradients and adds noise, at a cost in accuracy. Federated learning keeps the data where it is and exchanges model updates, but it does not guarantee privacy on its own. Synthetic data is useful for development, but it may memorize real records if it is not generated with guarantees.
Review questions
-
What does a smaller ε mean in differential privacy?
Stronger protection and more noise, and usually lower accuracy.
-
Why is federated learning alone not enough to guarantee privacy?
Because model updates may leak information about the local data, so it is combined with differential privacy and secure aggregation.
Sources and references
Complete the lesson
You have completed all the lessons in the track! You can now request the track completion certificate.
Request the certificate