Checks (computed live)
The science
Differential privacy. A randomised release M is ε-differentially private if, for any two datasets D and D′ that differ in one person and any set of outputs S, P[M(D) in S] ≤ eε P[M(D′) in S]. For a counting query the answer changes by at most 1 when one person is added or removed (sensitivity Δ = 1). The Laplace mechanism adds noise with density (1/2b)e−|x|/b and scale b = Δ/ε; its mean absolute error is b, its standard deviation is √2 b and P(|noise| > t) = e−t/b. Halving ε doubles the typical error: that is the privacy-utility trade-off. The privacy loss of one query has mean ε − 1 + e−ε (the Kullback-Leibler divergence between the two Laplace curves) and can never exceed ε.
Composition. Answering k queries on the same people adds up: basic composition gives kε. Advanced composition gives ε′ = ε√(2k ln(1/δ′)) + kε(eε − 1), which is smaller for many small-ε queries, but it is an (ε′, δ′) guarantee with δ′ = 10−6 rather than a pure ε guarantee. The vault door opens in proportion to the budget used; averaging k repeated answers shrinks the error only as 1/√k, worse than spending the whole budget kε on a single query (error √2/(kε)).
Fairness metrics. A model scores people; the score is N(d, 1) for those with the outcome and N(0, 1) for those without, and a person is selected when the score reaches a threshold t. Then TPR = Q(t − d), FPR = Q(t) (Q is the normal upper tail), the approval rate is p TPR + (1 − p) FPR and the precision is PPV = p TPR / (p TPR + (1 − p) FPR). Demographic parity asks for equal approval rates, equalised odds for equal TPR and FPR, predictive parity for equal PPV. With the same threshold both groups have the same TPR and FPR, so equalised odds holds, but PPV odds = (p/(1 − p))(TPR/FPR): when base rates p differ, precision and approval rates differ. This is the impossibility result of Chouldechova and of Kleinberg, Mullainathan and Raghavan: unless the classifier is perfect or the base rates are equal, equal error rates and equal precision cannot both hold. Choosing the group-B threshold to equalise approval rates or precision removes that gap and opens an error-rate gap, which the scale shows.
k-anonymity. The quasi-identifiers age, area and sex split the table into groups of people with identical values; the table is k-anonymous if every group has at least k people. If an attacker knows a target is in the table, the chance of picking the right record is 1/(group size); the average over everybody is (number of groups)/(number of people) and the worst case is 1/k. With N people in C equally likely cells the expected number of occupied cells is C(1 − (1 − 1/C)N) and the expected number of people who are alone in their cell is N(1 − 1/C)N−1. Generalising age and area raises k; suppressing the small groups reaches the target at a cost in records.
Eight independent checks run live: Laplace mean error and tail against b and e−t/b; the sampled privacy loss against kε and k(ε − 1 + e−ε); the 99% quantile of the loss against the advanced-composition bound; closed-form fairness rates against 600,000 simulated people; the parity solver residual and the odds identity; the impossibility result; and occupied cells, unique records and the risk bookkeeping for k-anonymity.
Honest simplifications
- Everything here is synthetic: a fixed count of 300 in a database of 1,000, a seeded population of 2,000 people, and Gaussian scores. No real person or real statistic is used, and none of the numbers describes a real system.
- The population is uniform over age, area and sex. Real populations are far from uniform, so real tables have more unique records than the uniform formulas predict.
- The Laplace mechanism is shown in the central model for a counting query with known sensitivity 1; floating-point side channels, clamping and attackers who see many different queries are not modelled. The advanced-composition figure is an (ε′, δ′) bound; the budget shown is the smaller of the two numbers.
- Both groups share one score model (same d). Real score distributions often differ between groups, and equal d is an assumption chosen so that the closed forms are exact.
- Demographic parity, equalised odds and predictive parity are three common criteria, not the whole of fairness, and different thresholds per group may be restricted by law in some places. k-anonymity does not stop attribute disclosure or linkage with outside data. This lab teaches the arithmetic; it gives no legal or ethical advice.