RECoRD: A Multi-Agent LLM Framework for Reverse Engineering Codebase to Relational Diagram
Yuan Xue, Xiaoyu Lu, Yunfei Bai, Yunan Liu, Hoiyi Ng
Abstract
Understanding the behavior and logical structure of complex algorithms is a fundamental challenge in industrial systems. Recent advancements in large language models (LLMs) have demonstrated remarkable code understanding capabilities. However, their potential for reverse engineering algorithms into interpretable causal structures remains unexplored. In this work, we develop a multi-agent framework, RECoRD, that leverages LLMs to Reverse Engineering Codebase to Causal Relational Diagram. RECoRD uses reinforcement fine-tuning (RFT) to enhance the reasoning accuracy of the relation extraction agent. Fine-tuning on expert-curated causal graphs allows smaller specialized models to outperform larger foundation models on domain-specific tasks. Experiments on three real-world use cases - News Vendor, MiniSCOT, and Black-Scholes - demonstrate the effectiveness of our approach. The RFT-trained models significantly outperformed their foundation counterparts, improving F1 score from 0.69 to 0.97 on MiniSCOT. RECoRD also exhibited strong generalization, with models fine-tuned on one use case improving performance on others. We further show how the extracted causal graphs can be leveraged to build a deep-dive assistant that reasons like domain experts, enabling rapid root cause analysis in complex software systems. By automating the construction of interpretable causal models from code, RECoRD has wide-ranging applications in areas such as software debugging, operational optimization, and risk management.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Builds on8
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
- Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
- WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun et al.ICLR 2024 · 945 citations
- CodeGen: An Open Large Language Model for Code with Multi-Turn Program SynthesisErik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu et al.ICLR 2023 · 234 citations
- Nash Learning from Human FeedbackRémi Munos, Michal Valko, Daniele Calandriello, Mohammad Gheshlaghi Azar et al.ICML 2024 · 212 citations
Related papers
- FoundRoot: Towards Foundation Model for Root Cause Analysis via Structured Deep ThinkingZhe Xie, Zeyan Li, Xiao He, Shenglin Zhang et al.ICSE 2026
- GraphSkill: Documentation-Guided Agentic Hierarchical Retrieval-Augmented Coding for Complex Graph ReasoningFali Wang, Chenglin Weng, Xianren Zhang, Siyuan Hong et al.KDD 2026
- Generalization of RLVR Using Causal Reasoning as a TestbedZhichu Lu, Hongyu Zhao, Shuo Sun, Hao Peng et al.ICLR 2026 · 4 citations
- Mitigating Hallucinations in Large Language Models via Causal ReasoningYuangang Li, Yiqing Shen, Yi Nian, Jiechao Gao et al.AAAI 2026 · 1 citation
- ReRec: Reasoning-Augmented LLM-based Recommendation Assistant via Reinforcement Fine-tuningJiani Huang, Shijie Wang, Liang-Bo Ning, Wenqi Fan et al.ACL 2026 · 1 citation
