AI Agent for Reverse-Engineering Legacy Finite-Difference Code and Translating to Devito
Yinghan Hou, Zongyou Yang

TL;DR
This paper presents an AI agent framework that automates the reverse engineering and translation of legacy finite difference code into the Devito environment using advanced retrieval, static analysis, and reinforcement learning techniques.
Contribution
It introduces a novel hybrid architecture combining RAG, knowledge graphs, and reinforcement learning for dynamic, adaptive code translation and analysis.
Findings
Effective knowledge graph construction from source code
Enhanced retrieval performance via GraphRAG optimization
Improved code translation accuracy with feedback mechanisms
Abstract
To facilitate the transformation of legacy finite difference implementations into the Devito environment, this study develops an integrated AI agent framework. Retrieval-Augmented Generation (RAG) and open-source Large Language Models are combined through multi-stage iterative workflows in the system's hybrid LangGraph architecture. The agent constructs an extensive Devito knowledge graph through document parsing, structure-aware segmentation, extraction of entity relationships, and Leiden-based community detection. GraphRAG optimisation enhances query performance across semantic communities that include seismic wave simulation, computational fluid dynamics, and performance tuning libraries. A reverse engineering component derives three-level query strategies for RAG retrieval through static analysis of Fortran source code. To deliver precise contextual information for language model…
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
TopicsScientific Computing and Data Management · Topic Modeling · Multimodal Machine Learning Applications
