43.05.09 · numerical-analysis / 05-svd-low-rank

Randomized SVD and sketching

shipped3 tiersLean: none

Anchor (Master): Halko-Martinsson-Tropp 2011 Finding Structure with Randomness (SIAM Review 53) Sec. 10 (sharp Gaussian error constants and tail bounds), Sec. 11 (power-method stabilisation); Woodruff 2014 Sketching as a Tool for Numerical Linear Algebra (Foundations and Trends in TCS 8); Martinsson-Tropp 2020 Randomized numerical linear algebra: Foundations and algorithms (Acta Numerica 29); Clarkson-Woodruff 2017 Low-rank approximation and regression in input sparsity time (J. ACM 64)

Intuition Beginner

The singular value decomposition reads every column and every row of a matrix before it reports the matrix's shape. For a matrix with millions of rows this is expensive: you pay full price even when the data is nearly low-rank and only a handful of directions carry the information. Randomised methods bet that a few random combinations of the columns are enough to expose those directions, the way a small sample of voters can expose an election's trend.

The bet works because random combinations wash out the small directions and keep the large ones. Multiply your matrix by a tall thin table (Greek capital omega) of random numbers and you get a compressed sketch with far fewer columns. The columns of still span the dominant part of , because the big directions appear in almost every random combination while the small ones tend to cancel. Orthonormalise and you hold a cheap proxy for the range of .

Sketching plays the same trick on the least-squares fit. Instead of solving one huge over-determined problem, you compress the rows with a single random map and solve a much smaller fit. The compressed fit costs a fraction of the work and, with the right random map, its answer scores almost as well on the original objective as the exact answer does. Speed and accuracy trade off through one knob: how many random rows you draw.

Visual Beginner

The table contrasts the exact and randomised routes on the question that separates them: how much of the matrix you must touch.

Step Exact SVD Randomised SVD
Reads from all rows and columns , a few random combinations
Cost driver full pass over every entry a handful of matrix-multiplies
Output exact dominant directions approximate dominant directions
Error knob none (exact) oversampling and power iterations

The difference is the rightmost column. The exact method cannot return a partial answer; the randomised method lets you spend more random samples to shrink the approximation, trading a controllable probability of error for a large cut in work.

The geometry is the whole lesson. A random multiplier collapses dimension while leaving the large directions intact; the small directions, which the exact decomposition also has to read, are averaged away.

Worked example Beginner

Take a rank-one matrix whose two columns are parallel:

Draw a single random test vector, say , and form the sketch:

Normalise to unit length. Its length is , so the proxy basis vector is .

Now project onto this proxy: . The single stretch factor of the small matrix is its length , and the recovered factorisation is with , , and .

Checking, . One random sample recovered the matrix exactly, because the data had only one true direction. What this tells us: when the matrix is low-rank, a few random samples suffice; oversampling handles the noise and the rank you did not assume in advance.

Check your understanding Beginner

Formal definition Intermediate+

Let have singular value decomposition with singular values , and let be the optimal rank- truncation established in 01.01.12. The deterministic SVD computes the full decomposition at cost ; the randomised methods below trade a controllable probability of error for reading through only a small number of matrix-vector products.

Random test matrices. A Gaussian test matrix is an whose entries are independent variables. Structured alternatives — the subsampled randomised Fourier / Hadamard transform (SRHT) and the sparse sign matrix — apply in or time while retaining the same accuracy guarantees up to constants [Halko, N., Martinsson, P.-G. & Tropp, J. A. — Finding Structure with Randomness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions].

The randomised range finder. Given a target rank and an oversampling parameter , set . Draw , form the sketch , and compute a thin QR factorisation with orthonormal. The columns of are the randomised range finder: they span an -dimensional subspace that, with high probability, contains the dominant left singular directions . The approximation error is , measured in the spectral or Frobenius norm.

The fixed-rank randomised SVD. Combining the range finder with one small SVD yields the decomposition:

  1. Draw ; form ; orthonormalise .
  2. Project to a small matrix: .
  3. Compute the SVD of the small matrix .
  4. Lift back: , and return truncated to rank .

The expensive step touches only times (to form and ); the SVD runs on the matrix . The dominant cost is rather than , the savings over 43.05.08's full SVD route when .

Subspace embeddings and sketch-and-solve. A matrix is an -subspace embedding for a subspace when for every . Given the overdetermined least-squares problem of 43.04.01, sketch-and-solve draws that embeds the column space of and solves the compressed problem instead. A Gaussian with rows is an -embedding of any fixed -dimensional subspace; a sparse count-sketch achieves the same in application time [Woodruff, D. P. — Sketching as a Tool for Numerical Linear Algebra].

