liveBook · Manning

Low-rank approximation

As explained in LLMs in Production

A method that represents a matrix or parameter structure with a lower-rank approximation to reduce storage or computation.

A large language model can be costly to download, load into memory, and deploy. Low-rank approximation tackles part of that size problem by representing a large matrix or tensor with smaller components. It is also called low-rank factorization, low-rank decomposition, or matrix factorization. section 3.3.1 section 3.5

Figure 3.2 Example of SVD, a low-rank approximation. A is a large matrix with dimensions N and M. We can approximate it with three smaller matrices: U with dimensions M and P, Ʃ a square matrix with dimension P, and V with dimensions N and P (here we show the transpose). Usually, both P<<M and P<<N are true.
figure

In singular value decomposition (SVD), a matrix A is approximated using U, Σ, and the transpose of V. The shared dimension P is usually much smaller than A’s dimensions; choosing a smaller P compresses more but makes the approximation less accurate. section 3.3.1

Compress a 4 × 4 matrix

A SciPy example calls `scipy.sparse.linalg.svds(matrix, k=1)` on a 4 × 4 matrix. Its returned components have shapes 4 × 1, 1, and 1 × 4: nine stored values rather than the original sixteen. Multiplying the components reconstructs a 4 × 4 approximation, not the original values exactly. section 3.3.1

SVD is one option; Tucker decomposition and canonical polyadic decomposition are also named techniques. For model compression, the practical choice is how much approximation error is acceptable for the reduction in size. Low-rank methods are also used for model adaptation through LoRA. section 3.3.1 section 3.5

How LLMs in Production covers it

How deep it goes
Explains SVD through factor dimensions and a worked rank-one example, without deriving the linear algebra.
Examples
Uses a SciPy rank-one approximation of a 4 × 4 matrix and its reconstructed values.
What it assumes
Assumes basic familiarity with matrices; introduces low-rank approximation in plain language rather than deriving SVD.
What you can do after
Apply it via SciPy’s `svds` to make a low-rank matrix approximation and inspect the size–accuracy trade-off.
How it connects
Connects SVD, Tucker decomposition, canonical polyadic decomposition, model compression, and LoRA.

Also explained in

Compare how 3 books explain low-rank approximation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.