RAMA: A Rapid Multicut Algorithm on GPU

Ahmed Abbas, Paul Swoboda

Introduction

The multicut problem, also known as correlation clustering, is a cornerstone of computer vision and machine learning, particularly in tasks like image segmentation and object clustering. Despite its utility, the problem is NP-hard, and high-quality solvers have traditionally been restricted to sequential CPU implementations. RAMA (Rapid Multicut Algorithm) introduces a paradigm shift by reimagining graph operations as parallel linear algebra, enabling massive speedups on GPU architectures.

The Multicut Problem

In a multicut formulation, a graph represents nodes (e.g., pixels or super-pixels) connected by edges with weights. Positive weights suggest nodes belong to the same cluster, while negative weights suggest they should be separated. The objective is to partition the graph to minimize the cost of "cut" edges. Modern datasets, such as those in connectomics (mapping brain neurons), involve billions of variables, rendering traditional CPU solvers—which often rely on irregular data structures and sequential logic—prohibitively slow.

Methodology

RAMA employs a recursive primal-dual approach designed specifically for the massive parallelism of GPUs. The algorithm iterates through three primary stages:

  1. Dual Step (Lagrange Relaxation): The algorithm identifies conflicted cycles (e.g., triangles with contradictory edge weights) and applies a novel, massively parallel message-passing scheme. This reparametrizes edge costs and provides a theoretical lower bound on solution quality.
  2. Primal Step (Parallel Edge Contraction): To generate a valid clustering, the algorithm merges nodes connected by high-weight edges. RAMA innovatively expresses these contractions as sparse matrix-matrix multiplications (SpGEMM), allowing it to utilize highly optimized GPU linear algebra libraries.
  3. Recursion: The process repeats on the newly contracted graph until no further beneficial merges are possible.
The RAMA iteration cycle: message passing updates edge costs to resolve conflicts, followed by edge contraction to reduce the graph size.

By interleaving these steps, the dual step informs the primal step, ensuring that greedy contraction choices are guided by a more accurate global view of the problem.

Performance and Scalability

RAMA delivers significant performance gains without sacrificing solution quality. By bypassing traditional graph traversal in favor of linear algebra, the algorithm avoids the bottlenecks typically associated with irregular data on GPUs.

  • Speed: On high-resolution datasets like Cityscapes, RAMA's primal version achieves up to a 30x speedup over standard CPU-based Greedy Additive Edge Contraction (GAEC).
  • Scalability: The algorithm scales gracefully to problems with hundreds of millions of variables. While CPU solvers struggle with increasing instance sizes, RAMA maintains efficient runtimes, processing massive graphs in seconds.
Runtime scaling comparison: RAMA (PD) demonstrates significantly better scalability than the CPU-based GAEC as the number of edges increases.

Conclusion

RAMA demonstrates that combinatorial optimization can be effectively ported to GPUs by reformulating graph operations as linear algebra. While currently limited by GPU memory for the most extreme datasets, it represents a major leap forward in processing large-scale clustering problems. Future developments focusing on multi-GPU support and more complex cycle separation could further extend its reach in high-throughput data analysis.

Summary updated

BibTeX
@misc{abbas2021rama,
  author = {Ahmed Abbas and Paul Swoboda},
  title = {{RAMA: A Rapid Multicut Algorithm on GPU}},
  year = {2021},
  eprint = {2109.01838},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.01838},
}
Figure