The interpolative decomposition. A rank- interpolative decomposition (ID) writes where consists of actual columns of (indexed by ) and contains a identity on those columns with entries bounded by in magnitude. The randomised ID first builds the range finder , then runs a column-pivoted QR on to select the columns , producing an interpretable factorisation (real columns of ) at the cost of the randomised SVD.

Counterexamples to common slips

  • The randomised SVD does not return the exact singular values; it returns estimates whose accuracy is governed by in expectation. Demanding exactness defeats the point: set to meet a tolerance, do not expect the deterministic answer.

  • Sketch-and-solve preserves the least-squares objective, not the minimiser. The sketch-optimal satisfies , but may be large when is ill-conditioned, because preserves the residual geometry, not the solution geometry.

  • Oversampling is not the target rank. The target rank is ; is the slack (typically to ) that drives the failure probability down. Setting discards the randomisation guarantee and leaves a brittle estimate.

  • The power method is not free. Forming directly loses precision when the spectrum spans many orders of magnitude, because the powered singular values overflow and underflow; the stabilised implementation re-orthonormalises between each application of and .

Key theorem with proof Intermediate+

Theorem (Johnson-Lindenstrauss; Gaussian embedding). Let and . Let where the entries of are independent variables. If

then with probability at least the random map satisfies

for every pair simultaneously. [Johnson, W. B. & Lindenstrauss, J. — Extensions of Lipschitz mappings into a Hilbert space]

Proof. Fix a pair and write . The coordinates of are independent Gaussian variables with mean zero and variance , since each row of dotted with is . Therefore where are independent , and the ratio is a chi-squared variable with degrees of freedom, scaled by .

The standard Chernoff bound on the chi-squared distribution gives

using the moment generating function for and the inequality together with its lower-tail analogue. By the union bound over both tails, the probability that the single pair is not preserved within the factor is at most .

There are pairs. A second union bound over all pairs bounds the probability that any pair fails:

Choosing makes the exponent satisfy , so the right-hand side is at most , and a sharper constant tightens this to . With the stated complement probability, every pair is preserved simultaneously.

Bridge. This theorem builds toward the subspace-embedding view of sketching, and it appears again in 43.04.01, where sketch-and-solve compresses the overdetermined least-squares fit through a random map that preserves every vector norm in the row space of . The foundational reason the random projection works is the concentration of the Gaussian quadratic form , and this is exactly the fact that a chi-squared variable with degrees of freedom sits within of its mean with probability . Putting these together, the same dimension-reduction mechanism that preserves pairwise point distances also preserves the geometry of an entire subspace, and the bridge is that the randomised range finder of 01.01.12's SVD and the sketch-and-solve map are two instances of one principle: a tall thin random multiplier that collapses dimension while leaving the relevant norms intact.

Exercises Intermediate+

Advanced results Master

Theorem (HMT range-finder expected error). Let have singular values , let be a target rank, and let be Gaussian oversampling. Draw a Gaussian , form , and let orthonormalise . Then the expected Frobenius error of the range finder satisfies

The same bound holds for the output of the fixed-rank randomised SVD, since the dominant error term is the range-finder projection. [Halko, N., Martinsson, P.-G. & Tropp, J. A. — Finding Structure with Randomness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions]

The bound reduces to the deterministic Eckart-Young tail as , recovering exactness in the limit of infinite oversampling; for the modest choice it inflates the optimal tail by at most . A matching high-probability tail bound, also due to Halko-Martinsson-Tropp, shows the error exceeds with probability at most , so the failure probability falls exponentially with the oversampling budget. The dominant computational cost is independent of in its leading term whenever dominates, which is why between and is the practical sweet spot.

Theorem (power method / subspace iteration accelerates slow decay). Let the range finder be applied not to but to the powered matrix , with the same Gaussian and oversampling . By the identity , the HMT expected-error bound applied to controls the error on the powered matrix by

so the only singular values that survive in the tail are those already smaller than raised to the power ; for any gap the ratio enters the reconstruction error raised to the -st power, so a modest or converts a barely-decaying spectrum into a sharply-decaying one.

The stabilised implementation avoids forming directly, which would overflow or underflow once the powered singular values span many orders of magnitude. Instead it alternates an application of or with a re-orthonormalising QR, so each iteration operates on an orthonormal basis and the dynamic range stays bounded; the cost grows to passes over , still linear in the sample size [Martinsson, P.-G. & Tropp, J. A. — Randomized numerical linear algebra: Foundations and algorithms].

