Most matrices in a trained network are large, but their action is often dominated by a handful of directions. Eigenvectors and the singular value decomposition find those directions, say how much each one matters, and give the provably best way to throw the rest away.
Eigenvectors: directions a map only stretches
A square matrix generally rotates and stretches vectors. An eigenvector is a nonzero vector whose direction leaves unchanged:
The scalar is its eigenvalue: the factor by which stretches (or, if negative, flips) that direction. Along an eigenvector a matrix acts like a number.
The most useful case is a symmetric matrix (), such as a covariance matrix or a Hessian of a loss. The spectral theorem guarantees that a real symmetric matrix has real eigenvalues and an orthonormal set of eigenvectors, so
with the eigenvectors as the columns of and the eigenvalues on the diagonal of .[1] In the eigenvector coordinate system, the matrix is just independent scaling along each axis.
Worked example
Let . Try : . Try : . So the eigenvalues are 3 and 1, with orthogonal eigenvectors along the diagonals. triples everything along and leaves alone.
Repeated application: the dominant direction wins
Apply repeatedly to :
The vector swings towards . Writing shows why: , and the component outgrows the other by a factor of 3 per step. This is power iteration, the simplest algorithm for finding the top eigenvector.
The same arithmetic explains a classical failure of recurrent networks. Backpropagating through time steps multiplies gradients by the recurrent weight matrix (and activation derivatives) times. Pascanu, Mikolov and Bengio showed that, in the linear case, a largest eigenvalue below 1 is sufficient for long-range gradient components to vanish, and a largest eigenvalue above 1 is necessary for them to explode.[2] Eigenvalues of size or look harmless until raised to the hundredth power: and .
A symmetric matrix has eigenvalues 0.5 and 2 with orthonormal eigenvectors . A vector is multiplied by the matrix 10 times. What is the result, and which component dominates?
Show answer +Hide answer −
. The component dominates by a factor of about : repeated application amplifies the largest eigenvalue's direction and suppresses the rest.
The SVD: every matrix, rotate–scale–rotate
Eigenvectors require a square matrix, and for non-symmetric matrices they may be complex or fail to form a basis. The singular value decomposition has no such restrictions. Any real matrix can be written
where () and () have orthonormal columns, and is diagonal with singular values , .[1] Geometrically: rotate the input into the basis , stretch the -th axis by (dropping dimensions or adding zeros to change size), then rotate into the output basis . Every linear map, including every weight matrix in a network, is that sequence.
The singular values are the square roots of the eigenvalues of , and the right singular vectors are its eigenvectors. For a symmetric matrix with non-negative eigenvalues, like above, the SVD and the eigendecomposition coincide.
The SVD reads off several quantities at once:
- Rank is the number of nonzero singular values.
- The spectral norm is the largest factor by which can stretch any vector. It bounds how much a layer can amplify a perturbation, which is why Miyato and colleagues stabilised GAN training by dividing each layer's weights by an estimate of (spectral normalisation).[3]
- The Frobenius norm measures total energy across all directions.
Eckart–Young: the best low-rank approximation
Keep only the top terms of the sum:
Eckart and Young proved in 1936 that no rank- matrix is closer to in the Frobenius norm,[4] and the error is exactly what was discarded:
(The analogous result holds in the spectral norm, with error .) If the singular values decay quickly, a small captures most of the matrix, and needs only numbers instead of .
Applied to a centred data matrix whose rows are examples, the top right singular vectors are the directions of greatest variance, which is principal component analysis. Pearson introduced the idea in 1901 as finding the lines and planes of closest fit to a cloud of points.[5]
Worked example: compressing
For , with , and . The best rank-1 approximation is
The error's Frobenius norm is , as the theorem says. The approximation keeps of the energy.
A matrix has singular values . Roughly what fraction of its squared Frobenius norm does the best rank-10 approximation keep, and how many numbers does it need to store compared with the full matrix?
Show answer +Hide answer −
versus , so about . Storage: numbers versus , about .
Low rank in modern models
These ideas explain why low-rank methods work for fine-tuning. Aghajanyan, Zettlemoyer and Gupta measured the intrinsic dimension of fine-tuning: optimising only 200 parameters, randomly projected into the full parameter space of a RoBERTa model, reached 90% of full fine-tuning performance on one paraphrase task (MRPC), and larger pretrained models tended to have lower intrinsic dimension.[6] LoRA, introduced in the previous lesson, builds the low-rank constraint into the weight update itself, . Hu and colleagues report that on GPT-3, a rank as small as one sufficed for adapting the query and value projections on the tasks they examined; comparing the subspaces learned at rank 8 and rank 64, they found that the top singular directions overlapped substantially while the remaining directions did not.[7] In SVD terms, the useful part of the update was concentrated in its first few singular values.
Low rank is an empirical property of particular updates and tasks, not a law, and nothing guarantees it for a new task. The SVD is the tool for checking: compute the singular values of a learned update, and see how fast they decay.
Key takeaways
- An eigenvector is a direction a square matrix only stretches; symmetric matrices have orthogonal eigenvectors and real eigenvalues.
- Repeated application amplifies the largest-eigenvalue direction; this is power iteration, and in recurrent networks it is the root of vanishing and exploding gradients.
- The SVD writes any matrix as rotate–scale–rotate. Singular values give the rank, the spectral norm (maximum stretch) and the Frobenius norm (total energy).
- By Eckart–Young, truncating the SVD gives the best rank- approximation, with error equal to the discarded singular values. PCA and low-rank adaptation such as LoRA rest on this.
Sources
-
G. Strang (2023). Introduction to Linear Algebra, 6th ed. Wellesley-Cambridge Press. https://math.mit.edu/~gs/linearalgebra/ila6/indexila6.html ↩ ↩2
-
R. Pascanu, T. Mikolov, Y. Bengio (2013). "On the difficulty of training Recurrent Neural Networks." ICML 2013. arXiv:1211.5063. https://arxiv.org/abs/1211.5063 ↩
-
T. Miyato, T. Kataoka, M. Koyama, Y. Yoshida (2018). "Spectral Normalization for Generative Adversarial Networks." ICLR 2018. arXiv:1802.05957. https://arxiv.org/abs/1802.05957 ↩
-
C. Eckart and G. Young (1936). "The Approximation of One Matrix by Another of Lower Rank." Psychometrika 1(3): 211–218. https://doi.org/10.1007/BF02288367 ↩
-
K. Pearson (1901). "On Lines and Planes of Closest Fit to Systems of Points in Space." Philosophical Magazine 2(11): 559–572. https://doi.org/10.1080/14786440109462720 ↩
-
A. Aghajanyan, L. Zettlemoyer, S. Gupta (2020). "Intrinsic Dimensionality Explains the Effectiveness of Language Model Fine-Tuning." arXiv:2012.13255. https://arxiv.org/abs/2012.13255 ↩
-
E. J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, W. Chen (2021). "LoRA: Low-Rank Adaptation of Large Language Models." arXiv:2106.09685. https://arxiv.org/abs/2106.09685 ↩
