惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
A
About on SuperTechFans
V
Visual Studio Blog
美团技术团队
雷峰网
雷峰网
J
Java Code Geeks
L
LINUX DO - 最新话题
T
Threatpost
I
Intezer
Simon Willison's Weblog
Simon Willison's Weblog
月光博客
月光博客
博客园 - Franky
The Cloudflare Blog
AWS News Blog
AWS News Blog
T
Tor Project blog
IT之家
IT之家
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
S
Securelist
V
V2EX
C
CERT Recently Published Vulnerability Notes
T
Threat Research - Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyberwarzone
Cyberwarzone
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
爱范儿
爱范儿
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
小众软件
小众软件
Spread Privacy
Spread Privacy
S
Security Affairs
NISL@THU
NISL@THU
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
AI
AI
Cisco Talos Blog
Cisco Talos Blog
N
Netflix TechBlog - Medium
博客园 - 司徒正美

Lei Mao's Log Book

2026 FIFA World Cup 备受嘲讽的会徽 Python Debugging Via VS Code In Docker Container Vargas Plateau Regional Park 徒步 Vargas Plateau Regional Park Apex 2026 FIFA World Cup 小组赛赛程 Retaining EXIF Metadata In GIMP San Francisquito Creek Joint Powers Authority 2025 Calendar Photo 麦当劳 The FIFA World Cup 套餐 Ardenwood Historic Farm 徒步 Ardenwood Historic Farm Synchronizations With TorchRec KeyedJaggedTensor Pacific Commons Linear Park 徒步 Pacific Commons Linear Park 2026 San Jose Half Marathon 竞赛 目标 Mountain View Shoreline Park 徒步 Mountain View Shoreline Park PyTorch AOTInductor Hybrid Lowering Carquinez Strait Regional Shoreline 徒步 Carquinez Strait Regional Shoreline PyTorch Triton Kernel Transparent Tracing and Compilation 脸庞 PyTorch Fake Export 2026 BRAIN Foundation 10K 竞赛 2026 Wild and Scenic Film Festival 参观 2026 Wild and Scenic Film Festival 系统工程程序员修 Bug FIFA 官方网站的语言 PyTorch Custom Operation 汉堡王 The Mandalorian and Grogu 套餐 Tilden Regional Parks Botanic Garden 参观 Tilden Regional Park Tilden Regional Parks Botanic Garden Tilden Regional Park 徒步 《寻秦记》电影版 ICML 2026 Area Chair Experience 2026 Foster City 5K Fun Run 竞赛 2026 年 3 月和 4 月该入手的模型手办 Docker Container GUI Display Using Wayland 马拉松破二 2026 Heart & Soles Run 5K 竞赛 How Is FARS, The Fully Automated Research System? 算计: 七天的死亡游戏 Lake Chabot Regional Park 徒步 Lake Chabot Regional Park 2023 年恐怖电影《感恩节》 2026 Airport Runway Run at San Carlos Airport 5K 竞赛 Page Table for Page-Locked Host Memory Don Edwards San Francisco Bay National Wildlife Refuge - Ravenswood 徒步 Don Edwards San Francisco Bay National Wildlife Refuge - Ravenswood 法外风云 PyTorch Graph Symbolic Integer Contra Costa Canal Regional Trail 徒步 Contra Costa Canal Regional Trail 娑婆诃 PyTorch Export 2026 Western Pacific 5K 竞赛 浮躁的科研和胡扯的自媒体 Connecting Logitech Devices On Linux 2026 Oakland Half Marathon 竞赛 Del Valle Regional Park 徒步 Del Valle Regional Park CUDA_LAUNCH_BLOCKING=1 踏切时间 Wildcat Canyon Regional Park 徒步 Wildcat Canyon Regional Park Credit Card Unauthorized Transaction While In Possession 莎拉的真伪人生 2026 Union City Superhero Fun Run 5K 竞赛 McLaughlin Eastshore State Park 徒步 McLaughlin Eastshore State Park Cloudflare Worker Proxy R2 Bucket Access Zorro 和 Batman Fix MacBook Pro Space Key Stuck Problem 2026 年 1 月和 2 月该入手的模型手办 2026 Brazen Victory 10K 竞赛 儿时的玩伴李峰 Marsh Creek Regional Trail 徒步 Marsh Creek Regional Trail Perfetto GPU Flow Artifacts 百万人推理 System Performance Optimizations QQ 幻想 2026 Brazen Bay Breeze 5K 竞赛 CUDA Shared Memory Bank Conflict-Free Vectorized Access Dota 闪电站出售 Mountain View Downtown 徒步 Mountain View Downtown C++ Latch and Barrier 2025 年跑步总结 2026 Rotary Mission Ten Half Marathon 竞赛 狗的素质等于人的素质 CUDA Rendezvous Stream Pleasanton Ridge Regional Park 徒步 Pleasanton Ridge Regional Park Xfinity Internet 多年来的使用感受 Don Castro Regional Recreation Area 徒步 Don Castro Regional Recreation Area 拖车公司的大汉们
Randomized SVD
2026-01-19 · via Lei Mao's Log Book

Introduction

Singular Value Decomposition (SVD) is a powerful matrix factorization technique widely used in various fields, including machine learning, data compression, and signal processing. However, performing SVD on large matrices can be computationally expensive. Randomized SVD is an efficient algorithm that approximates the SVD of large matrices using random projections.

In this blog post, I would like to quickly discuss the mathematical motivations behind Randomized SVD and outline the algorithm.

Prerequisites

Orthonormal Columns

Suppose $Q$ is a matrix with orthonormal columns, then we have $Q^{\top} Q = I$.

Orthonormal Projection

Suppose $Q$ is a matrix with orthonormal columns of shape $m \times k$, then the matrix $P = Q Q^{\top}$ is an orthonormal projection matrix projecting onto the column space of $Q$. For any vector $x$ of shape $m \times 1$, the projection of $x$ onto the column space of $Q$ is given by $P x = Q Q^{\top} x$. The matrix $P$ is symmetric and idempotent, i.e., $P^{\top} = P$ and $P^2 = P$.

Note that $Q Q^{\top} x$ is different from $Q^{\top} x$. $Q^{\top} x$ gives the coordinates of $x$ in the basis formed by the columns of $Q$, while $Q Q^{\top} x$ is the point that is the closest to $x$ in the column space of $Q$, i.e., the orthonormal projection of $x$ onto the column space of $Q$.

For example, suppose we have a point $x = [1, 1]$ and a matrix that only consists of one orthonormal column.

$$
Q = \begin{bmatrix}
1 \\
0
\end{bmatrix}
$$

The coordinates of $x$ in the basis formed by the column of $Q$ is given by:

$$
Q^{\top} x = \begin{bmatrix}
1 & 0
\end{bmatrix}
\begin{bmatrix}
1 \\
1
\end{bmatrix}
= 1
$$

The point that is the closest to $x$ in the column space of $Q$ is given by:

$$
Q Q^{\top} x = \begin{bmatrix}
1 \\
0
\end{bmatrix}
\begin{bmatrix}
1 & 0
\end{bmatrix}
\begin{bmatrix}
1 \\
1
\end{bmatrix}
= \begin{bmatrix}
1 \\
0
\end{bmatrix}
$$

The closest point to $x$ in the column space of $Q$ is $Q Q^{\top} x = [1, 0]$. We could not find any other point in the column space of $Q$ that is closer to $x$ than $[1, 0]$.

This can also be proved mathematically.

Proof

Let $y = Q c$ be any point in the column space of $Q$, where $c$ is a vector of shape $k \times 1$. The squared distance between $x$ and $y$ is given by:

$$
| x - y |^2 = | x - Q c |^2
$$

The squared distance between $x$ and $y$ is minimized when $c = Q^{\top} x$:

$$
\begin{aligned}
| x - Q c |^2 &= (x - Q c)^{\top} (x - Q c) \\
&= x^{\top} x - 2 c^{\top} Q^{\top} x + c^{\top} c
\end{aligned}
$$

The squared distance is minimized when the derivative with respect to $c$ is zero:

$$
\frac{\partial}{\partial c} | x - Q c |^2
= -2 Q^{\top} x + 2 c = 0
$$

Solving for $c$ gives:

$$
c = Q^{\top} x
$$

The squared distance between $x$ and $y$ is then given by:

$$
\begin{aligned}
| x - y |^2 &= | x - Q c |^2 \\
&= | x - Q Q^{\top} x |^2 \\
&= | (I - Q Q^{\top}) x |^2
\end{aligned}
$$

This concludes the proof. $\square$

If $x$ is already in the column space of $Q$, then $(I - Q Q^{\top}) x = 0$ and the squared distance is exactly zero. In this case, $x = Q c$ for some $c$ and the projection of $x$ onto the column space of $Q$ is $Q Q^{\top} x = Q Q^{\top} Q c = Q \left(Q^{\top} Q\right) c = Q I c = Q c = x$. So the distance between $x$ and its projection $Q Q^{\top} x$ is zero.

So if the column space of $Q$ captures most of the “energy” of the data points, then the projection of the data points onto the column space of $Q$ will be very close to the original data points.

Suppose $A$ is a data matrix of shape $m \times n$, without loss of generality, we could assume that $m \geq n$, and $A$ has rank $d$, $m \geq n \geq d$. If we could find a matrix $Q$ of shape $m \times k$ with orthonormal columns, where $k \leq d$, such that the column space of $Q$ captures most of the “energy” of the data points in $A$, then we could use $Q Q^{\top} A$ to approximate $A$ with a lower-rank matrix $Q$.

QR Decomposition

QR decomposition is a matrix factorization technique that decomposes a matrix $A$ of shape $m \times n$ into the product of an orthogonal matrix $Q$ and an upper triangular matrix $R$. The QR decomposition of a matrix $A$ is given by:

$$
A = QR
$$

where $Q$ is an orthogonal matrix of shape $m \times m$, and $R$ is an upper triangular matrix of shape $m \times n$. The QR decomposition can be computed using various algorithms, such as the Gram-Schmidt process or the Householder reflections.

