Parallel Spectral Clustering

Yangqiu Song, WenYen Chen, Hongjie Bai, Chih-Jen Lin, Edward Y. Chang

Abstract

Spectral clustering is a powerful technique for identifying non-linear clusters but suffers from $O(n^2)$ memory and computational complexity. This paper presents a distributed framework using the Message Passing Interface (MPI) to parallelize similarity matrix construction, eigenvalue decomposition, and $k$-means. By leveraging optimized Basic Linear Algebra Subroutines (BLAS) and the PARPACK library, the proposed system successfully clusters datasets exceeding 600,000 images—a scale previously impossible on single-machine architectures. The results demonstrate near-linear speedup and significant improvements in clustering quality over traditional Euclidean methods.

Introduction

Spectral clustering is often considered a "gold standard" in machine learning due to its ability to identify clusters with complex, non-linear boundaries. Unlike traditional $k$-means, which assumes spherical clusters, spectral methods capture the underlying manifold of the data. However, the algorithm faces a massive "scalability wall." For a dataset of $n$ points, computing the similarity matrix requires $O(n^2)$ time and memory. For instance, a dataset of 600,000 points would require nearly 3 Terabytes of RAM just to store the matrix. Furthermore, solving the subsequent eigenproblem is computationally intensive.

Historically, these requirements confined spectral clustering to small datasets or forced the use of accuracy-reducing approximations like the Nyström method. This research addresses whether the full accuracy of spectral clustering can be maintained while distributing the computational and memory load across a cluster of commodity machines.

Methodology

The authors propose a three-stage parallel pipeline implemented using MPI for inter-node communication.

1. Distributed Similarity Matrix & Sparsification

To overcome the memory bottleneck, the $n \times n$ similarity matrix is partitioned. Each of the $p$ available machines is responsible for building $n/p$ rows of the matrix.

Data distribution across nodes

The construction process utilizes optimized BLAS to perform matrix-matrix products, maximizing CPU cache efficiency and significantly speeding up inner-loop calculations. To maintain a manageable memory footprint, the matrix is sparsified by keeping only the $t$-nearest neighbors for each point, transforming a dense $O(n^2)$ matrix into a sparse $O(nt)$ representation.

2. Parallel Eigensolver

The system utilizes PARPACK, a parallel implementation of the ARPACK library, to find the top $k$ eigenvectors of the Laplacian matrix. PARPACK employs the "implicitly restarted Arnoldi method." The most computationally expensive component—matrix-vector multiplication—is performed in parallel across the nodes.

3. Parallel $k$-Means

After the eigenvectors are computed, they form a new "spectral space" representation of the data. A parallelized version of the $k$-means algorithm is then executed across the cluster to produce the final cluster assignments.

Experimental Evaluation

The framework was evaluated on two large-scale benchmarks:

  • RCV1 (Reuters Corpus Volume I): 193,844 news documents categorized into 103 industries, represented by TF-IDF feature vectors.
  • PicasaWeb: A dataset of 637,137 photos with 144 features (color, texture, shape). This dataset was too large to fit into the memory of a single standard machine at the time of the study.

Key Results

The parallel spectral algorithm demonstrated superior clustering quality and impressive scalability. On the RCV1 dataset, it achieved a Normalized Mutual Information (NMI) of 0.2875, outperforming both Euclidean $k$-means (0.2586) and Spherical $k$-means (0.2702).

The impact of both local optimization (BLAS) and distributed parallelization is starkly visible in the performance metrics.

Performance comparison of BLAS and parallelization

On the PicasaWeb dataset, the system achieved near-linear speedup up to 32 machines. The "saturation point" for this 637k-image dataset was reached at 128 machines, where the eigensolver performed roughly 46 times faster than a two-machine baseline. The study also highlighted that as dataset size ($n$) grows, computational intensity increases faster than communication overhead, making parallelization increasingly efficient for larger problems.

Discussion and Limitations

While the framework successfully scales with the number of data points ($n$), it encounters a bottleneck when the number of desired clusters ($k$) is very large. The Arnoldi factorization involves an $O(m^3)$ step, which can dominate the computation in high-$k$ scenarios. Furthermore, while the sparse matrix-vector product is parallelized, it still requires a "gather" operation with $O(n)$ cost. Future work may involve exploiting specific Laplacian sparsity patterns to further reduce communication overhead or conducting more detailed comparisons with approximation methods like Nyström in a distributed context.

Summary updated

BibTeX
@inproceedings{song2008parallel,
  author = {Yangqiu Song and WenYen Chen and Hongjie Bai and Chih-Jen Lin and Edward Y. Chang},
  title = {{Parallel Spectral Clustering}},
  booktitle = {ECML/PKDD},
  year = {2008},
  doi = {10.1007/978-3-540-87481-2\_25},
}
Figure