arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.22498cs.LGcs.AIcs.SC
收藏

神经编译器:程序到网络的翻译用于混合科学机器学习

The Neural Compiler: Program-to-Network Translation for Hybrid Scientific Machine Learning

Institute for Interdisciplinary Data Sciences(跨学科数据科学研究所);University of Idaho(爱达荷大学)

Lucas Sheneman

AI总结:

该研究提出了一种神经编译器,能够将程序转换为可微的PyTorch模块,用于混合科学机器学习,通过符号规范生成正确且可微的模块,实现系统化的可组合性。

摘要:

科学机器学习经常需要结合已知的物理规律与从数据中学习的未知参数或校正项。现有方法要么忽略已知结构,将其编码为软惩罚项,要么需要为每个方程手动编写PyTorch代码。我们提出了神经编译器,一种将用第一顺序Scheme-like表达式语言编写的程序转换为冻结、可微的PyTorch模块的系统。这些模块在浮点精度范围内匹配源程序,并通过autograd提供梯度。在混合模型中,编译模块精确编码已知的物理规律,而学习组件则建模未知的剩余部分。我们评估了该编译器在六个实验领域:费曼物理方程、洛特卡-沃勒特动力学、阻尼摆、一维热方程、三维向量力学以及组合泛化。编译模块在单个方程上与手动编写PyTorch实现数值上一致,显示编译没有精度损失。编译模型在大多数情况下能够将物理常数恢复到不到1%的误差,而标准PINN基线模型具有超过8500个参数,误差为7到93%。编译模块还可以与零误差组合,而神经近似方法在深度组合链中会积累大误差。编译器的主要价值不是优于手动编写方程的精度,而是系统化的可组合性:它从符号规范生成正确且可微的模块,而无需手动重写每个方程。该系统支持51个基本操作,包括向量和矩阵代数,能够实现PDE离散化和混合科学模型。这种字符串输入、模块输出的接口也为大语言模型提供了自然的目标,这些模型可以将科学描述翻译成可执行的可微模块。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