[Paper Review] PyDEns: a Python Framework for Solving Differential Equations with Neural Networks
PyDEns is a Python framework that enables solving partial differential equations (PDEs) using neural networks with flexible architecture selection, customizable sampling schemes, and seamless integration with deep learning workflows. It extends the Deep Galerkin method by automating loss computation via automatic differentiation and providing a high-level API for defining PDEs, initial/boundary conditions, and training configurations, significantly lowering the barrier for experimentation in physics-informed neural networks.
Recently, a lot of papers proposed to use neural networks to approximately solve partial differential equations (PDEs). Yet, there has been a lack of flexible framework for convenient experimentation. In an attempt to fill the gap, we introduce a PyDEns-module open-sourced on GitHub. Coupled with capabilities of BatchFlow, open-source framework for convenient and reproducible deep learning, PyDEns-module allows to 1) solve partial differential equations from a large family, including heat equation and wave equation 2) easily search for the best neural-network architecture among the zoo, that includes ResNet and DenseNet 3) fully control the process of model-training by testing different point-sampling schemes. With that in mind, our main contribution goes as follows: implementation of a ready-to-use and open-source numerical solver of PDEs of a novel format, based on neural networks.
Motivation & Objective
- To address the lack of flexible, user-friendly frameworks for experimenting with neural network-based PDE solvers.
- To enable researchers to easily define complex PDE problems, including time-dependent and high-dimensional equations, with minimal code.
- To provide full control over neural network architecture selection, from predefined models like ResNet and DenseNet to custom architectures.
- To support customizable point-sampling strategies across the domain, boundary, and initial condition regions for improved training efficiency and accuracy.
- To facilitate reproducible and scalable training of physics-informed neural networks using integration with the BatchFlow deep learning framework.
Proposed method
- The framework implements the Deep Galerkin method by formulating the PDE solution as a neural network that minimizes a loss function combining residual error, boundary conditions, and initial conditions.
- Loss components are computed using automatic differentiation to handle high-order derivatives, eliminating manual derivation of gradients.
- The framework supports a modular architecture where users define PDEs via a dictionary specifying the equation form, right-hand side, and initial/boundary conditions.
- Neural network architectures are defined using a human-readable layout language, supporting fully connected layers, residual connections, and activation functions.
- Point sampling is managed through a sampler algebra that allows mixtures and products of probability distributions (e.g., uniform, Gaussian, exponential) for domain, boundary, and initial condition regions.
- Training is performed via stochastic gradient descent using mini-batches of sampled points, with loss estimated over these batches to approximate the true integral loss.
Experimental results
Research questions
- RQ1How can a flexible, open-source framework streamline the process of solving PDEs using deep neural networks?
- RQ2To what extent can customizable sampling schemes improve the convergence and accuracy of physics-informed neural networks?
- RQ3Can a high-level API with automatic differentiation and modular architecture design reduce the implementation barrier for researchers in PDE-based machine learning?
- RQ4How do different neural network architectures (e.g., ResNet, DenseNet) and sampling strategies affect the solution quality of second-order PDEs?
- RQ5Can the framework support complex PDEs with non-trivial initial and boundary conditions while maintaining training stability and scalability?
Key findings
- PyDEns enables solving a wide class of PDEs, including the heat and wave equations, with minimal code through a high-level dictionary-based problem definition.
- The framework supports both standard architectures (e.g., ResNet, DenseNet) and custom neural network layouts defined via a symbolic layout language with residual and fully connected layers.
- Training performance is highly sensitive to batch size, with small batches causing high loss oscillations and large batches leading to poor convergence unless combined with region-specific sampling.
- Using region-specific samplers—especially near boundaries or initial conditions—improves model accuracy in targeted areas, which is critical for applications like oil-gas reservoir modeling.
- The framework successfully solves a non-linear PDE with a source term and non-trivial initial condition, demonstrating robustness on complex problems using a 4-layer fully connected network with residual connections.
- The integration with BatchFlow enables reproducible, scalable training and supports advanced training workflows, including multi-stage sampling strategies.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.