Algorithmic Acceleration of Parallel ALS for Collaborative Filtering: Speeding up Distributed Big Data Recommendation in Spark

Manda Winlaw, Michael B. Hynes, Anthony L. Caterini, Hans De SterckarXiv 2015

Introduction

Collaborative filtering serves as the foundation for modern recommendation systems, enabling platforms like Netflix and Spotify to predict user preferences by factorizing massive, sparse rating matrices into low-rank latent factors. The Alternating Least Squares (ALS) algorithm has become the industry standard for this task due to its inherent parallelizability. However, ALS often suffers from slow convergence, requiring numerous iterations to reach high-precision solutions. In distributed environments like Apache Spark, each iteration necessitates significant data shuffling, leading to high computational costs and latency.

This paper introduces ALS-NCG, a hybrid optimization framework that accelerates ALS by embedding it within a Nonlinear Conjugate Gradient (NCG) method. By treating ALS as a "nonlinear preconditioner," the proposed approach achieves over a 4x speedup in distributed environments while maintaining linear scalability.

The ALS-NCG Framework

The core innovation of ALS-NCG lies in using ALS not as a standalone solver, but to generate effective search directions for NCG.

ALS as a Preconditioner

Standard gradient descent often struggles with poorly scaled problems. ALS-NCG addresses this by treating the difference between the current state and the result of a single ALS iteration as a "preconditioned gradient." This direction is significantly more effective than a standard steepest-descent gradient, guiding the optimizer toward the global minimum more efficiently.

A common bottleneck in distributed optimization is the line search—the process of determining the optimal step size along a search direction. Traditional methods require multiple passes over the data to evaluate the loss function. The authors circumvent this by demonstrating that the loss function for matrix factorization can be expressed as a 4th-degree polynomial of the step size. This allows the coefficients to be computed in a single data pass (one shuffle), after which the optimal step size is found analytically.

Performance Evaluation

The researchers evaluated ALS-NCG using the MovieLens 20M dataset and various synthetic datasets scaling up to 800 million ratings to test distributed performance on a 16-node Spark cluster.

Speedup and Scalability

Experimental results demonstrate that ALS-NCG consistently outperforms standard ALS, particularly when high accuracy is required. As shown in the table below, the acceleration factor typically ranges from 3x to over 4x across different problem sizes.

Table showing acceleration factors for various problem sizes.

Convergence and Ranking Accuracy

Beyond raw clock time, ALS-NCG is significantly more iteration-efficient, often requiring 10x fewer iterations than standard ALS to reach the same level of convergence. This efficiency translates directly to faster stabilization of recommendations. In tests measuring "Top-20" ranking accuracy, ALS-NCG reached 100% stability in a fraction of the time required by ALS.

Ranking accuracy over time for ALS vs. ALS-NCG.

Conclusion

ALS-NCG effectively combines the rapid initial progress of ALS with the fine-tuning capabilities of NCG. While each iteration of ALS-NCG is approximately twice as computationally expensive as a standard ALS iteration due to gradient and polynomial coefficient calculations, the drastic reduction in total iterations leads to substantial overall performance gains. By minimizing expensive network shuffles through the polynomial line search trick, ALS-NCG provides a robust, scalable solution for high-precision recommendation at scale.

Summary updated

BibTeX
@misc{winlaw2015algorithmic,
  author = {Manda Winlaw and Michael B. Hynes and Anthony L. Caterini and Hans De Sterck},
  title = {{Algorithmic Acceleration of Parallel ALS for Collaborative Filtering: Speeding up Distributed Big Data Recommendation in Spark}},
  year = {2015},
  eprint = {1508.03110},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1508.03110},
}
Figure