Scientific machine learning often requires combining known physics with unknown parameters or correction terms learned from data. Existing approaches either ignore known structure, encode it as a soft penalty, or require hand-written PyTorch code for each equation. We present The Neural Compiler, a system that translates programs written in a first-order Scheme-like expression language into frozen, differentiable PyTorch modules. These modules match the source program to floating-point precision and provide gradients through autograd. In hybrid models, the compiled module encodes known physics exactly while learned components model the unknown remainder. We evaluate the compiler across six experiment domains: Feynman physics equations, Lotka-Volterra dynamics, a damped pendulum, a one-dimensional heat equation, three-dimensional vector mechanics, and compositional generalization. Compiled modules match hand-coded PyTorch implementations numerically for single equations, showing no accuracy loss from compilation. With only 1 to 4 trainable parameters, compiled models recover physical constants to less than 1 percent error in most cases, while standard PINN baselines with more than 8500 parameters show 7 to 93 percent error. Compiled modules also compose with zero error, while neural approximations can accumulate large errors in deep composition chains. The main value of the compiler is not improved accuracy over hand-coded equations, but systematic composability: it generates correct, differentiable modules from symbolic specifications without rewriting each equation by hand. The system supports 51 primitive operations, including vector and matrix algebra, enabling PDE discretizations and hybrid scientific models. This string-in, module-out interface also provides a natural target for large language models that translate scientific descriptions into executable differentiable modules.


翻译:科学机器学习通常需要将已知物理规律与从数据中学习的未知参数或修正项相结合。现有方法或忽略已知结构,或将其编码为软惩罚项,或需为每个方程手工编写PyTorch代码。本文提出神经编译器,该系统可将用一阶Scheme类表达式语言编写的程序翻译为冻结的可微分PyTorch模块。这些模块在浮点精度级别匹配源程序,并通过自动微分提供梯度。在混合模型中,编译后的模块精确编码已知物理规律,而学习组件则负责建模未知余项。我们在六个实验领域评估该编译器:费曼物理方程、洛特卡-沃尔泰拉动力学、阻尼摆、一维热方程、三维矢量力学以及组合泛化能力。对于单一方程,编译模块在数值上匹配手工编写的PyTorch实现,未出现编译精度损失。在仅含1至4个可训练参数的情况下,编译模型在多数案例中对物理常数的误差低于1%,而含超过8500个参数的标准PINN基线方法误差范围达7%至93%。编译模块在组合时保持零误差,而神经网络近似在深层组合链中会累积较大误差。该编译器的主要价值并非提升相对于手工编码方程的精度,而是系统的可组合性:它能从符号化规约生成正确、可微分的模块,无需为每个方程重写代码。系统支持包含向量与矩阵代数在内的51种基本运算,可处理偏微分方程离散化与混合科学模型。这种"字符串输入-模块输出"接口也为将科学描述翻译为可执行微分模块的大语言模型提供了天然目标。

0
下载
关闭预览

相关内容

编译器(Compiler),是一种计算机程序,它会将用某种编程语言写成的源代码(原始语言),转换成另一种编程语言(目标语言)。
专知会员服务
17+阅读 · 2021年4月16日
专知会员服务
28+阅读 · 2020年9月9日
2019年新书推荐-《神经网络与深度学习》-Michael Nielsen
深度学习与NLP
14+阅读 · 2019年2月21日
清华大学:刘洋——基于深度学习的机器翻译
人工智能学家
12+阅读 · 2017年11月13日
机器学习必备手册
机器学习研究会
19+阅读 · 2017年10月24日
神经网络机器翻译原理:LSTM、seq2seq到Zero-Shot
北京思腾合力科技有限公司
11+阅读 · 2017年8月10日
国家自然科学基金
7+阅读 · 2017年12月31日
国家自然科学基金
21+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
Arxiv
0+阅读 · 5月4日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
1+阅读 · 54分钟前
定向能反无人机系统最新发展动态
专知会员服务
3+阅读 · 今天13:50
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
2+阅读 · 今天13:33
相关VIP内容
专知会员服务
17+阅读 · 2021年4月16日
专知会员服务
28+阅读 · 2020年9月9日
相关基金
国家自然科学基金
7+阅读 · 2017年12月31日
国家自然科学基金
21+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员