Adabot: Fault-Tolerant Java Decompiler

Zhiming Li, Qing Wu, Kun QianarXiv 2019

Introduction

Reverse engineering is a cornerstone of software security and analysis, yet traditional Java decompilers remain surprisingly brittle. Most industry-standard tools rely on strictly defined rules and Abstract Syntax Trees (ASTs). While these work well for "clean" code, they often fail when faced with "noise"—informal bytecode, aggressive compiler optimizations, or deliberate obfuscation designed to thwart analysis. Adabot addresses this fundamental gap by treating decompilation not as a rule-matching exercise, but as a statistical machine translation task.

The Problem: The Brittleness of Rules

Traditional decompilers are not fault-tolerant. If the input bytecode does not perfectly conform to expected patterns, the tool typically fails to produce valid source code. Adabot shifts this paradigm by treating bytecode (or its mnemonic representation) as a source language and Java source code as the target language. This allows the system to "guess" the most likely intended structure even when the input is imperfect or noisy.

Figure 1: Mapping between bytecode, mnemonics, and source code elements like literals, fields, and methods.

Methodology: Neural Machine Translation for Code

The researchers framed decompilation as a Neural Machine Translation (NMT) problem, comparing two primary architectures:

  1. Attention-based NMT: A recurrence-based model (RNN) that uses an attention mechanism to focus on relevant parts of the input sequence.
  2. Transformer: A model based entirely on self-attention, processing input units in parallel.

A significant challenge in code translation is the unbalanced distribution of information. Structural keywords (e.g., public, class) are highly redundant, while unique identifiers (variable or method names) carry high entropy but appear rarely. To test robustness, the authors introduced "salt-and-pepper" noise—randomly corrupting bytecode units—to measure the Unit Error Probability (UEP).

Key Insights and Results

Transformers Conquer Redundancy

The Transformer architecture significantly outperformed the RNN-based NMT. Because Transformers process the entire sequence in parallel, they are more adept at extracting rare lexical information from a sea of redundant structural keywords. On the redundant test set, the Transformer reached a 94.50% BLEU-4 score and a remarkably low 2.65% Word Error Rate (WER).

Figure 5: Visualization of attention weights mapping bytecode sequences to specific source code tokens like 'println'.

Superior Fault Tolerance

When noise was introduced, the Transformer's performance remained stable. Even at a 20% unit error probability, its BLEU-4 score only dropped by approximately 6%. In contrast, the standard NMT model's performance plummeted as noise increased, proving it far less resilient to corruption.

Metrics Matter: WER vs. BLEU-4

While BLEU-4 is the standard for human language translation, the authors argue that Word Error Rate (WER) is a superior metric for code. In programming, a single substituted method name (e.g., getHeight vs. getGraphics) completely changes program logic. WER is more sensitive to these critical "point failures" that BLEU might overlook.

Conclusion and Future Work

Adabot demonstrates that statistical models can provide a robust, fault-tolerant alternative to traditional decompilation. While currently tested on API-level snippets from Java 11, the results suggest that Transformer-based models can handle the complexities of real-world code better than rule-based systems. Future work will focus on expanding the dataset to include longer, more complex, and randomized code snippets to further test the model's ability to handle long-range dependencies in large-scale commercial software.

Summary updated

BibTeX
@misc{li2019adabot,
  author = {Zhiming Li and Qing Wu and Kun Qian},
  title = {{Adabot: Fault-Tolerant Java Decompiler}},
  year = {2019},
  eprint = {1908.06748},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1908.06748},
}
Figure