Amplification of accuracy and replicability #
This module formalizes confidence and replicability amplification theorems for shared-seed replicable algorithms [ILPS22]:
- Confidence amplification: repeating an algorithm
2 * (r + 1)times with independent shared seeds and takingmajorityVote(forBooloutputs) ormedianOfRuns(forℝoutputs viaCslib.median) reduces failure probability fromβ₀ ≤ 1 / 2to(4 * β₀ * (1 - β₀)) ^ (r + 1)while scaling the disagreement parameter by2 * (r + 1). - Finite-domain amplification (
amplifyFinite): when the output spaceαis finite (M = |α|) and linearly ordered, any algorithm (with no replicability guarantee at all) whose failure probability satisfiesβ₀ < 1 / (M + 1)can be amplified to arbitrary(ρ, β)with strong (distribution-free)ρ-replicability by estimating empirical frequencies overkindependent runs and thresholding against a single shared random thresholdi : Fin N. - General-domain replicability amplification (
amplifyReplicability): for any[DecidableEq α], any algorithm that is weakly (or strongly)ρ₀-replicable withρ₀ < 1 / 2can be amplified to arbitraryρ > 0by samplingTcandidate seeds, estimating collision rates and strict majorities, and picking the first candidate seed whose empirical collision rate crosses a single shared random thresholdi : Fin N. When the input algorithm also has sufficiently small initial errorβ₀ = O(β / T)(withβ₀ / (a - δ)union-bounded across theTcandidate seeds by Markov's inequality inisAccurateFor_amplifyReplicabilityandexists_amplifyReplicability_accurate),amplifyReplicabilityalso achieves(good, β)accuracy; unlikeamplifyFinite,pickFirstThresholdeddoes not assumeβ₀ < 1 / (|α| + 1)and therefore preserves small initial error rather than amplifying error from≈ 1 / 2.
Main definitions #
Cslib.MachineLearning.Replicable.majorityVote:Boolconfidence amplification.Cslib.MachineLearning.Replicable.medianOfRuns:ℝconfidence amplification viaCslib.median.Cslib.MachineLearning.Replicable.amplifyFinite: finite-domain heavy-hitter amplification.Cslib.MachineLearning.Replicable.amplifyReplicability: general-domain collision-threshold replicability amplification.
Main results #
Cslib.MachineLearning.Replicable.majorityVote_accurate,Cslib.MachineLearning.Replicable.majorityVote_replicable,Cslib.MachineLearning.Replicable.exists_majorityVote: boolean majority amplification.Cslib.MachineLearning.Replicable.medianOfRuns_accurate,Cslib.MachineLearning.Replicable.medianOfRuns_replicable,Cslib.MachineLearning.Replicable.exists_medianOfRuns: median-of-runs amplification.Cslib.MachineLearning.Replicable.isReplicable_amplifyFinite,Cslib.MachineLearning.Replicable.isAccurateFor_amplifyFinite,Cslib.MachineLearning.Replicable.exists_amplifyFinite: finite-domain amplification fromβ₀ < 1 / (|α| + 1)to arbitrary strongρand accuracyβ.Cslib.MachineLearning.Replicable.disagreeProb_amplifyReplicability_le,Cslib.MachineLearning.Replicable.isAccurateFor_amplifyReplicability,Cslib.MachineLearning.Replicable.exists_amplifyReplicability,Cslib.MachineLearning.Replicable.exists_amplifyReplicability_accurate: amplifyingρ₀ < 1 / 2to arbitraryρ > 0over any[DecidableEq α], with preserved accuracy underO(β / T)initial error.
References #
- Impagliazzo, Lei, Pitassi, Sorrell (STOC 2022), Reproducibility in Learning (paper PDF not directly inspected in this formalization; definitions and finite/general amplification theorems are formalized directly in Lean).
Confidence amplification: majority vote and median-of-runs #
For any Boolean algorithm with error β₀ < 1 / 2 and any target β > 0, taking the majority
of 2 * (r + 1) independent repetitions achieves failure probability at most β.
Run a real-valued algorithm 2 * (r + 1) times on disjoint blocks with independent shared
seeds and output Cslib.median.
For any real estimator within ε except with probability β₀ < 1 / 2 and any β > 0,
medianOfRuns achieves (ε, β) estimation accuracy.
Finite-domain heavy-hitter amplification #
Empirical frequency of y : α in a tuple v : Fin k → α.
Least element of α whose empirical frequency crosses thresholdValue a b N i, falling back
to Finset.univ.min' if none qualifies.
Finite-domain heavy-hitter amplification: runs A independently with fresh internal seeds on
k disjoint m-sample blocks, shares a single threshold i : Fin N across [a, b), and
outputs the least element whose empirical frequency crosses thresholdValue a b N i.
Strong replicability of amplifyFinite: for any a < b, k, N ≥ 1, and δ ≥ 0,
amplifyFinite A a b k N is strongly ρ-replicable over all distributions D : PMF X with
ρ = 2 * |α| * (2 * exp(-2 * k * δ^2)) + |α| * (2 * δ / (b - a) + 1 / N).
Accuracy of amplifyFinite: if A errs with probability at most β₀ < 1 / (|α| + 1)
on 𝒟 and the threshold window [a, b) satisfies β₀ + δ < a ≤ b ≤ (1 - β₀) / |α| - δ, then
amplifyFinite A a b k N errs on 𝒟 with probability at most
|α| * (2 * exp (-2 * k * δ^2)).
Finite-domain amplification theorem [ILPS22]: for any finite
nonempty linearly ordered output type α, if A achieves error β₀ < 1 / (|α| + 1) on 𝒟
(with no replicability assumption at all on A), then for any target ρ > 0 and β > 0, there
exist thresholds a, b : ℝ and k, N ≥ 1 such that amplifyFinite A a b k N is strongly
ρ-replicable and (good, β)-accurate on 𝒟.
General-domain replicability amplification (DecidableEq α, ρ₀ < 1 / 2) #
Pick a candidate from v : Fin k → α appearing strictly more than k / 2 times, or
fallback if no strict majority exists.
Single candidate-seed trial inside amplifyReplicability: using k₁ independent sample
pairs to estimate the seed's collision probability and k₂ independent samples to find its
strict-majority output.
General-domain replicability amplification [ILPS22]: draws T
independent shared seeds r_t ~ A.seed and one threshold i ~ uniform (Fin N), runs
trialRun on each candidate seed over disjoint sample blocks, and outputs the strict-majority
candidate of the first seed passing thresholdValue a b N i.
Disagreement probability upper bound for amplifyReplicability: if
1 / 2 + δ < a < b ≤ θ_acc - δ and θ_acc < 1, then
(amplifyReplicability A a b T k₁ k₂ N).disagreeProb D is bounded by the bad-seed probability
(A.disagreeProb D / (1 - θ_acc)) ^ T, twice the concentration error over T trials, and the
threshold discretization error T * (2 * δ / (b - a) + 1 / N).
Accuracy preservation for amplifyReplicability: under IsReplicableFor A 𝒟 ρ₀ and
IsAccurateFor A 𝒟 good β₀ with 1 / 2 + δ < a < b ≤ θ_acc - δ and θ_acc < 1, the failure
probability of amplifyReplicability is bounded by the bad-seed probability
(ρ₀ / (1 - θ_acc)) ^ T, the Markov union bound (T : ℝ) * (β₀ / (a - δ)) over the T
candidate seeds, and the per-trial concentration errors.
General-domain replicability and accuracy-preserving amplification: over any
[DecidableEq α], for any initial ρ₀ < 1 / 2 and target ρ, β > 0, there exist shared-seed
and trial parameters (a, b, T, k₁, k₂, N) together with an initial-error threshold β₀_req > 0
(of order O(β / T)) such that any ρ₀-replicable algorithm A whose error satisfies
β₀ ≤ β₀_req is amplified to ρ-replicability while preserving (good, β) accuracy.
General-domain replicability amplification [ILPS22]: over any
[DecidableEq α] output type, any algorithm A that is weakly (or strongly) ρ₀-replicable on
𝒟 with ρ₀ < 1 / 2 can be amplified to ρ-replicability for any target ρ > 0.
See exists_amplifyReplicability_accurate for preserved (good, β) accuracy under O(β / T)
initial error.