Learning Algebraic Multigrid Using Graph Neural Networks

Ilay Luz, Meirav Galun, Haggai Maron, Ronen Basri, Irad Yavneh

Introduction

Efficient numerical solvers for sparse linear systems are crucial across science and engineering disciplines, from simulating fluid dynamics to analyzing electrical circuits. These problems frequently boil down to solving massive systems of linear equations ($Ax = b$). When the matrix $A$ is "sparse" (mostly zeros), Algebraic Multigrid (AMG) is a premier solver.

AMG accelerates convergence by creating a hierarchy of smaller, "coarser" versions of the original problem. The most critical component of this process is the prolongation operator ($P$), a matrix that maps solutions from the coarse level back to the fine level. For decades, experts have relied on hand-crafted heuristics to build $P$. However, these manual formulas are often sub-optimal for specific classes of problems. This paper introduces a framework that replaces these manual formulas with a learned mapping capable of adapting to the underlying structure of the data.

Methods

The authors treat the sparse matrix $A$ as a graph, where non-zero entries represent edges between variables. They then employ a Graph Neural Network (GNN) to learn the optimal values for the prolongation matrix $P$.

Matrix to Graph Representation

Key technical components of this approach include:

  • Architecture: The model uses a variant of the "encode-process-decode" GNN framework. Message-passing layers allow nodes to communicate with their neighbors, effectively learning local rules for how information should flow between grid levels.
  • Unsupervised Loss: Instead of requiring "correct" answers to train on, the model minimizes the Frobenius norm of the error propagation matrix. This serves as a mathematical proxy for the solver's convergence rate, essentially instructing the network to "make the error disappear as fast as possible."
  • Efficient Training: Calculating the loss involves inverting a matrix, which is computationally expensive. To overcome this, the authors trained on block-circulant matrices. This enabled the use of Fourier analysis to accelerate the computations, making it feasible to train on reasonably large, unstructured-like problems.

Datasets

The model was evaluated on several types of linear systems to test its robustness and generalization:

  1. Graph Laplacians: Randomly generated graphs using Delaunay triangulation with edge weights drawn from lognormal and uniform distributions.
  2. Diffusion Equations: Partial differential equations (PDEs) discretized on 2D triangular meshes, simulating physical processes like heat or chemical diffusion.
Triangular Mesh Example
  1. Spectral Clustering: Real-world-style datasets (Moons, Circles, and Gaussian clusters) where the AMG solver acts as a "preconditioner" to help find the eigenvectors of the data.

Key Insights and Results

  • Local Rules, Global Success: Because GNNs operate on local neighborhoods, a network trained on small matrices (e.g., 1,024 variables) can successfully generalize to solve systems with hundreds of thousands of variables without requiring retraining.
  • Unsupervised is Better: Since the "optimal" $P$ is unknown for most problems, the unsupervised loss function is highly effective. It allows the network to discover better strategies than human experts have historically found.
  • Hybrid Approach: The authors utilized a hybrid strategy. They used classical methods to decide which nodes to coarsen and where the non-zero entries in $P$ should be, then let the GNN fill in the optimal values for those entries.
  • Faster Convergence: In graph Laplacian problems, the GNN-based solver outperformed classical AMG (CAMG) in the vast majority of test cases, often significantly reducing the asymptotic convergence factor.
  • Robust Generalization: A network trained on lognormal distributions still outperformed CAMG when tested on uniform distributions, demonstrating that it learned general principles of multigrid theory rather than just memorizing the training data.
  • Spectral Clustering Speedup: When used as a preconditioner for the LOBPCG algorithm (a common tool for finding eigenvalues), the learned AMG reduced the number of iterations required by 10% to 15% across various cluster shapes.

Limitations and Future Work

While promising, the current framework has a few limitations:

  • Fixed Sparsity Pattern: Currently, the GNN only learns the values of the prolongation matrix. It still relies on classical heuristics to choose the "coarse nodes" and the sparsity pattern (which entries are non-zero). Learning these structural components end-to-end is a major next step.
  • Setup Overhead: While the GNN is fast at "inference" (solving), the initial setup time is higher than classical AMG because it requires a forward pass through a neural network. This makes it most advantageous for scenarios where you solve many similar systems, or for very large systems where the iteration savings outweigh the initial setup cost.
  • SPD Restriction: The current work is limited to Symmetric Positive Definite (SPD) or Semi-Definite (SPSD) matrices, which covers many, but not all, engineering applications.

Summary updated

BibTeX
@inproceedings{luz2020learning,
  author = {Ilay Luz and Meirav Galun and Haggai Maron and Ronen Basri and Irad Yavneh},
  title = {{Learning Algebraic Multigrid Using Graph Neural Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=uG9dJxvShy0},
}
Figure