AI Agent for Reverse-Engineering Legacy Finite-Difference Code and Translating to Devito
On the map: LLM agents and tool use → Web, search, and research agents
Abstract (arXiv)
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 guidance, the multi-stage retrieval pipeline performs parallel searching, concept expansion, community-scale retrieval, and semantic similarity analysis. Code synthesis is governed by Pydantic-based constraints to guarantee structured outputs and reliability. A comprehensive validation framework integrates conventional static analysis with the G-Eval approach, covering execution correctness, structural soundness, mathematical consistency, and API compliance. The overall agent workflow is implemented on the LangGraph framework and adopts concurrent processing to support quality-based iterative refinement and state-aware dynamic routing. The principal contribution lies in the incorporation of feedback mechanisms motivated by reinforcement learning, enabling a transition from static code translation toward dynamic and adaptive analytical behavior.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Web, search, and research agents, one of 16 directions in LLM agents and tool use. Builds on 12 of its 33 references that are in the map. First posted on arXiv 26 Jan 2026.
Builds on
12 of 33 references.
References · 12
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023G-Eval: NLG Evaluation using GPT-4 with Better Human Alignmentcited by 2,205
- 2024M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillationcited by 1,050
- 2022MTEB: Massive Text Embedding Benchmarkcited by 623
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2024"We Need Structured Output": Towards User-centered Constraints on Large Language Model Outputcited by 46
- 2024Prompt Design and Engineering: Introduction and Advanced Methodscited by 45
- 2024Towards Reproducible LLM Evaluation: Quantifying Uncertainty in LLM Benchmark Scorescited by 25
- 2024Asynchronous LLM Function Callingcited by 18
- 2024The Prompt Canvas: A Literature-Based Practitioner Guide for Creating Effective Prompts in Large Language Modelscited by 4
- 2024Prompto: An open source library for asynchronous querying of LLM endpointscited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024LLM Agents Improve Semantic Code Search
- 2025Agentic Retrieval-Augmented Generation: A Survey on Agentic RAG
- 2026Deep Agentic Search for Repository-Level Code Question Answering: An Empirical Study
- 2024A Collaborative Multi-Agent Approach to Retrieval-Augmented Generation Across Diverse Data
- 2025FAIR-RAG: Faithful Adaptive Iterative Refinement for Retrieval-Augmented Generation
- 2026The Illusion of Agentic Complexity in README.md Generation: Evaluating Single-Agent vs. Multi-Agent RAG Systems
- 2025RAG Without the Lag: Interactive Debugging for Retrieval-Augmented Generation Pipelines
- 2026Is Agentic RAG worth it? An experimental comparison of RAG approaches