pnnl/neuromancer
Pytorch-based framework for solving parametric constrained optimization problems, physics-informed system identification, and parametric model predictive control.
NeuroMANCER – A Differentiable‑Programming Toolkit for Physics‑Based AI
What it is
- An open‑source Python library built on PyTorch that lets you write differentiable models which combine neural networks with explicit physics, constraints, and optimization objectives.
- It targets three closely related tasks:
- Learning to Optimize (L2O) – train models that predict solutions of parametric constrained problems.
- Learning to Model (L2M) – build physics‑informed neural surrogates (e.g., Neural ODEs, Koopman operators, SINDy) for dynamical systems.
- Learning to Control (L2C) – use differentiable predictive control (DPC) to synthesize control policies for those models.
Key ideas & components
- Symbolic programming interface – define variables, constraints, and objectives with a math‑like syntax that the library turns into a computational graph.
- Node / System abstraction – wrap any PyTorch module (MLP, CNN, etc.) as a Node that maps inputs to outputs; a System stitches together Nodes, constraints and loss terms for end‑to‑end training.
- Differentiable layers – includes convex‑optimization layers, neural operators (FNO, SFNO, DeepONet, etc.), and modern function‑approximation blocks such as Kolmogorov‑Arnold Networks (KANs) and Function Encoders.
- Training utilities – loss helpers (PenaltyLoss, etc.), logging (MLFlowLogger), and a PyTorch‑Lightning‑compatible Trainer for scalable experiments.
Typical workflow (simplified)
- Define a neural module (e.g., an MLP) and wrap it with
Node. - Declare decision variables and any problem parameters using
nm.constraint.variable. - Write the objective and constraints using ordinary arithmetic and comparison operators.
- Create a loss with
PenaltyLoss(or other differentiable loss wrappers). - Instantiate a
Problemthat bundles the Node(s) and loss, then train with the LightningTrainer.
What you can do with it
- Solve parametric constrained optimization problems where the constraints themselves may be learned neural models.
- Identify governing equations from data using NODEs, SINDy, or Universal Differential Equations.
- Build fast surrogates for PDEs with Fourier Neural Operators or DeepONets.
- Design safe, optimal controllers for building HVAC, power‑grid response, fluid dynamics, or classic control benchmarks (pendulum, swing equation, etc.) via DPC.
- Export the library’s API and examples for retrieval‑augmented generation (RAG) pipelines through the provided NeuroMANCER‑GPT Assistant.
Getting started
- Install with
pip install neuromancer. - Run any of the many Colab notebooks linked in the README (e.g., linear regression tutorial, DeepONet antiderivative, building thermal dynamics, mixed‑integer DPC).
- Follow the step‑by‑step tutorials under examples/tutorials to learn the symbolic syntax, then explore domain‑specific notebooks under examples/domain_examples.
Who it’s for
- Researchers and engineers who need a unified framework to embed physical knowledge into machine‑learning pipelines.
- Anyone working on data‑driven system identification, optimal control, or differentiable simulation of PDE/ODE models.
- Teams looking to prototype and train models that must respect safety or feasibility constraints.
Documentation & community
- Full docs: https://pnnl.github.io/neuromancer/
- License: BSD (permissive for academic and commercial use).
- The project is actively maintained (v1.5.7) and includes recent additions such as neural‑operator wrappers and improved logging.
Related
- Project
- Project
- Project
- Project
- Project