Tady: A Neural Disassembler without Structural Constraint Violations

Siliang Qin, Fengrui Yang, Hao Wang, Bolun Zhang, Zeyu Gao, Chao Zhang, Kai Chen · DOI

Introduction

Disassembly—the process of translating raw binary bytes into human-readable assembly instructions—is the foundational step in reverse engineering and security analysis. While recent advancements in deep learning have produced neural disassemblers like XDA and DeepDi that offer high speed and instruction-level accuracy, they suffer from a critical flaw: "hallucinations" that violate fundamental program logic. These models frequently produce outputs that are structurally impossible, such as overlapping instructions or jump targets located in data sections. Even a 99% accurate model can be rendered useless for downstream tools like decompilers or data-flow analyzers if it produces a single structural violation.

Tady is a novel neural disassembler designed to solve this reliability issue. By formalizing disassembly as an optimization problem constrained by post-dominance relations, Tady ensures that its output is not only accurate at the instruction level but also structurally sound for rigorous security applications.

The Structural Consistency Problem

Traditional neural disassemblers treat binary code similarly to natural language, processing sequences of bytes to predict instruction boundaries and types. However, code is governed by strict execution logic that language models often fail to capture. Common violations include:

  • Instruction Overlap: Predicting two instructions that occupy the same memory address.
  • Control Flow Inconsistency: Identifying a jump instruction whose target is identified as data rather than code.

These violations break the Control Flow Graph (CFG), making it impossible for automated security tools to reliably trace program execution. Tady addresses this by moving beyond simple sequence prediction to a model that respects the underlying graph structure of executable code.

Methodology

Tady introduces a two-pronged approach to ensure structural integrity through a combination of specialized neural architectures and formal logical pruning.

1. Trace-Aware Neural Architecture

Tady utilizes a hybrid model to capture both local instruction patterns and global execution context:

  • Masked Sliding Window Attention (MSWA): Unlike standard transformers that attend to all neighboring bytes, Tady employs "reachability masks." This ensures an instruction only attends to other bytes that could actually be reached on a valid execution path, aligning the model's attention with the CPU's execution logic.
  • Global Message Passing: This layer facilitates information flow between distant code segments connected by jumps or calls, allowing the model to resolve long-range dependencies that local windows might miss.

2. PDT-Based Pruning and Optimization

The core innovation of Tady is its use of the Post-Dominator Tree (PDT) to enforce logical consistency. In compiler theory, if every path from instruction B to the program exit must pass through instruction A, then A "post-dominates" B. Tady leverages this relationship to identify and eliminate logical holes; for instance, if a block of code is identified as valid, its post-dominators must also be valid code.

Tady treats the final disassembly as a maximum-weight subtree problem. It takes the probabilistic scores generated by the neural network and applies a dynamic programming (DP) algorithm to prune away inconsistent instructions. This process leaves behind the most likely, globally consistent disassembly, reducing the validation complexity from $O(N^2)$ to linear time ($O(N)$).

Evaluation and Results

The authors evaluated Tady against a massive suite of binaries, including the Pangine, Assemblage, and x86-sok datasets, as well as specialized datasets like Obf-Ben and Quarks which contain heavily obfuscated code (OLLVM/Tigress).

Key Findings

  • Zero Violations: Tady effectively eliminates 100% of structural constraint violations after the pruning step, a feat not achieved by previous neural models.
  • Superior Accuracy: Tady achieved F1 scores above 0.99 on most benchmarks, consistently outperforming SOTA models like DeepDi and XDA, particularly on complex Linux binaries.
  • Efficiency: Tady processes binaries at a rate of 5.26 MB/s. While slightly slower than "raw" neural models that do not perform consistency checks, it remains significantly faster than industry-standard tools like IDA Pro.
  • Robustness: In tests against anti-disassembly techniques, Tady maintained high accuracy in identifying entry points where traditional rule-based tools like IDA Pro and Ghidra often failed.

Interestingly, Tady's error-detection logic was so effective that it identified thousands of structural errors in the "ground truth" labels of established research datasets, proving that even compiler-generated labels can contain subtle logical flaws.

Limitations and Future Work

While Tady represents a significant leap in reliable neural disassembly, some challenges remain:

  • Hardware Exceptions: The current logic assumes "fall-through" instructions are always executed, but hardware exceptions (e.g., division-by-zero) can redirect control flow to handlers, potentially bypassing the assumed path.
  • Virtualization Obfuscation: Tady struggles with "virtualization-based" obfuscation (like VMProtect), which transforms code into custom bytecode formats that do not follow standard x86 patterns.
  • Architecture Support: The current implementation is optimized for x86 and x86-64. Future work involves extending the reachability logic and training data to support ARM and RISC-V architectures.

Conclusion

Tady demonstrates that neural disassembly can be both fast and formally consistent. By integrating compiler theory—specifically post-dominance relations—into the deep learning pipeline, Tady bridges the gap between the probabilistic nature of AI and the deterministic requirements of binary analysis.

Summary updated

BibTeX
@inproceedings{qin2025tady,
  author = {Siliang Qin and Fengrui Yang and Hao Wang and Bolun Zhang and Zeyu Gao and Chao Zhang and Kai Chen},
  title = {{Tady: A Neural Disassembler without Structural Constraint Violations}},
  booktitle = {USENIX Security},
  year = {2025},
}
Figure