Search

Search papers and lessons

Global Sensitivity

Level 3 · 11 min read

Global sensitivity is the most a query's answer can change when one record is added or removed, taken over every possible dataset. It sets how much noise privacy needs.

On this page

  • Colour = topic mix
  • Discrete math
  • Linear algebra
  • Probability
  • ReadReady to readNot yet

TL;DR

A query is a Function that takes a whole dataset and returns an answer, such as a count or a total. Global sensitivity measures how much that answer can move when one record is added or removed, and it takes the worst case over every possible dataset, not just the one you hold. The result is a single non-negative number, the largest possible change measured with a norm when the answer is a vector.

Builds on: Function, Vector Norm, Supremum · Leads to: Differential Privacy, Gaussian Mechanism

Where it's used

Private statistics on phone data. A company wants to publish how many users opened an app each day without revealing whether any one person was in the count. Before it can add random noise that hides a single person, it must know the largest change one person could cause in the published number. For a count that change is 1, so a small amount of noise is enough.

Census and health tables. A statistics office publishes totals such as the sum of household incomes in a region. One household can change that total by a lot, so the office first caps each income at a fixed ceiling. The cap is what makes the largest possible change finite, and the global sensitivity is the size of that cap.

Training models with privacy. A learning algorithm that takes an average of per-person gradients or a sum of clipped values must add noise scaled to how much one person can move that sum. Practical systems compute this bound for every query they release, then pick the noise level from it.

How it works

Take a tiny dataset and one query, then find the worst change any single record can cause.

  1. Start with a dataset. Let D=(0.2, 0.5, 0.9)D = (0.2,\ 0.5,\ 0.9) be three numbers, each between 0 and 1. The query is the sum: f(D)=0.2+0.5+0.9=1.6f(D) = 0.2 + 0.5 + 0.9 = 1.6.
  2. Make a neighbour by adding one record. Let D′D' be DD with the number 1.01.0 appended. Then f(D′)=2.6f(D') = 2.6. The answer moved by 2.6−1.6=1.02.6 - 1.6 = 1.0. Check: the new record is 1.0, and the sum grew by exactly that record.
  3. Try a different added record. Append 0.00.0 instead. Now f=1.6f = 1.6, so the answer did not move at all. Check: adding 0 changes no sum.
  4. Remove a record. Taking away 0.90.9 gives a sum of 0.70.7, a change of 0.90.9. Removing is the same pair of datasets read backwards, so it cannot make a bigger change than adding.
  5. Look at every possible record. Every value lies between 0 and 1, so the change from any single record is at most 1. The change of exactly 1 is reached by adding a record whose value is 1.
  6. Take the worst case. The largest change over all datasets and all neighbours is 1. That number is the global sensitivity of the sum for values in [0,1][0, 1]. Check: this number does not depend on which dataset you started from.
