Faster and Cheaper: Parallelizing Large-Scale Matrix Factorization on GPUs

Wei Tan, Liangliang Cao, Liana L. Fong

TL;DR

Researchers from IBM and Yahoo! have developed cuMF, a CUDA-based library that makes large-scale matrix factorization (MF) significantly faster and cheaper by offloading it to GPUs. By aggressively optimizing memory access and implementing a topology-aware parallel reduction scheme, cuMF outperforms state-of-the-art distributed CPU clusters by 10x in speed and up to 100x in cost-efficiency, successfully solving the largest MF problem ever reported in literature (112 billion ratings).

What Problem Does This Paper Address?

Matrix Factorization is the engine behind modern recommendation systems (like Netflix or Amazon) and text mining. It works by breaking down a massive, sparse "rating matrix" (users x items) into two smaller, dense matrices representing hidden features.

The challenge is scale. Industry-scale problems now involve billions of users and hundreds of billions of ratings. While GPUs are famous for accelerating "compute-bound" tasks like Deep Learning (dense matrix math), MF is "memory-bound" because it involves manipulating sparse data. Standard GPU implementations often stall while waiting for data to move. Existing solutions usually rely on massive, expensive CPU clusters (50+ nodes) that suffer from high latency and high operational costs.

Methods

The authors introduce two major algorithmic frameworks to tackle these bottlenecks:

  1. MO-ALS (Memory-Optimized ALS): On a single GPU, the authors optimized the Alternating Least Squares (ALS) algorithm.
  2. Register Aggregation: This is the "secret sauce." Since registers are the fastest memory on a GPU but aren't "dynamically indexable," the authors used C++ macro expansion to generate specific code for different feature sizes, allowing them to store intermediate calculations in registers rather than slower global memory.
  3. Memory Hierarchy: They used texture memory as a cache for irregular data access and shared memory for data binning to reduce redundant global memory reads.
  4. SU-ALS (Scale-Up ALS): To handle models too big for one GPU, they developed a multi-GPU approach.
  5. Hybrid Parallelism: They combined model parallelism (partitioning the feature matrices) with data parallelism (partitioning the rating matrix).
  6. Topology-Aware Reduction: They designed a two-phase communication scheme that recognizes the physical layout of the server. It prioritizes fast "intra-socket" communication between GPUs on the same CPU before moving data across the slower "inter-socket" connection.

Datasets

The paper evaluates cuMF using both real-world benchmarks and massive synthetic datasets designed to mimic industry leaders:

  • Netflix: 99M ratings (Standard benchmark).
  • YahooMusic: 252.8M ratings.
  • Hugewiki: 3.1B ratings.
  • Synthetic "SparkALS" & "Factorbird": Modeled after datasets used in other major papers (3.5B to 38.5B ratings).
  • Synthetic "Facebook/cuMF": A massive 112-billion rating matrix with 1 billion users, representing the current ceiling for large-scale MF.

Key Insights and Ideas

  • Registers are Underutilized: Most GPU kernels focus on shared memory. This paper shows that for memory-bound sparse problems, forcing data into registers (via code generation/macros) provides the single largest performance boost (up to 2.5x).
  • Communication is the Multi-GPU Killer: Simply adding more GPUs doesn't help if they spend all their time talking to each other. By making the software "aware" of the PCIe and CPU socket topology, they achieved near-linear scaling.
  • Vertical vs. Horizontal Partitioning: Unlike many CPU-based systems that only partition data one way, cuMF’s hybrid approach allows it to solve problems where the feature matrices themselves are too large to fit in a single GPU's RAM.

Key Results

  • Speed: On a single machine with four GPUs, cuMF is 6-10x faster than 30-50 node CPU clusters running NOMAD, SparkALS, or Factorbird.
  • Cost: Because it uses one machine instead of a massive cluster, the cloud computing cost is 33-100x lower (merely 1%-3% of the cost of CPU solutions).
  • Record-Breaking Scale: cuMF solved a 112-billion rating problem (f=100) in 3.8 hours. For comparison, previous state-of-the-art systems like Facebook’s reached 100 billion ratings but required much larger infrastructure and used smaller feature dimensions (f=16).

Limitations and Future Work

  • Algorithm Specificity: The current optimizations are heavily tailored to the ALS algorithm. While ALS is popular for its parallel nature, other methods like Stochastic Gradient Descent (SGD) might require different optimization strategies.
  • Memory Ceiling: Even with multi-GPU scaling, the system is eventually limited by the total VRAM of the GPUs on a single motherboard.
  • Future Directions: The authors plan to extend these memory-optimization techniques to other sparse problems, such as large-scale graph algorithms (e.g., PageRank) and accelerating Hadoop/Spark frameworks using GPU-based sub-routines.

Summary updated

BibTeX
@inproceedings{tan2016faster,
  author = {Wei Tan and Liangliang Cao and Liana L. Fong},
  title = {{Faster and Cheaper: Parallelizing Large-Scale Matrix Factorization on GPUs}},
  booktitle = {HPDC},
  year = {2016},
  url = {https://openreview.net/forum?id=ADZSeC8PLPd},
}

Loading related content...

Figure