A Practical Randomized CP Tensor Decomposition

Casey Battaglino, Grey Ballard, Tamara G. Kolda

TL;DR

This paper introduces CPRAND, a randomized algorithm that drastically accelerates the CANDECOMP/PARAFAC (CP) tensor decomposition by using "sketching" to solve its underlying least squares problems. By sampling just a tiny fraction of the data, the authors achieve speedups of up to 500x per iteration on large, dense tensors while maintaining high decomposition quality and improving robustness to poor initializations.

What Problem Does This Paper Address?

Tensor decomposition is the multi-dimensional version of matrix factorization, used to find hidden patterns in complex data like neuroscience signals, social networks, or chemical spectra. The "gold standard" algorithm for this is CP-ALS (Alternating Least Squares).

However, CP-ALS has a major bottleneck: it repeatedly solves massive, highly overdetermined linear least squares problems. For a large, dense tensor, the computational cost and memory requirements become prohibitive. While randomized "sketching" (sampling a subset of the data to approximate the whole) has worked for matrices, applying it to tensors is tricky because the CP structure is already quite efficient. The authors set out to prove that randomization can still provide massive gains without sacrificing the quality of the final model.

Methods

The authors propose two primary algorithms and a novel stopping criterion:

  1. CPRAND: Instead of using every row in the least squares subproblems, CPRAND uniformly samples a small number of rows. Crucially, it uses a "Sampled Khatri-Rao Product" (SKR) to avoid ever forming the massive intermediate matrices explicitly, saving enormous amounts of memory.
  2. CPRAND-MIX: To handle "coherent" data (where information is concentrated in a few entries, making uniform sampling risky), this version applies a Randomized Fast Fourier Transform (FFT) as a preprocessing step. This "mixes" the data, spreading information evenly across all entries so that uniform sampling becomes highly effective.
  3. Sampling-Based Stopping Condition: Calculating the "fit" (how well the model matches the data) is usually as expensive as the decomposition itself. The authors developed a lightweight estimate using Chernoff-Hoeffding bounds, allowing the algorithm to know when to stop without doing a full, expensive pass over the data.

Datasets

The researchers evaluated their methods on three types of data:

  • Synthetic Tensors: Tensors with known ground truth, varying in order (3rd and 5th), size (up to 800 per dimension), noise levels, and "collinearity" (how similar the underlying factors are).
  • COIL-100: An image-recognition dataset containing 7,200 images of 100 objects at different angles, treated as a $128 \times 128 \times 3 \times 7200$ tensor.
  • Hazardous Gases: A 13.4 GB dataset from wind tunnel experiments measuring gas concentrations across 72 sensors over 25,900 time steps.

Key Insights and Ideas

  • The Khatri-Rao Advantage: The authors proved that the Khatri-Rao product (the core structure in CP decomposition) actually reduces the "coherence" of the system. This means that even if individual factor matrices are "spiky," their product is likely to be "smooth," making it naturally well-suited for random sampling.
  • Robustness to Initialization: Standard CP-ALS is notoriously sensitive to its starting point and often gets stuck in local minima. The "noise" introduced by random sampling in CPRAND actually helps the algorithm escape these local minima, leading to better final scores than the deterministic version.
  • Sublinear Scaling: Because the number of samples needed ($S$) depends more on the target rank ($R$) than the total size of the tensor, the relative speedup grows larger as the tensors get bigger.

Key Results

  • Massive Speedups: For 3rd-order tensors, CPRAND was up to 50x faster per iteration. For 5th-order tensors, it reached 500x faster.
  • Efficiency: On the 13.4 GB Hazardous Gas dataset, CPRAND converged in 53.6 seconds, compared to nearly 10 minutes for standard CP-ALS—a 10x total speedup while achieving slightly better classification accuracy.
  • Sample Efficiency: The authors found that sampling only $10R \log(R)$ rows (where $R$ is the rank) was typically sufficient for high-quality results.
  • Fit Accuracy: The randomized stopping condition was able to estimate the model fit to within 1% accuracy while being orders of magnitude faster than an exact calculation.

Limitations and Future Work

  • Complex Numbers: Using the FFT for mixing (CPRAND-MIX) turns real-valued data into complex-valued data, which doubles the memory footprint during that stage. The authors suggest real-valued transforms (like the Discrete Cosine Transform) could be faster if better implemented in software like MATLAB.
  • Sparse Tensors: The current mixing approach is designed for dense tensors. Applying it to sparse tensors would "fill them in," destroying their sparsity and making them harder to process. Future work is needed to adapt these sketching methods for sparse data.
  • Theoretical Bounds: While the empirical results are strong, the authors note that more theoretical work is needed to rigorously estimate the optimal sample size for different types of data.

Summary updated

BibTeX
@article{battaglino2018practical,
  author = {Casey Battaglino and Grey Ballard and Tamara G. Kolda},
  title = {{A Practical Randomized CP Tensor Decomposition}},
  journal = {SIAM J. Matrix Anal. Appl.},
  year = {2018},
  doi = {10.1137/17m1112303},
}
Figure