Fortran2CPP: Automating Fortran-to-C++ Translation using LLMs via Multi-Turn Dialogue and Dual-Agent Integration
Le Chen, Bin Lei, Dunzhi Zhou, Pei-Hung Lin, Chunhua Liao, Caiwen, Ding, Ali Jannesari

TL;DR
Fortran2CPP leverages a novel multi-turn dialogue dataset and dual-agent LLM approach to significantly improve the accuracy and reliability of translating legacy Fortran code into C++, addressing key challenges in HPC modernization.
Contribution
Introduces a new dialogue dataset and dual-LLM framework for automated Fortran-to-C++ translation, achieving substantial improvements in translation quality and success rates.
Findings
3.31x improvement in CodeBLEU scores
92% increase in compilation success rate
Enhanced syntactic and functional translation accuracy
Abstract
Translating legacy Fortran code into C++ is a crucial step in modernizing high-performance computing (HPC) applications. However, the scarcity of high-quality, parallel Fortran-to-C++ datasets and the limited domain-specific expertise in large language models (LLMs) present significant challenges for automated translation. In this paper, we introduce Fortran2CPP, a multi-turn dialogue dataset generated by a novel LLM agent-based approach that integrates a dual-LLM Questioner-Solver module to enhance translation accuracy. Our dataset comprises 11.7k dialogues capturing iterative feedback-decision workflows including code translation, compilation, execution, unit testing, and error-fixing. Using this dataset, we fine-tune several open-weight LLMs and achieve up to a 3.31x improvement in CodeBLEU scores and a 92\% increase in compilation success rate, demonstrating enhanced syntactic…
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.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware System Performance and Reliability · Advanced Data Processing Techniques · Service-Oriented Architecture and Web Services
