Neural incomplete factorization: learning preconditioners for the conjugate gradient method

Paul Häusner, Ozan Öktem, Jens Sjölund

Abstract

The convergence of the conjugate gradient method for solving large-scale and sparse linear equation systems depends on the spectral properties of the system matrix, which can be improved by preconditioning. In this paper, we develop a computationally efficient data-driven approach to accelerate the generation of effective preconditioners. We, therefore, replace the typically hand-engineered preconditioners by the output of graph neural networks. Our method generates an incomplete factorization of the matrix and is, therefore, referred to as neural incomplete factorization (NeuralIF). Optimizing the condition number of the linear system directly is computationally infeasible. Instead, we utilize a stochastic approximation of the Frobenius loss which only requires matrix-vector multiplications for efficient training. At the core of our method is a novel message-passing block, inspired by sparse matrix theory, that aligns with the objective of finding a sparse factorization of the matrix. We evaluate our proposed method on both synthetic problem instances and on problems arising from the discretization of the Poisson equation on varying domains. Our experiments show that by using data-driven preconditioners within the conjugate gradient method we are able to speed up the convergence of the iterative procedure.

Introduction

Solving large-scale linear systems of the form $Ax = b$ is a fundamental task in scientific computing, essential for physics simulations and optimization. For massive, sparse matrices, iterative solvers like the Conjugate Gradient (CG) method are preferred. However, the efficiency of CG is highly sensitive to the condition number of the matrix $A$. A high condition number leads to slow convergence.

Preconditioning is the standard technique to mitigate this, where a matrix $P$ is used to approximate $A$ such that $P^{-1}A$ has better spectral properties. Classical methods like Incomplete Cholesky (IC) factorization are effective but face significant challenges: they are difficult to parallelize on modern hardware like GPUs and can suffer from numerical "breakdowns" where the algorithm fails. This work introduces NeuralIF, a data-driven approach to automate and accelerate the generation of robust preconditioners using Graph Neural Networks (GNNs).

Neural Incomplete Factorization (NeuralIF)

NeuralIF leverages GNNs to predict the non-zero entries of a sparse triangular factor $L$, forming the preconditioner $P = LL^T$. This approach shifts the computational burden from a sequential algorithm to a highly parallelizable neural inference step.

Algorithmic Alignment and Graph Representation

To ensure the network effectively captures matrix properties, the authors utilize a novel message-passing block inspired by the Coates graph representation of a matrix. The GNN architecture is designed to align with the structure of matrix factorization by processing lower and upper triangular components separately, a concept known as algorithmic alignment.

Matrix representation as a Coates graph and the corresponding message-passing structure.

Training via Stochastic Frobenius Loss

Directly optimizing the condition number is computationally prohibitive for large systems. Instead, NeuralIF minimizes the Frobenius norm distance between $LL^T$ and $A$. To maintain scalability, the authors employ Hutchinson’s trace estimator, allowing the loss to be approximated using only matrix-vector multiplications rather than expensive matrix-matrix products. This self-supervised training regime eliminates the need for ground-truth solutions, as the model learns directly from the structure of $A$.

Experimental Evaluation

The method was evaluated on two distinct datasets:

  1. Synthetic Matrices: Sparse, symmetric positive-definite matrices ($n = 10,000$) with approximately 1% non-zero density.
  2. Poisson PDE Problems: Discretizations of the Poisson equation on various 2D domains (convex, holes, complex polytopes), with sizes ranging from $20,000$ to $500,000$ variables.

Results and Discussion

NeuralIF demonstrates significant advantages over traditional baselines in several key areas:

  • Computational Efficiency: The generation of the NeuralIF preconditioner was nearly 10x faster than IC(0) for large matrices due to superior GPU utilization.
  • Total Solve Time: On synthetic data, NeuralIF achieved a 25% reduction in total wall-clock time compared to standard IC.
  • Robustness: By enforcing positive definiteness through architectural constraints, such as exponential activation on diagonal elements, NeuralIF avoids the numerical breakdowns common in classical IC.
  • Generalization: Models trained on smaller matrices ($n \approx 20,000$) successfully generalized to matrices up to $n = 500,000$ without retraining, demonstrating the scalability of the GNN approach.

Conclusion

NeuralIF presents a scalable, data-driven alternative to hand-engineered preconditioners. While it introduces a training overhead, the benefits in solve time and robustness are substantial for repeated problem types, such as daily physical simulations. Future research will focus on learning optimal sparsity patterns and exploring loss functions that more directly capture spectral convergence properties.

Summary updated

BibTeX
@article{hausner2024neural,
  author = {Paul Häusner and Ozan Öktem and Jens Sjölund},
  title = {{Neural incomplete factorization: learning preconditioners for the conjugate gradient method}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=FozLrZ3CI5},
}
Figure