NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ReF Decompile: Relabeling and Function Call Enhanced Decompile

Yunlong Feng, Bohan Li, Xiaoming Shi, Qingfu Zhu, Wanxiang ChearXiv 2025 · DOI

Introduction

Decompilation—the process of translating low-level assembly code back into high-level source code—is a cornerstone of software security and reverse engineering. While traditional rule-based tools like Ghidra often produce non-functional "spaghetti code," recent Large Language Model (LLM) approaches show promise in capturing high-level semantics. However, these models face a critical "information loss" problem: they often lose track of control flow logic and cannot access constants stored in separate binary data segments.

The Information Loss Problem

The transition from binary to assembly for LLM consumption typically results in two types of data degradation:

  1. Control Flow Disruption: Raw jump addresses (e.g., jmp 0x1109) are often stripped or misinterpreted, breaking the program's logical structure.
  2. Data Segment Blindness: Critical constants, such as floating-point numbers or strings, are frequently stored in the .rodata section. Analysis of the ExeBench dataset reveals that nearly 48% of functions rely on this section. Standard decompilers only "see" the code segment, forcing models to hallucinate these missing values.

The ReF Decompile Method

To bridge these gaps, the authors propose ReF Decompile, which utilizes a two-pronged strategy: Relabeling and Function Calls.

Comparison of traditional decompilation vs. the ReF Decompile method, highlighting relabeling and data retrieval via function calls.

Relabeling Strategy

Instead of raw hexadecimal addresses, the system replaces jump targets with symbolic labels (e.g., L1, L2). This preserves the logical structure of loops and branches in a format that is easier for the model to process, similar to how a human reads assembly.

Function Call Strategy

ReF Decompile treats the binary's data segment as an external database. When the LLM encounters a memory access instruction, it can issue a "Function Call" request. The system identifies the address, retrieves the actual value from the binary, and feeds it back to the model. This transforms the task from guessing constants to incorporating retrieved facts.

Experimental Results

The researchers evaluated ReF Decompile using the HumanEval-Decompile benchmark, which includes 164 programming problems compiled at four optimization levels (O0 to O3). The model, based on llm4decompile-6.7b, was fine-tuned using LoRA to understand the new relabeled format and function call mechanism.

Performance comparison of ReF Decompile against baselines in terms of re-executability and readability.

ReF Decompile achieved a state-of-the-art 61.43% average re-executability rate, outperforming the strongest baseline by 8.69%. It also demonstrated superior readability, scoring 3.69 on a 1-5 scale, significantly higher than Ghidra (2.57) or GPT-4o (2.44). Ablation studies confirmed the importance of both strategies: removing relabeling dropped performance by approximately 3%, while removing the function call mechanism resulted in a 7% decrease.

Conclusion

ReF Decompile demonstrates that the bottleneck in automated decompilation is not just model "intelligence," but how binary data is presented. By restoring control flow logic and providing access to external data segments, ReF significantly improves both the functionality and readability of decompiled code. Future work will address tool invocation autonomy and support for complex library dependencies.

Summary updated

BibTeX
@misc{feng2025ref,
  author = {Yunlong Feng and Bohan Li and Xiaoming Shi and Qingfu Zhu and Wanxiang Che},
  title = {{ReF Decompile: Relabeling and Function Call Enhanced Decompile}},
  year = {2025},
  eprint = {2502.12221},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.12221},
}
Figure