neuralmd 0.1.0
Neural Multi-scale Decomposition for Physics-informed Machine Learning
License: MIT
Requires Python: >=3.8
Keywords: neural-network multi-scale decomposition physics-informed machine-learning

# NeuralMD

NeuralMD: Neural Multiscale Decompostion for Solving The Nonlinear Klein-Gordon Equation. 
See [Paper](https://arxiv.org/abs/2512.00266).

In this paper, we propose a neural multiscale decomposition method (NeuralMD) for solving the nonlinear Klein-Gordon equation (NKGE) with a dimensionless parameter $\varepsilon$ from the relativistic regime to the nonrelativistic limit regime. 

## Two-Stage Trade-off Pretraining

Unlike conventional point optimization, our proposed region optimization extends the optimization process of PINNs from isolated points to their continuous neighborhood region.

<p align="center">
<img src=".\fig\NeuralMD.png" height = "350" alt="" align=center />
<br><br>
<b>Figure 1.</b> Frame work of NeuralMD.
</p>


## Practical Algorithm

We present RoPINN for PINN training based on Monte Carlo sampling, which can effectively accomplish the region optimization without extra gradient calculation. 

<p align="center">
<img src=".\fig\Algorithm.png" height = "650" alt="" align=center />
<br><br>
<b>Figure 2.</b> NeuralMD algorithm.
</p>


## Get Started

1. Install Python 3.10 and **Pytorch 2.5.0**. For convenience, execute the following command.

```shell
pip install .
pip install -r requirements.txt
```

2. Train and evaluate model. We provide the experiment scripts of all benchmarks. You can reproduce the experiment results as the following examples:

```shell
test-baselines.ipynb # base models
test-neuralmd.ipynb # NeuralMD
test-neuralmd-interp.ipynb # Interpretability of NeuralND
```

Specifically, we have included the following PINN models in this repo:

- [x] PINN (Journal of Computational Physics 2019) [[Paper]](https://github.com/maziarraissi/PINNs)
- [x] FLS - (IEEE Transactions on Artificial Intelligence 2022) [[Paper]](https://arxiv.org/abs/2109.09338)
- [x] QRes - (SIAM 2021) [[Paper]](https://arxiv.org/abs/2101.08366)
- [x] KAN - (arXiv 2024) [[Paper]](https://arxiv.org/abs/2404.19756)
- [x] PINNsFormer - (ICLR 2024) [[Paper]](https://arxiv.org/abs/2307.11833)

## Results

We have experimented with different  tasks. See [our paper](https://arxiv.org/abs/2512.00266) for the full results.

<p align="center">
<img src="./fig/Results.png" height = "650" alt="" align=center />
<br><br>
<b>Figure 3.</b> Part of experimental results of NeuralMD.
</p>


## Citation

If you find this repo useful, please cite our paper.

```
@article{liang2025neuralmd,
  title={Neural Multiscale Decomposition for Solving The Nonlinear Klein-Gordon Equation},
  author={Liang, Zhangyong and Mao, Zhiping and Zhao, Xiaofei},
  journal={arXiv preprint arXiv:2512.00266},
  year={2025}
}
```

## Contact

If you have any questions or want to use the code, please contact [zyliang1994@tju.edu.cn](zyliang1994@tju.edu.cn).

## Acknowledgement

I would like to thank Professor Xiaofei Zhao for the guidance and support.
And we appreciate the following GitHub repos a lot for their valuable code base or datasets:

https://github.com/AdityaLab/pinnsformer