Lang-PINN: Bridging Natural Language and Scientific Simulation
By Mayank Deshpande ·
Physics-Informed Neural Networks (PINNs) have revolutionized how we solve complex partial differential equations (PDEs) in science and engineering. However, building them is notoriously difficult. It requires expert-level knowledge to translate a physical problem into a mathematical formulation, design the right neural architecture, and write error-free training code[14, 15, 25].
Enter Lang-PINN. Proposed by researchers from A*STAR (Singapore), Hong Kong Baptist University, and North China Electric Power University, Lang-PINN is an LLM-driven multi-agent framework. It is the first system capable of taking a natural language description of a problem and automatically producing a fully trainable, executable PINN solution[17, 100].
The Challenge: The "gap" in scientific automation
The "Translation" Gap
Scientists think in natural language like "a heat diffusion on a plate", but computers need formal math. Standard LLMs struggle to bridge this gap reliably[125, 147].
The "Architecture" Gap
A network for fluid dynamics might fail for wave equations. Manually tuning architectures for each problem is slow and error-prone[153, 172].
The "Code" Gap
Generating massive scripts at once leads to "spaghetti code". If one line fails, the whole pipeline breaks, making debugging a nightmare[175, 252].


The Four Agents of Lang-PINN
The framework operates like a team of specialized engineers, each handling a specific stage of the pipeline.
1. The PDE Agent: The Translator
The first hurdle is converting a vague text description into a rigorous mathematical equation. The PDE Agent acts as a reasoned translator.
- Chain-of-Thought (CoT) Rephrasing: Samples multiple reasoning trajectories to formulate candidate PDEs[200].
- Consensus Voting: Selects the best candidate using Symbolic Equivalence (checking if equations are mathematically identical) and Semantic Consistency (matching the original text).
The agent selects the equation most similar to the consensus of all generated candidates.
2. The PINN Agent: The Architect
Once the PDE is defined, the system must choose a neural network architecture (e.g., MLP, CNN, GNN). Since different PDEs behave differently (chaotic vs periodic), this is treated as a matching problem[224, 231].
It creates two vector representations:
- PDE Feature Vector (φ(E)): Encodes properties like periodicity, geometric complexity, and multi-scale demand.
- Capability Vector (ψ(𝒜)): Encodes how well an architecture handles those properties.
This ensures, for example, that a periodic wave problem is matched with an architecture designed for periodicity.
3. The Code Agent: The Engineer
Instead of writing a single massive script, the Code Agent uses modular generation[257]. It builds independent components for model definition, loss functions, data preprocessing, and training loops.
4. The Feedback Agent: The QA
The closed-loop mechanism that makes Lang-PINN robust. It executes the code and analyzes results.
- Error Analysis: Reads error messages to instruct the Code Agent on fixes.
- Quality Metrics: Calculates a score based on Effectiveness (MSE), Efficiency (Time), Complexity (FLOPs), and Robustness.
If the score improves, the refinement is accepted; otherwise, it rolls back[278, 279].
Walk the Pipeline Yourself
The four agents you just read about, in motion. Follow one plain-English prompt as it becomes an equation, gets matched to an architecture, compiles into modules, breaks, and self-heals — the whole closed loop in miniature.
Experimental Results
The researchers evaluated Lang-PINN on the PINNacle benchmark (14 PDEs across 1D, 2D, 3D) and their new Task2PDE dataset[283, 127].
Compared to standard agent baselines, significantly improving accuracy.
Execution success in 1D/2D settings, vs ~35% for competitors.
Converges in ~8 iterations thanks to modular correction.


