FidelityGPT: Correcting Decompilation Distortions with Retrieval Augmented Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhou, Zhiping, Li, Xiaohong, Feng, Ruitao, Zhang, Yao, Li, Yuekang, Feng, Wenbu, Wang, Yunqian, Li, Yuqing
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912664971640832
author Zhou, Zhiping
Li, Xiaohong
Feng, Ruitao
Zhang, Yao
Li, Yuekang
Feng, Wenbu
Wang, Yunqian
Li, Yuqing
author_facet Zhou, Zhiping
Li, Xiaohong
Feng, Ruitao
Zhang, Yao
Li, Yuekang
Feng, Wenbu
Wang, Yunqian
Li, Yuqing
contents Decompilation converts machine code into human-readable form, enabling analysis and debugging without source code. However, fidelity issues often degrade the readability and semantic accuracy of decompiled output. Existing methods, such as variable renaming or structural simplification, provide partial improvements but lack robust detection and correction, particularly for complex closed-source binaries. We present FidelityGPT, a framework that enhances decompiled code accuracy and readability by systematically detecting and correcting semantic distortions. FidelityGPT introduces distortion-aware prompt templates tailored to closed-source settings and integrates Retrieval-Augmented Generation (RAG) with a dynamic semantic intensity algorithm to locate distorted lines and retrieve semantically similar code from a database. A variable dependency algorithm further mitigates long-context limitations by analyzing redundant variables and integrating their dependencies into the prompt context. Evaluated on 620 function pairs from a binary similarity benchmark, FidelityGPT achieved an average detection accuracy of 89% and a precision of 83%. Compared to the state-of-the-art DeGPT (Fix Rate 83%, Corrected Fix Rate 37%), FidelityGPT attained 94% FR and 64% CFR, demonstrating significant gains in accuracy and readability. These results highlight its potential to advance LLM-based decompilation and reverse engineering.
format Preprint
id arxiv_https___arxiv_org_abs_2510_19615
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle FidelityGPT: Correcting Decompilation Distortions with Retrieval Augmented Generation
Zhou, Zhiping
Li, Xiaohong
Feng, Ruitao
Zhang, Yao
Li, Yuekang
Feng, Wenbu
Wang, Yunqian
Li, Yuqing
Software Engineering
Cryptography and Security
Decompilation converts machine code into human-readable form, enabling analysis and debugging without source code. However, fidelity issues often degrade the readability and semantic accuracy of decompiled output. Existing methods, such as variable renaming or structural simplification, provide partial improvements but lack robust detection and correction, particularly for complex closed-source binaries. We present FidelityGPT, a framework that enhances decompiled code accuracy and readability by systematically detecting and correcting semantic distortions. FidelityGPT introduces distortion-aware prompt templates tailored to closed-source settings and integrates Retrieval-Augmented Generation (RAG) with a dynamic semantic intensity algorithm to locate distorted lines and retrieve semantically similar code from a database. A variable dependency algorithm further mitigates long-context limitations by analyzing redundant variables and integrating their dependencies into the prompt context. Evaluated on 620 function pairs from a binary similarity benchmark, FidelityGPT achieved an average detection accuracy of 89% and a precision of 83%. Compared to the state-of-the-art DeGPT (Fix Rate 83%, Corrected Fix Rate 37%), FidelityGPT attained 94% FR and 64% CFR, demonstrating significant gains in accuracy and readability. These results highlight its potential to advance LLM-based decompilation and reverse engineering.
title FidelityGPT: Correcting Decompilation Distortions with Retrieval Augmented Generation
topic Software Engineering
Cryptography and Security
url https://arxiv.org/abs/2510.19615