Privacy and Uncertainty Quantification
M2 · P1 (announced) · Year 2 · Period 1
Contents
- Introduction and overview
- 0. Reminders: probability, concentration, DP as seen in M1
- 1. Differential privacy: the foundation
- 2. Mechanisms: Laplace, Gaussian, exponential
- 3. Composition: advanced and Rényi DP
- 4. Local versus global, and DP-SGD
- 5. DP in industry and attacks
- 6. Uncertainty: sources and vocabulary
- 7. Calibration: diagrams, ECE, Brier
- 8. Bayesian deep learning: MC dropout versus ensembles
- 9. Conformal prediction: theorem and algorithm
- 10. Quantile and conformalized regression
- 11. UQ for LLMs
- 12. Applications: deciding under uncertainty
- Exercises
- Projects and assessment
- References
Introduction and overview
| Module | Privacy and Uncertainty Quantification |
| Code | Not published — the module is announced in period 1 by the master’s brochure; the 2026-2027 SynapseS course description has not been published (the S3/S4 tracks of the catalog are currently empty). |
| Team and workload | Instructor, teaching hours and ECTS: not published · two complementary parts: differential privacy (mechanisms, composition, Rényi DP, DP-SGD, industrial deployments) and uncertainty quantification (calibration, deep ensembles, conformal prediction, LLM UQ) — the two families of guarantees that condition the responsible deployment of models. |
| Period | M2 · period 1 (announced) |
| Status in the program | M2Outside recommended track M2 program being finalized by the course instructors; the official description will not be communicated until the course description is published. |
Audience: an engineer who must ship a model with guarantees on privacy and on calibration. Empirical first: the module starts from concrete failures — a classifier with 91% accuracy but an ECE of 0.18 (it is over-confident), a DP-SGD fine-tuning at ε = 2 that leaves the model unusable — and only then names the tools (mechanisms, composition, conformal prediction).
Differential privacy and uncertainty quantification are the two families of guarantees that a model needs before it can be deployed responsibly; the module treats them in two parts, privacy first (ch. 1–5), then uncertainty (ch. 6–12).
What you will be able to do
- State the definition of \varepsilon-differential privacy and prove that a mechanism satisfies it (Laplace, Gaussian, exponential);
- Compose mechanisms (sequential and parallel theorems) and tighten the privacy budget with Rényi DP;
- Choose between local and global DP, and explain precisely what DP-SGD modifies in SGD;
- Read a reliability diagram and quantify the miscalibration of a classifier (ECE, Brier score);
- Compare MC dropout and deep ensembles for estimating the uncertainty of a deep network;
- Implement “split” conformal prediction and prove its marginal coverage guarantee;
- Produce adaptive intervals via conformalized quantile regression;
- Audit the uncertainty of an LLM and argue for a decision under uncertainty (alert threshold, abstention).
Official objectives and syllabus
Official syllabus: course description not published — this module appears neither in the S3 track nor in the S4 track of the 2026-2027 SynapseS catalog (both currently empty), and the master’s wiki indicates that the detailed M2 curriculum is still under development: description, teaching hours and instructor are therefore “not published”. The themes below are those carried by the module in the master’s brochure, as restated by these course materials, mapped to the sections that cover them.
| Announced theme (brochure, as restated by the materials) | Course section covering it |
|---|---|
| Differential privacy: definitions and foundation | ch. 1 “Differential privacy: the foundation” |
| Mechanisms: Laplace, Gaussian, exponential | ch. 2 “Mechanisms: Laplace, Gaussian, exponential” |
| Advanced composition and Rényi DP | ch. 3 “Composition: advanced and Rényi DP” |
| Local versus global DP, DP-SGD | ch. 4 “Local versus global, and DP-SGD” |
| DP in industry and attacks | ch. 5 “DP in industry and attacks” |
| Uncertainty: sources, calibration | ch. 6 “Uncertainty: sources and vocabulary” and ch. 7 “Calibration: diagrams, ECE, Brier” |
| Bayesian deep learning | ch. 8 “Bayesian deep learning: MC dropout versus ensembles” |
| Conformal prediction | ch. 9 “Conformal prediction: theorem and algorithm” |
| Quantile and conformalized regression | ch. 10 “Quantile and conformalized regression” |
| UQ for LLMs | ch. 11 “UQ for LLMs” |
| Deciding under uncertainty | ch. 12 “Applications: deciding under uncertainty” |
The exact split between brochure content and the materials’ own extensions can only be settled once the official course description is published; in any case, chapter 0 (reminders: probability, concentration, DP as seen in M1) is part of the common structure of the repository’s course materials.
Where this course fits in the program
M2 module offered in period 1, outside the recommended track: it is aimed at all students who want to add demonstrable guarantees to their profile, whatever their specialty.
Prerequisites: the limit theorems, confidence intervals and tests of Refresher Statistics (ch. 4 and 6), and the honest comparison of two models of Machine Learning (4.9). They are the language of the coverage guarantees of ch. 9. Statistics in Action (bootstrap, multiple testing) is optional, a reference for the same logic. The first encounter with differential privacy in ch. 5 of Emerging ML helps if you took it; otherwise ch. 0–1 are self-contained.
Downstream modules: the privacy part of Explainability, Security, Privacy of LLMs (memorization, membership inference, DP of LLMs, ch. 7–8) relies directly on the mechanisms and composition proved here. On the production side, the drift monitoring of ML Ops and LLM Engineering Principles (ch. 5) tells when the data have moved; that module does not treat calibration or conformal prediction, and ch. 7–10 here say what to re-check when it fires (recalibration, a recomputed conformal quantile).
Canonical home. The DP proofs of ch. 1–4 (definition, post-processing, the Laplace mechanism, composition, Rényi DP, amplification by subsampling) are the reference derivations of these notes; the Gaussian mechanism, advanced composition and the subsampled-Gaussian accountant of DP-SGD are sketched or cited with their sources. ESP of LLMs ch. 8, Security & Robustness ch. 7–8, Advanced GNN 7.4 and Boosting → Tabular ch. 8 use these results without re-proving them: this page is where the proofs are.
Ch. 5 is the short introduction to membership inference that those pages can cite; the full attack (shadow models, LiRA) is Security & Robustness Def. 8.3.
Course outline
- Reminders: probability, concentration, DP as seen in M1 — puts the Markov/Hoeffding inequalities and the DP definition back in shape before going further.
- Differential privacy: the foundation — definitions (neighboring, mechanism), the three structural properties (post-processing, group privacy, convexity) and sensitivity, the quantity that sets the noise of ch. 2.
- Mechanisms: Laplace, Gaussian, exponential — sensitivity, noise calibration and the exponential mechanism for discrete responses.
- Composition: advanced and Rényi DP — why naive compositions waste the budget, and how Rényi DP tightens it.
- Local versus global, and DP-SGD — two trust models, then the algorithm that trains networks while preserving privacy.
- DP in industry and attacks — real deployments, the \varepsilon budget in practice, and attacks (reconstruction, inference) that motivate the theory.
- Uncertainty: sources and vocabulary — aleatoric versus epistemic, and why modern networks are poorly calibrated.
- Calibration: diagrams, ECE, Brier — measuring the gap between stated confidence and observed frequency.
- Bayesian deep learning: MC dropout versus ensembles — two practical approximations of epistemic uncertainty, with their trade-offs.
- Conformal prediction: theorem and algorithm — a distribution-free coverage guarantee in a few lines of code.
- Quantile and conformalized regression — intervals whose width adapts to the query point.
- UQ for LLMs — verbalized confidence, semantic coherence and the limits of the previous methods on generations.
- Applications: deciding under uncertainty — assembling the tools to arbitrate abstention, alert and action in a real system.
- Exercises — from proofs of mechanisms to conformal implementations on real data.
- Projects and assessment — solo and group subjects, a written-exam proposal and a rubric.
- References — the primary sources (Dwork, Rényi DP, Angelopoulos) to go to the text.
Session plan
24 h in class (assumed) = 8 sessions of 3 h. The fiche publishes no teaching hours: 24 h is the M2 volume published for the Large Language Models course (CSC_53432_EP: 24 h, 2 ECTS) and is assumed here; the session split below is our proposal for covering these notes in that time. Level 1 = foundations (reviews, definitions, first worked examples), 2 = core methods, 3 = advanced material (recent research, open problems); the level never goes down from one session to the next.
The uncertainty part opens with a short vocabulary chapter (ch. 6), taught in the same session as calibration (ch. 7); that session works at the level of the core privacy chapters before it, since temperature scaling and the Brier decomposition are core methods.
| Session | Hours | Level | Content | Practice |
|---|---|---|---|---|
| 1 | 3 h | 1 | ch. 0 Reminders; ch. 1 Differential privacy: definition, structural properties, sensitivity | compute the sensitivity of five queries (Definition 1.3) |
| 2 | 3 h | 2 | ch. 2 Mechanisms: Laplace, Gaussian, exponential | Ex. 1 |
| 3 | 3 h | 2 | ch. 3 Composition: basic, advanced, Rényi DP | Ex. 4 |
| 4 | 3 h | 2 | ch. 4 Local versus global DP, DP-SGD; ch. 5 DP in industry and attacks | Ex. 2, 5 |
| 5 | 3 h | 2 | ch. 6 Uncertainty: sources and vocabulary; ch. 7 Calibration: ECE, Brier, temperature scaling | Ex. 3 |
| 6 | 3 h | 2 | ch. 8 Bayesian deep learning: MC dropout versus ensembles | Ex. 6 |
| 7 | 3 h | 2 | ch. 9 Conformal prediction; ch. 10 Quantile and conformalized regression | Ex. 7, 8 |
| 8 | 3 h | 3 | ch. 11 UQ for LLMs; ch. 12 Deciding under uncertainty, risk control | Ex. 9, 10 (Ex. 11: project, outside class) |
Self-study, outside the 24 h: no chapter — every chapter is covered in class; the project (Ex. 11) takes about 10 h of personal work over the module.
How to study this module
- Redo the proofs on scratch paper: every theorem fits on one page, and it is by rewriting them that one retains the exact hypotheses.
- Implement Laplace noise and “split” conformal yourself (a few dozen lines): the guarantees become tangible when you see the coverage histogram.
- Whenever an \varepsilon appears, ask yourself which pair of neighboring datasets it distinguishes — that is the only way to give it meaning.
- Work through the two parts in order but in parallel in your head: chapters 6–12 replay in UQ the same moves as in privacy (guarantee, budget, utility trade-off).
- Do the exercises on your own first (the page gives no solutions; the worked examples of each chapter are the models to follow), and compare your intervals with those of others: coverage is verified, not declared.
The LLGA perspective The singularity of the master is to cross LLMs, graphs, and applications; now privacy and uncertainty are precisely the questions where this intersection remains the most open — DP on graphs (sensitive edges, neighbors), UQ of text and graph generations. Whether you aim for research (PhD, R&D) or data careers in a regulated sector (health, banking, insurance), knowing how to certify a learning system — not merely measure it — is what distinguishes an engineer trained in LLGA.
0. Reminders: probability, concentration, DP as seen in M1
Both parts of the module prove guarantees, and these proofs use a small toolbox from M1: concentration inequalities, the first definition of differential privacy, and the language of tests and intervals. This chapter lists what is assumed and where it is used.
Prerequisites (M1 modules)
- Concentration inequalities (cf. Machine Learning module, ch. 0): Markov \mathbb{P}(Z \geq t) \leq \mathbb{E}Z/t, Chernoff/Hoeffding for sums of Bernoullis — they provide the guarantees of the mechanisms and conformal coverage;
- Differential privacy, first encounter (cf. Emerging ML module, chapter 5, if you took it; ch. 1 restates everything needed): \varepsilon-DP definition, Laplace noise, DP-SGD as a conclusion of federated learning — the present module takes up this basis and develops it: mechanisms (ch. 2), fine composition (ch. 3), industrial implementations (ch. 4–5);
- Generalization theory (cf. Machine Learning module, ch. 8): bias-variance trade-off, error decomposition — the UQ part (ch. 6–12) answers the dual question: not just “what risk on average”, but “what guarantee on this prediction”;
- Training of networks (cf. Deep Learning module, ch. 3 and 8): SGD, mini-batches, dropout — DP-SGD (ch. 4) and MC dropout (ch. 8) modify them marginally but change their nature;
- Statistics of tests and intervals (cf. Refresher Statistics module, ch. 4 and 6; Machine Learning module, 4.9; Statistics in Action module, ch. 8 and 9, as an optional reference): frequentist guarantees, p-values, bootstrap — the language of the coverage guarantees of ch. 9.
Why these two parts in a single module? Privacy and UQ are the two faces of the “right to error” of learning systems: privacy quantifies what a model can reveal about the training data, UQ quantifies what it can assert about a new input.
Both escape evaluation by accuracy alone; both provide formal guarantees (inequalities, theorems) rather than empirical promises; and both converge on LLMs (ch. 11): models large enough to memorize and confident enough to mislead.
The thread: make the uncertainties computable, then arbitrate them.
1. Differential privacy: the foundation
A hospital wants to publish statistics about its patients, or to train a model on their records, without revealing anything about any single patient. This chapter gives the definition that makes this promise precise and checkable.
What breaks Three mistakes recur in practice: believing that removing names and identifiers is enough, releasing statistics with no privacy budget at all, and forgetting that the privacy losses of successive releases add up (composition, ch. 3).
The historical motivation (reconstructed by Dinur-Nissim, 2003): publishing “anonymized” statistics about a database is often enough to reconstruct the individual data by cross-referencing enough queries — naive anonymization (removing name/SSN) does not resist.
The answer of Dwork, McSherry, Nissim, Smith (2006): define protection as a property of the mechanism (the randomized algorithm), not of the data.
Definition 1.1 — Neighboring and differential privacy Two databases x, x' are neighboring, written x \sim x', if they differ in the data of a single individual.
Convention on this page (and in these notes): one row is added or removed, unless stated otherwise. Replacing a row is a removal plus an addition, so it costs at most 2\varepsilon (group privacy, Proposition 1.2 with k = 2). On a graph, the individual is an edge (edge-DP) or a node with all its edges (node-DP): see Advanced GNN 7.4.
A randomized mechanism M is \varepsilon-DP if for every pair of neighboring databases and every subset S of outputs: \mathbb{P}(M(x) \in S) \;\leq\; e^{\varepsilon}\, \mathbb{P}(M(x') \in S).
(\varepsilon, \delta) version: the inequality may be violated with probability \leq \delta (a figure to be read as “cryptographically improbable”, \delta \ll 1/n).
Reading: changing the data of one person changes the distribution of the published conclusions by at most (multiplicatively) e^\varepsilon — so these conclusions reveal little about that person, whatever the adversary’s side knowledge.
Key result — differential privacy \mathbb{P}(M(x) \in S) \;\leq\; e^{\varepsilon}\, \mathbb{P}(M(x') \in S) \qquad \text{for all neighbors } x \sim x' \text{ and all } S
Proposition 1.2 — Three structural properties
- Post-processing: if M is \varepsilon-DP, any g \circ M (subsequent analysis, training, selective publication) still is — privacy does not degrade through processing of the outputs.
- Group privacy: if x, x' differ on k individuals, \mathbb{P}(M(x) \in S) \leq e^{k\varepsilon}\mathbb{P}(M(x') \in S).
- Convexity: a mixture of \varepsilon-DP mechanisms is \varepsilon-DP.
Proof.
- For every set S of outputs, \mathbb{P}(g(M(x)) \in S) = \mathbb{P}(M(x) \in g^{-1}(S)) \leq e^\varepsilon \mathbb{P}(M(x') \in g^{-1}(S)) = e^\varepsilon \mathbb{P}(g(M(x')) \in S) — the direct image of a dominated measure preserves the Radon-Nikodym ratio.
- A chain of k intermediate neighboring databases and multiplication of the e^\varepsilon.
- For a mixture with weights \lambda_j over M_j all \varepsilon-DP: \sum_j \lambda_j \mathbb{P}(M_j(x) \in S) \leq \sum_j \lambda_j e^\varepsilon \mathbb{P}(M_j(x') \in S) = e^\varepsilon \mathbb{P}(\text{mixture}(x') \in S). ∎
Definition 1.3 — Sensitivity The \ell_1 (resp. \ell_2) sensitivity of a query f on neighboring databases: \Delta_1 f = \max_{x \sim x'} \|f(x) - f(x')\|_1, \qquad \Delta_2 f = \max_{x \sim x'} \|f(x) - f(x')\|_2. Computed examples:
- counting (how many individuals satisfy Q?) \Rightarrow \Delta_1 = 1 (one row changes the count by at most 1);
- mean over n rows in [0, 1] \Rightarrow \Delta_1 = 1/n (adding one row shifts the mean by at most 1/n);
- histogram with k bins \Rightarrow \Delta_1 = 1 (one row falls in one bin — under the add/remove convention);
- maximum \Rightarrow \Delta_1 unbounded (hence the systematic clipping in practice, ch. 4).
Sensitivity measures “how much one individual can weigh” — it is what will set the noise.
Choosing \varepsilon — the embarrassing question No universal rule, but industry benchmarks:
- 2020 US Census: a global \varepsilon on the order of twenty in total for the person file (Abowd, 2018);
- Apple (keyboard telemetry): \varepsilon on the order of 4–8 per day;
- Google (RAPPOR): \varepsilon \approx \ln 3 per report, cumulative budgets;
- academic literature: \varepsilon \leq 1 “strict”, 1–10 “reasonable”.
The essential point: \varepsilon is a budget that one spends (ch. 3), not a moral grade.
2. Mechanisms: Laplace, Gaussian, exponential
The definition of chapter 1 says what a private mechanism must satisfy, not how to build one. This chapter gives the three standard constructions: add noise scaled to the sensitivity (Laplace, Gaussian), or sample a discrete answer with probabilities that depend smoothly on its quality (exponential mechanism).
Theorem 2.1 — The Laplace mechanism (Dwork et al., 2006) Let f have sensitivity \Delta_1. The mechanism M(x) = f(x) + (Z_1, \dots, Z_k), \qquad Z_i \sim \mathrm{Laplace}\big(0, \tfrac{\Delta_1}{\varepsilon}\big)\ \text{i.i.d.} is \varepsilon-DP. The Laplace law with parameter b has density p(z) = \frac{1}{2b} e^{-|z|/b}.
Proof. For an output z \in \mathbb{R}^k, the ratio of densities equals \frac{p_x(z)}{p_{x'}(z)} = \prod_{i=1}^k \exp\!\Big( -\frac{\varepsilon}{\Delta_1}\big( |z_i - f_i(x)| - |z_i - f_i(x')| \big) \Big) = \exp\!\Big( \frac{\varepsilon}{\Delta_1} \sum_i \big( |z_i - f_i(x')| - |z_i - f_i(x)| \big) \Big). By the triangle inequality, \sum_i \big( |z_i - f_i(x')| - |z_i - f_i(x)| \big) \leq \sum_i |f_i(x) - f_i(x')| \leq \Delta_1, hence p_x(z)/p_{x'}(z) \leq e^{\varepsilon} for all z — integrating over S gives the definition (and symmetrically by exchanging x, x'). ∎
Utility, computed. For a counting query (\Delta_1 = 1): \mathbb{P}(|Z| \geq t) = e^{-\varepsilon t}. With \varepsilon = \ln 20 \approx 3.0 and b = 1/\varepsilon \approx 0.33, the published answer is shifted
- by at least 1 unit with probability e^{-\varepsilon} = 5\%,
- by at least 3 units with probability 20^{-3} \approx 0.01\%
— a modest noise at the scale of the single individual one seeks to mask.
Theorem 2.2 — The Gaussian mechanism, analytic form For f with \ell_2 sensitivity \Delta_2, M(x) = f(x) + \mathcal{N}(0, \sigma^2 I_k) is (\varepsilon, \delta)-DP as soon as \sigma \;\geq\; \Delta_2\, \frac{\sqrt{2 \ln(1.25/\delta)}}{\varepsilon} \qquad (\varepsilon \leq 1). Numerically, for \varepsilon = 1, \delta = 10^{-6}: \sqrt{2\ln(1.25 \times 10^6)} = \sqrt{28.1} \approx 5.3, \qquad \text{hence } \sigma \approx 5.3\,\Delta_2 .
Why prefer Gaussian over Laplace in ML:
- Gaussian noise composes very well (Rényi DP, ch. 3);
- it is isotropic and gradient-compatible;
- the Gaussian tail is lighter for large k.
Proof: computation of the ratio of Gaussian densities bounded by e^{\varepsilon} except on a set of probability \delta — analysis in Dwork & Roth (2014), lemma A.1 (the factor 1.25 is a convenience constant of the upper bound).
Definition 2.3 — The exponential mechanism (McSherry-Talwar, 2007) For a non-numeric response (choosing a median, an item, a model): a score function u(x, h) (to be maximized) with sensitivity \Delta_u = \max_h \max_{x \sim x'} |u(x, h) - u(x', h)|, and the output law \mathbb{P}(M(x) = h) \;\propto\; \exp\!\Big( \frac{\varepsilon\, u(x, h)}{2\Delta_u} \Big).
Utility guarantee: if h^* = \arg\max_h u(x, h) and u(x, h^*) - u(x, h) \geq \mathrm{GAP}, then \mathbb{P}(u(x, M(x)) \leq u(x, h^*) - \mathrm{GAP}) \leq |\mathcal H| \exp\big(-\varepsilon\, \mathrm{GAP}/(2\Delta_u)\big), where |\mathcal H| is the number of candidate outputs — the gap to the optimum decreases exponentially with \varepsilon and the gap.
This is the mechanism of discrete choices: model selection, private top-k, auction mechanisms.
Example 2.4 — Private median: publishing a robust statistic A “median age” query has unbounded sensitivity (shifting the median by one row can make it jump far if the data are concentrated). The exponential mechanism with u(x, h) = -\big|\#\{i : x_i < h\} - \#\{i : x_i > h\}\big| (minus the imbalance between the individuals below and above h; one row changes it by at most 1, so \Delta_u = 1) publishes an \varepsilon-DP median with controlled utility.
This is the canonical example of the structural choice of mechanism according to the query — the privacy engineer spends most of their time here, not on the noise itself.
3. Composition: advanced and Rényi DP
A real analysis never releases a single statistic: it asks many queries, or, in training, takes thousands of gradient steps on the same data. This chapter computes how the privacy losses of successive mechanisms add up, and how Rényi DP keeps the total budget small.
Theorem 3.1 — Basic composition, proved If M_1 is \varepsilon_1-DP and M_2, applied after M_1 and allowed to depend on its output, is \varepsilon_2-DP, then (M_1, M_2) \text{ is } (\varepsilon_1 + \varepsilon_2)\text{-DP} — adaptive composition accumulates linearly.
Proof. By conditioning then post-processing: for measurable S, \mathbb{P}(M_2(M_1(x), x) \in S_2 \mid M_1(x) = m) \leq e^{\varepsilon_2} \mathbb{P}(M_2(M_1(x'), x') \in S_2 \mid M_1(x') = m) — caution: conditioning only makes sense via the regular version.
The clean proof handles densities: p_x(m, s) = p_x(m)\, p_x(s \mid m) \leq e^{\varepsilon_1} p_{x'}(m) \cdot e^{\varepsilon_2} p_{x'}(s \mid m) = e^{\varepsilon_1 + \varepsilon_2} p_{x'}(m, s), then one integrates.
Adaptivity breaks nothing because e^{\varepsilon_2} bounds the ratio for every value of the history. ∎
Theorem 3.2 — Advanced composition (Dwork, Rothblum, Vadhan, 2010) The composition of k adaptive (\varepsilon_0, \delta_0)-DP mechanisms is (\varepsilon^*, \, k\delta_0 + \delta')-DP for every \delta' > 0 with \varepsilon^* = \sqrt{2 k \ln(1/\delta')}\; \varepsilon_0 \;+\; k\, \varepsilon_0 \big( e^{\varepsilon_0} - 1 \big). In \sqrt k rather than k — the idea (sketch: the proof bounds the deviation of the sum of log-ratios via Azuma, then converts a sub-Gaussian concentration into an (\varepsilon, \delta)-type threshold).
Numerical. k = 100 releases, \varepsilon_0 = 0.01, \delta' = 10^{-5}: \sqrt{200 \times 11.5} \times 0.01 = 0.48, \qquad 100 \times 0.01 \times 0.0101 = 0.010 \ \text{(second term)}, hence \varepsilon^* \approx 0.49 versus \varepsilon = k\varepsilon_0 = 1.0 under basic composition — twice as good. The gain explodes for large k (ch. 4, DP-SGD: k \sim 10^4 steps).
Definition 3.3 — Rényi DP (Mironov, 2017) The Rényi divergence of order \alpha > 1 between two laws P, Q: D_\alpha(P \| Q) = \frac{1}{\alpha - 1} \ln\, \mathbb{E}_{Q}\!\Big[ \Big( \frac{dP}{dQ} \Big)^{\alpha} \Big]. M is (\alpha, \varepsilon)-RDP if D_\alpha(M(x) \| M(x')) \leq \varepsilon for all neighboring databases. Three computational virtues:
Gaussian mechanism: for f with sensitivity \Delta_2, the noise \mathcal N(0, \sigma^2) is exactly \Big(\alpha, \frac{\alpha \Delta_2^2}{2\sigma^2}\Big)\text{-RDP for every } \alpha;
composition = addition at fixed \alpha: k mechanisms (\alpha, \varepsilon_i)-RDP compose into (\alpha, \sum_i \varepsilon_i)-RDP.
Proof: the joint likelihood ratio factorizes into the ratios of the successive outputs, each given the history. By the tower property, take the expectation of the last factor (raised to the power \alpha) conditionally on the history: (\alpha, \varepsilon_k)-RDP bounds it by e^{(\alpha - 1)\varepsilon_k} for every history. By induction, \mathbb{E}_Q\Big[\Big(\frac{dP}{dQ}\Big)^{\alpha}\Big] \leq e^{(\alpha - 1)\sum_i \varepsilon_i}, which is D_\alpha \leq \sum_i \varepsilon_i — the epsilons add exactly;
conversion: (\alpha, \varepsilon)\text{-RDP} \;\Rightarrow\; \Big(\varepsilon + \frac{\ln(1/\delta)}{\alpha - 1}, \delta\Big)\text{-DP} — one then optimizes \alpha a posteriori.
Example 3.4 — The RDP account, computed end to end 64 successive releases of the same Gaussian counting query, noise \sigma = 8\Delta_2, target \delta = 10^{-6}.
(a) Classical route. Each release: \varepsilon_0 = \sqrt{2 \ln(1.25/\delta_0)}\,\Delta_2/\sigma \approx 5.3/8 = 0.66 . Advanced composition over k = 64: \sqrt{128 \times 13.8} \times 0.66 + 64 \times 0.66 \times (e^{0.66} - 1) \approx 27.8 + 39.5 \approx \mathbf{67}. Ruinous. Here \delta_0 = \delta' = 10^{-6}, so the total failure probability is k\delta_0 + \delta' = 64 \times 10^{-6} + 10^{-6} \approx 6.5 \times 10^{-5}.
(b) RDP route. Each release is (\alpha, \alpha/128)-RDP (\alpha\Delta_2^2/2\sigma^2 = \alpha/128); the 64 compose into (\alpha, \alpha/2)-RDP. Conversion: \varepsilon(\alpha) = \frac{\alpha}{2} + \frac{13.8}{\alpha - 1}, minimized at \alpha - 1 = \sqrt{2 \times 13.8} \approx 5.3, i.e. \varepsilon^* \approx 3.13 + 2.63 \approx \mathbf{5.8}.
Same releases, and a total \delta of 10^{-6} instead of 6.5 \times 10^{-5} — RDP accounting is better on both counts and saves a factor of more than 10 on \varepsilon.
This is exactly what the “moments accountants” of DP-SGD do (ch. 4); the later improvement (amplification by subsampling, Wang et al. 2019) adds another significant factor when each step touches only a mini-batch.
The family of generalized DP z-CDP (Bun & Steinke, 2016 — Rényi divergence parameterized by \rho = \varepsilon/\alpha), f-DP (Dong, Roth, Su, 2019 — binary tests, exact frontier): same program, different representations.
The practitioner retains: divergences with exact additivity (Rényi) give the tightest composition bounds, and the interface (Opacus, TF Privacy, OpenDP) performs the conversion to (\varepsilon, \delta) for governance.
4. Local versus global, and DP-SGD
Two practical questions remain: whom must the individuals trust with their raw data, and how does one train a neural network under differential privacy? This chapter answers the first with the global/local distinction and the second with DP-SGD.
Definition 4.1 — Trust model: global (curator) vs local Global (centralized) DP: a trusted curator holds the raw data and randomizes the outputs. Better utility; single target (losing the database = catastrophe).
Local DP: each individual randomizes their own data before sending — the server never sees the truth; no third party to trust; price: much more noise (typically an extra error of order 1/\sqrt n).
Deployment: telemetry (Apple, Google; cf. Emerging ML module ch. 3 for the link with federated learning).
Proposition 4.2 — Warner’s randomized response (1965), the local prototype Sensitive question “X \in \{0,1\}”; the client answers the truth with probability p, the opposite with 1 - p. The channel is \varepsilon-DP with e^{\varepsilon} = \frac{p}{1-p} \qquad \text{(e.g. } p = 0.75 \Leftrightarrow \varepsilon = \ln 3 \approx 1.1).
Proof. Transition matrix T = \begin{pmatrix} p & 1-p \\ 1-p & p \end{pmatrix}. For any response y, the ratio \frac{\mathbb{P}(y \mid X{=}1)}{\mathbb{P}(y \mid X{=}0)} equals p/(1-p) or (1-p)/p depending on y, whose maximum is p/(1-p) = e^\varepsilon. ∎
Estimation and cost, computed. Let \pi be the true proportion and \bar Y_n the proportion of 1 responses among n. A response is 1 with probability r = (1-p) + (2p-1)\pi, so debiasing gives \hat\pi = \frac{\bar Y_n - (1-p)}{2p-1}, \qquad \mathrm{Var}(\hat\pi) = \frac{r(1-r)}{n\,(2p-1)^2}. In the clear the variance is \pi(1-\pi)/n. Since r - \tfrac12 = (2p-1)\big(\pi - \tfrac12\big), r is closer to \tfrac12 than \pi is, so r(1-r) \geq \pi(1-\pi) and the inflation factor is at least (2p-1)^{-2}: \frac{\mathrm{Var}(\hat\pi)}{\pi(1-\pi)/n} = \frac{r(1-r)}{\pi(1-\pi)\,(2p-1)^2} \;\geq\; \frac{1}{(2p-1)^2}.
At p = 0.75, it is 4 for \pi = 1/2 and about 9.3 for \pi = 0.1 — one needs at least four times as many users for the same precision as in the clear, and more for rare traits.
RAPPOR (Google Chrome): per-bit randomized response on a Bloom register + cohorts — the same arithmetic, at scale.
Definition 4.3 — DP-SGD (Abadi et al., 2016), summary At every step:
- draw a mini-batch B by Poisson sampling, each row kept with probability q = b/n (b the expected batch size);
- clip each individual gradient — bounds the sensitivity at C: \tilde g_i = g_i / \max(1, \|g_i\|_2 / C);
- aggregate and add noise, with \sigma the noise multiplier (the noise standard deviation is \sigma C): \tilde g = \frac{1}{b}\Big( \sum_{i \in B} \tilde g_i + \mathcal N(0, \sigma^2 C^2 I) \Big); one divides by the expected size b, not by the realized |B|, which depends on who was sampled;
- standard SGD step.
The final budget combines RDP composition (ch. 3) and amplification by subsampling — each step sees only a fraction q of the individuals (Proposition 4.4 gives the simplest form). The RDP bound of a step noised with variance \sigma^2 C^2 is reduced by a factor of order q^2 (regime q \varepsilon_{\text{step}} \lesssim 1); exact computation in Wang, Balle, Kasiviswanathan (2019).
The “moments accountant” of Abadi et al. is the ancestor of this computation; implementations: Opacus (PyTorch), TensorFlow Privacy.
Typical settings: \sigma \in [0.5, 1.5], C set to the median of the gradient norms, \varepsilon_{\text{final}} \in [1, 10] for modestly sized models — LLMs with 10¹¹ parameters remain an open frontier (ch. 11).
Proposition 4.4 — Privacy amplification by subsampling (Balle, Barthe, Gaboardi, 2018) Let M be \varepsilon-DP for add/remove neighbours, and run it on a Poisson subsample that keeps each row independently with probability q. The result is \varepsilon'-DP with
\varepsilon' = \log\big(1 + q\,(e^{\varepsilon} - 1)\big) \;\approx\; q\,(e^{\varepsilon} - 1) \quad \text{for small } q.
If M is (\varepsilon, \delta)-DP, the subsampled mechanism is (\varepsilon', q\delta)-DP.
Proof. Let x' = x \cup \{z\}, let T be the Poisson subsample of x, and let P be the law of M(T).
- With probability 1 - q the row z is not sampled: the run on x' also outputs M(T).
- With probability q it is: the run outputs M(T \cup \{z\}), of law P_z. Since T \sim T \cup \{z\}, DP gives P_z(S) \leq e^{\varepsilon} P(S).
- Hence \mathbb{P}(M(x') \in S) = (1 - q)P(S) + qP_z(S) \leq \big(1 + q(e^{\varepsilon} - 1)\big)P(S).
- The other direction uses P_z(S) \geq e^{-\varepsilon} P(S) and gives a ratio that is no larger. ∎
Computed. With \varepsilon = 1 and q = 0.01, \varepsilon' = \log(1.0172) \approx 0.017, a gain of about sixty per step. This is what makes thousands of DP-SGD steps affordable.
import torch, torch.nn as nn
from opacus import PrivacyEngine
train_ds = torch.utils.data.TensorDataset( # toy stand-in for real data
torch.randn(10_000, 32), torch.randint(0, 2, (10_000,)))
model = nn.Linear(32, 2)
loader = torch.utils.data.DataLoader(train_ds, batch_size=256)
opt = torch.optim.SGD(model.parameters(), lr=0.05)
privacy_engine = PrivacyEngine()
model, opt, loader = privacy_engine.make_private_with_epsilon(
module=model, optimizer=opt, data_loader=loader,
target_epsilon=3.0, # targeted (epsilon, delta=1e-5) budget
target_delta=1e-5, epochs=20,
max_grad_norm=1.0, # C: per-example clipping
)
# Ordinary training loop; at each step:
# grad_i clipped to C, noise N(0, sigma^2 C^2), sigma set by the
# RDP accountant + amplification by subsampling.
for epoch in range(20):
for x, y in loader:
opt.zero_grad()
loss = nn.functional.cross_entropy(model(x), y)
loss.backward(); opt.step()
print(privacy_engine.get_epsilon(delta=1e-5)) # epsilon actually spentWhat DP-SGD does not solve Utility drops with the dimension of the model (the noise is isotropic while gradients live in privileged directions); tuning C is an art; rare features (a unique user!) weigh heavily after clipping; and DP protects the data, not the outputs (an incorrectly calibrated model can be private and misleading — that is the job of the UQ part).
5. DP in industry and attacks
The theory of chapters 1–4 is deployed at national and planetary scale, and it is motivated by attacks that really work. This chapter describes three deployments and the two attack families that justify paying the price of a formal guarantee.
Example 5.1 — Three real deployments
(a) 2020 US Census (Abowd, KDD 2018). All published statistical tables go through the TopDown algorithm (optimization + Gaussian noise, exponential mechanism for the invariants); direct motivation: reconstruction attacks on the 2010 census tabulations — an internal attack exactly reconstructed a substantial fraction of the individual records (on the order of half); per-domain public ε budget, intense public debates with demographers.
(b) Apple (2017–). “Learning with Privacy at Scale”: keyboard/emoji/QuickType telemetry in local DP (count-mean sketch + Hadamard); millions of devices, daily ε on the order of 4–8 per domain — an illustration of the “budget” that is spent every day.
(c) Google RAPPOR (Erlingsson et al., CCS 2014). First large academic-industry production of local DP; chain: signal (Bloom register) → permanent randomized response → instantaneous RR → cohorts; real discoveries (dominant Chrome settings).
Landmark 5.2 — Two families of attacks that motivate the guarantees
Membership inference (Shokri et al., IEEE S&P 2017). The adversary queries the model (confidences) and classifies “was in the train?”; AUC typically well above 0.5 on rare/atypical points — the risk grows with the model’s overconfidence: calibration (ch. 7) is also a defense.
Unintended memorization (Carlini et al., 2019 — “The Secret Sharer”). Insert a canary (“secret key”) into the train of a generator; exposure measured by the relative perplexity of the canary: LLMs memorize and exfiltrate verbatim sequences seen only once — a founding result for LLM privacy (ch. 11); follow-up: training extraction on GPT-2 by the same group (2021).
DP is the defense with a guarantee: an \varepsilon-DP mechanism bounds the membership likelihood ratio at e^{\varepsilon} (hence the AUC of any adversary); the private trained model remains useful (ch. 4) provided one pays in accuracy.
Regulation GDPR (anonymization “reasonably impossible to re-identify”): DP is the most accepted formal reading of this criterion; sectoral frameworks (health, banking) and emerging standards (NIST, ISO/IEC 27559).
For the engineer: keep a budget ledger (which query, which ε spent, which composition) as one keeps an incident log — the frameworks (OpenDP, Google DP library) enforce this discipline.
6. Uncertainty: sources and vocabulary
A medical classifier announces 0.97 confidence on a patient unlike any in its training set; without calibration or a coverage guarantee, the clinic cannot set the threshold below which the model should abstain. This chapter opens the second part of the module: it names the sources of such uncertainty and fixes the vocabulary of the guarantees we will prove.
Definition 6.1 — Aleatoric and epistemic uncertainty Aleatoric (data): the irreducible noise of generation — two patients identical on observed features, different outcomes; one can only measure it.
Epistemic (model): what the model ignores because it has not learned enough in that region — reducible by data; one can reduce it.
In heteroscedastic regression, y = f(x) + \nu(x)\,\xi with standard noise \xi: the noise level \nu(x) is aleatoric; the variance between models trained on resamples is epistemic (ch. 8 will make it operational via ensembles).
Distribution shift: a third source — the input leaves the training support; the model does not know that it does not know (ch. 9 provides a safety net; cf. MLOps ch. 5 for drift monitoring in production).
Definition 6.2 — The frequentist contract of calibration A probabilistic predictor \hat p(y \mid x) is calibrated if among all the times it announces 80%, the truth occurs ~80% of the time: \mathbb{P}\big(y = 1 \mid \hat p(x) = c\big) = c \qquad \text{for (almost) all } c \in [0, 1].
Calibrated ≠ accurate: always predicting the prevalence 0.3 is perfectly calibrated and useless; calibrated ≠ certain. Calibration is a decodability condition: without it, no threshold, cost, or action derived from the probabilities has the intended meaning.
The vocabulary of guarantees extends to sets: marginal coverage (ch. 9), conditional coverage (desired, imperfectly attainable), risk control (ch. 12).
Map of the UQ part
- Ch. 7: diagnosing (calibration, Brier).
- Ch. 8: two practical Bayesian answers (MC dropout, ensembles).
- Ch. 9: the distribution-free guarantee par excellence (conformal).
- Ch. 10: the “variable set size” version (quantiles).
- Ch. 11: the transport to LLMs.
- Ch. 12: decision-making arbitration (costs, abstention).
Philosophy of the module: UQ without a testable guarantee is an opinion.
7. Calibration: diagrams, ECE, Brier
Before correcting a model’s confidence, one must measure how wrong it is. This chapter gives the standard diagnostics — the reliability diagram, the expected calibration error and the Brier score — and the simplest fix, temperature scaling.
Definition 7.1 — Reliability diagram, bins, ECE Partition [0, 1] into B bins; bin b = predictions with mean confidence \mathrm{conf}_b, observed accuracy \mathrm{acc}_b, count n_b.
The reliability diagram plots \mathrm{acc}_b against \mathrm{conf}_b (the diagonal = perfect calibration); the expected calibration error: \mathrm{ECE} = \sum_{b=1}^{B} \frac{n_b}{n} \big| \mathrm{acc}_b - \mathrm{conf}_b \big|.
Precautions on binning: the partition influences the measure (10 bins is the de facto standard); kernel / isotonic-regression variants preferable in research (Naeini et al. 2015; see also the Machine Learning module ch. 4 for evaluation curves and 4.5 for Platt and isotonic calibration).
Example 7.2 — ECE computed by hand 100 binary predictions, 5 bins (mean confidences are given):
| Bin (confidence) | n_b | \mathrm{conf}_b | correct | \mathrm{acc}_b | \lvert \mathrm{acc}_b - \mathrm{conf}_b \rvert | contribution |
|---|---|---|---|---|---|---|
| [0.5, 0.6) | 10 | 0.55 | 5 | 0.50 | 0.05 | 0.005 |
| [0.6, 0.7) | 20 | 0.65 | 12 | 0.60 | 0.05 | 0.010 |
| [0.7, 0.8) | 30 | 0.75 | 20 | 0.667 | 0.083 | 0.025 |
| [0.8, 0.9) | 25 | 0.85 | 18 | 0.72 | 0.13 | 0.0325 |
| [0.9, 1.0] | 15 | 0.95 | 12 | 0.80 | 0.15 | 0.0225 |
\mathrm{ECE} = 0.005 + 0.010 + 0.025 + 0.0325 + 0.0225 = \mathbf{0.095}.
Global check: total accuracy 67/100 = 67\%, mean confidence \sum n_b\,\mathrm{conf}_b / n = 76.5\% — a gap of 9.5 points, consistent. The model is systematically overconfident by ~10 points, and the reliability diagram would be a curve below the diagonal bending downward.
This is the signature measured by Guo et al. (2017) on modern networks: more depth/capacity ⇒ more overconfidence, not less.
Definition 7.3 — Brier score and its decomposition (Brier 1950; Murphy 1973) \mathrm{BS} = \frac{1}{n}\sum_i (\hat p_i - y_i)^2, \qquad \text{decomposition:} \quad \mathrm{BS} = \underbrace{\text{reliability}}_{\text{calibration}} - \underbrace{\text{resolution}}_{\text{discrimination}} + \underbrace{\text{uncertainty}}_{\text{irreducible}}.
- the reliability term (the squared, weighted ECE): \sum_b \frac{n_b}{n}(\mathrm{conf}_b - \mathrm{acc}_b)^2;
- resolution measures the deviation of the \mathrm{acc}_b from the prevalence;
- uncertainty = \bar y (1 - \bar y) does not depend on the model.
BS rewards both calibration and discrimination — it is a quadratic Brier distance; not to be confused with the log-loss (cross-entropy), which infinitely punishes wrong certainties.
Example 7.4 — Brier computed, and the mirage of confidence Four predictions: (0.9, y{=}1), (0.9, y{=}1), (0.9, y{=}0), (0.3, y{=}1): \mathrm{BS} = \frac{0.1^2 + 0.1^2 + 0.9^2 + 0.7^2}{4} = \frac{0.01 + 0.01 + 0.81 + 0.49}{4} = 0.33. The constant predictor equal to the prevalence 3/4 = 0.75 achieves \mathrm{BS} = 0.75 \times 0.25 = 0.1875 < 0.33 . Without information, it is better to state the base rate than to assert 90% — exactly the problem of overenthusiastic models.
Procedure 7.5 — Temperature scaling (Guo, Pleiss, Sun, Weinberger, 2017) A single scalar T > 0 recalibrates the logits: \hat p_T(y \mid x) = \mathrm{softmax}(z/T), T fitted by NLL on a validation set (a 1D optimization — which does not change the argmax, hence not the accuracy).
Computed. Two classes, logits z = (4, 0):
- T = 1: \mathrm{softmax}(z) = (0.982, 0.018);
- T = 2: \mathrm{softmax}(2, 0) = (0.881, 0.119);
- T = 4: \mathrm{softmax}(1, 0) = (0.731, 0.269).
If the true frequency of class 1 in this neighborhood is ~75%, T \approx 4 is the right calibration — the ranking of the predictions is intact, only the confidence scale is corrected.
Limits: T is global, calibrated on a fixed distribution; local recalibration: isotonic, Platt per bin, or conformalized calibration (ch. 9-10).
import numpy as np
def ece(conf, y, bins=15):
edges = np.linspace(0, 1, bins + 1); idx = np.digitize(conf, edges[1:-1])
n = len(conf); total = 0.0
for b in range(bins):
m = idx == b
if m.sum() == 0: continue
total += (m.sum()/n) * abs(y[m].mean() - conf[m].mean())
return total
def fit_temperature(logits, y, grid=np.linspace(0.5, 10, 200)):
# NLL on validation, one dimension, non-parametric and sufficient for labs
best_T, best = 1.0, np.inf
for T in grid:
z = logits / T
p = np.exp(z - z.max(1, keepdims=True))
p /= p.sum(1, keepdims=True)
nll = -np.log(np.clip(p[np.arange(len(y)), y], 1e-12, None)).mean()
if nll < best: best, best_T = nll, T
return best_T8. Bayesian deep learning: MC dropout versus ensembles
Calibration corrects the confidence of one model, but a single model cannot tell what it has not learned. This chapter gives two practical ways of estimating that epistemic uncertainty — keeping dropout active at inference, and training an ensemble — and compares their costs.
Definition 8.1 — The Bayesian framework for networks A prior p(w) on the weights, a likelihood p(y \mid x, w); the predictive integrates epistemic uncertainty: p(y \mid x, \mathcal D) = \int p(y \mid x, w)\, p(w \mid \mathcal D)\, dw. The posterior p(w \mid \mathcal D) is intractable; the whole field is the art of approximating it without spending one’s life on it (variational inference, Laplace, sampling; cf. Refresher Statistics module ch. 8 for the Bayesian foundation).
Result 8.2 — MC dropout (Gal & Ghahramani, 2016) Train with dropout (Deep Learning module ch. 3) then, at inference, keep dropout active and average S forward passes: \hat p(y \mid x) = \frac{1}{S} \sum_{s=1}^{S} p(y \mid x, \hat w_s), \qquad \hat w_s \sim \text{dropout masks}.
Gal & Ghahramani show that this procedure is approximate variational inference (in a deep Gaussian process). The dropout masks define a Bernoulli variational distribution q(w) over the weights. The dropout loss with weight decay is, up to constants and scaling, the negative ELBO, so minimizing it minimizes the gap to the posterior
\mathrm{KL}\big(q(w) \,\|\, p(w \mid \mathcal D)\big) = \log p(\mathcal D) - \mathrm{ELBO}(q).
The spirit is that of the bootstrap (Statistics in Action ch. 8): an approximate justification for a massive procedure.
Cost: S forwards per example (typically S \in [10, 100]), zero retraining. The variance between passes measures the epistemic part.
Result 8.3 — Deep ensembles (Lakshminarayanan, Pritzel, Blundell, 2017) Train M independent networks (different initializations; option: adversarial training) and aggregate: average of the probabilities (classification), mixture of the predicted Gaussians (regression — the aggregated variance includes the dispersion of the means).
Bayesian position (Wilson & Izmailov, 2020): ensembles approximate the posterior in function space better than methods in weight space; pragmatic position: the most robust baseline of the field, at the price of M trainings.
Example 8.4 — Compared on the dimensions that matter
| Criterion | MC dropout | Deep ensembles |
|---|---|---|
| Training cost | 1× | M× (typically 5) |
| Inference cost | S forwards | M forwards |
| Epistemic out of distribution | correct, sometimes underestimated | good (diversity of minima) |
| Heteroscedastic aleatoric | if a variance head is added | native (mixture) |
| Out-of-distribution detection (OOD) | variance of the passes → score | disagreement between members → score |
| LLM scale | dropout already exists (reasonable) | prohibitive (but cf. snapshots/weight averaging) |
The famous “deep ensembles work better than one would expect from a Bayesian perspective” (a position defended by Lakshminarayanan et al.) and the counterpoint “ensembles ARE approximate Bayes model averaging” (Wilson & Izmailov): the disagreement is real.
Practice decides: with a free training compute budget, ensembles; otherwise MC dropout; and in all cases, evaluate the calibration (ch. 7) — not just the RMSE.
Usage warning These methods give uncertainties without guarantee: they can be silently overconfident out of distribution. Ch. 9 brings the distribution-free corrective; the typical modern combination: ensembles for diversity + conformal for the coverage guarantee.
9. Conformal prediction: theorem and algorithm
Question: can we build prediction sets with coverage guaranteed without any distributional assumption? Answer (Vovk): yes, provided one has exchangeable data and accepts marginal coverage. This is the most useful result of the UQ part.
Definition 9.1 — Non-conformity scores and exchangeability Any score s(x, y) (small = conforming): for classification, s = 1 - \hat p(y \mid x) (softmax of the true class); for regression, s = |y - \hat f(x)|.
The data Z_1, \dots, Z_n, Z_{n+1} are exchangeable if their joint law is invariant under permutation (i.i.d. ⇒ exchangeable; cf. Statistics in Action ch. 11 for the de Finetti connection — exchangeability, not i.i.d., is the true foundation).
Split conformal: split into train (the model learns) and calibration (the scores, never seen by the model).
Theorem 9.2 — Exact marginal coverage (proved) Let s_1, \dots, s_n be the calibration scores and s_{\text{new}} the score of a new pair, exchangeable at (n+1) with continuous values.
For \alpha \in (0, 1), set k = \lceil (n+1)(1 - \alpha) \rceil and let \hat q be the k-th smallest calibration score. Then \mathbb{P}\big( s_{\text{new}} \leq \hat q \big) \;\geq\; 1 - \alpha \qquad \text{(exactly } k/(n+1) \text{ for continuous scores).}
Proof. By exchangeability, the rank of s_{\text{new}} in the multiset \{s_1, \dots, s_n, s_{\text{new}}\} is uniform over \{1, \dots, n+1\}.
Justification: for every permutation \pi of \{1, \dots, n+1\}, the law of (Z_{\pi(1)}, \dots, Z_{\pi(n+1)}) is that of (Z_1, \dots, Z_{n+1}).
The event “the rank of the last coordinate equals r” is the image by permutation of “the rank equals r'” for all r, r' — same probability, and the sum of the n+1 probabilities equals 1: each equals 1/(n+1).
With continuous scores, ties are almost surely absent, and the event \{s_{\text{new}} \leq \hat q\} is exactly \{\text{rank} \leq k\}, of probability \frac{k}{n+1} \geq 1 - \alpha by definition of k. By exchanging the roles of the n+1 positions, no asymptotic result is used: the guarantee is finite-sample.
With ties, taking \hat q as the k-th smallest value counting strictly keeps the event \{s_{\text{new}} < \hat q\} \cup \{s_{\text{new}} = \hat q\} of probability \geq k/(n+1) — the bound survives. ∎
Key result — split conformal coverage k = \lceil (n+1)(1 - \alpha) \rceil, \qquad \hat q = s_{(k)}, \qquad \mathbb{P}\big( s_{\text{new}} \leq \hat q \big) \geq 1 - \alpha
Example 9.3 — Split conformal, algorithm and worked example Algorithm.
- train \hat f on the train set;
- compute the scores s_i on the n calibration points;
- k = \lceil (n+1)(1-\alpha) \rceil, \hat q = k-th smallest score;
- predict, for a new x, the set C(x) = \{y : s(x, y) \leq \hat q\} — in regression: [\hat f(x) - \hat q, \hat f(x) + \hat q].
Example (regression). n = 9, \alpha = 0.1 ⇒ k = \lceil 10 \times 0.9 \rceil = 9. Absolute calibration residuals: 0.02 · 0.05 · 0.08 · 0.11 · 0.14 · 0.19 · 0.25 · 0.34 · 0.51 — the 9th (largest) is \hat q = 0.51. The prediction for any new x is \hat f(x) \pm 0.51, \qquad \mathbb{P}(\text{cover}) \geq 90\% — exactly 9/10 = 90\% if the future residuals resemble the calibration ones.
Classification: same steps with s = 1 - \hat p(\text{candidate predicted class}); the set C(x) contains the classes with sufficient softmax. Typical size 1 where the model is confident, 2-3 at the boundaries — the map of set sizes is a free ambiguity detector.
Effect of n: \hat q is the empirical (1-\alpha)-quantile with the finite-sample correction \lceil(n+1)(1-\alpha)\rceil; the +1 counts the new point, which is the (n+1)-th member of the exchangeable sample.
When \alpha < 1/(n+1), k exceeds n (e.g. \alpha = 0.1, n = 5): k = \lceil 5.4 \rceil = 6 > n ; the set is then all of \mathbb R — the algorithm honestly admits its ignorance.
import numpy as np
from sklearn.linear_model import LinearRegression
rng = np.random.default_rng(1)
n_tr, n_cal, n_te, alpha = 2000, 3000, 5000, 0.1
X = rng.uniform(-2, 2, size=(n_tr + n_cal + n_te, 1))
y = 2 * X[:, 0] + rng.normal(0, 1, len(X)) # toy i.i.d. data
X_tr, X_cal, X_te = np.split(X, [n_tr, n_tr + n_cal]) # exchangeable split
y_tr, y_cal, y_te = np.split(y, [n_tr, n_tr + n_cal])
model = LinearRegression().fit(X_tr, y_tr) # never the calibration set
s_cal = np.abs(y_cal - model.predict(X_cal)) # non-conformity scores
k = int(np.ceil((n_cal + 1) * (1 - alpha))) # 9 for n=9; 2701 for n=3000
qhat = np.sort(s_cal)[k - 1]
lo, hi = model.predict(X_te) - qhat, model.predict(X_te) + qhat
# empirical check of the coverage (exercise 7): it fluctuates around 0.90,
# since the guarantee holds on average over the calibration draw
cov = ((y_te >= lo) & (y_te <= hi)).mean()
print(f"qhat = {qhat:.3f}, observed coverage = {cov:.3f} (target >= {1-alpha})")What the theorem says — and does not say Coverage is marginal: on average over the draws of the calibration set and of new pairs.
It can be uneven across groups (conditional coverage); extensions (Mondrian conformal: per-stratum coverage; weighted conformal: known covariate shift) handle structured cases.
The train/calibration swap costs data; CV+/jackknife+ variants when n is scarce. Internal link: the Statistics in Action module ch. 8 applies the same “empirical quantile + finite-sample correction” logic to bootstrap intervals.
10. Quantile and conformalized regression
Split conformal regression returns intervals of the same width everywhere, even where the noise is small. This chapter makes the width adapt to the input by learning conditional quantiles, then restores the finite-sample guarantee by conformalizing them.
Definition 10.1 — Distributional quantile, quantile regression, pinball loss (Koenker & Bassett, 1978) The quantile q_\tau(x) of Y \mid X = x satisfies \mathbb P(Y \leq q_\tau(x) \mid x) = \tau. One estimates it by minimizing the pinball loss: \ell_\tau(y, \hat q) = \begin{cases} \tau\,(y - \hat q) & y \geq \hat q \\ (1 - \tau)\,(\hat q - y) & y < \hat q \end{cases} \qquad \text{(subgradients } \in [\tau - 1, \tau]\text{)}.
This is a convex problem (a linear program for the linear model; gradient descent for networks).
Training two heads \hat q_{\text{lo}} = \hat q_{\alpha/2}, \hat q_{\text{hi}} = \hat q_{1 - \alpha/2} gives an adaptive prediction band — wide where the data are dispersed (heteroscedastic aleatoric, ch. 6). Without an exact coverage guarantee, however: the learned quantiles are optimistic on the train set.
Theorem 10.2 — Conformalized Quantile Regression (Romano, Patterson, Candès, 2019) Non-conformity score on calibration: s_i = \max\big( \hat q_{\text{lo}}(x_i) - y_i,\; y_i - \hat q_{\text{hi}}(x_i) \big). Taking \hat q = the \lceil(n+1)(1-\alpha)\rceil-th smallest score, the band C(x) = \big[ \hat q_{\text{lo}}(x) - \hat q,\; \hat q_{\text{hi}}(x) + \hat q \big] has coverage \geq 1 - \alpha in finite samples (thm 9.2), and inherits the adaptivity of the learned quantiles: the bands vary with x.
In short: CQR = quantiles (local shape) + conformal (global guarantee) — the dominant recipe in practice.
Example 10.3 — CQR on a synthetic case, verified y = 2x + \sin(2x)\, (1 + 0.5x)\,\xi, \quad \xi \sim \mathcal N(0, 1) \qquad \text{(increasing variance)}. In the lab:
- a two-head pinball network (\tau \in \{0.05, 0.95\});
- 1000 calibration points, scores s_i;
- \hat q \approx corrected empirical quantile;
- over 100 repetitions, mean coverage 89.8% (target 90%), bands ~3× narrower than the constant-residual split conformal in calm regions — the “hourglass” plot of the bands flaring at large x is the visual deliverable of the lab (exercise 8).
11. UQ for LLMs
LLMs add three difficulties to the calibration problem: the output space is combinatorial (sequences, not classes); RLHF training seems to degrade verbal calibration; and generative use (a written answer) does not naturally expose token probabilities.
The M2 module Explainability, Security, Privacy of LLMs continues this part on the security and privacy side (jailbreaks ch. 5, memorization and training extraction ch. 7, membership inference and DP of LLMs ch. 8); cf. also the Large Language Models module, ch. 9 (hallucination, abstention).
Definition 11.1 — Verbalized confidence Ask the model for its confidence in words: “What’s the probability that your answer is correct? Answer with a number in [0, 100]” (Lin, Hilton, Evans, 2022).
On pre-trained models (GPT-3 on trivia), verbalized confidence is fairly well calibrated — the model has absorbed the calibration of its pre-training log-loss.
But: Tian et al. (2023, “Just Ask for Calibration”) show that aligned (RLHF) models are clearly overconfident and not very sensitive to the wording; Xiong et al. (2024) confirm the systematic overconfidence and the massive influence of the prompt (chain-of-thought, multiple choice), with calibration gaps depending on the format of several tens of ECE points.
Definition 11.2 — Three native sources of generative uncertainty
Token logprobs: entropy of the distribution of the next token, or sequence probability (product); biased (length, temperature); local calibration per bin (as in ch. 7) on a labeled set.
Self-consistency: sample K trajectories (temperature > 0) and measure agreement: the frequency of the majority answer is a proxy for confidence (direct link with the ensemble diversity of ch. 8 — prediction averaging vs variance).
Kuhn, Gal, Farquhar (2023) refine this into semantic entropy. Two sampled answers fall in the same cluster when a natural-language-inference (NLI) model predicts that each entails the other (bidirectional entailment): “Paris”, “paris” and “the capital of France” are one answer for the user. With clusters c and p(c \mid x) the total probability of the answers in c,
\mathrm{SE}(x) = -\sum_{c} p(c \mid x)\,\log p(c \mid x).
In practice p(c \mid x) is estimated by the fraction of the K samples that fall in c (Farquhar et al., 2024). It separates semantic uncertainty (is the answer determined?) from lexical uncertainty (how is it worded?).
Computed. K = 10 answers form clusters of sizes 6, 3 and 1:
\mathrm{SE} = -(0.6 \ln 0.6 + 0.3 \ln 0.3 + 0.1 \ln 0.1) \approx 0.90 \text{ nats}.
Counting the six distinct strings as separate answers (sizes 3, 2, 1 in the first cluster, 2, 1 in the second, 1 in the third) would give about 1.70 nats: rewordings inflate the naive entropy.
Generative conformal: apply ch. 9 to scores (negative sequence logprob, semantic conformity): response sets with guaranteed coverage — the loop is closed with distribution-free methods.
Conformal abstention. Answer only when the conformal set is a single semantic cluster, and otherwise defer to a human or to retrieval (ch. 12). This is the policy of the Year 2 capstone Y2.1 (GraphRAG with calibrated abstention).
The privacy wall on the LLM side LLMs memorize (ch. 5, Secret Sharer); DP-SGD at the scale of 10¹¹ parameters still costs too much utility for general-purpose pre-training.
Current industrial leads: DP-SGD on the alignment phases (the most sensitive data), private RAG (the data stay server-side with per-query budgets), federated learning + DP (cf. Emerging ML module ch. 3), and the systematic evaluation of extraction (canaries). An open topic — precisely the crossroads targeted by this module.
12. Applications: deciding under uncertainty
A probability, an interval or a privacy budget is only useful once it drives a decision: treat or not, raise an alert, abstain and hand over to a human. This chapter turns the guarantees of the module into decision rules.
Example 12.1 — Medicine: calibration as a condition of care A risk model announcing “30% complications” triggers a costly protocol: if the patients announced at 30% actually suffer complications 45% of the time (the risk is underestimated), we undertreat; if they suffer them 15% of the time (the risk is overestimated), we overtreat — both harm patients.
Van Calster et al. (2019) document the chronic miscalibration of published clinical models and call it the “Achilles heel of predictive analytics”.
Remedy: mandatory reliability diagrams (ch. 7), recalibration (temperature/isotonic), and for binary decisions: thresholds derived from utility (FN cost / FP cost), not raw probabilities.
Definition 12.2 — Expected-utility decision, abstention, risk control With costs c_{\text{FP}}, c_{\text{FN}}, the optimal classifier will predict 1 only if \hat p \geq c_{\text{FP}} / (c_{\text{FP}} + c_{\text{FN}}) — an exact formula if \hat p is calibrated (ch. 6). Hence the sequence of the module: calibrate (7), aggregate the sources (8-10), then decide.
Selective abstention: the model may answer “I don’t know” when the conformal set has more than one element (or more than a budget of m elements) or the CQR band is wider than a business threshold (delegation to a human); the risk-coverage curve is plotted in the lab.
Conformal risk control (Angelopoulos, Bates, Fisch, Lei, Schuster, 2022) chooses the threshold itself on a calibration set to control an expectation. Take losses L_i(\lambda) \in [0, B], non-increasing in \lambda (e.g. the fraction of missed findings), with empirical mean \hat R_n(\lambda), and set \hat\lambda = \inf\Big\{\lambda : \frac{n}{n+1}\hat R_n(\lambda) + \frac{B}{n+1} \leq \alpha\Big\}, \qquad \text{then } \mathbb{E}\big[L_{n+1}(\hat\lambda)\big] \leq \alpha. With the miscoverage loss and B = 1, this is exactly the quantile of ch. 9.
Learn then Test (Angelopoulos, Bates, Candès, Jordan, Lei, 2021) gives a high-probability guarantee for any risk, monotone or not. It tests H_\lambda : R(\lambda) > \alpha for each candidate \lambda with a p-value (e.g. from Hoeffding), keeps the rejected ones under a family-wise error correction, and ensures R(\hat\lambda) \leq \alpha with probability \geq 1 - \delta.
These are the final building blocks of the “guarantee” chain.
Example 12.3 — Industrial assembly table
| Business need | Required guarantee | Tool of the module |
|---|---|---|
| Publish stats without re-identification | controlled ε budget | ch. 1–3 (mechanisms, RDP composition) |
| Train on customer data | formal privacy of the model | ch. 4 (DP-SGD + accountant) |
| Sort alerts | honest confidence ordering | ch. 7 (calibration, Brier) |
| Per-point forecast intervals | guaranteed 90% coverage | ch. 9–10 (conformal, CQR) |
| Delegate hard cases to a human | error rate of the subset | ch. 12 (selective prediction, LTT) |
| LLM in production | confidence of the answers | ch. 11 (semantic, generative conformal) |
Position in the master: this module is the “guarantees” foundation of M2. The Large Language Models module deepens evaluation (ch. 9), and Explainability, Security, Privacy of LLMs covers the security side.
On graphs. No other module of these notes treats uncertainty on graphs, so here is the transfer. MC dropout on a GNN keeps dropout active in message passing and averages S passes per node; a deep ensemble trains M GNNs. Split conformal for node classification calibrates on held-out labelled nodes. It stays valid in the transductive setting when calibration and test nodes form a random split and training never sees their labels (Huang, Jin, Candès, Leskovec, 2023). Solo project 2 below tests this.
Exercises
★ Laplace mechanism.
Re-prove thm 2.1 for k = 1.
Counting with ε = ln 20: probability of an error ≥ 2? ≥ 5?
50-bin histogram, total ε = 1; distribute the noise (composition) and compare the mean squared error with the vector Laplace mechanism in a single query.
★ Local DP.
Prove the debiasing formula 4.2 and its variance factor.
In RAPPOR with 128 bits, 2 successive RRs: what ε per bit?
Sizing: precision of ±2 points on a proportion, p = 0.75 — how many users?
★ Calibration.
Recompute the ECE 7.2 with 10 equal-width bins and comment on the sensitivity.
Implement the reliability diagram.
Temperature scaling on CIFAR-10 (ResNet): ECE before/after, NLL before/after, accuracy unchanged?
Show that the constant 0.75 beats the classifier of example 7.4 in both Brier score and log-loss (about 0.56 against 0.93 nats). Then replace the wrong prediction (0.9, y{=}0) by (1.0, y{=}0): which score stays finite, and which one punishes the wrong certainty without bound?
★★ Composition.
Redo the computation 3.4 for \sigma = 12, k = 256, \delta = 10^{-5}.
Inverse: what \sigma for k = 10^4 DP-SGD steps, ε = 2, δ = 10⁻⁵, q = 0.01 (approximation without amplification, then with the q^2 factor)?
Show that RDP composition at fixed \alpha is exact for Gaussians (direct computation of the Rényi divergence of a product).
★★ DP-SGD. On MNIST: implement per-example clipping + noise (numpy or Opacus), plot accuracy vs ε for σ ∈ {0, 0.5, 1, 2}, comment on the frontier; ablation on C (0.1 to 10); verify that without clipping the mechanism is no longer DP.
★★ MC dropout versus ensembles. 1D heteroscedastic regression: train
one network + MC dropout (S = 50 passes);
5 networks (deep ensemble); compare NLL, RMSE, coverage of the bands at ±2 predicted standard deviations;
test both out of distribution (extrapolation);
compare training and inference times, and conclude in a budget-constrained situation.
★★ Conformal.
Re-prove the uniformity of the rank with ties (convention of thm 9.2).
Empirically verify the coverage over 1000 repetitions (n = 1000, α = 0.1): histogram of the coverages — what happens if the data are not exchangeable (drift)?
Effect of the calibration size: n \in \{20, 100, 1000\};
implement per-class Mondrian and measure the coverage inequality across classes.
★★ CQR. Reproduce example 10.3; compare the mean widths CQR vs constant split conformal; what happens if the two quantile heads cross (lo > hi)? Fix it (monotonicity constraint or sorting).
★★ Decision. Screening: prevalence 5%, costs c_{FP} = 1, c_{FN} = 20.
Optimal threshold on calibrated probabilities.
Re-derive with probabilities overconfident by 10 points — quantify the cost of miscalibration.
Add the abstention option with a delegation cost; plot risk-coverage.
★★★ LLM UQ.
On 100 trivia questions: verbalized confidence vs actual frequency — plot the reliability diagram.
Self-consistency K = 10: correlation between agreement and correctness.
Group the answers semantically (by hand or NLI) and compare lexical vs semantic entropy.
At small scale: build a conformal set of answers and measure the coverage.
★★★ Project. Complete “privacy + UQ” pipeline: a sensitive dataset (e.g. Adult):
- publish useful statistics under budget ε = 2 (mechanisms, composition);
- train a private predictive model (DP-SGD);
- calibrate and conformalize its outputs;
- write the guarantee sheet (ε, δ, neighbour convention and accountant; coverage level and calibration-set size; ECE before and after; the exchangeability assumption and what would break it) and the limitations discussion.
Grading: 30% privacy, 30% UQ, 20% empirical validation, 20% sheet and honesty about the limits.
This guarantee sheet is the format required by the trust work package of every Year 2 transverse project (projects page).
Projects and assessment
The fiche of this module displays no assessment: its 2026–2027 SynapseS description is not published (see the table of the introduction). Everything below is therefore a proposal: the written exam is a mock final, and the projects are practice that an instructor may adopt as continuous assessment. Every subject exercises objective O8 (trustworthy AI: privacy and uncertainty guarantees) and O7 (hands-on practice: audited pipelines); the graph subjects add O4 and the RAG subject adds O3.
Each project report includes the guarantee sheet of Ex. 11, which is also the format of the trust work package of the Year 2 transverse projects: Y2.1 (conformal abstention), Y2.2 (conformal under shift) and Y2.5 (privacy and calibration of fraud alerts).
Solo projects
- [Solo · ≈ 20 h] Paper study: an RDP accountant from scratch (Mironov, 2017; Mironov, Talwar and Zhang, 2019). Question: how much do Rényi DP and subsampling save over advanced composition, and does a short NumPy accountant agree with a production one?
- Implement the Gaussian RDP curve, additive composition and the conversion to (\varepsilon, \delta) over a grid of orders (Definition 3.3). Then add the RDP of the sampled Gaussian mechanism of Mironov, Talwar and Zhang, a binomial sum for integer orders (ch. 3, 4).
- Reproduce Example 3.4, Proposition 4.4 and Ex. 4b. Cross-check against the RDP accountant of Opacus, with the same integer orders, for q \in \{0.001, 0.01, 0.1\} and \sigma \in \{0.5, 1, 2\}, up to 10^4 steps. No data is needed.
- Opacus converts RDP to (\varepsilon, \delta) with the slightly tighter formula of Balle, Barthe, Gaboardi, Hsu and Sato (2020), not with that of Definition 3.3: implement both and report the gap.
- Deliverables: code with unit tests, a 4–6 page report with curves of \varepsilon against the number of steps, a 10-minute talk. Success: the RDP curve, and \varepsilon under the same conversion, within 1 % of Opacus on the whole grid; \varepsilon^* \approx 5.75 in Example 3.4 with the conversion of Definition 3.3.
- [Solo · ≈ 25 h] Conformal prediction for GNN node classification. Question: does split conformal keep its 90 % coverage on a citation graph, where the nodes are linked rather than i.i.d.? The subject connects this module to Graph ML and Advanced GNN.
- Train a two-layer GCN (Kipf and Welling, 2017; Graph ML ch. 5) on Cora and PubMed, with the Planetoid splits of PyTorch Geometric. Calibrate on held-out labelled nodes: split conformal with the score of Definition 9.1, then per-class Mondrian conformal (ch. 9).
- Compare with naive sets that keep the most probable classes of an MC-dropout average (S = 50 passes) or of a 5-GCN ensemble until their mass reaches 90 % (ch. 8). Reproduce the split-conformal baseline of Huang, Jin, Candès and Leskovec (2023).
- Break exchangeability on purpose: calibrate on high-degree nodes only, or on one community, and relate the coverage loss to the homophily of the test nodes (ch. 12, “On graphs”).
- Deliverables: code, a 4–6 page report, a 10-minute talk. Success: mean coverage within one point of 90 % over 50 random calibration/test splits, with the per-class gaps and the shift experiment reported with intervals.
- [Solo · ≈ 20 h] Edge-level versus node-level DP for graph statistics. Question: what does it cost to protect a person rather than one of their friendships? The subject applies ch. 1–3 to the graph setting of Advanced GNN 7.4.
- Derive the sensitivities (Definition 1.3) of the edge count, the degree histogram and the triangle count, under edge neighbours and under node neighbours. For node-DP, first project the graph to a maximum degree D, and bound how much one node can change the projected graph: this is the subtle step.
- Release the statistics with the Laplace and Gaussian mechanisms (ch. 2), and an edge-DP top-10 of the highest-degree nodes with the exponential mechanism. Keep the whole budget ledger with RDP composition (ch. 3).
- Data: the ego-Facebook and ca-GrQc graphs of SNAP (Leskovec and Krevl, 2014).
- Deliverables: code, a 4–6 page report, a 10-minute talk. Success: curves of relative error for \varepsilon from 0.1 to 10 under both neighbour notions, the gap explained by the ratio of sensitivities, and a justified choice of D.
Group projects
- [Group of 3 · ≈ 30 h each] A private and calibrated readmission model. Question: can one hospital model be private, calibrated and covered at once, and what does each guarantee cost? The subject extends Ex. 11 to the Diabetes 130-US hospitals data (Strack and coauthors, 2014; UCI repository, about 100,000 encounters).
- Member 1: privacy — the privacy unit is the patient, so keep one encounter per patient (about 70,000 rows, as in Strack and coauthors) and row-level DP then protects patients (Definition 1.1). Cohort statistics under a budget \varepsilon = 1 with a budget ledger (ch. 1–3); DP-SGD with Opacus for \varepsilon \in \{1, 3, 8\} and \delta = 10^{-6} (ch. 4).
- Member 2: attack — a loss-threshold attack and a shadow-model membership inference (ch. 5; Security & Robustness Def. 8.3), before and after DP, reported as the true-positive rate at 1 % false positives.
- Member 3: uncertainty and decision — temperature scaling and ECE (ch. 7), conformal sets for readmission and CQR intervals for the length of stay (ch. 9–10), a cost-sensitive threshold with abstention to a clinician (ch. 12).
- Deliverables: code, a 6–8 page report, the guarantee sheet of Ex. 11, a 15-minute talk. Success: a privacy–utility–coverage frontier over the three budgets, an attack advantage that shrinks with \varepsilon, and coverage within one point of 90 % on held-out patients.
- [Group of 3 · ≈ 30 h each] An abstaining RAG assistant with semantic uncertainty. Question: can a retrieval-augmented LLM tell when not to answer, with a guarantee on the errors of what it does answer? The subject connects this module to Large Language Models ch. 7 and 9, and prepares Y2.1.
- Data and models: TriviaQA (Joshi, Choi, Weld and Zettlemoyer, 2017), with its Wikipedia evidence documents as the retrieval corpus. Kuhn, Gal and Farquhar (2023) used the closed-book setting, which is the no-retrieval baseline here. Use an open instruction model of 1–3 B parameters on a free GPU, and an NLI model for entailment, DeBERTa-large fine-tuned on MNLI as in that paper.
- Member 1: the RAG pipeline (BM25 and a dense retriever), K = 10 sampled answers per question, verbalized confidence (Definition 11.1), correctness by exact match.
- Member 2: uncertainty scores — token log-probability, self-consistency and semantic entropy with bidirectional entailment (Definition 11.2); AUROC for correctness and ECE (ch. 7).
- Member 3: abstention — a threshold chosen on 500 calibration questions by conformal risk control (Definition 12.2), with the loss “answered and wrong” at \alpha = 0.1; the risk–coverage curve; 20 canary strings planted in the document store and an extraction test (ch. 5).
- Deliverables: code, a 6–8 page report with the guarantee sheet, a 15-minute talk. Success: over 20 random calibration/test splits, the mean rate of answered-and-wrong questions stays at or below 10 %; the AUROC of semantic and lexical entropy is reported with intervals, with and without retrieval; canary leakage is measured.
- [Group of 3 · ≈ 30 h each] Paper study: conformal fraud alerts under drift on the Elliptic graph (Weber and coauthors, 2019). Question: does a coverage guarantee survive a regime shift in a transaction graph, and what restores it? The subject prepares Y2.5 and uses the drift monitoring of MLOps ch. 5.
- Member 1: models — reproduce the temporal split of the paper (train on time steps 1–34, test on 35–49) with a random forest and a GCN (Graph ML ch. 5); calibrate both (ch. 7).
- Member 2: guarantees over time — split conformal alert sets calibrated on the last training steps; the coverage per time step through the dark-market shutdown that the paper reports near step 43; recalibration on a rolling window, and Mondrian conformal per class (ch. 9).
- Member 3: decisions — a cost-sensitive alert threshold under a budget of analyst reviews per time step, abstention to the analyst, and the risk–coverage curve (ch. 12).
- Deliverables: code, a 6–8 page report with the guarantee sheet, a 15-minute talk. Success: the illicit-class F1 of the paper is reproduced within a few points, the coverage drop after the shift is measured, and the report says how much the rolling window recovers and at what cost in set size.
Written exam (proposal)
Format: 2 hours, one handwritten A4 sheet allowed, a non-programmable calculator, four questions. The fiche displays no exam, so this is a mock.
Question (4 points). (a) State \varepsilon-DP with the neighbour convention of this page, and the post-processing property. Why may a model trained with DP-SGD be published with all its weights? (b) Distinguish aleatoric and epistemic uncertainty, and say which of the two the variance between MC-dropout passes estimates. (c) What does the split conformal guarantee promise, and what does it not promise? Give one deployment in which it fails.
Expected: (a) Definition 1.1 with add/remove neighbours, and Proposition 1.2(1). The weights are a post-processing of the noised gradients, whose whole sequence is (\varepsilon, \delta)-DP by composition and amplification (ch. 3–4). (b) Definition 6.1; the variance between passes is the epistemic part (Result 8.2).
- Marginal coverage of at least 1 - \alpha, on average over the calibration draw and the new point (Theorem 9.2). It promises nothing per group or per input. It fails without exchangeability: calibration in one hospital and deployment in another, or after a drift.
Question (5 points). (a) A counting query is released with the Laplace mechanism at \varepsilon = 0.5. Give the noise scale and the probability of an error of at least 4. (b) A Gaussian counting query is released 100 times with \sigma = 10\,\Delta_2. With \delta = 10^{-5}, compute the RDP account and its optimal order. (c) An \varepsilon = 2 mechanism runs on a Poisson subsample with q = 0.02. What is its guarantee?
Expected: (a) the scale is b = 1/\varepsilon = 2 and \mathbb P(|Z| \geq 4) = e^{-2} \approx 0.135 (Theorem 2.1). (b) Each release is (\alpha, \alpha/200)-RDP, and the 100 releases compose into (\alpha, \alpha/2)-RDP (Definition 3.3). The conversion gives \varepsilon(\alpha) = \frac{\alpha}{2} + \frac{\ln 10^5}{\alpha - 1}, minimal at \alpha - 1 = \sqrt{2 \ln 10^5} \approx 4.8, where \varepsilon \approx 2.90 + 2.40 = 5.3; advanced composition would give about 53. (c) By Proposition 4.4, \varepsilon' = \ln(1 + 0.02\,(e^2 - 1)) \approx 0.12.
Question (5 points). Let the scores s_1, \dots, s_{n+1} be exchangeable with no ties, and let \hat q be the k-th smallest of the first n, where k = \lceil (n+1)(1-\alpha) \rceil \leq n.
- Prove that \mathbb P(s_{n+1} \leq \hat q) = k/(n+1). (b) Deduce that the coverage lies between 1 - \alpha and 1 - \alpha + 1/(n+1). (c) Give k and the coverage when (n, \alpha) = (19, 0.1). What happens with eight calibration points?
Expected: (a) by exchangeability, the rank of s_{n+1} among the n+1 scores is uniform on \{1, \dots, n+1\}, and the event \{s_{n+1} \leq \hat q\} is “this rank is at most k” (Theorem 9.2).
By definition of the ceiling, (n+1)(1-\alpha) \;\leq\; k \;<\; (n+1)(1-\alpha) + 1; divide by n+1.
Then k = 18 and the coverage is exactly 18/20 = 0.90. With eight points, k = \lceil 8.1 \rceil = 9 exceeds n, and the set is the whole output space (Example 9.3).
Question (6 points). A binary model outputs the logits z = (3, 0), for classes 1 and 0, on a group of patients, 70 % of whom have class 1. (a) Compute the announced probability of class 1, and the temperature that calibrates it on this group. (b) Prove that, for calibrated probabilities and costs c_{\text{FP}}, c_{\text{FN}}, predicting 1 minimizes the expected cost exactly when \hat p \;\geq\; \frac{c_{\text{FP}}}{c_{\text{FP}} + c_{\text{FN}}}.
- Predicting 1 triggers a costly protocol, with c_{\text{FP}} = 3 and c_{\text{FN}} = 1. Compare the decisions and expected costs before and after calibration.
Expected: (a) at T = 1, \hat p = 1/(1 + e^{-3}) \approx 0.95. Calibration asks 1/(1 + e^{-3/T}) = 0.7, so T = 3/\ln(7/3) \approx 3.5 (Procedure 7.5).
Predicting 1 costs c_{\text{FP}}(1 - \hat p) on average, predicting 0 costs c_{\text{FN}}\,\hat p; the first is smaller exactly above the threshold (Definition 12.2).
The threshold is 3/4. Before calibration, 0.95 \geq 0.75: the model treats everyone, at an expected cost of 3 \times 0.3 = 0.9 per patient. After calibration, 0.7 < 0.75: it treats no one, at a cost of 1 \times 0.7 = 0.7. Miscalibration costs 0.2 per patient.
Grading rubric (proposal)
| Criterion | Weight | What earns the marks |
|---|---|---|
| Correctness of the guarantees | 30 % | every \varepsilon, \delta and coverage level follows from a stated result of the chapters, with its assumptions checked: neighbour convention, accountant, exchangeability |
| Empirical validation | 25 % | coverage and calibration measured over repeated splits with intervals; privacy audited by an attack, not only declared |
| Guarantee sheet and limits | 15 % | the sheet of Ex. 11 is complete, and the report says what would break each guarantee |
| Code and reproducibility | 15 % | one script reruns every number of the report from public data with fixed seeds; the privacy ledger is logged |
| Report and talk | 15 % | a clear question, real references, figures that make the point, precise answers to questions |
References
- C. Dwork, F. McSherry, K. Nissim, A. Smith, “Calibrating Noise to Sensitivity in Private Data Analysis”, TCC 2006 — the founding act.
- C. Dwork, A. Roth, “The Algorithmic Foundations of Differential Privacy”, Foundations and Trends in Theoretical Computer Science 9, 2014 — the handbook.
- C. Dwork, G. Rothblum, S. Vadhan, “Boosting and Differential Privacy”, FOCS 2010 — advanced composition.
- I. Mironov, “Rényi Differential Privacy”, CSF 2017 — arXiv:1702.07476.
- M. Bun, T. Steinke, “Concentrated Differential Privacy: Simplifications, Extensions, and Lower Bounds”, TCC 2016.
- Y.-X. Wang, B. Balle, S. Kasiviswanathan, “Subsampled Rényi Differential Privacy and Analytical Moments Accountant”, AISTATS 2019 — arXiv:1808.00087.
- M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, L. Zhang, “Deep Learning with Differential Privacy”, CCS 2016 — arXiv:1607.00133 (DP-SGD, moments accountant).
- Ú. Erlingsson, V. Pihur, A. Korolova, “RAPPOR: Randomized Aggregatable Privacy-Preserving Ordinal Response”, CCS 2014 — arXiv:1407.6981.
- S. Warner, “Randomized Response: A Survey Technique for Eliminating Evasive Answer Bias”, JASA 60, 1965.
- A. Evfimievski et al., “Limiting Privacy Breaches in Privacy Preserving Data Mining”, PODS 2003 — modern randomized response, local DP.
- J. Abowd, “The U.S. Census Bureau Adopts Differential Privacy”, KDD 2018.
- Apple Differential Privacy Team, “Learning with Privacy at Scale”, Apple Machine Learning Journal 1(8), 2017.
- R. Shokri, M. Stronati, C. Song, V. Shmatikov, “Membership Inference Attacks Against Machine Learning Models”, IEEE S&P 2017.
- N. Carlini, C. Liu, Ú. Erlingsson, J. Kos, D. Song, “The Secret Sharer: Evaluating and Testing Unintended Memorization in Neural Networks”, USENIX Security 2019 — arXiv:1802.08232.
- G. Brier, “Verification of Forecasts Expressed in Terms of Probability”, Monthly Weather Review 78, 1950; A. Murphy, “A New Vector Partition of the Probability Score”, J. Applied Meteorology 10, 1973.
- M. P. Naeini, G. F. Cooper, M. Hauskrecht, “Obtaining Well Calibrated Probabilities Using Bayesian Binning”, AAAI 2015.
- C. Guo, G. Pleiss, Y. Sun, K. Q. Weinberger, “On Calibration of Modern Neural Networks”, ICML 2017 — arXiv:1706.04599.
- B. Lakshminarayanan, A. Pritzel, C. Blundell, “Simple and Scalable Predictive Uncertainty Estimation using Deep Ensembles”, NeurIPS 2017 — arXiv:1612.01474.
- Y. Gal, Z. Ghahramani, “Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning”, ICML 2016 — arXiv:1506.02142.
- A. G. Wilson, P. Izmailov, “Bayesian Deep Learning and a Probabilistic Perspective of Generalization”, NeurIPS 2020 — arXiv:2002.08791.
- V. Vovk, A. Gammerman, G. Shafer, Algorithmic Learning in a Random World, Springer, 2005 (2nd ed. 2022) — the founding book of conformal prediction.
- J. Lei, M. G’Sell, A. Rinaldo, R. Tibshirani, L. Wasserman, “Distribution-Free Predictive Inference for Regression”, JASA 113, 2018 — arXiv:1604.04173.
- Y. Romano, E. Patterson, E. Candès, “Conformalized Quantile Regression”, NeurIPS 2019 — arXiv:1905.03222.
- A. N. Angelopoulos, S. Bates, “A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification”, 2023 — arXiv:2107.07511.
- A. N. Angelopoulos, S. Bates, E. Candès, M. Jordan, L. Lei, “Learn then Test: Calibrating Predictive Algorithms to Achieve Risk Control”, The Annals of Applied Statistics, 2025 (preprint October 2021) —arXiv:2110.01052 (high-probability risk control by multiple testing).
- A. N. Angelopoulos, S. Bates, A. Fisch, L. Lei, T. Schuster, “Conformal Risk Control”, 2022, ICLR 2024 — arXiv:2208.02814 (control of an expected risk).
- B. Balle, G. Barthe, M. Gaboardi, “Privacy Amplification by Subsampling: Tight Analyses via Couplings and Divergences”, NeurIPS 2018 — arXiv:1807.01647.
- S. Farquhar, J. Kossen, L. Kuhn, Y. Gal, “Detecting Hallucinations in Large Language Models Using Semantic Entropy”, Nature 630, 2024.
- K. Huang, Y. Jin, E. Candès, J. Leskovec, “Uncertainty Quantification over Graph with Conformalized Graph Neural Networks”, NeurIPS 2023.
- Project sources: I. Mironov, K. Talwar, L. Zhang, “Rényi Differential Privacy of the Sampled Gaussian Mechanism”, 2019 — arXiv:1908.10530; B. Balle, G. Barthe, M. Gaboardi, J. Hsu, T. Sato, “Hypothesis Testing Interpretations and Rényi Differential Privacy”, AISTATS 2020 — arXiv:1905.09982 (the RDP-to-DP conversion used by Opacus);T. N. Kipf, M. Welling, “Semi-Supervised Classification with Graph Convolutional Networks”, ICLR 2017 — arXiv:1609.02907; J. Leskovec, A. Krevl, “SNAP Datasets: Stanford Large Network Dataset Collection”, 2014; B. Strack et al., “Impact of HbA1c Measurement on Hospital Readmission Rates: Analysis of 70,000 Clinical Database Patient Records”, BioMed Research International, 2014 (the Diabetes 130-US hospitals data, UCI repository); M. Joshi, E. Choi, D. Weld, L. Zettlemoyer, “TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension”, ACL 2017 — arXiv:1705.03551; M. Weber et al., “Anti-Money Laundering in Bitcoin: Experimenting with Graph Convolutional Networks for Financial Forensics”, KDD Workshop on Anomaly Detection in Finance, 2019 — arXiv:1908.02591 (the Elliptic data).
- R. Koenker, G. Bassett, “Regression Quantiles”, Econometrica 46, 1978.
- S. Lin, J. Hilton, O. Evans, “Teaching Models to Express Their Uncertainty in Words”, TMLR 2022 — arXiv:2205.14334.
- K. Tian, W. Yao, D. Yu, L. Mou, “Just Ask for Calibration: Strategies for Eliciting Calibrated Confidence Scores from Language Models Fine-Tuned with Human Feedback”, EMNLP 2023 (Findings) — arXiv:2305.14975.
- M. Xiong, Z. Hu, X. Lu, Y. Li, J. Fu, J. He, B. Hooi, “Can LLMs Express Their Uncertainty? An Empirical Evaluation of Confidence Elicitation in LLMs”, ICLR 2024 — arXiv:2306.13063.
- L. Kuhn, Y. Gal, S. Farquhar, “Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generation”, ICLR 2023 — arXiv:2302.09664.
- B. Van Calster, D. J. McLernon, M. van Smeden, L. Wynants, E. W. Steyerberg, on behalf of Topic Group 6 (Evaluating diagnostic tests and prediction models) of the STRATOS initiative, “Calibration: the Achilles heel of predictive analytics”, BMC Medicine 17:230, 2019.
- Internal follow-ups: M1 modules “Refresher Statistics” (ch. 8: Bayesian statistics), “Machine Learning” (ch. 8: generalization; ch. 4: evaluation), “Emerging ML” (ch. 3–5: federated, Byzantine, privacy: first encounter with DP), “Statistics in Action” (ch. 7–8: multiple testing, bootstrap — the empirical-quantile logic of conformal), M2 “Large Language Models” (ch. 9–10); the M2 module “Explainability, Security, Privacy of LLMs” (ch. 5–8) continues the security and privacy part for LLMs.
- Tools: Opacus (PyTorch / Meta), TensorFlow Privacy, OpenDP, Google DP library; awesome-conformal-prediction for the conformal ecosystem, MAPIE (scikit-learn-contrib).