Documentation

LeanMlir.Verified.Smoothing

Randomized-smoothing statistics (Cohen–Rosenfeld–Kolter 2019) #

The pieces the smoothing certificate needs, in pure Float (no kernel, no Mathlib): the probit Φ⁻¹ for the radius σ·Φ⁻¹(p_A), and the Clopper–Pearson lower confidence bound on p_A (the exact binomial bound, not a normal approximation). CP is built bottom-up from the regularized incomplete beta Iₓ(a,b) (Lanczos lgamma, Lentz continued fraction) and solved by 60-step bisection. None of this is proved, and the bisection returns the midpoint of its final bracket rather than rounding toward the conservative end.

def VerifiedNet.smoothCertify (net : VerifiedNet) (cfg : VerifiedConfig) (dataDir : String) (sigmas : List Float) :

Randomized-smoothing certificate (Cohen–Rosenfeld–Kolter 2019) — a depth-independent certificate, for nets where the Lipschitz product is too loose to certify anything. The smoothed classifier ĝ(x) = argmax_c P[f(x+η)=c], η ~ N(0,σ²I), is certified robust at L2 radius σ·Φ⁻¹(p_A) where p_A is a lower bound on the top class's noise probability. It's forward-only: no new kernel, no input-VJP — just sample n noisy copies, run the existing proof-rendered <slug>_fwd, count argmax votes, Clopper–Pearson lower-bound p_A. The base classifier is trained with matched Gaussian augmentation (every batch corrupted with N(0,σ²I) host-side before the proof-rendered SGD step — the forward/backward graph is untouched), the Cohen recipe. Architecture-agnostic + depth-independent, so it certifies a non-vacuous radius on the very nets (CIFAR, deep) where ∏‖Wᵢ‖₂ is astronomically loose. Generic over any VerifiedNet (fwd + train-step only).

n (SMOOTH_N, default 10000 — Cohen's large-n regime) is the estimation budget and the only tightening lever: the per-point radius is capped at σ·Φ⁻¹(α^(1/n)) (a unanimous vote certifies only p_A ≥ α^(1/n)), so larger n lifts the ceiling and tightens the CP bound toward the true noise-probability — bigger certified radii at the same 1−α guarantee.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Randomized-smoothing certificate (Cohen 2019, depth-independent); see VerifiedNet.smoothCertify. Forward-only — works on any spec via its rendered fwd.

    Equations
    Instances For