- Licence
- CC0 1.0 (public domain)Adapted from www.nist.gov
- Languages
- English
- Topics
- Science
A model that performs well on test examples can still give away the people it was trained on. The common belief that good generalization preserves privacy is, in the authors’ words, far from true: generalization is an average-case property over the data, while privacy has to hold for everyone, including outliers who differ from the typical data.
This is the last guest post in a series on differential privacy on the NIST Cybersecurity Insights blog. The series’ regular authors, Joseph Near and David Darais, introduce the authors, Nicolas Papernot and Abhradeep Thakurta, research scientists at Google Brain who study how differential privacy applies to machine learning. Earlier posts dealt with traditional data analysis such as aggregate queries over database tables; this one asks whether the same protection is possible for machine learning.
Why private learning algorithms are needed
Machine learning is increasingly used for sensitive tasks such as medical diagnosis. A model learns by studying a lot of data and updating its parameters to encode the relationships in it. Ideally those parameters capture general patterns, such as smokers being more likely to have heart disease, and not facts about particular training examples. But algorithms do not learn to ignore the specifics by default, so publishing a model, for instance one that diagnoses cancer, can accidentally reveal information about its training set.
Earlier ideas for protecting privacy include k-anonymity, l-diversity, m-invariance and t-closeness. All of them are vulnerable to composition attacks, which use auxiliary information to break the protection. A well-known example is the de-anonymization of part of a movie-ratings dataset released for the Netflix Prize, which researchers achieved because some people had also shared their ratings publicly on IMDb.
Differentially private learning algorithms can quantify and bound how much private information leaks from the training data. That lets developers prevent memorization and train responsibly on sensitive data.
Privacy can help learning
Earlier posts in the series showed that the noise needed for differential privacy can reduce accuracy. Recent research shows the counterintuitive reverse for generalization: differential privacy can improve it. Researchers formally showed that, for any differentially private learning algorithm, generalization comes for free: if the algorithm has good training accuracy, it is guaranteed good test accuracy. The reason is that differential privacy is itself a very strong form of regularization.
Two ways to train a private neural network
| Approach | Idea |
|---|---|
| DP-SGD (differentially private stochastic gradient descent) | Adds noise to each gradient computed during training |
| Model agnostic private learning | Trains many non-private models on subsets of the sensitive data, then combines their answers with a differentially private mechanism |
DP-SGD
DP-SGD changes the model updates of stochastic gradient descent (SGD), the most common optimizer in deep learning. SGD works iteratively. At each step it samples a small group of training examples, a minibatch, computes the average model error on them, differentiates it with respect to each model parameter to get a gradient, and updates the parameters by subtracting the gradient multiplied by a small constant, the learning rate.
DP-SGD makes two changes. The gradients are computed per example rather than averaged, and each is first clipped to control its sensitivity. Then Gaussian noise is added to their sum to give the indistinguishability that differential privacy needs.
The privacy analysis assumes minibatches are sampled uniformly at random from the training data. This is not a requirement of DP-SGD as such, but many SGD implementations instead go through different permutations of the data in each epoch, so they do not satisfy it. For a fixed privacy guarantee, the noise added at each step is proportional to the number of training steps, so that number has to be tuned for the best balance of privacy and usefulness.
Model agnostic private learning
Noise added to gradients can hurt accuracy, and model agnostic private learning sometimes does better at the same privacy level. It builds on the Sample and Aggregate framework, a general way to make a non-private algorithm differentially private without knowing how it works inside. For a classification problem:
- Split the training data into k disjoint subsets of equal size.
- Train an independent model on each subset.
- To predict for a new example, build a private histogram of the k models’ predictions.
- Output the bin with the highest count, after adding a small amount of Laplace or Gaussian noise to the counts.
Two lines of work use this idea. One, called model agnostic private learning, aims at theoretical trade-offs between privacy and usefulness. The other, PATE (private aggregation of teacher ensembles), is aimed at practical deployment. Both rest on the observation that if the models’ predictions are fairly consistent, the privacy cost is very small, so many prediction queries can be run without breaking the privacy limits.
In PATE, an ensemble of models trained without privacy predicts with differential privacy because the models answer in aggregate and never reveal their individual predictions. A private dataset is partitioned into non-overlapping subsets, one per model, and the predicted label is the one with the largest noisy vote count. The noise keeps the result from reflecting any single teacher’s vote and does not change the output when the ensemble agrees strongly.
Putting it into practice
Both approaches are conceptually simple, and open-source implementations exist. DP-SGD is available in TensorFlow Privacy, Objax and Opacus, so an existing TensorFlow, JAX or PyTorch pipeline can swap its non-private optimizer for DP-SGD. TensorFlow Privacy also has an example implementation of PATE. The authors name three obstacles.
Accuracy. Data often come from distributions with heavy tails. In a medical application, for example, patients with a given condition are fewer than patients without it, so there are few training examples to learn from. Differential privacy prevents learning patterns not found generally in the data, which limits what can be learned about those patients. More generally, there is often a trade-off: the smaller the privacy budget, the larger the typical effect on accuracy. The tension is not inevitable, though, because differential privacy implies generalization (though not the other way round), so in some cases privacy and accuracy work together.
Computational overhead. DP-SGD needs per-example gradients, which makes it harder to use the optimizations that machine learning frameworks apply for hardware accelerators such as GPUs. PATE must train several teacher models instead of one. The cost is mostly reduced in recent implementations, in particular Objax and Opacus.
The privacy budget. The smaller the budget, the stronger the guarantee, so two analyses can be compared for which is more private. But it is unclear what counts as small enough. Applications to machine learning often need a budget that gives little theoretical guarantee to reach useful accuracy. The authors suggest practitioners also test their algorithm by attacking it themselves. A theoretical analysis gives a worst-case limit on what any adversary could learn, while a specific attack shows how well a particular adversary would do. That helps interpret the guarantee but never replaces it. Open-source attack implementations, such as one for membership inference, are increasingly available.
What is left open
The field is growing quickly, and the post leaves out many topics. Three it names:
- Hyperparameters. The choice of hyperparameters in training must itself preserve differential privacy, and recent research offers algorithms for that.
- Architecture. The best architecture for ordinary training is not necessarily the best for private training, and the number of parameters can hurt the trade-off between privacy and usefulness, so choosing well matters.
- Federated settings. In federated learning the data records are spread across many places, such as mobile devices. Running DP-SGD or PATE-style algorithms there raises further challenges, which cryptographic tools and algorithms designed for the federated setting help address.
The authors thank Peter Kairouz, Brendan McMahan, Ravi Kumar, Thomas Steinke, Andreas Terzis and Sergei Vassilvitskii for feedback. Parts of the post first appeared on cleverhans.io. A final post in the series was to summarize the topics and say how the project would live on after the blog.
Sources
- National Institute of Standards and Technology, How to deploy machine learning with differential privacy, NIST Cybersecurity Insights blog, differential privacy series. Guest post by Nicolas Papernot and Abhradeep Thakurta (Google Brain), introduced by the series’ regular authors Joseph Near and David Darais; its figure and formula, made by the guest authors, are left out. Rewritten in hubnx's own words.
Comments





