Proof-of-concept: Using ChatGPT to Translate and Modernize an Earth System Model from Fortran to Python/JAX
Anthony Zhou, Linnia Hawkins, Pierre Gentine

TL;DR
This paper demonstrates a semi-automated approach using GPT-4 to translate Earth system models from Fortran to Python/JAX, significantly improving speed, accessibility, and enabling differentiability for climate modeling.
Contribution
Introducing a GPT-4 based method for translating legacy Fortran climate models to Python/JAX, enhancing performance and differentiability for scientific research.
Findings
Python/JAX version runs up to 100x faster on GPU
Enables parameter estimation via automatic differentiation
Produces readable and classroom-friendly code
Abstract
Earth system models (ESMs) are vital for understanding past, present, and future climate, but they suffer from legacy technical infrastructure. ESMs are primarily implemented in Fortran, a language that poses a high barrier of entry for early career scientists and lacks a GPU runtime, which has become essential for continued advancement as GPU power increases and CPU scaling slows. Fortran also lacks differentiability - the capacity to differentiate through numerical code - which enables hybrid models that integrate machine learning methods. Converting an ESM from Fortran to Python/JAX could resolve these issues. This work presents a semi-automated method for translating individual model components from Fortran to Python/JAX using a large language model (GPT-4). By translating the photosynthesis model from the Community Earth System Model (CESM), we demonstrate that the Python/JAX…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsComputational Physics and Python Applications
