NLA-lib Explorer

Hutch++

Combine a low-rank approximation with residual trace estimation.

Implementation guides

Definition

Definition (Hutch++). Choose a range sketch \mathbf{S} and let \mathbf{P} be the orthogonal projector onto \operatorname{range}(\mathbf{A}\mathbf{S}). Compute the captured trace \operatorname{tr}(\mathbf{P}\mathbf{A}) and add a Girard–Hutchinson estimate, with fresh probes, of \operatorname{tr}((\mathbf{I}-\mathbf{P})\mathbf{A}(\mathbf{I}-\mathbf{P})). The low-rank part and residual estimator have separate roles; the probability results specify the required independence and distribution.

Lean statement and details
NLAlib.hutchpp.{u_2, u_3, u_4, u_5} {𝕜 : Type u_2} [RCLike 𝕜] {n : Type u_3} {s : Type u_4}
  {t : Type u_5} [Fintype n] [Fintype s] [Fintype t] [DecidableEq n] (A : Matrix n n 𝕜)
  (S : Matrix n s 𝕜) (G : Matrix n t 𝕜) : 𝕜

Full source on GitHub

Copy link

Components

Mathematical guarantees

Theorem (Unbiasedness with independent residual probes). Suppose the range sketch is almost everywhere measurable, the residual probe matrix is independent of it and has at least one column, and each residual probe is square integrable and isotropic. For every square \mathbf{A},

\mathbb{E}[\mathsf{hutch++}(\mathbf{A})]=\operatorname{tr}(\mathbf{A}).

The range sketch can have any distribution. Residual probes need not be independent of one another for this expectation identity.

Lean statement and details

General form: sizes are index types

