Programming lesson
Projection-Free Low-Rank Matrix Optimization: From Nuclear Norm to LMO for Large-Scale ML
Learn how to scale low-rank matrix optimization to large datasets using linear minimization oracles (LMO) instead of costly SVD projections, with hands-on examples from movie recommendation and blind deconvolution.
Introduction: The Low-Rank Matrix Optimization Challenge
Low-rank matrix optimization is at the heart of modern machine learning applications, from recommendation systems to image deblurring. The goal is to find a matrix X that minimizes a convex objective f(X) subject to a rank constraint rank(X) ≤ r. Since rank is non-convex, we often relax it to a nuclear norm constraint ||X||* ≤ κ. However, projecting onto the nuclear norm ball requires a full singular value decomposition (SVD), which scales as O(min(p²m, pm²))—a bottleneck for large matrices like the Netflix dataset (100 million ratings). In this tutorial, you'll learn how to replace projection with a linear minimization oracle (LMO) that only needs the top singular vector pair, drastically reducing computation. We'll connect these ideas to real-world examples: MovieLens recommendation and blind deconvolution for crime scene investigation.
Understanding the Nuclear Norm and Its Projection
For a matrix Z with SVD Z = UΣV^T, the projection onto the nuclear norm ball ||X||* ≤ κ is computed by projecting the singular value vector σ onto the ℓ1-ball of radius κ. This follows from Mirsky's inequality, which shows that the Frobenius distance between two matrices is at least the distance between their singular value vectors. Formally, proj_X(Z) = U Σ_{ℓ1} V^T, where Σ_{ℓ1} has diagonal σ_{ℓ1} = proj_{ℓ1-ball}(σ).
In Python, you can implement this as:
import numpy as np
def projNuc(Z, kappa):
U, s, Vt = np.linalg.svd(Z, full_matrices=False)
s_proj = projL1(s, kappa) # provided function
return U @ np.diag(s_proj) @ VtTesting on the MovieLens 100k dataset (1000 users × 1700 movies) and 1M dataset (6000 × 4000) shows that SVD time grows quickly. For 100k, average projection time is ~0.5s; for 1M, it jumps to ~8s. For the Netflix-scale matrix (480k × 18k), SVD is impractical.
The Linear Minimization Oracle (LMO): A Faster Alternative
Instead of projecting, we can use a linear minimization oracle (LMO) that solves lmo_X(Z) = argmin_{X in X} ⟨X, Z⟩. For the nuclear norm ball, the LMO returns -κ u v^T, where u and v are the left and right singular vectors corresponding to the largest singular value of Z. This requires only the top singular vector pair, which can be computed via power iteration in O(pm) time—much faster than full SVD.
Implementation:
def lmoNuc(Z, kappa):
u, s, v = svd_top(Z) # top singular triple
return -kappa * np.outer(u, v)Timing on MovieLens: 100k ~0.02s, 1M ~0.1s—orders of magnitude faster than projection. This speedup is crucial for large-scale optimization.
Application 1: Movie Recommendation with Matrix Completion
Recommendation systems predict user ratings for movies. The rating matrix R (users × movies) is partially observed. Assuming it is low-rank, we solve:
minimize ||P_Ω(X - R)||_F^2 subject to ||X||_* ≤ κUsing the LMO-based Frank-Wolfe algorithm, we can handle datasets like MovieLens 1M efficiently. Each iteration only needs the top singular vector of the gradient, avoiding SVD.
Application 2: Blind Deconvolution for Crime Scene Investigation
In blind deconvolution, we observe a blurry image y = w * x (circular convolution) and want to recover the sharp image x and blur kernel w. By modeling w and x as belonging to known subspaces (e.g., wavelets for x, support constraint for w), the problem becomes a low-rank matrix optimization. The nuclear norm relaxation helps separate the two signals. Using an LMO-based solver, we can deblur a license plate image even with a rough estimate of the blur support.
Conclusion: Why LMO Matters for Scalable ML
The shift from projection to linear minimization is a key trend in scalable optimization. As datasets grow—from MovieLens to Netflix to real-time video—the SVD bottleneck becomes prohibitive. LMO-based methods like Frank-Wolfe are projection-free and memory-efficient, making them ideal for modern AI applications. By mastering these techniques, you'll be equipped to tackle large-scale matrix problems in recommendation, imaging, and beyond.
Further Reading & Next Steps
Explore the provided homework scripts (Pr11b, Pr12b) to run your own timing experiments. Experiment with different κ values and datasets. For blind deconvolution, try using a wavelet basis for x and a box support for w. The code templates will guide you.