Inferensys

Glossary

DP-SGD

Differentially Private Stochastic Gradient Descent (DP-SGD) is a training algorithm that provides formal differential privacy guarantees by clipping per-sample gradients and adding calibrated Gaussian noise to the aggregated gradient during each optimization step.
Finance analyst reviewing cash flow AI optimization on laptop, charts and projections visible, home office work session.
PRIVACY-PRESERVING TRAINING ALGORITHM

What is DP-SGD?

Differentially Private Stochastic Gradient Descent (DP-SGD) is the canonical algorithm for training deep neural networks with formal differential privacy guarantees, protecting individual training records from extraction and inference attacks.

Differentially Private Stochastic Gradient Descent (DP-SGD) is a training algorithm that bounds the influence of individual examples by clipping per-sample gradients to a fixed L2 norm and adding calibrated Gaussian noise to the aggregated gradient before each weight update. This mechanism ensures the model's parameters are statistically indistinguishable from those trained without any single record.

The algorithm introduces a privacy accountant that tracks cumulative privacy loss across training iterations, computing the total epsilon budget consumed. By tuning the clipping threshold and noise multiplier, engineers trade off between model utility and the formal privacy guarantee, directly mitigating membership inference and model inversion risks.

MECHANISMS

Key Features of DP-SGD

Differentially Private Stochastic Gradient Descent (DP-SGD) modifies the standard training loop with two critical operations to provide provable privacy guarantees, ensuring that the final model parameters do not memorize sensitive details about individual training examples.

01

Per-Sample Gradient Clipping

The foundational sensitivity-bounding step. Instead of computing a single average gradient for a batch, DP-SGD computes the gradient for each individual example independently. Each per-sample gradient vector is then clipped to a maximum L2 norm (a clipping threshold C). This ensures that no single data point can contribute a gradient with a magnitude greater than C, strictly limiting the maximum possible influence of any individual record on the model update.

02

Gaussian Noise Injection

After clipping and aggregating the per-sample gradients into a single batch gradient, calibrated random noise is added. This noise is sampled from a Gaussian distribution with a standard deviation proportional to the clipping threshold C and inversely proportional to the target privacy budget epsilon. This step masks the precise contribution of any single example, converting a deterministic update into a randomized mechanism that satisfies the mathematical definition of differential privacy.

03

The Moments Accountant

A sophisticated privacy accounting technique used to track the total privacy loss (epsilon) over many iterative training steps. Unlike basic composition theorems, the Moments Accountant computes a tight bound on the privacy loss random variable by tracking the log moments of the privacy loss distribution. This provides a much more accurate estimate of the total privacy budget consumed, allowing for significantly more training iterations under the same final epsilon guarantee compared to naive strong composition.

04

Privacy Budget (Epsilon, ε)

A quantifiable, tunable parameter that defines the strength of the privacy guarantee. A lower epsilon (e.g., ε = 0.1) provides a stronger guarantee but adds more noise, reducing model utility. A higher epsilon (e.g., ε = 8.0) adds less noise but provides a weaker guarantee. The budget is consumed with each training step, and training must stop once the pre-defined total epsilon is exhausted. This provides a formal, mathematical dial to trade off between privacy and accuracy.

05

Subsampling Amplification

A privacy amplification technique where each training step operates on a random subset (a mini-batch) of the full dataset, sampled with a fixed probability q. The randomness of whether a specific data point is included in a batch adds an additional layer of uncertainty for an adversary. This privacy amplification by subsampling effectively reduces the privacy cost of each step, allowing for a much lower total epsilon for the same number of iterations compared to processing the full dataset.

06

Distinction from Standard SGD

Standard SGD computes the average gradient for a batch directly, which can leak information about the batch's constituents. DP-SGD fundamentally alters this process:

  • Gradient computation: Standard SGD computes a single batch gradient; DP-SGD computes and clips per-sample gradients.
  • Update rule: Standard SGD updates weights with the raw average gradient; DP-SGD updates weights with a clipped, aggregated, and noised gradient.
  • Computational cost: DP-SGD is significantly more computationally expensive due to the requirement to backpropagate individually for each sample in a batch.
DP-SGD EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about Differentially Private Stochastic Gradient Descent, the foundational algorithm for training deep learning models with formal privacy guarantees.

Differentially Private Stochastic Gradient Descent (DP-SGD) is a training algorithm that modifies standard SGD to provide provable differential privacy guarantees for individual training examples. It works through two core mechanisms: per-sample gradient clipping and Gaussian noise injection. First, the gradient of the loss is computed independently for each example in a mini-batch. Each per-sample gradient is then clipped to a maximum L2 norm C, bounding the influence any single record can have on the model update. The clipped gradients are aggregated, and calibrated Gaussian noise is added to the sum. Finally, the noisy aggregated gradient is used to update the model weights. This process ensures the output distribution of the model is statistically indistinguishable whether or not a specific individual's data was included in the training set, quantified by the privacy parameter epsilon.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.