Neural Semantic Restoration for Binary Decompilation

This direction is merged into another direction: semantic information loss. Its last version stays readable and citable here.

Version 1 of 136 papers46 conceptsfrozen 2026-10-04

When a programmer compiles source code into a binary executable, a massive amount of information is discarded. Variable names like retry_count become generic memory offsets; descriptive function names like validate_session disappear; and the structured logic of loops and conditionals is flattened into a sequence of jumps and registers. This process is "lossy," making reverse engineering a grueling task of manual reconstruction.

Recent research has shifted from rule-based decompilation—which often produces syntactically correct but unreadable "spaghetti" code—toward Neural Semantic Restoration. This approach treats decompilation not just as a translation of instructions, but as a reconstruction of human intent.

The Skeleton and the Skin

A central intuition in this field is that a program consists of two layers: a functional skeleton (the raw logic and data flow) and a semantic skin (the identifiers and comments that explain why the code exists). Traditional decompilers like Ghidra are excellent at recovering the skeleton but fail at the skin, producing variables named v1, v2, and v3.

Hanzhuo Tan and colleagues formalize this in SK2Decompile, a two-phase framework that decouples these tasks. By first establishing a functionally correct structural skeleton and then using a Large Language Model (LLM) to "regrow" the skin, they achieve significantly higher re-executability and readability. This decoupling works because naming is a context-filling problem: once the model sees a variable being used to store a 32-bit integer that is compared against 0x50 (80) and passed to a networking function, it can infer that the variable is likely port_number.

Identifier Recovery as a Proxy for Understanding

How do neural models learn to "read" the intent behind raw logic? The breakthrough lies in identifier-aware pre-training. In CodeT5, Yue Wang and Shafiq Joty introduced tasks that force models to recover masked variable and function names.

This is more than a simple "fill-in-the-blank" exercise. To guess a variable name correctly, a model must understand the variable's functional role across the entire scope. Pratyay Banerjee and Kuntal Kumar Pal demonstrated this with VarBERT VarBERT, showing that limiting the masking process specifically to identifiers forces the model to focus on the relationship between code logic and specific data slots. Similarly, Dejiao Zhang uses identifier deobfuscation in CodeSage CodeSage to build high-performance code embeddings that capture deep structural logic rather than surface-level keywords.

Refining the Decompiler Output

Rather than attempting to translate raw assembly directly to C—a task prone to "hallucinations" where the model invents logic—many researchers use LLMs as a refinement layer.

In this paradigm, a traditional tool handles the heavy lifting of structural recovery, and the LLM acts as a "cleaner." Tong Ye and Lingfei Wu show in CP-BCS that refining pseudo-code with contextually relevant names significantly improves downstream tasks like code summarization. This approach is also central to LLM4Decompile, where Hanzhuo Tan demonstrates that LLMs can fix the syntactic errors and generic placeholders of traditional tools, doubling the re-executability of the resulting code.

Bridging the Gap to Security Analysis

The ultimate goal of semantic restoration is to make "opaque" code auditable. This has immediate implications for security:

  • Vulnerability Detection: Nasir Hussain and Haohan Chen developed VulBinLLM VulBinLLM, which uses semantic restoration to simplify logic and rename variables, making security flaws more prominent to automated scanners.
  • Malware Analysis: Liang Jiang and Zhiqiang Lin created SYMGEN SYMGEN, which uses autoregressive generation to infer function names in stripped binaries, providing a 489% improvement in accuracy over previous methods.
  • Smart Contracts: In the Web3 space, Eason Chen and colleagues use MAD MAD to decompile closed-source smart contracts into a format nearly indistinguishable from the original source, enabling public auditing of "black box" protocols.

By treating code as a mixture of formal logic and human communication, neural semantic restoration allows us to peer through the obfuscation of the compilation process, recovering the "why" behind the "what."

Papers in this version

History & citationVersion 1 · 2026-10-04

Merged into another direction · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_neural_semantic_restoration_for_binary_d_ef7465ba,
  title = {Neural Semantic Restoration for Binary Decompilation},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/neural-semantic-restoration-for-binary-decompilation/rdr_ef7465ba189b45ee8e55592060731056},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-12-05},
}

This exact version (version 1, frozen text):

@misc{lacuna_neural_semantic_restoration_for_binary_d_ef7465ba_v1,
  title = {Neural Semantic Restoration for Binary Decompilation},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/neural-semantic-restoration-for-binary-decompilation/rdr_ef7465ba189b45ee8e55592060731056/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-12-05},
}