TL;DR
Neural decompilers are surprisingly good at generating correct code, but they are terrible at picking it. By shifting the focus from better generation to smarter candidate selection, researchers achieved a massive boost in functional correctness—even on obfuscated binaries previously thought to be "unsuitable" for these models.
What Problem Does This Paper Address?
Decompilation is the "reverse engineering" process of turning machine-executable binary code back into human-readable source code. While Large Language Models (LLMs) have recently outperformed traditional heuristic tools like Ghidra in terms of code readability, they suffer from a major reliability gap: they often produce code that looks right but fails to compile or execute correctly.
This issue is magnified by code obfuscation—techniques like Control Flow Flattening (FLA) that deliberately scramble a program's logic to thwart analysis. Prior work suggested that off-the-shelf neural decompilers were essentially useless against such obfuscated inputs. This paper investigates whether the problem lies in the model's inability to generate the right code, or our inability to select the right output from the model's possibilities.
Methods
The authors propose a two-stage generate-then-select pipeline:
- Candidate Generation: Instead of using "greedy decoding" (picking the single most likely token at each step), the model samples a pool of $N=100$ different candidate programs using varying "temperatures" to encourage diversity.
- Candidate Selection: A "selector" ranks these 100 candidates to pick the best one. The authors evaluated several selector families:
- Static Selectors: These don't require running the code. They include text/syntax similarity to the input, "consensus" (picking the most common output), and Negative Perplexity (how "natural" or likely the code seems to the model itself).
- Dynamic Selectors: Specifically, Execution-Guided Selection, which runs the candidates against unit tests and picks the one that passes the most assertions.
Datasets
The study utilizes two established benchmarks and introduces a significant new one:
- HumanEval-Decompile: Self-contained C functions with functional assertions.
- ExeBench: Real-world C functions extracted from GitHub, including complex project-specific logic.
- ExeBench-Obfuscated (New): A large-scale dataset of 362,647 samples. It pairs original source code with binaries obfuscated using the OLLVM framework (including FLA, Bogus Control Flow, and Instruction Substitution). This is the first large-scale dataset purpose-built for training neural decompilers on obfuscated code.
Key Insights and Ideas
- The Model Already Knows the Answer: A token-level analysis (RQ1) revealed that the "ground-truth" token is in the model's top-five predictions 95.6% of the time. This means the correct reconstruction is almost always present in the model's sampling space; greedy decoding simply misses it.
- Selection is the Bottleneck: The gap between the best possible sample in a pool (the "Oracle") and the one chosen by greedy decoding is huge (up to 33 percentage points). Improving selection is a "low-hanging fruit" for boosting performance without needing larger models.
- Perplexity is a Powerful Signal: For static analysis, Negative Perplexity emerged as the strongest selector. It effectively identifies which candidate the model "believes in" most strongly over the entire sequence, outperforming complex similarity metrics.
- Obfuscation is Solvable: By combining their selection pipeline with just one epoch of fine-tuning on the new obfuscated dataset, the authors reached an 88.8% pass rate on obfuscated binaries. This directly contradicts earlier claims that these models couldn't handle such inputs.
Key Results
- Oracle Potential: Multi-sample decoding reaches a
pass@100of 93% on HumanEval-Decompile, proving the "correct" code is nearly always generated. - Static Selection Boost: Using Negative Perplexity as a selector reached 73.3% pass@1 on HumanEval, a 6% improvement over the best previous baselines.
- Closing the Gap: On the ExeBench dataset, execution-guided selection reached 86.3% pass@1, nearly closing the gap with the theoretical Oracle (86.8%).
- Efficiency: Generating 100 candidates takes about 12.6 seconds per function—a negligible cost for a human reverse engineer who might otherwise spend hours on the same task.
Limitations and Future Work
The primary limitation is that Execution-Guided Selection—the most powerful method—requires a test harness (input/output pairs), which is rarely available in "in-the-wild" malware analysis. While Negative Perplexity is a strong static alternative, there is still a significant gap between it and the Oracle.
Future research could focus on developing better static selectors that can "reason" about the functional correctness of code without executing it, perhaps by incorporating formal verification or better structural analysis into the ranking process.
Summary updated