# A Fortran-Keras Deep Learning Bridge for Scientific Computing

arXiv: https://arxiv.org/abs/2004.10652 · HTML: https://mlsanity.com/paper/2004.10652/

## Key facts

- Cited by 16 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 14 Apr 2020.

## Built on by (most cited first, 16 of 16)

- [Hard-Constrained Deep Learning for Climate Downscaling](https://mlsanity.com/paper/2208.05424/) (2022)
- [Climate-Invariant Machine Learning](https://mlsanity.com/paper/2112.08440/) (2021)
- [FuXi Weather: A data-to-forecast machine learning system for global weather](https://mlsanity.com/paper/2408.05472/) (2024)
- [Bridging observation, theory and numerical simulation of the ocean using Machine Learning](https://mlsanity.com/paper/2104.12506/) (2021)
- [Online model error correction with neural networks in the incremental 4D-Var framework](https://mlsanity.com/paper/2210.13817/) (2022)
- [Using Machine Learning at Scale in HPC Simulations with SmartSim: An Application to Ocean Climate Modeling](https://mlsanity.com/paper/2104.09355/) (2021)
- [Deep Reinforcement Learning for Computational Fluid Dynamics on HPC Systems](https://mlsanity.com/paper/2205.06502/) (2022)
- [Deep Learning Based Cloud Cover Parameterization for ICON](https://mlsanity.com/paper/2112.11317/) (2021)
- [Multi-fidelity climate model parameterization for better generalization and extrapolation](https://mlsanity.com/paper/2309.10231/) (2023)
- [Navigating the Noise: Bringing Clarity to ML Parameterization Design with O(100) Ensembles](https://mlsanity.com/paper/2309.16177/) (2023)
- [In Situ Framework for Coupling Simulation and Machine Learning with Application to CFD](https://mlsanity.com/paper/2306.12900/) (2023)
- [Online Test of a Neural Network Deep Convection Parameterization in ARP-GEM1](https://mlsanity.com/paper/2410.21920/) (2024)
- [RoseNNa: A performant, portable library for neural network inference with application to computational fluid dynamics](https://mlsanity.com/paper/2307.16322/) (2023)
- [Stabilizing PDE--ML coupled systems](https://mlsanity.com/paper/2506.19274/) (2025)
- [climt-paraformer: Stable Emulation of Convective Parameterization using a Temporal Memory-aware Transformer](https://mlsanity.com/paper/2604.21085/) (2026)
- [Perspectives on AI Architectures and Co-design for Earth System Predictability](https://mlsanity.com/paper/2304.03748/) (2023)

## Abstract (arXiv)

Implementing artificial neural networks is commonly achieved via high-level programming languages like Python and easy-to-use deep learning libraries like Keras. These software libraries come pre-loaded with a variety of network architectures, provide autodifferentiation, and support GPUs for fast and efficient computation. As a result, a deep learning practitioner will favor training a neural network model in Python, where these tools are readily available. However, many large-scale scientific computation projects are written in Fortran, making it difficult to integrate with modern deep learning methods. To alleviate this problem, we introduce a software library, the Fortran-Keras Bridge (FKB). This two-way bridge connects environments where deep learning resources are plentiful, with those where they are scarce. The paper describes several unique features offered by FKB, such as customizable layers, loss functions, and network ensembles. The paper concludes with a case study that applies FKB to address open questions about the robustness of an experimental approach to global climate simulation, in which subgrid physics are outsourced to deep neural network emulators. In this context, FKB enables a hyperparameter search of one hundred plus candidate models of subgrid cloud and radiation physics, initially implemented in Keras, to be transferred and used in Fortran. Such a process allows the model's emergent behavior to be assessed, i.e. when fit imperfections are coupled to explicit planetary-scale fluid dynamics. The results reveal a previously unrecognized strong relationship between offline validation error and online performance, in which the choice of optimizer proves unexpectedly critical. This reveals many neural network architectures that produce considerable improvements in stability including some with reduced error, for an especially challenging training dataset.
