MGCNN: a learnable multigrid solver for sparse linear systems from PDEs on structured grids

Yan Xie, Minrui Lv, Chen-Song ZhangarXiv 2023 · DOI

Abstract

This paper presents a learnable solver tailored to iteratively solve sparse linear systems from discretized partial differential equations (PDEs). Unlike traditional approaches relying on specialized expertise, our solver streamlines the algorithm design process for a class of PDEs through training, which requires only training data of coefficient distributions. The proposed method is anchored by three core principles: (1) a multilevel hierarchy to promote rapid convergence, (2) adherence to linearity concerning the right-hand-side of equations, and (3) weights sharing across different levels to facilitate adaptability to various problem sizes. Built on these foundational principles and considering the similar computation pattern of the convolutional neural network (CNN) as multigrid components, we introduce a network adept at solving linear systems from PDEs with heterogeneous coefficients, discretized on structured grids. Notably, our proposed solver possesses the ability to generalize over right-hand-side terms, PDE coefficients, and grid sizes, thereby ensuring its training is purely offline. To evaluate its effectiveness, we train the solver on convection-diffusion equations featuring heterogeneous diffusion coefficients. The solver exhibits swift convergence to high accuracy over a range of grid sizes, extending from $31 \times 31$ to $4095 \times 4095$. Remarkably, our method outperforms the classical Geometric Multigrid (GMG) solver, demonstrating a speedup of approximately 3 to 8 times. Furthermore, our numerical investigation into the solver's capacity to generalize to untrained coefficient distributions reveals promising outcomes.

Introduction

Solving sparse linear systems is the "engine room" of scientific computing, particularly when dealing with discretized partial differential equations (PDEs). Traditional iterative methods, such as Geometric Multigrid (GMG), are highly efficient but often require significant expert tuning and "trial-and-error" to handle complex, heterogeneous coefficients where physical properties vary across space.

While deep learning has shown promise in this area, many existing neural solvers struggle with scalability—working on much larger grids than they were trained on—and generalization to new equations or right-hand-side (RHS) terms. MGCNN (Multigrid Convolutional Neural Network) bridges this gap by creating a "plug-and-play" learnable solver that behaves like a traditional numerical method but with the speed and adaptability of modern AI.

The MGCNN Architecture

MGCNN is designed to be a robust, black-box operator for solving linear systems. Its architecture is divided into two distinct phases: the Setup Phase and the Solve Phase. In the Setup Phase, a nonlinear ResNet processes the PDE coefficients to generate "setup tensors" for each grid level. These tensors are then utilized in the Solve Phase, which is a linear, iterative process to find the solution.

Conceptual diagram of the MGCNN framework, illustrating the mapping between the solution (sol) and the right-hand side (rhs) mediated by coefficient-dependent operators.

Core Design Principles

The architecture is anchored by three non-negotiable design principles:

  1. Multilevel Hierarchy: The network mimics the "V-cycle" of traditional multigrid methods. It moves from fine to coarse grids to capture both local and global errors, ensuring rapid convergence.
  2. Linearity: The Solve Phase is strictly linear with respect to the RHS of the equation. This ensures the solver can be integrated into standard iterative frameworks and generalizes perfectly to any RHS distribution without retraining.
  3. Weight Sharing: The same CNN weights are applied across different levels of the multigrid hierarchy. This is the key to scalability, allowing a model trained on small $31 \times 31$ grids to solve systems on massive $4095 \times 4095$ grids.
The multilevel hierarchy within the MGCNN Solve Phase, showing the integration of restriction (R) and prolongation (P) operators to facilitate multi-scale error correction.

Training and Datasets

MGCNN is trained using an unsupervised loss function that minimizes the residual norm ($||f - Au||^2$). This approach is superior to supervised learning in this context because it avoids the need for "ground truth" solutions, which are computationally expensive and difficult to generate accurately for complex PDEs.

The model was primarily trained on convection-diffusion equations with heterogeneous coefficients. While initial training used simple white noise distributions, the authors found that training on a mixture of white noise and CIFAR10 images significantly boosted the solver's ability to handle completely unseen distributions, such as MNIST digits or Fashion-MNIST patterns.

Key Results

The MGCNN solver demonstrates exceptional performance across several metrics:

  • Efficiency: On a V100 GPU, MGCNN achieved a 3x to 8x speedup in total computation time compared to classical GMG solvers.
  • Precision: The solver consistently reached a relative residual tolerance of $10^{-8}$ (double precision) across all tested grid sizes.
  • Zero-Shot Generalization: A model trained on white noise and CIFAR10 could effectively solve systems with coefficients shaped like shirts (FMNIST) or numbers (MNIST) with only a minor increase in iteration count.
  • Scalability: Due to weight sharing, the model successfully solved $4095 \times 4095$ systems—the limit of the testing hardware—without any additional tuning after being trained on much smaller grids.

Conclusion and Future Work

MGCNN represents a significant step toward learnable, general-purpose numerical solvers. While currently limited to scalar PDEs on structured grids, it provides a blueprint for future extensions. Potential future research directions include adapting the architecture for unstructured grids using Graph Neural Networks (GNNs), extending the framework to vector-type PDEs like the Stokes equations, and utilizing MGCNN as a fast inner-loop solver for nonlinear Newton-type methods.

Summary updated

BibTeX
@misc{xie2023mgcnn,
  author = {Yan Xie and Minrui Lv and Chen-Song Zhang},
  title = {{MGCNN: a learnable multigrid solver for sparse linear systems from PDEs on structured grids}},
  year = {2023},
  eprint = {2312.11093},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.11093},
}
Figure