Theorem (subspace embeddings from count-sketch; input-sparsity-time least squares). Let be a fixed -dimensional subspace and . There is a distribution on sparse matrices , each column of having a single nonzero entry, with rows, such that is an -subspace embedding for with probability at least . Moreover is computable in time. [Clarkson, K. L. & Woodruff, D. P. — Low-rank approximation and regression in input sparsity time]

The count-sketch construction hashes each row of to one of buckets with a random sign; the product sums signed rows into buckets, so its cost is proportional to the number of nonzeros of , not to . Combined with the sketch-and-solve guarantee of Exercise 7, this yields an algorithm for -approximate least squares — a qualitative improvement over the cost of forming the normal equations when and is sparse. The Gaussian embedding achieves the same guarantee with rows but costs to apply; the fast Johnson-Lindenstrauss transform of Ailon and Chazelle interpolates, applying in while retaining [Ailon, N. & Chazelle, B. — The fast Johnson-Lindenstrauss transform and algorithmic applications].

Synthesis. Randomised numerical linear algebra trades a vanishing probability of error for a large cut in computational complexity, and the foundational reason it works is that a random projection preserves the geometry of a fixed low-dimensional subspace with exponentially high probability — the same concentration fact that powers the Johnson-Lindenstrauss lemma proved above. This is exactly what lets the randomised range finder of 01.01.12 recover the dominant singular subspace from a handful of random matrix-vector products, and the bound generalises the deterministic Eckart-Young guarantee to a probabilistic one whose failure probability the power method and oversampling drive down. Putting these together, the randomised SVD, the sketch-and-solve least squares of 43.04.01, and the interpolative decomposition are one construction read three ways: sketch the range, solve in the sketch, then read the factorisation off the small compressed matrix. The bridge is that the deterministic low-rank approximation of 43.05.08 and 01.01.12 and its randomised counterpart are the same Eckart-Young optimisation, with randomisation replacing the exhaustive column scan by a random probe whose accuracy the lemma controls; the method appears again in 43.07.02, where block Krylov and randomised range finding merge into the randomised Arnoldi and Lanczos iterations used for very large eigenvalue problems.

Full proof set Master

Proposition (power iteration sharpens the spectrum). For and integer , the powered matrix has the singular value decomposition , and in particular its -th singular value is .

Proof. Compute , so , using . Inductively , since orthogonal satisfies and powers of the diagonal matrix are taken entrywise. Then . The diagonal of is , and are the singular vectors of , so this is an SVD with the claimed singular values. The range finder applied to therefore confronts the amplified spectrum , in which any ratio is raised to the -st power; this is the rigorous content of the power-method acceleration.

Proposition (sketch-and-solve approximation guarantee). Suppose is an -subspace embedding for the column space of . Let minimise and minimise . Then .

Proof. Write . For every , the residual lies in , the embedded subspace, so the two-sided embedding bound applies: . Apply the upper bound to : . Because minimises the sketched residual, , hence by transitivity .

Apply the lower bound to : . Chaining the two inequalities, , and dividing and taking the square root gives . The embedding preserves the residual geometry of the augmented column space, which is all the proof needs; it does not preserve the solution vector, explaining the caveat in the formal definition above.

Proposition (Gaussian matrices are subspace embeddings). Let be a fixed subspace of dimension and let be Gaussian. If for a universal constant , then is an -subspace embedding for with probability at least .

Proof. Choose an orthonormal basis for , so writes with . The embedding condition becomes for all , that is the matrix approximately preserves every norm. Let be a half-net of the unit sphere , which has size . By the Johnson-Lindenstrauss concentration of the theorem above, for a fixed on the unit sphere lies in with probability at least .

A union bound over the net requires , satisfied by . A standard net-extension argument lifts the estimate from net points to every unit vector by successive halving, giving for all unit , hence the embedding on all of .

Connections Master

  • The existence and uniqueness of the singular value decomposition, the Eckart-Young best-rank- approximation, and the dyadic expansion are the foundation on which the randomised range finder rests; 01.01.12 proves them, and this unit specialises the projection onto a random subspace as a probabilistic surrogate for the deterministic truncation .

  • The least-squares problem that sketch-and-solve compresses — the normal equations, the conditioning analysis , and the trade-off between solving fast and solving accurately — is the subject of 43.04.01, and the sketch-and-solve guarantee is exactly the randomised counterpart of that unit's normal-equations and QR solvers, with the embedding replacing the full row reduction.

  • The full SVD machinery that the sibling 43.05.08 deploys for total least squares and the generalised SVD is what randomisation accelerates: the randomised SVD produces the dominant singular triples of the augmented matrix at rather than cost, so the TLS fit of 43.05.08 can be computed from a sketch whenever the data is approximately low-rank.

  • The Gaussian concentration and chi-squared tail bounds that power the Johnson-Lindenstrauss lemma belong to the probability substrate of 26.02.01 and 26.03.01; this unit imports the concentration inequality from that material and applies it with a union bound over pairs.

  • The randomised range finder is the block analogue of the Krylov subspace construction of 43.07.02: both build a subspace from repeated action of (or ) on a starting vector or block, and randomised block Lanczos and Arnoldi iterations, used for large eigenvalue problems, sit precisely at the junction this unit opens up.

