Lably
Skip to content

Differentially private stochastic gradient descent

Machine learning technique for privacy-preserving training

  • 7 min read
  • 5 chapters

Related on Lably

Through De facto and de jure, Health care and Computer security

DP-SGD has become a de facto standard for privacy-preserving learning from large datasets. It is used in domains with sensitive data, including healthcare and cybersecurity. DP-SGD has been shown to demonstrate that deep neural networks with non-convex objectives can be trained under a modest privacy budget, at a manageable cost in software complexity and model quality. A non-convex objective is one that may have multiple local minima, making optimization more challenging than with convex objectives. Existing approaches require large privacy budgets to train and incur high overheads in computational resources. A privacy budget refers to the total amount of privacy loss allowed over the entire training process.

DP-SGD follows the same steps as standard stochastic gradient descent (SGD). However, it also clips the gradients' norm to a threshold and then add Gaussian noise. Gaussian noise is a type of random noise drawn from a normal distribution. Differential privacy is formally defined using the parameters (ε, δ), which bound the privacy loss of any algorithm. DP-SGD tracks privacy loss by a method called the moments accountant. Current implementations use a method called Rényi differential privacy, which provides an even tighter privacy accounting than the original moments accountant. The moments accountant tracks the privacy loss as a random variable at each step. Another privacy-preserving training method is Private Aggregation of Teacher Ensembles (PATE), which uses an ensemble of teacher models to label public data. A teacher model is a model trained on private data that is used to label or provide guidance to another model (the student model).

Description

Standard SGD computes gradients over mini-batches. A gradient is a mathematical measure of how much the model's error changes, while a mini-batch is a small random subset of the training data. These gradients can then reveal information about individual training examples. DP-SGD can modify this process to provide privacy guarantees. This procedure is formalized as Algorithm 1 in the study by Abadi et al., which provides pseudocode for the training loop (including gradient computation, clipping, and noise addition steps).

It first computes gradients for each training example in the batch. Then, it clips the L2 norm of each gradient to a threshold C. The L2 norm is the straight-line distance from the origin to the point represented by the vector (a mathematical object that has both magnitude and direction). Finally, it adds Gaussian noise to the clipped gradients, before averaging them out.

The pseudocode for Algorithm 1 is presented below:

DP-SGD uses a subsampling method where each mini-batch is formed by sampling each example independently with probability q. This provides privacy amplification by subsampling. Subsampling means selecting a random subset of the data for each training step rather than using the full dataset. The privacy parameters include the clipping norm (C) and the noise scale (σ). The clipping norm is the maximum allowed length of a gradient. Any gradient longer than C is scaled down to length C. The noise scale on the other hand controls how much random noise is added to the gradients. These parameters can determine the privacy-utility trade-off. The noise scale σ is calibrated such that the noise variance is proportional to C²σ². Unlike standard SGD, DP-SGD's privacy loss accumulates over multiple training steps, and the moments accountant can track this cumulative loss to determine the overall privacy guarantee, usually denoted as ε (epsilon), δ (delta). An ε controls how information about any single example can be leaked. Likewise, a δ is a small probability that the privacy guarantee fails. Hence, it provides tighter estimates on the overall privacy loss. Privacy loss is a measure of how much information an individual training example can be inferred from the algorithm's output.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication