Randomized Cholesky QR factorizations

Oleg BalabanovarXiv 2022 · DOI

Introduction

QR factorization—the decomposition of a matrix $X$ into an orthogonal matrix $Q$ and an upper triangular matrix $R$—is a fundamental operation in numerical linear algebra. It serves as a cornerstone for solving linear least-squares problems, computing eigenvalues, and training large-scale machine learning models. In the era of high-performance computing (HPC), the efficiency of these operations is increasingly defined by communication costs rather than raw floating-point operations.

For "tall-and-skinny" matrices (where the number of rows $m$ significantly exceeds the number of columns $n$), the Cholesky QR algorithm is theoretically ideal. It is "communication-avoiding," requiring only a single global synchronization point in distributed environments. However, Cholesky QR suffers from a significant drawback: numerical instability. If the input matrix is even moderately ill-conditioned, the algorithm fails to maintain the orthogonality of $Q$. This paper introduces a family of randomized Cholesky QR factorizations that resolve this long-standing trade-off, offering both the speed of communication-avoiding methods and the robustness of traditional stable algorithms.

The Problem: The Stability-Efficiency Gap

The instability of standard Cholesky QR stems from its reliance on the Gramian matrix $X^TX$. Computing this product effectively squares the condition number of the input matrix, leading to a rapid loss of precision. While "shifted" or "re-orthogonalized" variants of Cholesky QR exist to mitigate this, they often double the computational cost or require additional communication rounds, neutralizing the algorithm's primary advantages.

Conversely, Householder QR—the industry standard for stability—is computationally expensive and requires frequent communication, making it a bottleneck on modern parallel architectures. The challenge lies in finding a method that preserves the single-pass communication profile of Cholesky QR without the catastrophic loss of precision.

Methodology: Randomized Sketching

The proposed solution leverages random sketching to compute the triangular factor $R$. Instead of processing the full Gramian matrix, the algorithm follows a three-step randomized pipeline:

  1. Sketching: A random sketching matrix $\Theta$ is applied to the input $X$ to create a smaller "sketch" $P = \Theta X$. This sketch is significantly smaller than the original matrix but is designed to preserve its essential geometric and spectral properties.
  2. Factorization: The $R$ factor is computed from the small sketch $P$ using a stable, standard method such as Householder QR. Because $P$ is small, this step is computationally inexpensive.
  3. Back-substitution: The final orthogonal factor $Q$ is retrieved via the relationship $Q = XR^{-1}$.

By using a sketch rather than the Gramian, the algorithm avoids the "squaring" of the condition number, providing a numerically cleaner foundation for the $R$ factor.

Algorithmic Variants

The paper details several specialized versions of this approach:

  • RCholeskyQR: The direct randomized implementation.
  • RRRCholQR (Rank-Revealing): A variant designed for matrices that are not full rank. It can detect and isolate linearly dependent columns, ensuring stability even in degenerate cases.
  • Reduced RCholeskyQR: Optimized for applications like model order reduction, where only a low-dimensional projection of $Q$ is required.
  • Multi-precision Implementation: A hybrid approach where the "minor" operations on the small sketch are performed in high precision (e.g., float64), while the "dominant" operations on the large matrix $X$ remain in standard precision (e.g., float32). This provides a significant stability boost with negligible overhead.

Experimental Evaluation

The author validated these algorithms across a diverse set of benchmarks:

  • Synthetic Stress Tests: Using Singular Value Decomposition (SVD) to create matrices with precisely controlled condition numbers to find the breaking points of each algorithm.
  • Rank-Deficient Problems: A matrix derived from a 2D grid discretization of a trigonometric function was used to test the robustness of the rank-revealing variant.
  • Real-World Applications: The "Ga41As41H72" matrix from the SuiteSparse Matrix Collection, representing a quantum chemistry problem, was integrated into a block GMRES solver to evaluate performance in a production-like setting.

Key Results and Insights

The randomized Cholesky QR family demonstrates superior performance across several metrics:

  • Speed and Scalability: RCholeskyQR2 achieved up to a 1.5x speedup over the best existing shifted Cholesky variants and was 2x faster than standard Householder QR. Its communication-avoiding nature makes it particularly effective on distributed systems.
  • Robustness to Rank-Deficiency: For matrices with low numerical rank, the RRRCholQR variant outperformed Householder QR by 10x to 100x, as it only needs to process the linearly independent components of the matrix.
  • Unconditional Stability: The RRRCholQR variant is shown to be "unconditionally stable," meaning its accuracy is independent of the input matrix's condition number. In tests, the proposed methods maintained near-machine precision orthogonality ($10^{-16}$ for float64) even when standard Cholesky QR failed entirely.

Conclusion

Randomized Cholesky QR factorizations represent a significant advancement in numerical linear algebra. By replacing the unstable Gramian computation with a random sketch, these algorithms break the traditional link between communication efficiency and numerical instability.

While the use of randomization introduces a theoretical risk of failure, the probability is mathematically negligible for practical sketching dimensions. Future work will likely focus on optimizing these techniques for emerging low-precision hardware, such as AI-targeted tensor cores, and extending the sketching philosophy to other fundamental matrix decompositions.

Summary updated

BibTeX
@misc{balabanov2022randomized,
  author = {Oleg Balabanov},
  title = {{Randomized Cholesky QR factorizations}},
  year = {2022},
  eprint = {2210.09953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.09953},
}
Figure