arXiv:2603.16976cs.MScs.AI2026-03

用编译工具让神经网络无缝融入天气模型,提升预报精度与效率

Implementation of tangent linear and adjoint models for neural networks based on a compiler library tool

  • 基于LibTorch的编译工具,实现Python模型到C++的静态转换与调用
  • 在C++层构建神经网络的切线与伴随模型,支持四维变分同化系统
  • 兼容主流模型,可部署于异构平台,耦合成本极低

本文提出TorchNWP,一个用于高效耦合人工智能组件与传统数值模型的编译库工具。针对以Fortran开发的数值模型与基于Python的深度学习框架之间存在的跨语言兼容性差、耦合灵活性不足及数据传输效率低等问题,该工具基于LibTorch优化设计统一应用层调用接口,将PyTorch框架下的深度学习模型转换为静态二进制格式,并提供C/C++接口。通过混合Fortran/C/C++编程,实现深度学习模型在数值模型中的部署。仅需编译成可调用链接库并链接至原模型即可完成集成。在此基础上,在C/C++层面实现了基于神经网络的切线线性模型与伴随模型,屏蔽了神经网络内部结构,简化了四维变分数据同化系统的构建流程。同时支持异构平台部署,兼容主流神经网络模型,可映射不同并行粒度并实现高效并行执行。使用该工具对原数值模型代码修改极少,显著降低耦合成本。已成功应用于CMA-GFS和MCV等数值天气预报模型,实现基于深度学习的物理参数化方案(如辐射、非地形重力波拖曳)的耦合及其切线与伴随模型开发,显著提升了数值天气预报的准确性和效率。

原文摘要 · Abstract (English)

This paper presents TorchNWP, a compilation library tool for the efficient coupling of artificial intelligence components and traditional numerical models. It aims to address the issues of poor cross-language compatibility, insufficient coupling flexibility, and low data transfer efficiency between operational numerical models developed in Fortran and Python-based deep learning frameworks. Based on LibTorch, it optimizes and designs a unified application-layer calling interface, converts deep learning models under the PyTorch framework into a static binary format, and provides C/C++ interfaces. Then, using hybrid Fortran/C/C++ programming, it enables the deployment of deep learning models within numerical models. Integrating TorchNWP into a numerical model only requires compiling it into a callable link library and linking it during the compilation and linking phase to generate the executable. On this basis, tangent linear and adjoint model based on neural networks are implemented at the C/C++ level, which can shield the internal structure of neural network models and simplify the construction process of four-dimensional variational data assimilation systems. Meanwhile, it supports deployment on heterogeneous platforms, is compatible with mainstream neural network models, and enables mapping of different parallel granularities and efficient parallel execution. Using this tool requires minimal code modifications to the original numerical model, thus reducing coupling costs. It can be efficiently integrated into numerical weather prediction models such as CMA-GFS and MCV, and has been applied to the coupling of deep learning-based physical parameterization schemes (e.g., radiation, non-orographic gravity wave drag) and the development of their tangent linear and adjoint models, significantly improving the accuracy and efficiency of numerical weather prediction.

神经网络天气预报模型耦合编译工具

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。