Lesson overview | Lesson overview | Next part
Matrix Norms and Condition Numbers: Part 1: Intuition to 9. Applications in Machine Learning
1. Intuition
1.1 Why We Need to Measure Matrices
Before introducing any formula, consider five concrete scenarios where "how big is this matrix?" is not a vague question but a precise computational need:
Scenario 1 - Bounding errors in linear systems. You solve on a computer. The computed satisfies for some rounding error matrix . How wrong is ? The answer involves and - you need norms to bound the damage.
Scenario 2 - Regularization. Your neural network overfits. You add a penalty to the loss. Which norm ? The Frobenius norm penalizes every weight equally. The spectral norm penalizes the largest singular value. The nuclear norm encourages low rank. Each choice embeds different inductive bias.
Scenario 3 - Lipschitz constants. Your network maps inputs to outputs. How much can a small input perturbation change the output? The Lipschitz constant of a linear layer is exactly . The global Lipschitz constant of a deep network is bounded by .
Scenario 4 - Convergence of gradient descent. Gradient descent on converges geometrically with rate where is the condition number. A large condition number means slow convergence.
Scenario 5 - Low-rank approximation quality. The Eckart-Young theorem says the best rank- approximation to has error in spectral norm and in Frobenius norm. Without norms, we cannot even state what "best approximation" means.
In every scenario, the choice of norm carries meaning. This section develops the machinery to make those choices deliberate and principled.
1.2 Geometric Picture: Amplification and Shrinkage
A matrix is a linear map. Applied to the unit sphere in , it produces an ellipsoid in . This follows directly from the SVD:
rotates the sphere (orthogonal maps preserve spheres). stretches along coordinate axes by factors (with ). rotates the result. The outcome: the unit sphere maps to an ellipsoid whose semi-axes have lengths .
MATRIX NORMS AS ELLIPSOID GEOMETRY
========================================================================
Unit sphere in \mathbb{R}^n -> A maps to -> Ellipsoid in \mathbb{R}^m
***** +-----------+
* * * * A = U\SigmaV^T +-+ +-+
* * * * * ---------------> +-+ +-+
* * * * +--+ +--+
***** +-+ +-+ <- \sigma_2
+-----------+
<-------------------------------------->
2\sigma_1 (longest axis)
Spectral norm ||A||_2 = \sigma_1 = length of longest semi-axis
Frobenius norm ||A||_F = \sqrt(\sigma_1^2+\sigma_2^2+...) = "total energy" of axes
Nuclear norm ||A||_* = \sigma_1+\sigma_2+... = sum of all semi-axis lengths
========================================================================
Each norm captures a different aspect of this ellipsoid:
- : the worst-case amplification - how long is the longest axis?
- : root-mean-square amplification across all directions
- : total "size" of all directions (related to rank)
For AI: Weight matrices in neural networks define such ellipsoids. A spectrally normalized layer has - the unit sphere maps to an ellipsoid whose longest axis has length exactly 1. A Frobenius-regularized layer has bounded total energy across all singular values.
1.3 Why Matrix Norms Matter for AI
The table below shows each major AI technique and the norm that is its mathematical core:
| AI Technique | Norm Used | Mathematical Role |
|---|---|---|
| Weight decay / L2 reg | Frobenius | Penalizes total squared weight energy |
| Spectral normalization (GANs) | Spectral | Enforces 1-Lipschitz discriminator |
| Nuclear norm reg | Nuclear | Promotes low-rank weight matrices |
| Gradient clipping | Frobenius or L2 of gradient | Prevents exploding gradients |
| LoRA / low-rank adaptation | Implicit nuclear norm | Low-rank has bounded |
| Certified robustness | Per-layer spectral | Bounds Lipschitz constant of network |
| Condition number in Adam | of curvature | Diagonal preconditioning approximates |
| Attention stability | Prevents softmax saturation | |
| Generalization bounds | products | PAC-Bayes and Rademacher complexity |
1.4 Historical Timeline
| Year | Contributor | Contribution |
|---|---|---|
| 1878 | Frobenius | Introduced the entry-sum norm (now Frobenius) in matrix theory |
| 1911 | Hilbert | Trace-class operators in infinite-dimensional spaces |
| 1937 | von Neumann | Schatten/trace norms; characterization of unitarily invariant norms |
| 1951 | Ky Fan | Ky Fan k-norms; Fan dominance theorem |
| 1960s | Golub, Kahan | Numerical algorithms for condition numbers; QR iteration |
| 1976 | Rudin | Functional analysis formalization; duality of norms |
| 1987 | Candes, Recht | Nuclear norm relaxation of rank minimization |
| 1992 | Trefethen & Bau | Numerical linear algebra framing of condition number for ML |
| 2009 | Candes & Recht | Matrix completion via nuclear norm minimization (Netflix Prize theory) |
| 2018 | Miyato et al. | Spectral normalization for GANs - spectral norm goes mainstream in DL |
| 2021-2024 | LoRA, DoRA, MuP | Mixed-norm methods for efficient fine-tuning of LLMs |
2. Norm Axioms
2.1 Abstract Norm Definition
Definition. A norm on a vector space over is a function satisfying three axioms for all and :
| Axiom | Formula | Name |
|---|---|---|
| N1 | and | Positive definiteness |
| N2 | $|\alpha\mathbf{v}| = | \alpha |
| N3 | Triangle inequality |
A function satisfying N1 (without the zero condition), N2, and N3 is a semi-norm. A semi-norm can be zero on nonzero vectors.
Matrix space as a vector space. The space of real matrices is a vector space of dimension under entry-wise addition and scalar multiplication. Any norm on (after reshaping) gives a valid matrix norm. But not every matrix norm is "compatible" with matrix multiplication - additional properties (submultiplicativity) are often required.
Definition (submultiplicative norm). A matrix norm on is submultiplicative (or consistent) if:
Submultiplicativity is essential for analyzing products of matrices (as arise in deep network Jacobians) and for bounding errors that propagate through multiplications.
Non-example of submultiplicativity. The max-entry norm satisfies the three norm axioms but is NOT submultiplicative in general. For (all-ones matrix divided by ): , , so .
2.2 Standard Vector Norms
For , the standard norms are:
The unit balls have characteristic shapes:
UNIT BALLS IN 2D FOR DIFFERENT p-NORMS
========================================================================
p=1 (diamond) p=2 (circle) p=\infty (square) p=1/2 (star)
[not a norm!]
* ___ +---+
/|\ / \ | | *
/ | \ / \ | | /|\
*--+--* | * | | | */ \*
\ | / \ / | | \ /
\|/ \___/ +---+ \|/
* *
p < 1: concave, violates triangle inequality -> NOT a norm
p \geq 1: convex, satisfies all axioms -> valid norm
========================================================================
Holder's inequality. For conjugate exponents (with ):
This generalizes the Cauchy-Schwarz inequality () and is the foundation for dual norm theory.
2.3 Equivalence of Norms in Finite Dimensions
Theorem. On (or any finite-dimensional normed space), all norms are equivalent: for any two norms and , there exist constants such that:
Proof sketch. The unit sphere is compact. A norm is continuous. A continuous function on a compact set attains its extrema. These extrema give the constants and .
Specific bounds relating standard norms on :
| Inequality | Bound | Tight when |
|---|---|---|
| factor 1 | has one nonzero entry | |
| factor | all entries equal | |
| factor | one / all entries equal | |
| factor | one / all entries equal |
Why this matters: Norm equivalence guarantees that convergence in one norm implies convergence in all others - so the choice of norm for convergence analysis is flexible. However, the constants matter for quantitative bounds, and choosing the right norm can tighten bounds by factors of or .
Warning: Norm equivalence fails in infinite dimensions. In function spaces, - this distinction is crucial in functional analysis and infinite-width neural network theory.
2.4 Dual Norms
Definition. The dual norm of on is:
Key dual pairs:
- and are dual:
- is self-dual: (Cauchy-Schwarz with equality)
- and are dual when (Holder conjugates)
Dual norms for matrices (treating them as vectors): the dual of the spectral norm is the nuclear norm:
This duality appears in optimization: the subdifferential of involves matrices with spectral norm .
For AI: The dual norm appears naturally in proximal gradient methods. The proximal operator of (nuclear norm) is soft-thresholding of singular values - a key step in matrix completion algorithms and low-rank optimization.
3. The Frobenius Norm
3.1 Definition and Geometric Meaning
The Frobenius norm treats a matrix as a long vector and applies the Euclidean norm:
For , it is the norm on . This gives the Frobenius norm full access to Euclidean geometry: inner products, projections, and angles between matrices.
The matrix inner product. The Frobenius norm is induced by the inner product:
This turns the space into a Hilbert space. Cauchy-Schwarz holds: .
Geometric interpretation. is the "size" of the linear map when averaged uniformly over the unit sphere. More precisely, if is drawn uniformly from the unit sphere , then:
This is the mean squared output energy - the Frobenius norm measures average amplification over all directions.
3.2 SVD Relationship
The deepest formula for the Frobenius norm comes from the singular value decomposition:
where are the nonzero singular values and .
Proof. . Since , we have . Trace is invariant under similarity, so .
Consequences:
- equals the sum of squared singular values - a measure of total "energy"
- (Frobenius norm is at least as large as spectral norm)
- (Frobenius norm bounded by times spectral norm)
- For rank-1 matrices: (single singular value)
For AI: The Frobenius norm of a weight matrix equals - the norm of singular values. Weight decay (L2 regularization) penalizes , encouraging all singular values to shrink uniformly. This is weaker than nuclear norm regularization (), which promotes low-rank structure.
3.3 Key Properties and Inequalities
Submultiplicativity:
Proof. where is the -th row of and is the -th column of . By Cauchy-Schwarz: . Summing over : .
Unitary invariance:
This follows from the SVD formula: unitary transformations permute singular values but don't change them.
Comparison with other norms:
| Norm | Symbol | Relationship to |
|---|---|---|
| Spectral | ||
| Nuclear | ||
| Max entry | ||
| Row-sum |
3.4 Best Low-Rank Approximation
The Eckart-Young theorem - the fundamental result about low-rank approximation - is stated in terms of both the Frobenius and spectral norms:
Theorem (Eckart-Young, 1936). Let and . Then:
In both norms, the optimal rank- approximation is obtained by truncating the SVD.
For AI: This theorem is the mathematical foundation of PCA (-> 03-PCA), LoRA, and attention matrix compression. When training a LoRA adapter with , , the Eckart-Young theorem guarantees this is the optimal rank- perturbation in the Frobenius norm.
3.5 Computing and Differentiating the Frobenius Norm
Computation. In NumPy: np.linalg.norm(A, 'fro') or equivalently np.sqrt(np.sum(A**2)).
Gradient. The Frobenius norm is differentiable everywhere. Its gradient with respect to is:
This makes the Frobenius norm easy to differentiate in backpropagation. Weight decay adds to the loss, contributing gradient - the standard L2 regularization term.
For AI: Spectral normalization (Miyato 2018) normalizes weight matrices by their spectral norm, not Frobenius. The gradient of the spectral norm is:
the rank-1 outer product of the top left and right singular vectors. This is non-smooth when has multiplicity .
4. Induced (Operator) Norms
4.1 The General Definition
A matrix norm is induced (or operator) if it measures the worst-case amplification of a vector norm:
The notation specifies the norms on input () and output () spaces.
Why induced norms matter. The definition captures the most important property of a linear map: its maximum stretch factor. For stability analysis, control theory, neural network Lipschitz bounds, and generalization theory, the induced norm is the right tool.
Submultiplicativity is automatic. Any induced norm satisfies because:
4.2 The Spectral Norm ()
The most important induced norm is the spectral norm (also called operator 2-norm):
Proof that . Write . Then:
where has . This is maximized by (put all weight on ), giving . The maximizer is (the top right singular vector).
Computing the spectral norm:
- Exact: via SVD,
- Approximate: power iteration , converging as
- For symmetric PSD matrices:
For AI: The spectral norm of a weight matrix in a neural network is the Lipschitz constant of that layer (for activations with Lipschitz constant 1). The overall network Lipschitz constant is . Spectral normalization divides each weight matrix by its spectral norm at every step, bounding this product and stabilizing GAN training.
4.3 The Matrix 1-Norm and \infty-Norm
Matrix 1-norm (, input and output use ):
Matrix \infty-norm (, input and output use ):
Why these formulas. For the 1-norm: . Since , the worst case is to put all weight () on the column with maximum norm.
Examples. For :
- Column sums: , . So .
- Row sums: , . So .
Duality. . These two norms are transposes of each other.
4.4 The 2->1 and 1->2 Norms (NP-Hard)
The nuclear norm is the induced norm's dual... actually, let's be precise: computing and is NP-hard in general. This is a fundamental computational barrier.
No polynomial-time algorithm is known for this. However, there are useful bounds:
For AI: The NP-hardness of connects to problems in statistics (robustness of PCA) and compressed sensing. Approximate algorithms using semidefinite programming can compute up to a factor.
4.5 Submultiplicativity and Consistency
Definition. A matrix norm is:
- Submultiplicative: (all induced norms satisfy this)
- Consistent with vector norm : (induced norms satisfy this by construction)
- Compatible or subordinate: same as consistent
The Frobenius norm is submultiplicative but NOT induced. Every induced norm must satisfy , but . The Frobenius norm is sometimes called a "compatible" norm because .
Non-example. The max-entry norm satisfies the norm axioms but is NOT submultiplicative: can exceed .
5. Schatten Norms and the Nuclear Norm
5.1 The Schatten p-Norm Family
The Schatten -norm unifies the spectral, Frobenius, and nuclear norms by applying the vector norm to the vector of singular values:
where and .
The three canonical Schatten norms:
| Name | Formula | Interpretation | |
|---|---|---|---|
| Nuclear (trace) | Sum of singular values | ||
| Frobenius | RMS singular value | ||
| Spectral (operator) | Maximum singular value |
Ordering. For : . In particular:
with inequalities sharp for full-rank matrices with equal singular values.
Duality. Schatten norms are dual in pairs: where . In particular:
This is Holder's inequality for singular values.
5.2 The Nuclear Norm
The nuclear norm (also called trace norm or Ky Fan -norm when applied to all singular values) is:
where is the matrix square root (symmetric PSD). For square PSD matrices, - hence "trace norm."
The nuclear norm as the convex envelope of rank. This is the key motivation:
More precisely, on the set , the nuclear norm is the tightest convex lower bound on rank. This makes it the convex relaxation of rank minimization - replacing the NP-hard rank minimization with a convex nuclear norm minimization.
Dual norm. The nuclear norm is dual to the spectral norm:
This duality is exploited in semidefinite programming formulations of nuclear norm minimization.
5.3 Computing the Nuclear Norm and Proximal Operator
Computation. , computed via SVD. In NumPy: np.linalg.norm(A, 'nuc').
Subdifferential. The nuclear norm is convex but non-smooth (when has repeated singular values). Its subdifferential at is:
For strictly positive singular values, is the unique subgradient.
Proximal operator. The proximal operator of (needed for nuclear norm regularization) is singular value soft-thresholding:
This is the key computational step in matrix completion, robust PCA, and spectral recovery algorithms.
For AI: Matrix completion (Netflix Prize formulation) seeks the minimum-rank matrix consistent with observed entries. The convex relaxation minimizes the nuclear norm, solvable with alternating direction method of multipliers (ADMM) using the proximal operator above. LoRA implicitly regularizes toward low nuclear norm through the factored parameterization .
5.4 Ky Fan Norms
The Ky Fan -norm is the sum of the top singular values:
Special cases:
- : (spectral norm)
- : (nuclear norm)
Ky Fan norms form a chain: , but this is NOT a "norm" ordering - a matrix can have larger than another while having smaller for larger .
Variational formula. The Ky Fan -norm has a beautiful characterization:
where the max is over orthonormal matrices . The optimal choice is and .
6. Unitarily Invariant Norms
6.1 Definition and Characterization
A matrix norm is unitarily invariant if:
This means the norm depends only on the singular values of , not on the specific singular vectors.
Von Neumann's characterization. A norm is unitarily invariant if and only if it is a symmetric gauge function applied to the vector of singular values:
where is a symmetric gauge function - a norm on that is:
- A norm (positive definite, homogeneous, triangle inequality)
- Symmetric: for any permutation
- Monotone: when for all
Examples of unitarily invariant norms:
- Frobenius: on singular values
- Spectral: on singular values
- Nuclear: on singular values
- Ky Fan :
- Schatten : on singular values
Non-unitarily-invariant norms:
- Matrix 1-norm (depends on column structure)
- Matrix -norm (depends on row structure)
- Entry-max norm
6.2 Fan Dominance and Majorization
Majorization. A vector majorizes (written ) if:
where are the decreasing order statistics.
Fan's dominance theorem. For unitarily invariant norms:
More precisely: for ALL unitarily invariant norms if and only if majorizes :
This connects matrix norm comparison to singular value majorization.
6.3 Weyl's Inequality (Preview of Perturbation Theory)
For unitarily invariant norms, Weyl's inequality gives bounds on singular value perturbation:
Theorem (Weyl). If , then for all :
Each singular value can change by at most under perturbation . This will be developed fully in 8.
6.4 The Role in Optimization
Unitarily invariant norms appear naturally in matrix optimization because they respect the singular value geometry of the problem. The Mirsky theorem states that for unitarily invariant norms, the best rank- approximation (in ANY unitarily invariant norm) is the truncated SVD - Eckart-Young generalizes beyond Frobenius.
For AI: The invariance to unitary transformations aligns with key AI structures. Transformers apply learned projections , ; if undergo orthogonal reparametrization, unitarily invariant norms capture the effective capacity independently of parameterization choice. This is exploited in analyses of transformer expressivity.
7. Condition Number
7.1 Definition and Intuition
The condition number of a nonsingular matrix (with respect to the -norm) is:
For (using spectral norms):
the ratio of the largest to smallest singular value.
Geometric intuition. The condition number measures the eccentricity of the ellipsoid . A sphere (all equal) gives . A very flat pancake (one ) gives .
CONDITION NUMBER GEOMETRY
========================================================================
\kappa(A) = 1 (identity) \kappa(A) = 10 (moderate) \kappa(A) -> \infty (near-singular)
*** ******* ---------------------
* * * * ---------------------
*** ******* ---------------------
\sigma_1/\sigma_2 = 1 \sigma_1/\sigma_2 = 10 \sigma_1/\sigma_2 -> \infty
(sphere) (ellipse) (flat disk -> singular)
========================================================================
7.2 Condition Number and Numerical Stability
The condition number quantifies how sensitive the solution of is to perturbations.
Forward error bound. If solves , then:
The relative error in the solution is at most times the relative error in the data. If the input has digits of precision, the output has roughly reliable digits.
Example. For and double-precision arithmetic ( correct digits), the solution has reliable digits. For , only 4 reliable digits remain.
For AI: The Hessian of the loss has condition number . High means:
- Gradient descent requires tiny step sizes (limited by ) but needs many steps (to make progress along directions)
- The loss landscape has steep valleys - the classic "ill-conditioned optimization" problem
- Adam and other adaptive optimizers implicitly precondition to reduce effective
7.3 Properties and Bounds
Key properties:
- for all nonsingular (since )
- iff is a scalar multiple of a unitary matrix
- - condition numbers multiply
- for any scalar
Norm dependence. Different norms give different condition numbers, but they're equivalent up to polynomial factors in .
For singular matrices: We define (singular matrices are maximally ill-conditioned).
Distance to singularity. The condition number relates to how far is from the nearest singular matrix:
(using the spectral norm). A matrix with is "close to singular" in a relative sense.
7.4 Tikhonov Regularization
When is too large for reliable computation, Tikhonov regularization artificially improves conditioning:
Condition number of the regularized system:
Since , the regularized system has finite condition number even when is singular (). As increases, decreases toward 1.
Solution bias. The Tikhonov solution has smaller norm than the minimum-norm least-squares solution: . This is the bias-variance tradeoff: regularization introduces bias to reduce variance (sensitivity to noise).
For AI: L2 regularization (weight decay) in neural networks is essentially Tikhonov regularization applied to the loss landscape. Adding to the loss shifts the Hessian eigenvalues by , bounding - improving the condition number of the optimization problem.
7.5 Estimating Condition Numbers
Computing exactly requires full SVD ( for ). For large matrices, approximations are needed.
Power method / Lanczos. Estimate by power iteration on . Estimate by inverse power iteration (more expensive, requires solving linear systems).
LAPACK routines. scipy.linalg.svd + ratio; or np.linalg.cond(A, p) for various -norms.
Randomized condition number estimation. For : generate , compute . This estimates with high probability using just two matrix-vector products.
8. Perturbation Theory
8.1 Motivation and Setup
The fundamental question of numerical analysis: If we perturb the data slightly, how much do the outputs change?
For matrix computations, we study:
- How much do eigenvalues change when ?
- How much do singular values change when ?
- How much does the solution change when or are perturbed?
All answers involve matrix norms.
Setup. Let with SVD , singular values (). Let be the perturbed matrix with singular values .
8.2 Weyl's Inequality for Singular Values
Theorem (Weyl's Inequality). For any :
Proof sketch. By the variational formula for singular values (Courant-Fischer), . Adding shifts this by at most .
Interpretation: Singular values are Lipschitz functions of the matrix with Lipschitz constant 1 (with respect to the spectral norm):
This makes singular values numerically stable - small matrix perturbations cause small changes.
Stronger form (Mirsky's theorem):
In Frobenius norm, the vector of singular values is also Lipschitz-1.
8.3 Eigenvalue Perturbation: Bauer-Fike
For symmetric matrices with eigenvalues , the analog of Weyl is:
For non-symmetric matrices, the situation is more complex. The Bauer-Fike theorem bounds eigenvalue perturbation for diagonalizable :
where is the condition number of the eigenvector matrix.
Key insight: Eigenvalues of non-normal matrices can be extremely sensitive to perturbation. The condition number - which can be astronomically large for non-normal matrices - amplifies the perturbation. This is why direct eigenvalue computation for non-normal matrices is numerically dangerous.
For AI: The sensitivity of eigenvalues of non-normal operators appears in RNN/LSTM gradient flow analysis. The eigenvalues of the recurrent weight matrix determine long-term memory, but if is non-normal, small weight perturbations (from noise, finite-precision, or gradient updates) can dramatically change eigenvalues and hence gradient behavior.
8.4 Forward and Backward Error Analysis
Forward error: - how wrong is the computed answer? Backward error: - how much do we need to perturb the input for to be exact?
Fundamental relationship:
An algorithm is backward stable if it produces output with small backward error. For backward-stable algorithms on problems with small condition number, the forward error is also small.
Example. Gaussian elimination with partial pivoting is backward stable: the computed solution satisfies where (small backward error). The forward error is bounded by .
9. Applications in Machine Learning
9.1 Weight Regularization: Frobenius vs Nuclear
Neural network training minimizes a loss with a regularizer:
Frobenius (L2/weight decay):
- Gradient:
- Effect: shrinks all singular values uniformly
- Induces: no sparsity in singular values; doesn't promote low rank
- Used in: essentially all deep learning (Adam, SGD with weight decay)
Nuclear norm:
- Subgradient: (top singular vectors)
- Effect: promotes sparsity in singular values -> low-rank solutions
- Proximal step: singular value soft-thresholding
- Used in: matrix completion, robust PCA, some transformer pruning methods
Spectral norm:
- Subgradient: (rank-1 outer product)
- Effect: limits largest singular value; controls Lipschitz constant
- Used in: spectral normalization for GAN training (Miyato 2018)
LoRA and nuclear norm. The LoRA reparameterization (with , ) has an interesting norm structure:
The product parameterization implicitly regularizes the nuclear norm of the weight increment, even without explicit regularization.
9.2 Spectral Normalization for GANs
Generative Adversarial Networks (GANs) require the discriminator to be Lipschitz:
For a neural network where , and the activation has Lipschitz constant 1 (ReLU, tanh, etc.):
Spectral normalization (Miyato et al., 2018) replaces each with , ensuring each layer has spectral norm exactly 1, hence:
Implementation. The spectral norm is estimated via power iteration - a single step per training iteration suffices in practice:
v <- W^T u / ||W^T u||
u <- W v / ||W v||
\sigma <- u^T W v
W <- W / \sigma
This adds minimal overhead and dramatically stabilizes GAN training.
9.3 Gradient Clipping and Norm Bounds
Gradient clipping prevents gradient explosion by rescaling gradients when their norm exceeds a threshold:
Choice of norm matters:
- Global L2 clipping: (all parameters concatenated). Standard in transformers (Vaswani 2017): clip at .
- Per-tensor clipping: clip each weight matrix's gradient separately using its spectral norm. More expensive but more principled.
- Frobenius clipping: clip by per layer. Common in modern optimizers.
For AI: The choice of gradient clipping norm affects which singular value components of the gradient are preserved. Clipping by spectral norm ensures the maximum singular value doesn't exceed , while Frobenius clipping preserves the relative structure of all singular values but scales them uniformly.
9.4 Low-Rank Approximation and Model Compression
The Eckart-Young theorem justifies truncated SVD for model compression:
Weight matrix compression. For a weight matrix , store the rank- approximation using parameters instead of . The approximation error:
Compression ratio. For compression ratio , we need .
LoRA revisited. Instead of post-hoc compression, LoRA trains the low-rank increments directly:
The parameter savings are dramatic: fine-tuning parameters per layer instead of .
9.5 Lipschitz Bounds and Generalization
PAC-Bayes generalization bounds connect norms of weight matrices to the generalization gap. For a feedforward network with layers:
where the precise bound depends on the norm choice. Bartlett et al. (2017) proved a spectrally-normalized margin bound:
where is the input bound, is the margin, and is the training set size.
Key insight: The ratio (the stable rank) measures effective dimensionality. Matrices with low stable rank generalize better.
9.6 Attention Mechanisms and Low-Rank Structure
The attention mechanism in transformers computes:
The matrix (for sequence length ) is the attention logit matrix.
Nuclear norm of attention. Empirically, trained attention matrices have low nuclear norm relative to their Frobenius norm - they exhibit low-rank structure. Dong et al. (2021) ("Attention is not All You Need") showed that purely attention-based models without MLP layers collapse to rank-1, connecting to the spectral norm of the attention matrix.
Multi-head Low-Rank Attention (MLA). DeepSeek's MLA architecture (2024) explicitly parameterizes key-value caches in low-rank form to reduce memory:
where with . This is exactly SVD-based compression of the KV cache, motivated by the low-rank structure of attention matrices.
9.7 Implicit Regularization in Deep Learning
Deep learning optimizers (SGD, Adam) exhibit implicit regularization - they converge to solutions with small norms even without explicit regularization.
Observation (Gunasekar et al., 2017). Gradient flow on matrix factorization converges to the minimum nuclear norm solution. This is because the dynamics , implicitly minimize .
Spectral norm implicit regularization. For overparameterized linear networks (depth ), gradient descent with small step size finds solutions with small spectral norm of the end-to-end product .
For AI (2026). Modern foundation models benefit from understanding these implicit biases:
- LoRA fine-tuning implicitly penalizes nuclear norm of the weight increment
- Adam with weight decay (decoupled) implicitly regularizes toward solutions with small
- Gradient clipping implicitly regularizes the spectral norm of gradient steps