What is DP-SGD (Differentially Private Stochastic Gradient Descent)?

DP-SGD is a form of stochastic gradient descent that clips each training example's gradient to a bound and adds calibrated noise to the summed gradient, giving a differential privacy guarantee: the model is only boundedly affected by whether any one person's record is in the training data.

Privacy-preserving machine learning spans many methods such as federated learning, encrypted computation and differential privacy; DP-SGD is the training method limiting how far the model itself leaks training data. Gradient clipping is its first step.

Topic
AI security
Also known as
Differentially private SGD
Origin
Abadi et al., 2016

How DP-SGD (Differentially Private Stochastic Gradient Descent) works

  1. At each step a random batch is drawn and each example's gradient computed separately.
  2. Each gradient is clipped so its norm stays within a bound, limiting any one example's influence.
  3. Calibrated Gaussian noise is added to the sum of clipped gradients and the model updates with it.
  4. The privacy budget spent, in epsilon and delta, is tracked; training stops when it runs out.

In more detail

What epsilon and delta mean and the privacy accountant

In the formal (ε, δ)-differential privacy guarantee, ε (epsilon) bounds the maximum log-odds shift caused by adding or removing a record, smaller ε means stronger privacy, while δ (delta) allows a tiny failure probability that must remain well below 1/N (where N is the dataset size). A privacy accountant (such as Rényi DP or PRV accountant) tightly tracks cumulative privacy loss across training iterations.

Example-level versus user-level DP and Poisson subsampling

Standard DP-SGD protects individual training examples, which does not automatically protect an entire person if that person contributes dozens of emails or clinical notes. Organisations handling multi-record user data must apply user-level DP (grouping and clipping all records per user) and ensure Poisson subsampling rather than naive shuffling so formal accounting bounds hold.

Cost at scale: DP-LoRA and ghost clipping

Computing and clipping per-sample gradients prevents frameworks from averaging gradients inside a single backward pass, creating severe VRAM and throughput bottlenecks on large language models. Combining DP-SGD with parameter-efficient fine-tuning (DP-LoRA) and Ghost Clipping cuts trainable parameters and memory overhead dramatically, making private LLM fine-tuning practical on enterprise GPUs.

Layer compatibility: the BatchNorm problem, LayerNorm and RMSNorm

DP-SGD requires replacing or freezing layers that mix statistics across samples, most notably Batch Normalisation, because inter-sample statistics leak information across the batch and invalidate privacy guarantees. Transformers naturally rely on LayerNorm or RMSNorm, which operate independently per sample and remain DP-compatible.

Commonly confused terms

TermHow it differs
Federated learningFederated learning keeps raw data distributed on local devices and shares only model updates, whereas DP-SGD adds calibrated noise during gradient updates so the trained model itself mathematically limits leakage about individual records; the two are often combined.
Gradient clippingStandard gradient clipping caps the aggregate batch gradient norm purely to stabilise training against exploding gradients, whereas DP-SGD clips each individual example's gradient separately before summing so that sensitivity is strictly bounded.
PII scrubbing and anonymisationPII scrubbing removes explicit identifiers such as names or ID numbers before training via rules or NER, whereas DP-SGD provides a formal, quantifiable privacy bound against memorising arbitrary sensitive phrases or rare contexts without relying solely on pattern detection.

Why DP-SGD (Differentially Private Stochastic Gradient Descent) matters for on-premises AI

Language models can memorise and later reveal names, numbers and rare records, which matters when training on health, finance or government data. DP-SGD puts a measurable upper bound on such leakage. The cost is accuracy and compute: stronger privacy needs more noise and model quality can fall. The privacy budget is therefore chosen by data sensitivity and quality measured on the organisation's evaluation set.

ON-PREMISES EXAMPLE

Fine-tuning a clinical note summariser on its own records, a hospital uses DP-SGD; it sets the privacy budget with its data protection team, tests separately whether the model reproduces patient names and measures quality loss on its own questions.

Common questions

What does DP-SGD provide?

A mathematical guarantee that the model is only boundedly affected by any one person's record, limiting leakage through memorisation.

Does DP-SGD lower model quality?

It can. Stronger privacy needs more noise. The balance between privacy budget and quality is tuned on the organisation's data.

Sources

In the glossary: Glossary, A to D

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.