flowchart LR
  A[Dataset D] --> B[Add or remove one record]
  B --> C[Neighbour D']
  A --> D[Compute f on D]
  C --> E[Compute f on D']
  D --> F[Size of the difference]
  E --> F
  F --> G[Largest difference over all D and D']

The math

Definition

Definition: Global sensitivity

Two datasets DD and D′D' are neighbours if D′D' is DD with exactly one record added or removed. For a query ff whose answer is a vector, the global sensitivity in the ℓp\ell_p norm is

Δpf=sup⁡D∼D′ ∥f(D)−f(D′)∥p,\Delta_p f = \sup_{D \sim D'} \, \|f(D) - f(D')\|_p,

where D∼D′D \sim D' means "DD and D′D' are neighbours", ∥⋅∥p\|\cdot\|_p is the ℓp\ell_p norm of the difference, and sup⁡\sup is the Supremum over all such pairs. When p=1p = 1 this is written Δ1f\Delta_1 f, and when p=2p = 2 it is Δ2f\Delta_2 f.

A record is one person's row in the dataset. A query is any function from datasets to numbers or vectors. The norm ∥⋅∥p\|\cdot\|_p is the length of the difference. The ℓ1\ell_1 norm adds absolute values, and the ℓ2\ell_2 norm is the Euclidean length.

Step 1 in symbols: choose a neighbour

Pick any dataset DD and any record xx. The neighbour is D′=D∪{x}D' = D \cup \{x\} when adding, or D′=D∖{x}D' = D \setminus \{x\} when removing. The set brackets name the collection of records and are not part of any formula you will compute.

Step 2 in symbols: the difference

The change in the answer is f(D′)−f(D)f(D') - f(D). For the sum query, f(D)=∑x∈Dxf(D) = \sum_{x \in D} x, so adding xx gives

f(D∪{x})−f(D)=x.f(D \cup \{x\}) - f(D) = x.

Here ∑\sum is the sum over the records and xx is the value of the one new record.

Step 3 in symbols: bound the change

If every record is clipped to lie in [0,B][0, B], then 0≤x≤B0 \le x \le B. Removing a record gives the change −x-x, so its size is also at most BB. Therefore

∣f(D∪{x})−f(D)∣≤Bfor every D and every admissible x.|f(D \cup \{x\}) - f(D)| \le B \quad \text{for every } D \text{ and every admissible } x.

The bound is reached by choosing x=Bx = B, so the supremum equals BB:

Δ1f=B.\Delta_1 f = B.

Step 4 in symbols: a vector query

Let f(D)=(sum of values,count of records)f(D) = (\text{sum of values}, \text{count of records}). Adding one record with value xx in [0,B][0, B] changes the answer by c=(x,1)\mathbf{c} = (x, 1). Its norms are

∥c∥1=x+1,∥c∥2=x2+1.\|\mathbf{c}\|_1 = x + 1, \qquad \|\mathbf{c}\|_2 = \sqrt{x^2 + 1}.

Both grow as xx grows on [0,B][0, B], so the supremum is reached at x=Bx = B:

Δ1f=B+1,Δ2f=B2+1.\Delta_1 f = B + 1, \qquad \Delta_2 f = \sqrt{B^2 + 1}.
0246810024681012value of the added record xsize of the change
  • l1 change (x, 1)
  • l2 change (x, 1)
With the clip bound B = 10, both norms are largest at x = 10. The l1 change reaches 11 and the l2 change reaches sqrt(101), about 10.05. The two norms differ because the count moves by 1 on top of the value.

Worked examples

Example
Example 1: counting records

A query returns the number of records in the dataset. A dataset DD holds three people, so f(D)=3f(D) = 3.

  1. Add one new person to get D′D' with four records. Then f(D′)=4f(D') = 4.
  2. The change is 4−3=14 - 3 = 1.
  3. Remove a person instead: ff goes from 3 to 2, a change of −1-1, size 1.
  4. Every neighbour changes the count by exactly one record, so the largest change is 1.
  5. Conclusion: Δ1f=1\Delta_1 f = 1 for any counting query, whatever the dataset looks like.
Example
Example 2: a sum of clipped values

Each value is clipped to [0,10][0, 10]. The query is f(D)=f(D) = sum of the clipped values. Take D=(2,5,1)D = (2, 5, 1), so f(D)=8f(D) = 8.

  1. Add the value 10 to get D′=(2,5,1,10)D' = (2, 5, 1, 10). The sum is 1818.
  2. The change is 18−8=1018 - 8 = 10.
  3. Add the value 0 instead. The sum stays 88, so the change is 0.
  4. Any added value xx is between 0 and 10, so the change xx is between 0 and 10. Removing a value changes the sum by an amount between −10-10 and 0, so its size is also at most 10.
  5. The largest size is 10, reached by adding a 10.
  6. Conclusion: Δ1f=10\Delta_1 f = 10. The same argument works for every starting dataset, so the answer does not depend on DD.
Example
Example 3: survey hours with two outputs

A sleep survey clips each person's reported hours to [0,12][0, 12]. The query returns the pair (total hours, number of respondents). Take a dataset DD and add one respondent who reports 12 hours. The change in the answer is c=(12,1)\mathbf{c} = (12, 1).

  1. The ℓ1\ell_1 size of the change is ∣12∣+∣1∣=13|12| + |1| = 13.
  2. The ℓ2\ell_2 size of the change is 122+12=145\sqrt{12^2 + 1^2} = \sqrt{145}.
  3. Compute 145\sqrt{145}: since 122=14412^2 = 144, the root is just above 12, about 12.0412.04.
  4. Any respondent with xx hours in [0,12][0, 12] gives a change (x,1)(x, 1) with smaller norms, so the worst case is x=12x = 12.
  5. Conclusion: Δ1f=13\Delta_1 f = 13 and Δ2f≈12.04\Delta_2 f \approx 12.04.

Try it: the same survey with hours clipped to [0,8][0, 8]. What are Δ1f\Delta_1 f and Δ2f\Delta_2 f?

Answer: Δ1f=8+1=9\Delta_1 f = 8 + 1 = 9, and Δ2f=82+1=65≈8.06\Delta_2 f = \sqrt{8^2 + 1} = \sqrt{65} \approx 8.06.

Common mistakes and tradeoffs

Mistake 1: confusing global sensitivity with the change on your data. It is tempting to measure how much the answer moves for the dataset you actually have. In fact the local change can be small for some datasets and large for others, and reporting it leaks information. Global sensitivity takes the worst case over all datasets, because the privacy guarantee has to hold for any dataset an attacker might guess.

Mistake 2: assuming an unbounded sum has a finite sensitivity. It is tempting to think a sum of salaries has a sensible worst case. In fact if values are unbounded, one record can change the sum by an arbitrarily large amount, so Δ1f\Delta_1 f is infinite. This is why systems clip each value to a range first. Clipping is a real tradeoff: it adds a small bias to the answer in exchange for a finite sensitivity.

Mistake 3: treating all norms as interchangeable. It is tempting to pick whichever norm is convenient. In fact Δ1\Delta_1 and Δ2\Delta_2 differ, as Example 3 showed. The noise mechanisms in later lessons are calibrated to a particular norm, so using the wrong one either adds too little noise or more than needed.

When to use it. Use global sensitivity when the query's output is bounded or clipped and you need a guarantee that holds for every dataset. It is the standard input for Differential Privacy mechanisms.

When not to use it. When the output is unbounded and cannot be clipped, a global bound does not exist, and you need a different tool. Also, when the data are public and no privacy is needed, the sensitivity bound is unnecessary.

Alternatives. A tighter bound from a smarter query design gives less noise. Local sensitivity can be useful for analysis, but it is not a privacy guarantee on its own.

History

In the early 2000s, researchers working on private statistical databases knew that answers leak information about individuals, but they lacked a clean way to say how much noise was enough. In 2006 Cynthia Dwork, Frank McSherry, Kobbi Nissim and Adam Smith proposed calibrating noise to the sensitivity of the query, and introduced the idea that the amount of noise should depend on how much one record can change the answer. That paper made sensitivity the central quantity in the field. Dwork and Aaron Roth later gathered the theory in a monograph, which is the standard reference for the definition used here.

Recap

  • A query maps a dataset to an answer, and a neighbour is a dataset with one record added or removed.
  • The change in the answer is a vector, and its size is measured with a norm, such as ℓ1\ell_1 or ℓ2\ell_2.
  • Global sensitivity is the supremum of that size over all neighbouring pairs, so it holds for every dataset.
  • Clipping makes sensitivity finite. Different norms give different bounds for the same query.
  • Read next: Differential Privacy, which uses the sensitivity to decide how much noise to add, and Gaussian Mechanism, which calibrates Gaussian noise in the ℓ2\ell_2 norm.

Check yourself

QuestionIn one sentence, what is a neighbouring pair of datasets?Show answer

Two datasets are neighbours when one is obtained from the other by adding or removing exactly one record. Everything else stays the same.

QuestionA sum query clips each value to [0,10][0, 10]. Dataset DD has values (2,9)(2, 9), so f(D)=11f(D) = 11. If one record with value 6 is added, what is the change in the answer?Show answer

The new sum is 11+6=1711 + 6 = 17, so the change is 17−11=617 - 11 = 6. The change equals the value of the added record, which is 6.

QuestionWhy does the definition take the worst case over all datasets instead of using the change on the dataset you have?Show answer

A privacy guarantee must hold for every dataset, including ones an attacker can guess. The change on your actual data can be small even when some other dataset would show a large change, and that gap would leak information about the people in the data. The supremum closes that gap.

QuestionA query returns (sum of hours, count) with hours clipped to [0,4][0, 4]. What is its ℓ1\ell_1 global sensitivity?Show answer

The worst added record has 4 hours, giving a change (4,1)(4, 1). Its ℓ1\ell_1 size is 4+1=54 + 1 = 5, so Δ1f=5\Delta_1 f = 5.

Sources