Inferensys

Glossary

DP-SGD

Differentially Private Stochastic Gradient Descent, the standard training algorithm that clips per-sample gradients and adds Gaussian noise to the aggregated gradient during each training step to achieve differential privacy guarantees.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
PRIVACY-PRESERVING TRAINING

What is DP-SGD?

DP-SGD is the foundational algorithm for training deep learning models with formal differential privacy guarantees, protecting individual data points from extraction or inference.

Differentially Private Stochastic Gradient Descent (DP-SGD) is a training algorithm that modifies standard SGD by clipping per-sample gradients to a fixed L2 norm bound and injecting calibrated Gaussian noise into the aggregated gradient at each step. This ensures the final model's parameters are statistically indistinguishable whether or not any single training example was included, providing a provable (ε, δ)-differential privacy guarantee.

The sensitivity of the gradient—the maximum influence a single data point can exert—is bounded by the clipping threshold C, while the privacy budget ε controls the noise multiplier σ. A privacy accountant tracks cumulative privacy loss across training iterations using advanced composition theorems, such as Rényi Differential Privacy (RDP) accounting, to halt training before the total ε exceeds a pre-defined limit.

MECHANICS OF PRIVACY

Key Features of DP-SGD

Differentially Private Stochastic Gradient Descent (DP-SGD) modifies the standard training loop to provide provable privacy guarantees. It achieves this through two core operations applied during every training step.

01

Per-Sample Gradient Clipping

Before aggregation, the gradient of the loss is computed independently for each data point in the mini-batch. Each per-sample gradient is then clipped to a maximum L2 norm bound (C). This bounding operation limits the maximum influence any single training example can exert on the model update, a critical prerequisite for bounding sensitivity.

C
Clipping Threshold
02

Calibrated Gaussian Noise Injection

After clipping and aggregating the per-sample gradients, isotropic Gaussian noise is added to the summed gradient. The noise is drawn from a distribution with a standard deviation proportional to the noise multiplier (σ) and the clipping norm. This noise masks the contribution of any single individual, transforming a deterministic optimization step into a randomized mechanism.

03

Privacy Amplification by Subsampling

DP-SGD relies on Poisson sampling or uniform shuffling to select mini-batches. The randomness of whether a specific record is included in a batch provides a significant privacy amplification effect. Because an adversary cannot be certain if a target record was even processed, the privacy loss (ε) is dramatically reduced compared to processing the full dataset deterministically.

05

Microbatch Processing

Computing per-sample gradients naively is memory-intensive. Modern implementations use vectorized operations and microbatching to efficiently compute individual gradients without instantiating a full tensor for every sample simultaneously. This engineering trick makes DP-SGD feasible for deep neural networks with millions of parameters.

06

The Privacy-Utility Trade-off

The noise multiplier (σ) and clipping norm (C) define a fundamental trade-off. A smaller C or larger σ yields a stronger privacy guarantee (lower ε) but degrades model accuracy. Tuning these hyperparameters is the central challenge of DP-SGD deployment, often requiring grid search to find a Pareto-optimal point for a target privacy budget.

DP-SGD DEEP DIVE

Frequently Asked Questions

Explore the core mechanics, privacy guarantees, and implementation trade-offs of Differentially Private Stochastic Gradient Descent, the foundational algorithm for training neural networks with provable privacy.

Differentially Private Stochastic Gradient Descent (DP-SGD) is a training algorithm that modifies standard SGD to provide a mathematical guarantee of differential privacy for the training data. It works by introducing two critical steps into each training iteration: per-sample gradient clipping and calibrated noise injection. First, the gradient of the loss is computed individually for each data point in a minibatch. Each per-sample gradient is then clipped to a maximum L2 norm C, bounding the influence of any single example. The clipped gradients are aggregated, and isotropic Gaussian noise drawn from a distribution scaled by a noise multiplier σ is added to the sum. Finally, the model weights are updated using this sanitized, privacy-preserving gradient. This process ensures the final model's parameters do not memorize or reveal information about any specific individual in the training set.

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.