NLAlib.integral_hutchpp.{u_1, u_2, u_3, u_4, u_5} {Ω : Type u_1} {mΩ : MeasurableSpace Ω}
  {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {n : Type u_3} {s : Type u_4} {t : Type u_5} [Fintype n]
  [Fintype s] [Fintype t] [DecidableEq n] [IsProbabilityMeasure μ] [Nonempty t] (A : Matrix n n 𝕜)
  {S : Ω → Matrix n s 𝕜} {G : Ω → Matrix n t 𝕜} (hS : AEMeasurable S μ) (hSG : S ⟂ᵢ[μ] G)
  (hG : ∀ (j : t), IsIsotropic (fun ω i ↦ G ω i j) μ) :
  ∫ (ω : Ω), hutchpp A (S ω) (G ω) ∂μ = A.trace

Full source on GitHub

Copy link

Further results

Theorem (Hutch++ does not overestimate a positive semidefinite trace by a factor 1 + \varepsilon).

With the hypotheses of NLAlib.measureReal_abs_trace_sub_hutchpp_gt_mul_nuclearNorm_le_of_isSubgaussianVector: the sketch \mathbf{S}^{\mathsf{H}}, \lvert s \rvert \ge 1, has independent, isotropic, sub-Gaussian rows with proxy c; the n \times \ell residual test matrix \mathbf{G} is independent of \mathbf{S} with independent entries, sub-Gaussian with variance proxy c' and of second moment 1; r \ge 1, \varepsilon > 0, \delta > 0, \lvert s \rvert \ge 25 c^2 (r \log 21 + \log(2/(\delta/4)))/(16C (1/2)^2), with C = 1/36, and \log\frac{4}{\delta} \le \frac{1}{196}\cdot\frac{4\ell r\varepsilon^2}{c'^2(1 + 5c/2)}\,,\qquad \log\frac{4}{\delta} \le \frac{1}{196}\cdot\frac{2\ell\sqrt{r}\,\varepsilon}{c'\sqrt{1 + 5c/2}}\,. Then for every real positive semidefinite \mathbf{A} \mathbb{P}\bigl[\mathsf{hutchpp}(\mathbf{A}, \mathbf{S}, \mathbf{G}) > (1 + \varepsilon)\operatorname{tr}\mathbf{A}\bigr] \le \delta\,; the size is subgaussianEmbeddingDim c r (1 / 2) (δ / 4), C is subgaussianJLConstant, the factor is subgaussianRangeFinderFactor c and 1/196 is hansonWrightConstant. The lower half is Matrix.PosSemidef.measureReal_hutchpp_lt_one_sub_mul_trace_le_of_isSubgaussianVector. [MeyerMuscoMuscoWoodruff2021, Theorem 1]; there both halves together, with sign test matrices and unspecified constants.

General form: sizes are index types

Lean statement and details
Matrix.PosSemidef.measureReal_hutchpp_gt_one_add_mul_trace_le_of_isSubgaussianVector.{u_1, u_2, u_3,
    u_4}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {n : Type u_2} {s : Type u_3}
  {t : Type u_4} [Fintype n] [Fintype s] [Fintype t] [DecidableEq n] [Nonempty s] {A : Matrix n n ℝ}
  (hA : A.PosSemidef) {S : Ω → Matrix n s ℝ} {G : Ω → Matrix n t ℝ} {c c' : ℝ≥0}
  (hSind : iIndepFun (fun i ω ↦ (S ω)ᴴ i) μ)
  (hSsub : ∀ (i : s), IsSubgaussianVector (fun ω ↦ (S ω)ᴴ i) c μ)
  (hSiso : ∀ (i : s), IsIsotropic (fun ω ↦ (S ω)ᴴ i) μ)
  (hGind : iIndepFun (fun p ω ↦ G ω p.1 p.2) μ)
  (hGsub : ∀ (i : n) (j : t), HasSubgaussianMGF (fun ω ↦ G ω i j) c' μ)
  (hGvar : ∀ (i : n) (j : t), ∫ (ω : Ω), G ω i j ^ 2 ∂μ = 1) (hSG : S ⟂ᵢ[μ] G) {r : ℕ} (hr : 0 < r)
  {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ)
  (hs : subgaussianEmbeddingDim (↑c) r (1 / 2) (δ / 4) ≤ ↑(Fintype.card s))
  (ht₁ :
    Real.log (4 / δ) ≤
      hansonWrightConstant *
        (4 * ↑(Fintype.card t) * ↑r * ε ^ 2 / (↑c' ^ 2 * subgaussianRangeFinderFactor ↑c)))
  (ht₂ :
    Real.log (4 / δ) ≤
      hansonWrightConstant *
        (2 * ↑(Fintype.card t) * √↑r * ε / (↑c' * √(subgaussianRangeFinderFactor ↑c)))) :
  μ.real {ω | (1 + ε) * A.trace < hutchpp A (S ω) (G ω)} ≤ δ

Full source on GitHub

Copy link

Theorem (Hutch++: tail bound given a range-finder guarantee).

Let the sketch test matrix \mathbf{S} be almost everywhere measurable and the n \times \ell residual test matrix \mathbf{G} be independent of it, with independent entries that each satisfy the sub-Gaussian moment generating function bound with variance proxy c (HasSubgaussianMGF) and have second moment 1. If, for some r and K, the range-finder event \|\mathbf{A} - \mathsf{rsvd}(\mathbf{A}, \mathbf{S})\|_{\mathsf{F}}^2 \le K\|\mathbf{A} - \llbracket\mathbf{A}\rrbracket_r\|_{\mathsf{F}}^2 fails with probability at most \delta_1, then for every real square \mathbf{A} and every \tau \ge 0, with \mathbf{E}_r = \mathbf{A} - \llbracket\mathbf{A}\rrbracket_r, \mathbb{P}\bigl[\lvert \operatorname{tr}\mathbf{A} - \mathsf{hutchpp}(\mathbf{A}, \mathbf{S}, \mathbf{G}) \rvert \ge \tau\bigr] \le \delta_1 + 2\exp\Bigl(-\frac{1}{196}\min\Bigl( \frac{\ell\tau^2}{c^2 K\|\mathbf{E}_r\|_{\mathsf{F}}^2}, \frac{\ell\tau}{c\sqrt{K}\|\mathbf{E}_r\|_{\mathsf{F}}}\Bigr)\Bigr)\,; the constant is hansonWrightConstant. On the range-finder event the compressed residual has Frobenius (hence spectral) norm at most \sqrt{K}\|\mathbf{E}_r\|_{\mathsf{F}}; conditionally on \mathbf{S} the Girard–Hutchinson tail applies (NLAlib.measureReal_abs_trace_sub_girardHutchinson_ge_le), and ProbabilityTheory.IndepFun.measureReal_mem_le_add integrates it over the sketch. A zero denominator makes its fraction 0, and the bound is then at least 2; in particular, when \|\mathbf{E}_r\|_{\mathsf{F}} = 0 the bound says nothing, and that case is handled through exactness of Hutch++ on the range-finder event instead. Instances: NLAlib.measureReal_abs_trace_sub_hutchpp_ge_le_of_isSubgaussianVector, NLAlib.measureReal_abs_trace_sub_hutchpp_ge_le_of_hasLaw_gaussianMatrix. [MeyerMuscoMuscoWoodruff2021, Theorem 4 and Lemma 2]; there for positive semidefinite \mathbf{A} with \|\mathbf{\Delta}\|_{\mathsf{F}} \le 2\|\mathbf{E}_r\|_{\mathsf{F}} given, unspecified constants and a sample-size form.

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_abs_trace_sub_hutchpp_ge_le.{u_1, u_2, u_3, u_4} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {n : Type u_2} {s : Type u_3} {t : Type u_4} [Fintype n]
  [Fintype s] [Fintype t] [DecidableEq n] (A : Matrix n n ℝ) {S : Ω → Matrix n s ℝ}
  {G : Ω → Matrix n t ℝ} {c : ℝ≥0} (hS : AEMeasurable S μ) (hSG : S ⟂ᵢ[μ] G)
  (hGind : iIndepFun (fun p ω ↦ G ω p.1 p.2) μ)
  (hGsub : ∀ (i : n) (j : t), HasSubgaussianMGF (fun ω ↦ G ω i j) c μ)
  (hGvar : ∀ (i : n) (j : t), ∫ (ω : Ω), G ω i j ^ 2 ∂μ = 1) {r : ℕ} {K δ₁ : ℝ}
  (hRF :
    μ.real {ω | K * frobNorm (A - truncatedSVD A r) ^ 2 < frobNorm (A - rsvd A (S ω)) ^ 2} ≤ δ₁)
  {τ : ℝ} (hτ : 0 ≤ τ) :
  μ.real {ω | τ ≤ |A.trace - hutchpp A (S ω) (G ω)|} ≤
    δ₁ +
      2 *
        rexp
          (-(hansonWrightConstant *
              min (↑(Fintype.card t) * τ ^ 2 / (↑c ^ 2 * K * frobNorm (A - truncatedSVD A r) ^ 2))
                (↑(Fintype.card t) * τ / (↑c * √K * frobNorm (A - truncatedSVD A r)))))

Full source on GitHub

Copy link

Theorem (The variance of Gaussian Hutch++ for a positive semidefinite matrix).

if the n \times \lvert s \rvert sketch test matrix \mathbf{S} and the n \times \ell residual test matrix \mathbf{G}, \ell \ge 1, are independent and standard Gaussian, then for every real positive semidefinite \mathbf{A} and every r \ge 1 with 2r + 1 \le \lvert s \rvert, \operatorname{Var}[\mathsf{hutchpp}(\mathbf{A}, \mathbf{S}, \mathbf{G})] \le \frac{(\operatorname{tr}\mathbf{A})^2}{\ell\, r}\,, NLAlib.variance_hutchpp_le_nuclearNorm_of_hasLaw_gaussianMatrix with \|\mathbf{A}\|_* = \operatorname{tr}\mathbf{A}. With r = (m - 2)/8, \lvert s \rvert = (m + 2)/4 and \ell = (m - 2)/2 it is 16(\operatorname{tr}\mathbf{A})^2/(m - 2)^2 for m = 2\lvert s \rvert + \ell products. [MeyerMuscoMuscoWoodruff2021, Theorem 10]; there with sign residual probes (see NLAlib.variance_hutchpp_of_hasLaw_rademacherMatrix).

General form: sizes are index types

Lean statement and details
Matrix.PosSemidef.variance_hutchpp_le_trace_sq_of_hasLaw_gaussianMatrix.{u_1, u_3, u_4, u_5}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {n : Type u_3} {s : Type u_4}
  {t : Type u_5} [Fintype n] [Fintype s] [Fintype t] [DecidableEq n] [Nonempty t] {A : Matrix n n ℝ}
  (hA : A.PosSemidef) {S : Ω → Matrix n s ℝ} {G : Ω → Matrix n t ℝ}
  (hS : HasLaw S (gaussianMatrix n s) μ) (hG : HasLaw G (gaussianMatrix n t) μ) (hSG : S ⟂ᵢ[μ] G)
  {r : ℕ} (hr0 : 0 < r) (hr : 2 * r + 1 ≤ Fintype.card s) :
  Var[fun ω ↦ hutchpp A (S ω) (G ω); μ] ≤ A.trace ^ 2 / (↑(Fintype.card t) * ↑r)

Full source on GitHub

Copy link

Mathematical background

Appears under these tasks