RLforDecomp / README.md
Divij's picture
RLforDecomp: v2 paper splits (train / val / test / decompiler_test)
5116799
|
Raw History Blame Contribute Delete
7.83 kB
metadata
pretty_name: RLforDecomp
license: other
license_name: upstream-open-source-licenses
task_categories:
  - text-generation
tags:
  - decompilation
  - reverse-engineering
  - binary-analysis
  - c
  - code
size_categories:
  - 100K<n<1M
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: val
        path: data/val-*
      - split: test
        path: data/test-*
      - split: decompiler_test
        path: data/decompiler_test-*
dataset_info:
  config_name: default
  features:
    - name: input
      dtype: string
    - name: output
      dtype: string
    - name: function_name
      dtype: string
    - name: repo_name
      dtype: string
    - name: category
      dtype: string
    - name: sample_id
      dtype: string
    - name: decompiler
      dtype: string
    - name: opt_level
      dtype: string
  splits:
    - name: train
      num_examples: 643767
    - name: val
      num_examples: 5954
    - name: test
      num_examples: 10838
    - name: decompiler_test
      num_examples: 48664

RLforDecomp

Function-level pairs for decompilation refinement: input is a C function as produced by a decompiler, output is the original source function it came from. The task is to reconstruct the source function from the decompiler output. Quality is measured by the graph edit distance (GED) between the control-flow graphs of the prediction and of the source function, as in the SAILR paper (GED = 0: identical CFG). All binaries are x86-64, compiled at -O0.

from datasets import load_dataset
ds = load_dataset("Divij/RLforDecomp")   # DatasetDict: train / val / test / decompiler_test

Splits

split rows projects decompiler(s) intended use
train 643,767 1,972 Gentoo packages IDA Pro 9.2 training
val 5,954 30 Gentoo packages IDA Pro 9.2 tuning: checkpoint selection, thresholds, sweeps
test 10,838 30 Gentoo packages IDA Pro 9.2 evaluation on unseen repositories, same decompiler as training
decompiler_test 48,664 23 SAILR (Debian) projects IDA (older release), Ghidra, angr-SAILR, angr-Phoenix, angr-DREAM evaluation on unseen repositories and unseen decompilers

decompiler_test rows per decompiler: ghidra 11,681, angr_dream 11,486, ida 11,269, angr_sailr 7,410, angr_phoenix 6,818.

Splits are disjoint at the level of the version-stripped package name (every version of a project lands in the same split), and no decompiled input occurs in more than one split. Treat test and decompiler_test as held-out: evaluate a frozen system on them once and tune on val instead.

Fields

field meaning
input decompiled function (model input)
output original source function (target)
function_name function name used to pair the two sides
repo_name Gentoo package (with version) or SAILR project
category Gentoo category, or sailr for decompiler_test
sample_id parent binary (Gentoo) or SAILR file stem; not unique per row
decompiler ida for train/val/test; one of ida, ghidra, angr_sailr, angr_phoenix, angr_dream for decompiler_test
opt_level always O0

A row is uniquely identified by (sample_id, function_name, decompiler).

Length in characters (median / 95th percentile); lengths are heavy-tailed (train inputs: p99 about 11K, max about 454K).

split input output
train 531 / 4,278 447 / 3,094
val 612.5 / 4,696 488 / 3,451
test 431 / 4,313 449 / 3,233
decompiler_test 625 / 4,694 531 / 4,052

How it was built

  • Gentoo (train, val, test). From the x86-64 Gentoo binaries and source archives released with VarBERT (O0 only; built with debug info and not stripped). Each binary was matched to its source archive (exact or revision-normalized package name, or a manually reviewed override) and its DWARF compilation units to archive members; a binary with any unresolved unit was dropped. Every remaining binary was decompiled whole with IDA Pro 9.2 (output normalized with the SAILR lexer rules: IDA integer type names mapped to C types, __fastcall/__noreturn/__cdecl removed, :: mapped to _), leaving 9,612 binaries (2,107 packages, 76 categories) before pairing and filtering.
  • Pairs. IDA output is split into functions, top-level functions are extracted from the matched source files, and functions are paired by exact, case-sensitive name. IDA auto-generated names (sub_...) and any name with more than one distinct body on either side are dropped. Comments are removed from both sides and both are formatted with clang-format (LLVM style). Exact duplicate (input, output) pairs are removed.
  • SAILR (decompiler_test). All usable O0 output of the SAILR artifact: 23 projects, each source function paired with the output of up to five decompilers. A pair is kept only if pyjoern can build a CFG for the named function on both sides. The source side is the artifact's normalized, preprocessed source.
  • Contamination guards. No Gentoo package whose version-independent name matches a SAILR project, no Gentoo row whose decompiled input occurs in SAILR, and no exact-input overlap between any two splits.

Things to know

  1. Unstripped inputs in train/val/test. Gentoo binaries keep DWARF and symbols, so IDA output for train/val/test typically retains real identifiers, types and even label names. decompiler_test inputs use generic names (a1, param_1, struct_0 *a0, ...), so it measures a substantial distribution shift.
  2. Pairs are matched by name, not proven equivalent. There is no address- or line-level alignment, and source can contain code that the compiler removed (for example assert macros). Identical decompiler output can map to different sources: in train, 5,078 distinct inputs occur with more than one distinct output (for example compiler/CRT stubs and trivial one-liners).
  3. CFG-buildability was required only for decompiler_test. train, val and test rows were not filtered on it.
  4. Exact deduplication only. Near-duplicates, forks and vendored copies can remain; leakage checks are exact-match.
  5. Skew. Large projects dominate: 121 of the 1,972 train packages hold half of the rows, two packages hold half of val and half of test, and three projects (openssh-portable, bash, coreutils) hold 49% of decompiler_test. Read aggregate metrics per repository or with a repository-clustered bootstrap. Because GED is heavy-tailed, the exact-match rate (GED = 0) is the more stable summary than the mean.
  6. Verbatim upstream strings. Functions are copied from public projects and can contain strings that resemble credentials (PEM header markers in key parsers; one public Amazon API access-key ID in glyr's generic_amazon_url).

License and provenance

The output side is source code from open-source projects (named in repo_name) under their own, varying licenses (for example GPL, LGPL, BSD, MIT); the input side is decompiler output for binaries built from that code. This compilation is provided for research use. You are responsible for complying with the licenses of the upstream projects.

Upstream artifacts:

  • VarBERT: K. K. Pal et al., "Len or index or count, anything but v1": Predicting Variable Names in Decompilation Output with Transfer Learning. IEEE Symposium on Security and Privacy, 2024.
  • SAILR: Z. L. Basque et al., Ahoy SAILR! There is No Need to DREAM of C: A Compiler-Aware Structuring Algorithm for Binary Decompilation. USENIX Security Symposium, 2024.