Dataset Viewer
The dataset viewer is not available for this subset.
Cannot get the split names for the config 'default' of the dataset.
Exception:    SplitsNotFoundError
Message:      The split names could not be parsed from the dataset config.
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.12/site-packages/datasets/inspect.py", line 286, in get_dataset_config_info
                  for split_generator in builder._split_generators(
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/webdataset/webdataset.py", line 81, in _split_generators
                  first_examples = list(islice(pipeline, self.NUM_EXAMPLES_FOR_FEATURES_INFERENCE))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/webdataset/webdataset.py", line 34, in _get_pipeline_from_tar
                  for filename, f in tar_iterator:
                                     ^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/utils/track.py", line 49, in __iter__
                  for x in self.generator(*self.args):
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/utils/file_utils.py", line 1387, in _iter_from_urlpath
                  yield from cls._iter_tar(f)
                File "/usr/local/lib/python3.12/site-packages/datasets/utils/file_utils.py", line 1338, in _iter_tar
                  stream = tarfile.open(fileobj=f, mode="r|*")
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/tarfile.py", line 1886, in open
                  t = cls(name, filemode, stream, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/tarfile.py", line 1762, in __init__
                  self.firstmember = self.next()
                                     ^^^^^^^^^^^
                File "/usr/local/lib/python3.12/tarfile.py", line 2750, in next
                  raise ReadError(str(e)) from None
              tarfile.ReadError: invalid header
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/split_names.py", line 66, in compute_split_names_from_streaming_response
                  for split in get_dataset_split_names(
                               ^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/inspect.py", line 340, in get_dataset_split_names
                  info = get_dataset_config_info(
                         ^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/inspect.py", line 291, in get_dataset_config_info
                  raise SplitsNotFoundError("The split names could not be parsed from the dataset config.") from err
              datasets.inspect.SplitsNotFoundError: The split names could not be parsed from the dataset config.

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

BCSD Dataset

A dataset for Binary Code Similarity Detection (BCSD). It contains C/C++ programs compiled with two compilers (GCC, Clang) at five optimization levels (O0, O1, O2, O3, Os) on x86-64, together with their disassembly and precomputed function embeddings.

Contents

File Size Description
sources.tar.zst 22 MB Original source files (C, C++, Go, Rust)
binaries.tar.zst 1.85 GB Compiled ELF binaries (114,532 files)
disasm.tar.zst 47 MB Linear disassembly (angr), one JSON per binary
disasm_jtrans.tar.zst 99 MB Basic-block disassembly for jTrans models
embeddings.tar.zst 538 MB Per-function embeddings (.npy) for each approach

Statistics: 11,639 source programs over 5,212 problems (AtCoder, LeetCode, Rosetta Code).

Path layout

The binaries, disasm, disasm_jtrans and embeddings archives use the same layout:

<compiler>/<arch>/<optim>/<dataset>/<problem>/<Lang>__impl_NN
example: clang/x86_64/Os/rosetta_code/binary_digits/Cpp__impl_01

Sources use sources/<dataset>/<problem>/<Lang>/impl_NN.ext.

Download

pip install -U "huggingface_hub[cli]"

# one file
hf download <user>/bcsd-dataset disasm.tar.zst --repo-type dataset --local-dir .

# everything
hf download <user>/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:

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):

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)):

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.

Downloads last month
61