Historical & philosophical context Master

The use of randomness to compress a high-dimensional geometric object originates with Johnson and Lindenstrauss, whose 1984 paper Extensions of Lipschitz mappings into a Hilbert space showed that any points in Euclidean space can be embedded into dimensions while preserving all pairwise distances within [Johnson, W. B. & Lindenstrauss, J. — Extensions of Lipschitz mappings into a Hilbert space]. The lemma sat in geometric functional analysis for two decades before the database community recognised it as a dimension-reduction tool: Papadimitriou, Raghavan, Tamaki and Vempala (2000) applied random projections to latent semantic indexing, and Achlioptas (2003) supplied the database-friendly sign matrices that made the projection cheap to apply.

The numerical-linear-algebra treatment crystallised with Sarlos, whose 2006 FOCS paper Improved approximation algorithms for large matrices via random projections first cast least squares and low-rank approximation as sketch-and-solve problems governed by the Johnson-Lindenstrauss mechanism [Sarloes, T. — Improved approximation algorithms for large matrices via random projections]. Halko, Martinsson and Tropp's 2011 SIAM Review paper Finding Structure with Randomness gave the modern form of the randomised range finder, the fixed-rank randomised SVD, the sharp Gaussian error constants, and the power-method stabilisation; Clarkson and Woodruff's 2013/2017 work on input-sparsity-time regression supplied the count-sketch embeddings that apply in time linear in the number of nonzeros. Martinsson and Tropp's 2020 Acta Numerica survey collected the foundations and the algorithms into the unified treatment this unit follows.

Bibliography Master

@article{halko-martinsson-tropp-2011,
  author  = {Halko, Nathan and Martinsson, Per-Gunnar and Tropp, Joel A.},
  title   = {Finding Structure with Randomness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions},
  journal = {SIAM Review},
  volume  = {53},
  number  = {2},
  pages   = {217--288},
  year    = {2011}
}

@incollection{johnson-lindenstrauss-1984,
  author    = {Johnson, William B. and Lindenstrauss, Joram},
  title     = {Extensions of {L}ipschitz mappings into a {H}ilbert space},
  booktitle = {Modern Analysis and Probability},
  series    = {Contemporary Mathematics},
  volume    = {26},
  publisher = {American Mathematical Society},
  year      = {1984},
  pages     = {189--206}
}

@book{woodruff-2014,
  author    = {Woodruff, David P.},
  title     = {Sketching as a Tool for Numerical Linear Algebra},
  series    = {Foundations and Trends in Theoretical Computer Science},
  volume    = {8},
  publisher = {now Publishers},
  year      = {2014}
}

@inproceedings{sarlos-2006,
  author    = {Sarl\'os, Tam\'as},
  title     = {Improved approximation algorithms for large matrices via random projections},
  booktitle = {Proc. 47th IEEE Symposium on Foundations of Computer Science (FOCS)},
  year      = {2006},
  pages     = {143--152}
}

@article{ailon-chazelle-2009,
  author  = {Ailon, Nir and Chazelle, Bernard},
  title   = {The fast {J}ohnson--{L}indenstrauss transform and algorithmic applications},
  journal = {SIAM Journal on Computing},
  volume  = {39},
  number  = {1},
  pages   = {330--349},
  year    = {2009}
}

@article{clarkson-woodruff-2017,
  author  = {Clarkson, Kenneth L. and Woodruff, David P.},
  title   = {Low-rank approximation and regression in input sparsity time},
  journal = {Journal of the ACM},
  volume  = {63},
  number  = {6},
  pages   = {Art. 54},
  year    = {2017}
}

@article{martinsson-tropp-2020,
  author  = {Martinsson, Per-Gunnar and Tropp, Joel A.},
  title   = {Randomized numerical linear algebra: Foundations and algorithms},
  journal = {Acta Numerica},
  volume  = {29},
  pages   = {403--572},
  year    = {2020}
}