Inferensys

Glossary

Sensitivity

The maximum change in a query's output caused by adding or removing a single record from a dataset, which directly determines the amount of noise required to achieve differential privacy.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
QUERY STABILITY METRIC

What is Sensitivity?

Sensitivity quantifies the maximum possible change in a query's output when a single record is added to or removed from a dataset, serving as the calibration parameter for noise injection in differential privacy.

In differential privacy, sensitivity measures a query function's inherent stability by calculating the maximum difference in its output between any two neighboring datasets—datasets that differ by exactly one record. This metric directly determines the magnitude of noise required to obscure the presence or absence of any individual. A query with high sensitivity, such as a raw count, requires more noise to achieve the same privacy guarantee as a low-sensitivity query like a bounded average.

There are two primary variants: L1 sensitivity, used by the Laplace mechanism, computes the maximum absolute difference summed across all output dimensions; L2 sensitivity, used by the Gaussian mechanism, computes the maximum Euclidean distance. Sensitivity is a property of the query function itself, not the data, and must be rigorously bounded—often through techniques like gradient clipping in DP-SGD—to ensure the privacy budget is not exceeded.

FOUNDATIONS

Key Properties of Sensitivity

Sensitivity is the mathematical bridge between a dataset and the noise required to protect it. Understanding its properties is essential for calibrating differential privacy mechanisms.

01

Global Sensitivity (GS)

The maximum possible difference in a query's output over all possible neighboring datasets, regardless of the specific data distribution.

  • Definition: GS(f) = max ||f(D) - f(D')|| over all adjacent D, D'
  • Worst-case bound: Provides a guarantee that holds for any possible dataset
  • Noise calibration: The Laplace mechanism scales noise directly to GS/ε
  • Example: For a counting query, GS = 1; for a sum query with values bounded in [0, B], GS = B
02

Local Sensitivity (LS)

The maximum change in query output for a specific, fixed dataset D, considering only its immediate neighbors.

  • Definition: LS(f, D) = max ||f(D) - f(D')|| for D' adjacent to D
  • Data-dependent: Can be much smaller than global sensitivity for well-behaved datasets
  • Direct use is unsafe: Releasing LS itself can leak information about the data
  • Smooth sensitivity is a refined variant that adds a safety margin to LS to prevent leakage
03

L1 vs L2 Sensitivity

The choice of norm used to measure sensitivity directly determines which noise distribution is appropriate.

  • L1 Sensitivity: Sum of absolute differences across all output dimensions. Used with the Laplace mechanism for pure ε-DP
  • L2 Sensitivity: Euclidean (root sum-of-squares) distance. Used with the Gaussian mechanism for (ε, δ)-DP
  • Practical impact: L2 sensitivity is often smaller in high-dimensional outputs, requiring less noise
  • Example: For a histogram query, L1 sensitivity = 2 (one entry removed, one added); L2 sensitivity = √2
04

Sensitivity of Common Queries

Understanding the sensitivity of standard database operations is critical for practical implementation.

  • Count queries: GS = 1 — adding or removing one record changes a count by at most 1
  • Sum queries: GS = B, where B is the upper bound on individual contributions
  • Average queries: GS = B/n, but requires knowing n in advance; often decomposed into noisy sum / noisy count
  • Histogram queries: GS = 1 for disjoint bins (L1); each record affects exactly one bin
  • Gradient queries (DP-SGD): Sensitivity controlled by gradient clipping to a fixed L2 norm C
05

Sensitivity and the Privacy-Utility Trade-off

Sensitivity is the multiplier that translates privacy budget ε into noise magnitude, directly governing the privacy-utility frontier.

  • Noise scale: Laplace noise ~ GS/ε; Gaussian noise ~ GS · √(2 ln(1.25/δ)) / ε
  • High sensitivity → high noise: Queries with large GS require more noise, degrading accuracy
  • Mitigation strategies:
    • Clipping: Bound per-record contributions to reduce sensitivity
    • Query decomposition: Break complex queries into lower-sensitivity sub-queries
    • Relaxing to (ε, δ)-DP: Allows L2 sensitivity and Gaussian noise, often more efficient
06

Sensitivity in Iterative Algorithms

When differential privacy is applied repeatedly, sensitivity compounds according to the composition theorem.

  • Sequential composition: Total privacy cost = sum of individual ε values; sensitivity bounds apply per-iteration
  • DP-SGD: Per-example gradient clipping bounds the L2 sensitivity of each training step to C
  • Moments accountant: Tracks cumulative privacy loss more tightly than simple composition, critical for deep learning
  • Amplification by subsampling: Randomly sampling a batch reduces effective sensitivity, strengthening the privacy guarantee
SENSITIVITY IN DP

Frequently Asked Questions

Clear, technical answers to the most common questions about how sensitivity calibrates the noise required to achieve differential privacy.

Sensitivity is the maximum change in a query's output caused by adding or removing a single record from the dataset. It quantifies how much a single individual's data can influence the result of a computation. Formally, for two neighboring datasets D and D' differing by one record, the L1 sensitivity of a function f is defined as Δf = max ||f(D) - f(D')||₁. This value directly determines the scale of noise required: a higher sensitivity means a single record has a larger potential impact, necessitating more noise to mask that influence and achieve a given privacy guarantee. Sensitivity is the bridge between the data, the query, and the privacy budget ε.

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.