When a neural model decompiles a binary, it turns machine code back into readable C. The model often gets the control flow right and then gets the details wrong. It invents a constant, misspells a format string, or calls a library function the binary never imports. These details decide whether the recovered code runs. They are also exactly the things that are still present, verbatim, in the binary. We propose a decompiler whose decoder can emit any such literal only in one of two ways: by pointing at a specific entry in a table of entities extracted from the program's lifted intermediate representation, or by generating it and marking it as generated. The intermediate representation (IR) is the compiler's architecture-neutral form of the program, for example LLVM IR.
The table holds every constant, string literal, global, external callee, and SSA value. An SSA value is a single-assignment virtual register, the IR's stand-in for a variable. Each entity is represented by pooling a bidirectional encoder's states over all of its occurrences, so it carries context from both where it is defined and where it is used. Pointing emits the whole entity at once rather than subword pieces. Because every variable in the output C is bound to an IR value, naming can be done once per variable in a separate bidirectional pass. The practical payoff is that every literal in the output comes with a provenance link back to the binary, and the claim to test is that this raises re-executability at equal model size.
Core Claim
Current decompilers treat literals as free text. Two pipelines illustrate this. SK2Decompile first produces an IR "skeleton" with placeholder identifiers and then a naming "skin", both with causal LLMs trained by reinforcement learning. The Decompile-Bench / LLM4Decompile line fine-tunes causal models on million-scale binary–source pairs. Neither has an architectural reason to reproduce 0x5A827999 or "%s: cannot open\n" exactly. Older work that did care about exact values handled them outside the network. TraFix generates C templates and then fills constants and names by deterministic program-dependence-graph matching. That second stage breaks when optimization changes the graph shape.
Our claim is that making literals entity-addressable fixes the specific failures that code pointer-generators have run into. Standard copy mechanisms such as See et al. and Vinyals et al. point at token positions. Over subword-tokenized, compiler-transformed input this has two known problems: it fragments identifiers, and the input positions no longer line up with the output. Pointing at entities instead should improve re-executability and literal fidelity over a size-matched causal decompiler. The gain should be largest on functions whose behavior hinges on specific constants, strings, or library calls, and smaller at high optimization levels, where compilers rewrite constants (for example, turning a division into a multiplication by a "magic number"). The pointer–generate gate has to learn that trade-off.
Research Program
The input side reuses the IR-abstraction literature. We lift x86-64 binaries to LLVM IR, following the architecture-neutral lifting lines of Li et al. and Wang et al.. A deterministic pass then builds the entity table: integer and float immediates, string and data-section contents, imported symbol names (which survive stripping because dynamic linking needs them), globals, and SSA values.
This design corrects a known weakness. inst2vec replaced immediates with coarse tags like <INT> and paid for it where values matter. We instead keep every value as an addressable object.
A bidirectional Transformer encodes the linearized IR. Each entity's vector is an attention-pooled summary of the encoder states at its occurrences. The bidirectional encoder matters here because an SSA value's meaning often lies in its downstream uses: a value passed as the second argument of fopen is a mode string. VarBERT showed the value of this two-sided view for variable naming.
The decoder is causal. At step $t$ it mixes a vocabulary distribution with a distribution over entities:
$$P(y_t) = g_t\, P_{vocab}(y_t) + (1-g_t)\, \mathrm{softmax}_e\!\left(s_t^\top W\, u_e\right)$$
Here $g_t \in [0,1]$ is the learned gate, $s_t$ is the decoder state, $u_e$ is the pooled vector of entity $e$, and $W$ is a learned bilinear map. Choosing an entity emits its full surface form, or, for an SSA value, a variable slot bound to that value. Supervision for the pointer comes from aligning literals in the reference source to table entries by exact match. Unmatched literals become generation targets.
A second stage names the variable slots. A bidirectional model sees, for each slot, all its uses in the generated C plus the pooled IR context and nearby copied callees and strings. This is VarBERT-style naming, but over consistent, IR-bound variables and with API names and strings available as copy sources.
Baselines
The naive reference point is an industrial rule-based decompiler (IDA Pro / Hex-Rays output, as reported by Decompile-Bench). On GitHub2025 it scores a Readability-to-Information (R2I) of about 38.35. It fixes the floor for readability and literal fidelity, since rule-based decompilers copy literals faithfully but read poorly.
The strongest size-matched competitor is a causal decoder fine-tuned on the same Decompile-Bench pairs with the same tokenizer, the same parameter count (about 1.3B), and the same number of training tokens. The target is LLM4Decompile-DCBench, which reports 20.89% HumanEval re-executability and an R2I of 65.73 on GitHub2025. We will retrain it ourselves under our budget rather than rely on the published number alone.
The strongest system overall is SK2Decompile, with 69.00% average HumanEval re-executability. It uses a larger model and reinforcement learning with compiler feedback, so we treat it as an upper reference. We also test whether adding our entity pointer to its skeleton stage helps, instead of claiming to beat it at a smaller scale.
Beating the matched causal baseline means a statistically significant gain in re-executability across three seeds and all four optimization levels. It also requires a larger gain on literal fidelity, defined as the fraction of reference constants, strings, and callees reproduced exactly. For naming, the reference is VarBERT's 84.15% Top-1 on the DIRE dataset. Our naming stage must at least match it when given Hex-Rays input, and we then report its accuracy on our IR-bound slots.
Three ablations each remove one ingredient. The first replaces entity pointing with See-style token-position copying over subwords. The second replaces the bidirectional encoder and occurrence pooling with a causal encoder. The third drops SSA-value entities, so that only literals can be pointed to.
Why not just…?
Why not just scale a causal LLM? A causal LLM's attention can already copy tokens from its prompt, and LargePiG argues that large language models behave as implicit pointer-generators. This is the main threat. Two pieces of evidence cut against it but do not settle it. SK2Decompile reports large gains over GPT-5-mini, and SmartBT beat GPT-4 on bytecode with a small copy-augmented model. The size-matched baseline, plus a comparison against a 7B causal model, will show whether literal fidelity stops being a bottleneck at scale. If the 7B model closes the gap, the contribution shrinks to provenance and auditability, and we will say so.
Why not just repair literals after generation? A cheap alternative is to generate freely and then snap each output constant or string to the nearest entity in the IR table. We will implement exactly this repair on the causal baseline. Snapping can fix typos but cannot fix a literal placed in the wrong spot or a callee the model never mentioned. If post-hoc repair matches our model, the end-to-end pointer is not justified.
Why not just rely on subword tokenization without a gate? Subword tokenization (BPE) removes out-of-vocabulary failures, but VarBERT still needed a heuristic to predict how many subword slots each name takes. Hua et al. found that models without copy defaulted to generic substitutes under domain shift. Our first ablation measures the entity-versus-token difference directly, and we split results into projects seen and unseen in training.
Why not a graph encoder? ProGraML encodes IR as a graph with a graph neural network, and graph message passing may represent entities better than a linearized sequence. On the other hand, VarBERT outperformed DIRE's graph-based model while training faster. As a secondary comparison, we swap in a ProGraML encoder for entity vectors while keeping the decoder fixed.
Proposed Experiments
We train on Decompile-Bench pairs compiled at -O0 through -O3 and evaluate on HumanEval re-executability and GitHub2025 R2I. We add the literal-fidelity metric above and report the rate of hallucinated callees, meaning emitted calls to functions the binary does not import. Name recovery is evaluated on the DIRE dataset.
The decisive check is a stratified analysis. We bucket test functions by how many literals the reference source contains, and we expect the gain over the causal baseline to grow with that count. A flat gain would mean the pointer is not what is helping. The gate's copy rate should fall from -O0 to -O3, tracking how often constants are compiler-rewritten. We will also report a provenance audit: the share of output literals with a valid entity link, and how often those links are wrong.
References
- SK2Decompile: LLM-based Two-Phase Binary Decompilation from Skeleton to Skin
- Decompile-Bench: Million-Scale Binary-Source Function Pairs for Real-World Binary Decompilation
- Towards Neural Decompilation
- Get To The Point: Summarization with Pointer-Generator Networks
- Pointer Networks
- Architecture- and OS-Independent Binary-Level Dynamic Test Generation
- CEBin: A Cost-Effective Framework for Large-Scale Binary Code Similarity Detection
- Neural Code Comprehension: A Learnable Representation of Code Semantics
- Variable Name Recovery in Decompiled Binary Code using Constrained Masked Language Modeling
- DIRE: A Neural Approach to Decompiled Identifier Naming
- LargePiG: Your Large Language Model is Secretly a Pointer Generator
- Automating Comment Generation for Smart Contract from Bytecode
- A Pilot Study of Domain Adaptation Effect for Neural Abstractive Summarization
- ProGraML: A Graph-based Program Representation for Data Flow Analysis and Compiler Optimizations