Paper proposes a LLM-based system to convert legacy scientific code with built-in verification mechanisms.
https://arxiv.org/abs/2410.24119
Original Problem π―:
Legacy Fortran code translation to C++ in scientific computing is time-consuming and error-prone. Manual conversion takes years, requiring deep expertise in both languages and careful handling of interoperability issues.
-----
Solution in this Paper π οΈ:
β Code-Scribe combines prompt engineering with user supervision for efficient code conversion
β The tool uses four main commands: Index (maps project structure), Inspect (interactive code querying), Draft (preliminary C++ code generation), and Translate (AI-powered conversion)
β Implements Retrieval-Augmented Generation (RAG) to provide context about external functions and avoid declaration errors
β Uses chat completion templates to guide LLMs in generating accurate translations
-----
Key Insights π:
β Incremental translation with interface layers is more effective than bulk conversion
β LLMs require specific context and constraints to avoid hallucinations in code generation
β Developer supervision remains crucial for verification despite AI automation
β Pattern recognition in source code improves translation accuracy
-----
Results π:
β Developer productivity increased from 2-3 files/day to 10-12 files/day
β GPT-4 showed best performance with 2.5 minutes review time
β CodeLlama-7B and Mistral-7B required more intervention, averaging 13 minutes review time










