--- license: cc-by-4.0 pretty_name: BCSD Dataset (Binary Code Similarity Detection) language: - en task_categories: - feature-extraction tags: - binary-code-similarity - bcsd - reverse-engineering - disassembly - x86-64 size_categories: - 100K/////__impl_NN example: clang/x86_64/Os/rosetta_code/binary_digits/Cpp__impl_01 ``` Sources use `sources////impl_NN.ext`. ## Download ```bash pip install -U "huggingface_hub[cli]" # one file hf download /bcsd-dataset disasm.tar.zst --repo-type dataset --local-dir . # everything hf download /bcsd-dataset --repo-type dataset --local-dir ./bcsd-dataset ``` ## Decompress The archives are compressed with zstd. Install zstd (`apt install zstd` or `brew install zstd`), then extract: ```bash tar --use-compress-program=unzstd -xf disasm.tar.zst # or, with a recent tar: tar --zstd -xf disasm.tar.zst ``` ## Usage Read a disassembly file (one JSON per binary): ```python import json d = json.load(open("disasm/clang/x86_64/Os/rosetta_code/binary_digits/Cpp__impl_01.json")) for fn in d["functions"]: print(fn["name"], fn["nb_instructions"]) for mnemonic, operands in fn["instructions"]: print(mnemonic, operands) ``` Load a function embedding (shape is `(n_functions, dim)`): ```python import numpy as np v = np.load("embeddings/palmtree/clang/x86_64/Os/rosetta_code/binary_digits/Cpp__impl_01.npy") print(v.shape) # (1, 128) ``` Embedding dimensions: `baseline` = 16, `palmtree` / `refuse` = 128, `jtrans` = 768. The file `embeddings/index.json` maps each `source_id::function` to its embedding paths. ## Notes Only C and C++ are compiled in this release; Go and Rust appear in the sources only. The dataset is x86-64 only. Source programs come from AtCoder, LeetCode and Rosetta Code; please respect their terms when reusing.