$XX^{t}$ Can Be Faster
Dmitry Rybin, Yushun Zhang, Zhi-Quan Luo
TL;DR
This work targets the efficient computation of $XX^{t}$ for $X\in\mathbb{R}^{n\times m}$ by introducing RXTX, a recursive $4\times 4$-block algorithm that reduces multiplications and total operations by about 5% versus the state of the art. RXTX's costs are analyzed via recurrences $R(n)=8R(n/4)+26M(n/4)$ and $R(n)\sim\frac{26}{41}M(n)+\frac{15}{41}n^{3/2}$, yielding an asymptotic constant of $\frac{26}{41}\approx0.6341$, a modest improvement over Strassen-inspired constants. The method also achieves non-asymptotic gains (e.g., $R(4)=34$ vs $R(4)=38$) and is supported by empirical runtime gains (e.g., average $2.524$ s vs $2.778$ s for large dense matrices) with high reliability. RXTX was discovered by RL-guided Large Neighborhood Search combined with a MILP-based pipeline, demonstrating how structured search can uncover efficient algorithms for structured matrix products like $XX^{t}$ with practical impact on covariance/Gram computations and potential applications in ML training pipelines.
Abstract
We present RXTX, a new algorithm for computing the product of matrix by its transpose $XX^{t}$ for $X\in \mathbb{R}^{n\times m}$. RXTX uses $5\%$ fewer multiplications and $5\%$ fewer operations (additions and multiplications) than State-of-the-Art algorithms. Note that the accelerations not only holds asymptotically for large matrices with $n \rightarrow \infty$, but also for small matrices including $n = 4$. The algorithm was discovered by combining Machine Learning-based search methods with Combinatorial Optimization.