Why This Matters
Lang-PINN represents a shift from "human-in-the-loop" to "human-on-the-loop" for scientific computing. By treating scientific consistency, executability, and trainability as verifiable goals, it allows domain scientists to focus on describing the problem rather than debugging the syntax[98, 100].
This framework proves that LLMs can do more than just write code snippets; when organized into a multi-agent system with rigorous feedback loops, they can act as autonomous research assistants capable of solving complex physical simulations.
References
Main Paper
Read the full paper on arXiv ↗Project Link
View the project on GitHub ↗Full Bibliography
- Jinze Bai et al. Qwen technical report, 2023. arXiv:2309.16609.
- Johannes Brandstetter, Daniel Worrall, and Max Welling. Message passing neural pde solvers. arXiv:2202.03376, 2022.
- Xinyun Chen et al. Teaching large language models to self-debug. arXiv:2304.05128, 2023.
- Wei-Lin Chiang et al. Vicuna: An open-source chatbot impressing gpt-4 with 90%* chatgpt quality, 2023.
- DeepSeek-AI et al. Deepseek-v3 technical report, 2025. arXiv:2412.19437.
- Stefan Falkner, Aaron Klein, and Frank Hutter. Bohb: Robust and efficient hyperparameter optimization at scale. ICML 2018.
- Zhongkai Hao et al. Pinnacle: A comprehensive benchmark of physics-informed neural networks for solving pdes, 2023.
- Xin He, Kaiyong Zhao, and Xiaowen Chu. Automl: A survey of the state-of-the-art. Knowledge-Based Systems, 2021.
- Ameya D Jagtap and George Em Karniadakis. Extended physics-informed neural networks (xpinns). Communications in Computational Physics, 2020.
- Ameya D Jagtap, Kenji Kawaguchi, and George Em Karniadakis. Adaptive activation functions accelerate convergence in deep and physics-informed neural networks. JCP 2020.
- Carlos E Jimenez et al. Swe-bench: Can language models resolve real-world github issues? arXiv:2310.06770, 2023.
- George Em Karniadakis et al. Physics-informed machine learning. Nature Reviews Physics, 2021.
- Aditi Krishnapriyan et al. Characterizing possible failure modes in physics-informed neural networks. NeurIPS 2021.
- William La Cava et al. Contemporary symbolic regression methods and their relative performance. NeurIPS 2021.
- Jia Li et al. Structured chain-of-thought prompting for code generation. ACM TSE 2025.
- Lisha Li et al. Hyperband: A novel bandit-based approach to hyperparameter optimization. JMLR 2018.
- Raymond Li et al. Starcoder: may the source be with you! arXiv:2305.06161, 2023.
- Shanda Li et al. Codepde: An inference framework for llm-driven pde solver generation. arXiv:2505.08783, 2025.
- Zongyi Li et al. Fourier neural operator for parametric partial differential equations. arXiv:2010.08895, 2020.
- Anton Lozhkov et al. Starcoder 2 and the stack v2: The next generation. arXiv:2402.19173, 2024.
- Lu Lu et al. Deepxde: A deep learning library for solving differential equations. SIAM review, 2021.
- Aman Madaan et al. Self-refine: Iterative refinement with self-feedback. NeurIPS 2023.
- Tobias Pfaff et al. Learning mesh-based simulation with graph networks. ICLR 2020.
- Md Ashiqur Rahman et al. Pretraining codomain attention neural operators for solving multiphysics pdes. NeurIPS 2024.
- Maziar Raissi et al. Physics-informed neural networks. Journal of Computational Physics, 2019.
- Baptiste Roziere et al. Code llama: Open foundation models for code. arXiv:2308.12950, 2023.
- Samuel H Rudy et al. Data-driven discovery of partial differential equations. Science advances, 2017.
- Noah Shinn et al. Reflexion: Language agents with verbal reinforcement learning. NeurIPS 2023.
- Khemraj Shukla et al. Parallel physics-informed neural networks via domain decomposition. JCP 2021.
- Vincent Sitzmann et al. Implicit neural representations with periodic activation functions. NeurIPS 2020.
- Jasper Snoek et al. Practical bayesian optimization of machine learning algorithms. NeurIPS 2012.
- Makoto Takamoto et al. Pdebench: An extensive benchmark for scientific machine learning. NeurIPS 2022.
- Hugo Touvron et al. Llama 2: Open foundation and fine-tuned chat models. arXiv:2307.09288, 2023.
- Sifan Wang et al. Understanding and mitigating gradient flow pathologies in physics-informed neural networks. SIAM 2021.
- Sifan Wang et al. When and why pinns fail to train: A neural tangent kernel perspective. JCP 2022.
- Xuezhi Wang et al. Self-consistency improves chain of thought reasoning in language models. ICLR 2023.
- Yicheng Wang et al. Auto-pinn: Understanding and optimizing physics-informed neural architecture. 2023.
- Yifan Wang and Linlin Zhong. Nas-pinn: Neural architecture search-guided physics-informed neural network for solving pdes. 2023.
- Jason Wei et al. Chain of thought prompting elicits reasoning in large language models. NeurIPS 2022.
- Chenxi Wu et al. A comprehensive study of non-adaptive and residual-based adaptive sampling for physics-informed neural networks. CMAME 2023.
- Qingpo Wuwu et al. Pinnsagent: Automated pde surrogation with large language models. arXiv:2501.12053, 2025.
- John Yang et al. Swe-agent: Agent-computer interfaces enable automated software engineering. NeurIPS 2024.
- Shunyu Yao et al. Tree of thoughts: Deliberate problem solving with large language models. NeurIPS 2023.
- Jeremy Yu et al. Gradient-enhanced physics-informed neural networks. CMAME 2022.
- Richard Zanibbi et al. Multi-stage math formula search. SIGIR 2016.