If $A$ is lower rank, we could use the thin QR decomposition to get $Q$ with orthonormal columns. The thin QR decomposition of a matrix $A$ of shape $m \times n$ with rank $d$ is given by:

$$
A = QR
$$

where $Q$ is of shape $m \times d$ with orthonormal columns, and $R$ is of shape $d \times n$.

Singular Value Decomposition (SVD)

Singular Value Decomposition (SVD) is a matrix factorization technique that decomposes a matrix $A$ of shape $m \times n$ into the product of three matrices: $U$, $\Sigma$, and $V^{\top}$. The SVD of a matrix $A$ is given by:

$$
A = U \Sigma V^{\top}
$$

where $U$ is an orthogonal matrix of shape $m \times m$, $\Sigma$ is a diagonal matrix of shape $m \times n$ with non-negative singular values on the diagonal, and $V$ is an orthogonal matrix of shape $n \times n$.

If $A$ has rank $d$, then only the first $d$ singular values in $\Sigma$ are non-zero. We could use the compact SVD to get a more compact representation of $A$. The compact SVD of a matrix $A$ of shape $m \times n$ with rank $d$ is given by:

$$
A = U \Sigma V^{\top}
$$

where $U$ is of shape $m \times d$, $\Sigma$ is of shape $d \times d$, and $V$ is of shape $n \times d$.

Reduced SVD

If we only keep the top $k$ singular values and their corresponding singular vectors, where $k \leq d$, we could get the rank-$k$ approximation of $A$ as follows:

$$
A \approx U_k \Sigma_k V_k^{\top}
$$

where $U_k$ is of shape $m \times k$, $\Sigma_k$ is of shape $k \times k$, and $V_k$ is of shape $n \times k$.

SVD is useful for data compression, which reduces the storage requirement for large data matrix $A$ from $\mathcal{\Theta}(mn)$ to $\mathcal{\Theta}(k(m+n+k))$, where $k$ is the target rank. When $k \ll \min(m, n)$, the storage saving could be significant.

Randomized SVD

Performing SVD on the large data matrix $A$ directly could be computationally expensive. Instead, if we know the orthonormal basis $Q$ that captures most of the “energy” of the data points in $A$, we could first project $A$ onto the column space of $Q$ to get a smaller matrix $B = Q^{\top} A$ of shape $k \times n$, then perform SVD on the smaller matrix $B$ to get its SVD decomposition $B = \tilde{U} \Sigma V^{\top}$, where $\tilde{U}$ is of shape $k \times k$, $\Sigma$ is of shape $k \times n$, and $V$ is of shape $n \times n$. Finally, we could reconstruct the approximate SVD decomposition of $A$ as follows:

$$
\begin{align}
A
&\approx Q Q^{\top} A \\
&= Q B \\
&= Q \tilde{U} \Sigma V^{\top} \\
&= U \Sigma V^{\top}
\end{align}
$$

where $U = Q \tilde{U}$ is of shape $m \times k$.

So the question is how to find the orthonormal basis $Q$ that captures most of the “energy” of the data points in $A$ efficiently. Certainly we could use QR decomposition on $A$ directly to get $Q$, but this could still be computationally expensive for large matrices.

If we could reduce the size of $A$ from $m \times n$ to $m \times r$ while still preserving the orthonormal basis of the column space of $A$, where $r$ is slightly larger than $k$, then we could perform QR decomposition on the smaller matrix to get $Q$ efficiently. This is where random projection comes in.

The hypothesis is that if we project the data points in $A$ onto a random subspace of dimension $r$ using some random matrix $P$ of shape $n \times r$, when $r$ is slightly larger than $k$, the rank of $A$, with high probability, the orthonormal basis of the column space of the projected data points will be very close to the orthonormal basis of the column space of the original data points. This matrix $P$ cannot be any arbitrary matrix. For example, if $P$ is a matrix of all zeros, then the projected data points will all be zero and we cannot recover any information about the original data points. A common choice of $P$ is a Gaussian random matrix, where each entry is sampled from a standard normal distribution. Once we have the shrunken data matrix $Z = A P$ of shape $m \times r$, we could perform QR decomposition on $Z$ to get $Q$ of shape $m \times r$ with orthonormal columns. Then we could proceed with the steps mentioned above to compute the approximate SVD decomposition of $A$.

Concretely, the steps of the randomized SVD algorithm are as follows:

  1. Generate a Gaussian random matrix $P$ of shape $n \times r$. When $r$ is smaller than the rank of matrix $A$, $k$, there starts to be information loss.
  2. Compute the shrunken data matrix $Z = A P$ of shape $m \times r$.
  3. Perform QR decomposition on $Z$ to get $Q$ of shape $m \times r$ with orthonormal columns.
  4. Compute the smaller matrix $B = Q^{\top} A$ of shape $r \times n$.
  5. Perform SVD on $B$ to get $B = \tilde{U} \Sigma V^{\top}$.
  6. Compute $U = Q \tilde{U}$ of shape $m \times r$.
  7. The approximate SVD decomposition of $A$ is given by $A \approx U \Sigma V^{\top}$.

References