Randomized SVD

Chapter 8 Linear algebra

Chapter 8: Singular Value Decomposition (SVD) — Randomized SVD

From the book

Chapter 8: Singular Value Decomposition (SVD). In the chapter mind map this icon labels Randomized SVD: Random Projection. The discussion below is excerpted and lightly edited from § Algorithm: Randomized SVD in Mathematics for AI and Machine Learning.

When $M$ and $N$ are large, computing a full SVD costs $O(MN\min(M,N))$ and is simply out of reach. Randomized SVD computes an approximate rank-$k$ truncated SVD far more cheaply when $k \ll \min(M,N)$. It is not a new decomposition and it changes no mathematics: the output is still $A \approx U_k \Sigma_k V_k^\top$ with $U_k, V_k$ orthonormal and $\Sigma_k$ diagonal. Only the method of computation differs.

``{.algorithm caption="Randomized SVD" label="alg:randomized-svd"} \Require Matrix $A \in \mathbb{R}^{M \times N}$, target rank $k$, oversampling parameter $p$ (typically $p = 10$) \Ensure Rank-$k$ approximation $A \approx U_k \Sigma_k V_k^\top$ \State Generate random matrix $\Omega \in \mathbb{R}^{N \times (k+p)}$ \Comment{Random sampling: columns from standard Gaussian} \State $Y \gets A \Omega$ \Comment{Range finding: project onto $(k+p)$-dimensional subspace} \State Compute QR decomposition: $Y = QR$ where $Q \in \mathbb{R}^{M \times (k+p)}$ \Comment{Orthonormalization} \State $B \gets Q^\top A$ \Comment{Project $A$ onto subspace spanned by $Q$} \State Compute the thin SVD $B = \tilde{U} \tilde{\Sigma} \tilde{V}^\top$ \Comment{$B$ is only $(k+p) \times N$, so this is cheap} \State $\hat{U} \gets \tilde{U}_{[:,0:k]}$, $\Sigma_k \gets \tilde{\Sigma}_{0:k,0:k}$, $\hat{V} \gets \tilde{V}_{[:,0:k]}$ \Comment{Truncate: discard the $p$ oversampling directions} \State $U_k \gets Q \hat{U}$, $V_k \gets \hat{V}$ \Comment{Reconstruction} \State \Return $U_k$, $\Sigma_k$, $V_k$ such that $A \approx U_k \Sigma_k V_k^\top$ ``

Why it works. The columns of $A\Omega$ are random linear combinations of $A$'s columns. A random combination lands in the dominant subspace with high probability—the directions with large singular values are the ones most likely to be hit—so $k+p$ such samples capture $C(A_k)$ up to an error set by $\sigma_k, \sigma_{k+1}, \ldots$. Once $Q$ spans that subspace, $B = Q^\top A$ is a small $(k+p) \times N$ matrix whose SVD is cheap, and $QQ^\top A$ approximates $A$. The oversampling $p$ buys insurance: $k$ samples alone leave no margin for an unlucky draw.

When it fails, and the fix. The guarantees are probabilistic, and their quality is governed by the tail $\left(\sum_{i \ge k}\sigma_i^2\right)^{1/2}$ as well as by $\sigma_k$ itself[^hmt]. So the method is reliable when the spectrum decays, and unreliable when the singular values are nearly flat—there is then no dominant subspace to find. The standard remedy is power iteration: replace $Y = A\Omega$ by $Y = (AA^\top)^q A\Omega$, which raises every $\sigma_i$ to the power $2q+1$ and so steepens the decay artificially. Even $q = 1$ or $2$ usually suffices.

The classical alternative is a Krylov method such as Lanczos, which finds the top singular vectors in the Krylov space $\mathrm{span}\{\mathbf b, A^\top A\mathbf b, (A^\top A)^2\mathbf b, \ldots\}$ (the matrix chapter). The flop count is not where the win comes from: both methods cost $O(MNk)$ to leading order. The difference is that randomized SVD spends its work in two dense matrix products and touches $A$ only once or twice, whereas a Krylov method needs many sequential passes. For a matrix too large for memory—or one held in a distributed store, or arriving as a stream—the number of passes is what sets the wall-clock time.

[^hmt]: Randomized SVD error analysis: N. Halko, P. G. Martinsson and J. A. Tropp, "Finding Structure with Randomness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions," SIAM Review 53(2), 2011, <https://arxiv.org/abs/0909.4061>. Their Theorem 10.6 bounds $\mathbb{E}\|A - QQ^\top A\|_2$ by a multiple of $\sigma_k$ that shrinks as the oversampling $p$ grows, plus an additive term proportional to the spectral tail; Theorem 10.7 gives the corresponding tail bound.

What this drawing shows

What you see. Shows a random sketch capturing the dominant range before computing a low-rank singular-value decomposition.

In the mind map. Chapter 8 — Randomized SVD: Random Projection. See From the book above for definitions, figures, and worked examples.

Where to read next

Open Chapter 8 companion →

Read the full definitions, figures, and worked examples in Chapter 8: Singular Value Decomposition (SVD) — see the mind-map node Randomized SVD: Random Projection.

PNG Icons

Textless (256×256 px)
PNG 256×256 px Copy PNG URL
Textless (64×64 px)
PNG 64×64 px Copy PNG URL
Textless (32×32 px)
PNG 32×32 px Copy PNG URL

Animated GIFs