Singular Value Decomposition › Mathematical Formulation
Language AI HandbookAll chapters Singular Value Decomposition › Mathematical FormulationOne section · Sections in this chapter2 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
To understand SVD, it helps to start with a simpler case you may already know: eigendecomposition. For a square symmetric matrix , eigendecomposition gives us , where is an orthogonal matrix of eigenvectors and is diagonal with eigenvalues. This works beautifully when is square and symmetric, but our word-context matrix is rectangular: it has one row per word in the vocabulary and one column per context word, and those two sets need not have the same size.
SVD is the generalization of eigendecomposition to rectangular matrices. For any matrix of dimensions , SVD produces an exact decomposition:
where:
- is an orthogonal matrix whose columns are the left singular vectors
- is an diagonal matrix containing the singular values on the diagonal, where
- is the transpose of an orthogonal matrix whose columns are the right singular vectors
The singular values measure how much variance each corresponding direction explains. A large means the -th pair of left and right singular vectors captures a strong, consistent pattern in the data. A small corresponds to a weak pattern that may be statistical noise arising from the finite sample of text.
For a word-context matrix where rows represent vocabulary words and columns represent context words:
- The left singular vectors define a coordinate system in word space: each column of is a direction in the space of vocabulary words
- The right singular vectors define a coordinate system in context space: each column of is a direction in the space of context words
- The singular values tell you how important each coordinate axis is in explaining the data
The entire matrix can be reconstructed exactly from the full SVD. The SVD says: can be written as a sum of rank-1 matrices, each formed by the outer product of one left singular vector and one right singular vector, weighted by the corresponding singular value:
where is the -th column of and is the -th column of . Each term is a rank-1 matrix describing one coherent pattern: it says "the set of words characterized by tend to co-occur with the set of contexts characterized by , and this tendency has strength ." The full matrix is the superposition of all these patterns. The real power comes from the truncated version, where we keep only the largest-magnitude terms.
Why Orthogonality Matters
The orthogonality constraints on and are a technical constraint with direct consequences for the quality of the embeddings.
Orthogonality means the columns of form an orthonormal basis: , and similarly . In practical terms, this means each SVD dimension is completely uncorrelated with every other. In a raw co-occurrence matrix, the dimensions (context words) are highly correlated: "cat" and "kitten" often appear in the same contexts, so their corresponding dimensions carry redundant information. Any vector in the raw PPMI space is tangled up with this redundancy. SVD finds a new basis where this redundancy has been removed.
The first SVD dimension captures the single most important source of variation in the data. The second dimension captures the most important variation that remains after removing the first. The third captures what remains after removing the first two, and so on. This greedy structure, where each dimension is chosen to be maximally informative given the previous ones while remaining orthogonal to all of them, is exactly what makes the truncated SVD an optimal low-rank approximation. You cannot do better with the same number of dimensions, given the orthogonality constraint.
A useful geometric picture: the SVD is finding the principal axes of an ellipsoid. If you imagine the rows of as points in -dimensional space, they form some cloud with an elongated shape. The first left singular vector points along the longest axis of this ellipsoid, the direction of maximum spread. The second points along the next longest axis, perpendicular to the first. SVD is essentially fitting an ellipsoid to the data and reading off its axes.
Connection to Matrix Products
There is a clean algebraic relationship between SVD and the eigendecomposition of the symmetric matrices and . Multiplying out the SVD factorization:
Since is orthogonal, , so the middle terms collapse. This shows that the columns of are exactly the eigenvectors of the matrix , and the squared singular values are the corresponding eigenvalues. Similarly, the columns of are the eigenvectors of the matrix .
In NLP terms, is the word-by-word similarity matrix: entry is the dot product of the PPMI profiles of words and , measuring how similar their co-occurrence patterns are. The eigenvectors of this matrix are the directions that best explain word-to-word similarity. The left singular vectors of are precisely these eigenvectors, which is why SVD gives you meaningful word embeddings.