Course contentsShow
← Security
Lesson 2917 of 3,05254. Privacy EngineeringFree lesson

Sensitivity and Query Analysis

Calculating global sensitivity of queries to determine how much noise is required for differential privacy.

Sensitivity and Query Analysis

What you'll learn: How to calculate a query's global sensitivity to determine the minimum noise needed to guarantee differential privacy.

Why Sensitivity Matters

Before adding noise (via Laplace or Gaussian mechanisms), you must first understand how much a single individual's data can change your query's output. This maximum possible change is called global sensitivity, and it directly controls how much noise you need.

Think of sensitivity like measuring the "leverage" one person has on your statistics. If one person leaving your dataset can change the result by at most 1, that's low sensitivity. If they could change it by 1,000, that's high sensitivity—and you'll need proportionally more noise to hide their contribution.

Calculating Global Sensitivity

Global sensitivity (Δf) is defined as:

Δf = max |f(D₁) - f(D₂)|

...where D₁ and D₂ are any two datasets differing by exactly one record.

Common Examples

  • Counting queries (e.g., "How many users are over 30?"): Sensitivity = 1 (adding/removing one person changes count by ±1)
  • Sum queries (e.g., "Total age of all users"): Sensitivity = maximum possible value (if ages capped at 100, sensitivity = 100)
  • Average queries: Sensitivity depends on bounds and dataset size—often requires more complex analysis or query restructuring

Practical Impact

Once you know Δf, you can calibrate noise:

  • Laplace mechanism: Add noise proportional to Δf/ε
  • Gaussian mechanism: Add noise proportional to Δf·√(2ln(1.25/δ))/ε

Higher sensitivity means more noise required for the same privacy guarantee.

Key Takeaway: Global sensitivity measures the maximum influence one individual's data can have on a query result, and it determines the minimum noise scale required to achieve (ε,δ)-differential privacy—making sensitivity analysis the critical first step in any DP implementation.