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

SK2Decompile: LLM-based Two-Phase Binary Decompilation from Skeleton to Skin

Hanzhuo Tan, Weihao Li, Xiaolong Tian, Siyi Wang, Jiaming Liu, Jing Li, Yuqun Zhang

Introduction

SK2Decompile is a novel Large Language Model (LLM)-based decompiler that breaks the complex task of turning binary code into source code into two distinct phases: recovering the "skeleton" (program logic and structure) and then the "skin" (meaningful variable and function names). By utilizing reinforcement learning to optimize for both compilability and semantic similarity, it achieves a record-breaking 69% average re-executability rate on the HumanEval benchmark, significantly outperforming existing models like GPT-5-mini.

The Decompilation Dilemma

Decompilation—the process of reversing compiled machine code back into human-readable source code—is a cornerstone of software security, vulnerability discovery, and malware analysis. Historically, researchers and engineers have faced a frustrating trade-off:

  1. Traditional Decompilers (e.g., Ghidra or IDA Pro): These tools are functionally "correct" but produce low-level pseudocode that is notoriously difficult for humans to read and understand.
  2. End-to-End LLM-based Decompilers: These models produce code that looks natural and human-written, but it often fails to actually run (exhibiting low "re-executability"). The models frequently hallucinate logic or break syntax while simultaneously trying to guess variable names and reconstruct control flow.

The authors argue that the root cause of this failure is the intractable complexity of trying to figure out control flow, data structures, and meaningful identifiers all at once.

Methods: The Two-Phase Framework

To mitigate this complexity, the researchers introduce a two-phase framework called SK2Decompile (Skeleton-to-Skin Decompile).

Overview of the SK2Decompile two-phase framework

Phase 1: Structure Recovery (The Skeleton)

The model first translates binary code into a specialized Intermediate Representation (IR). This IR preserves the exact control flow (loops, if-statements) and data structures but replaces all identifiers with generic placeholders (e.g., var1, func1).

  • Reinforcement Learning (RL) for Compilability: The researchers employ a reward system where the model receives positive reinforcement if the generated IR successfully compiles. They utilize a tool called psychec to generate the necessary headers for this compilation check, grounding the LLM in syntactic reality.

Phase 2: Identifier Naming (The Skin)

Once the structural "skeleton" is solid, a second model takes the obfuscated IR and predicts meaningful names that reflect the actual program semantics.

  • Semantic RL: Instead of rewarding the model for an exact string match with the original source (which is overly strict), the system rewards it based on the semantic similarity between the predicted names and the original source code using code embeddings. This allows the model to choose human-centric names like count even if the original developer used counter.

Datasets and Evaluation

The models were trained on a massive corpus of approximately 5 million samples (2 billion tokens) derived from Exebench and Decompile-Bench, compiled with various optimization levels (-O0 to -O3). For evaluation, the team used standard benchmarks like HumanEval and MBPP to test functional correctness (whether the decompiled code runs and passes unit tests), alongside ExeBench and GitHub2025 to test readability and structure recovery in complex, real-world code.

Key Insights

  • The Information Bottleneck: By using an obfuscated IR as a bottleneck, the model is forced to ignore naming noise and focus entirely on structural correctness during the first phase.
  • The Markov Assumption: The authors found that once a clean, structured IR is established, the original messy binary or pseudocode provides almost no extra information for naming. This simplifies the probability chain and makes the second phase highly efficient.
  • Compilability as a Signal: Using a compiler in the RL loop is a powerful way to ground the LLM in "Hardware Truth," preventing the common hallucinations that plague end-to-end models.

Key Results

SK2Decompile sets a new state-of-the-art (SOTA) across multiple metrics:

Re-executability rates on HumanEval and MBPP benchmarks
  • Functional Correctness: As shown in the results, SK2Decompile achieved a 69.00% average re-executability rate on HumanEval, representing a massive 21.6% improvement over GPT-5-mini and significantly outperforming traditional tools like IDA.
  • Readability: On the GitHub2025 benchmark, the model showed a 29.4% improvement in the Relative Readability Index (R2I) over the previous best model, Idioms.
  • Ablation Success: The study demonstrated that splitting the task into two phases alone improved performance, but adding the RL rewards provided a massive secondary boost (e.g., a 10-20% jump in re-executability).

Limitations and Future Work

While highly effective, SK2Decompile has a few limitations:

  • Contextual Boundaries: The model currently processes functions in isolation. It struggles with global variables or external library dependencies not defined within the immediate snippet.
  • Arithmetic Precision: Like most LLMs, it can be tricked by aggressive compiler optimizations. If a compiler turns a simple division into a complex sequence of multiplications using "magic numbers," the model sometimes fails to reverse the math correctly.
  • Language Support: While robust for C, languages like Go and C++ (which introduce templates and garbage collection) add new noise that requires further research.

Future directions include integrating formal methods, such as SMT solvers, into the loop to handle complex numerical recovery and further bridge the gap between binary and source code.

Summary updated

BibTeX
@inproceedings{tan2026sk,
  author = {Hanzhuo Tan and Weihao Li and Xiaolong Tian and Siyi Wang and Jiaming Liu and Jing Li and Yuqun Zhang},
  title = {{SK2Decompile: LLM-based Two-Phase Binary Decompilation from Skeleton to Skin}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=jSQPqdoidy},
}
Figure