Large Language Models (LLMs) are increasingly being leveraged for generating and translating scientific computer codes by both domain-experts and non-domain experts. Fortran has served as one of the go to programming languages in legacy high-performance computing (HPC) for scientific discoveries. Despite growing adoption, LLM-based code translation of legacy code-bases has not been thoroughly assessed or quantified for its usability. Here, we studied the applicability of LLM-based translation of Fortran to C++ as a step towards building an agentic-workflow using open-weight LLMs on two different computational platforms. We statistically quantified the compilation accuracy of the translated C++ codes, measured the similarity of the LLM translated code to the human translated C++ code, and statistically quantified the output similarity of the Fortran to C++ translation.
Leveraging Large Language Models for Code Translation and Software Development in Scientific Computing
Institute for Clarity in Documentation(清晰文档研究所);Inria Paris-Rocquencourt(巴黎-罗克琴特研究所);Rajiv Gandhi University(拉贾·甘地大学);Tsinghua University(清华大学);Palmer Research Laboratories(帕勒尔研究实验室);Argonne National Laboratory(阿贡国家实验室)
AI Agent for Reverse-Engineering Legacy Finite-Difference Code and Translating to Devito
Department of Earth Science and Engineering(地球科学与工程系);Imperial College London(帝国理工学院伦敦分校);Department of Computer Science(计算机科学系);University College London(伦敦大学学院)
本研究提出一个集成 AI Agent 框架,结合检索增强生成(RAG)和开源大语言模型,通过多阶段迭代工作流将遗留有限差分代码转换为 Devito 环境,并引入强化学习反馈机制实现动态自适应代码翻译。