Coded Sparse Matrix Multiplication

Sinong Wang, Jiashang Liu, Ness B. Shroff

Distributed matrix multiplication often grinds to a halt due to "stragglers"—slow or faulty nodes in a computing cluster. While "coded computation" can bypass these stragglers by introducing redundancy, traditional methods often destroy the inherent sparsity of the data. This leads to massive computational overhead, defeating the purpose of the optimization. This paper introduces Sparse Code, a novel strategy that handles stragglers while preserving data sparsity, achieving near-optimal recovery speeds with linear decoding time.

The Straggler Bottleneck and Density Explosion

In large-scale machine learning, multiplying massive matrices (e.g., $C = A^T B$) requires distributing the workload across a cluster of machines. However, the "straggler problem" acts as a major bottleneck: the entire operation is only as fast as the slowest machine in the cluster.

To solve this, researchers use coded computation. Instead of simply splitting the work, machines compute "coded" (combined) versions of the data. In a cluster of $N$ machines, the master node might only need the results from any $K$ workers to reconstruct the final answer, effectively ignoring the stragglers.

Computation time comparison showing the density explosion of polynomial codes.

The catch is that most existing codes, such as Polynomial Codes or MDS codes, involve summing many submatrices together. If the original matrices are sparse (mostly zeros), these sums quickly become dense. This phenomenon, known as "density explosion," makes local computation and data transfer so heavy that the coded system ends up being significantly slower than a simple uncoded one. The core question this paper addresses is: Can we mitigate stragglers without ruining the computational benefits of sparsity?

Introducing Sparse Code

To overcome the density explosion, the authors propose Sparse Code. The architecture fundamentally rethinks how data is mixed and decoded.

System architecture of distributed matrix multiplication with coded computation handling a straggler node.

The Sparse Code framework operates through four main steps:

  1. Data Partitioning: The input matrices $A$ and $B$ are divided into $m$ and $n$ submatrices, respectively.
  2. Coded Computation: Each worker node calculates a weighted linear combination of only a few submatrix products ($A_i^T B_j$).
  3. The Wave Soliton Distribution: Crucially, the number of products each worker handles is not fixed. It follows a specific probability distribution designed by the authors called the Wave Soliton distribution. This ensures that most workers do very little work (keeping the data sparse), while maintaining just enough redundancy to recover the final result.
  4. Hybrid Decoding: When the master node collects enough results, it uses a two-stage decoding process:
  5. Peeling Decoding: Similar to solving a Sudoku puzzle, the decoder looks for "ripples"—results that consist of only one unknown submatrix product—and "peels" them off to solve for others iteratively.
  6. Rooting Step: If the peeling process gets stuck, the system uses a small amount of Gaussian elimination to "unstick" the decoder and continue the peeling process.

Key Insights and Performance

The authors evaluated Sparse Code using synthetic datasets (random Bernoulli matrices) and real-world sparse matrices from the University of Florida Sparse Matrix Collection, including web graphs and citation networks.

  • Sparsity-Aware Coding: This is the first coded distributed multiplication scheme where the decoding complexity is independent of the matrix dimensions, depending only on the number of non-zero elements ($nnz(C)$).
  • Massive Speedups: Sparse Code is 1.5× to 3× faster than the uncoded scheme on real-world datasets. Furthermore, it outperforms the current state-of-the-art (Polynomial Codes) by a massive margin on sparse data. In some extreme cases, Polynomial Codes took 1592 seconds due to density explosion, while Sparse Code finished in just 21 seconds.
  • Low Overhead: The computation overhead is only $O(\ln(mn))$ times that of an uncoded scheme, and the recovery overhead (extra workers needed) is typically less than 15%.
  • Theoretical Optimality: The authors prove the decodability of their code by reducing the problem to finding a "perfect matching" in a random bipartite graph, utilizing the Schwartz-Zippel Lemma. The "recovery threshold" (workers needed to finish) is $\Theta(mn)$, matching the information-theoretic lower bound with only a small constant gap.

Limitations and Future Directions

While highly effective for large-scale problems, the Wave Soliton distribution is asymptotically optimal, meaning it works best as the number of submatrices grows. For scenarios with very small $m$ and $n$, the authors had to develop a separate optimization framework to find the best degree distribution. Additionally, there remains a small constant gap between the Sparse Code's recovery threshold and the theoretical minimum.

Looking forward, the authors suggest that this "sparse coding" philosophy could be extended beyond matrix multiplication to more complex, higher-dimensional operations like tensor contractions, which are heavily utilized in modern deep learning architectures.

Summary updated

BibTeX
@inproceedings{wang2018coded,
  author = {Sinong Wang and Jiashang Liu and Ness B. Shroff},
  title = {{Coded Sparse Matrix Multiplication}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=H1457ib_bS},
}
Figure