The dataset is currently empty. Upload or create new data files. Then, you will be able to explore them in the Dataset Viewer.

ExeBench, explained

This repository is a reading guide to ExeBench for the Infinite RL team (AI@UNC). It contains no data yet. ExeBench itself is published by its authors at jordiae/exebench and github.com/jordiae/exebench.

How to read the source tags. Every statement is tagged with where it comes from. Paper citations give the section, table or figure.

Tag Source
[Paper Β§x / Table x / Fig. x] Armengol-EstapΓ© et al., ExeBench: An ML-Scale Dataset of Executable C Functions, MAPS '22, pp. 50–59 (doi:10.1145/3520312.3534867)
[Appendix x] The paper's supplementary material (I/O specification format, I/O samples; MIT-licensed)
[README] ExeBench's README (identical on Hugging Face and GitHub)
[Loader] exebench.py, the Hugging Face loading script
[Helpers] exebench/__init__.py and examples/basic.py on GitHub
[Measured] Counted by us in the actual v1.01 files (revision 093085f8)
[Interpretation] Our reading; not stated by the authors

Both the paper and its appendix have been read in full for this card.


1. What ExeBench is

ExeBench is a dataset of C functions taken from real GitHub code. Each function comes with what it needs to compile (its dependencies) and, for a subset, input/output (I/O) examples plus a harness that actually runs the function.

  • The gap it fills. [Paper Β§1]
    • AnghaBench, the closest prior dataset, provides 1.04M compilable C functions scraped from GitHub.
    • Its functions often lack externally defined types and function dependencies, are not executable, and come with no inputs or outputs.
  • What ExeBench adds. [Paper Β§1] It finds external types and functions automatically and produces I/O examples for 687,843 functions.
  • Headline numbers. [Paper, abstract; Β§8] "4.5M compilable and 700k executable C functions". The exact counts are 4,485,817 compilable and 687,843 executable (Β§8, Table 3).
  • Who made it. Jordi Armengol-EstapΓ©, Jackson Woodruff, Alexander Brauckmann, JosΓ© Wesley de Souza MagalhΓ£es and Michael F. P. O'Boyle (University of Edinburgh). MAPS '22, June 13, 2022, San Diego, co-located with PLDI.

2. How it was built

2.1 Collecting the code (Β§4)

  • Source. [Paper Β§4]
    • The GitHub Archive dataset hosted on Google BigQuery, downloading all .c and .h files.
    • Non-C headers are dropped with the Enry language identifier.
    • Function definitions are extracted from each file with Clang.
  • AnghaBench is processed too. [Paper Β§6.1, Table 1] It has 147 projects, and only synthetic declarations exist for it.

2.2 The pipeline (Β§3, Fig. 1)

[Paper Β§3, Fig. 1] The steps:

  1. Expand macros, except #include directives.
  2. Then four independent, parallel steps:
    • 2a. Real definitions: extract the real auxiliary definitions, fixing missing includes. [Paper Β§4, "Real Definitions"] Building each repository as its developers intended "is not scaleable". Instead, heuristics find the right include files, helped by an SQL database indexed by file name:
      • A missing system include (<lib.h>) is removed.
      • A missing relative include ("lib.h") is first searched for in the same repository, then across the whole dataset.
      • When several files share a name, the one with the most GitHub stars wins.
    • 2b. Synthetic definitions: inject synthetic type and function definitions for dependencies that cannot be found. This uses the type-inference scheme from AnghaBench. [Paper Β§2.1, Β§3.1]; [README] credits Psyche-C, https://github.com/ltcmelo/psychec.
    • 2c. Extract the function definition itself.
    • 2d. Extract metadata.
  3. Generate I/O with real definitions (3a) or synthetic ones (3b).

[Paper Β§3.1] Synthetic declarations (signatures without bodies) are enough to make functions compilable. Synthetic definitions (with bodies) are what make them executable. "Synthetic IO" is I/O generated with synthetic dependencies; "real IO" uses the real ones. [Paper Fig. 2] is a Venn diagram of these subsets.

2.3 Generating I/O (Β§5)

Signature-driven, not context-aware. [Paper Β§5] Test generation uses function signatures only, trading context sensitivity for automation. For example, it does not know that an input must be positive.

Number of pairs. [Paper Β§5]

  • Synthetic dependencies: 10 I/O pairs Γ— 3 seeds for the auxiliary definitions = 30 pairs per function.
  • Real dependencies: 10 pairs per function.
  • [Measured] v1.01 matches this in every row we counted: synthetic 30, real 10.

The I/O specification. [Paper Β§5.1; Appendix A]

  • A JSON description per function, based on FACC, generated automatically by a Python frontend from the C function.
  • It lists the variables live at entry (livein), live at exit (liveout), and a typemap.
  • Base types: uint8–uint64, int8–int64, float16, float32, float64, unit, string. array and struct are parametric types.
  • [Appendix A.3] Further fields: functionargs, returnval, execcmd, functionname, required_includes, range. In the v1.01 data these are named funargs, returnvarname, execcmd, funname, required_includes, range, plus classmap (struct layouts) and needs_cast. [Measured]

Arrays and strings.

  • [Paper Β§5.1] Default array length is 32. Strings are variable-length, null-terminated C strings.
  • [Appendix A.2] says arrays default to "large sizes" (to avoid out-of-bounds segfaults); the paper fixes the default at 32.
  • [Measured] The v1.01 typemap uses array(<type>#32).

Globals and by-reference arguments. [Paper Β§5.1.1]

  • Every argument passed by reference is treated as an output, checked after the call.
  • Undefined globals (synthetic case) become inputs, randomly generated per pair.

Running it.

  • [Paper Β§5.1.4] A C++ wrapper loads values from a JSON file into variables with a C++ JSON library, calls the function, and writes the live-out values back as JSON.
  • [Appendix A.3] The test executable takes a JSON input file and produces a JSON output file.

2.4 Simple vs rich I/O (Β§5.1.2–5.1.3)

[Paper Β§5.1.2] Simple IO is a set of I/O pairs that is either:

  • Constant: every input gives the same output. Example: inputs 1, 2, …, n and outputs 0, 0, …, 0.
  • Identity: the output variables keep the values they had before the call.

[Paper Β§5.1.3] Rich IO is everything else, i.e. I/O that a constant or identity implementation cannot pass.

What each is good for:

  • [Paper Β§5.1.2] Simple IO is "not useful for e.g. IO-based program synthesis", because a trivial implementation passes it. It can still serve to benchmark optimizations that already have correctness guarantees.
  • [Paper Β§5.1.3] Rich IO has potential for IO-guided program synthesis or code generation.

How this appears in v1.01. The files carry a per-row boolean real_io_pairs_are_trivial / angha_io_pairs_are_trivial. [Measured]

  • In the splits, *_simple_io rows are flagged trivial (500/500 sampled per split) and train_synth_rich_io rows are not (0/500 sampled). The flag is therefore how v1.01 labels the paper's simple (trivial) vs rich distinction. [Interpretation]
  • Caveat: the flag cannot be fully recomputed from the stored pairs with the paper's rule. [Measured] We tested every row we hold locally (all of valid_real, test_real and test_synth, plus the first 22,981 rows of train_real_compilable). The rule: each output variable is constant across pairs or equal to its input value, with float32-level tolerance.
    • 2,532 of 3,933 flagged rows satisfy the rule.
    • 1,401 flagged rows do not. Example: Util_strupper, whose output depends on its input ("cmvy…" β†’ "CMVY…").
    • Of 9,267 unflagged rows, 9,077 fail the rule; 190 would pass it.
    • So the authors' pipeline must use additional criteria or data that are not stored. [Interpretation]
  • Practical consequence: treat *_io_pairs_are_trivial = true as "do not use as a label". Unflagged rows are, with very few exceptions, genuinely rich. [Interpretation]

2.5 Safety (Β§5.2)

[Paper Β§5.2]

  • Crashes and leaks cannot affect the harness process, because each run is a separate process with a timeout.
  • But code with real dependencies can be unsafe for the host. The authors ran everything in containers with limited permissions, and warn users to do the same.
  • AnghaBench-style synthetic code is less risky because system calls are replaced by dummy functions.

2.6 Deduplication and splits (Β§7)

  • [Paper Β§7.1] AnghaBench and GitHub outputs are concatenated and exactly deduplicated on tokenized function definitions. Before removing a duplicate, the authors check that its external function references are identical.
  • [Paper Β§7.2] Splits ensure valid and test have all possible attributes to ease evaluation.
  • [Paper Β§7.4] Data is stored as compressed JSON Lines, the format of The Pile.

3. Statistics from the paper

Table 1: raw sources, before any preprocessing [Paper Table 1, Β§4]

Dataset Functions Files LOC per function Repositories Duplicated functions
AnghaBench 1,039,021 1,039,021 22.42 147 13.64%
GitHub 8,362,855 9,036,556 18.13 386,288 48.73%

Table 2: pipeline success rates, before deduplication [Paper Table 2, Β§6]

Dataset Method Compilable (% of total) Executable (% of compilable) Rich IO (% of executable) Total
AnghaBench Synth 1,039,021 (100%) 294,396 (28.33%) 36,665 (12.45%) 1,039,021
AnghaBench Real 0 0 0
GitHub Synth 6,566,961 (77.49%) 972,082 (14.80%) 156,717 (16.12%) 8,473,899
GitHub Real 1,700,356 (20.07%) 83,715 (4.92%) 8,274 (9.88%)

In words:

  • AnghaBench: [Paper Β§6.1] 294k (28%) were made executable with synthetic definitions, of which 37k had rich IO. The real-definition approach cannot be applied because the original context is missing.
  • GitHub: [Paper Β§6.2] Of about 8.5M functions:
    • about 77% compile with synthetic declarations; about 15% of those became executable, and about 16% of those had rich IO;
    • about 20% compile with real definitions; almost 5% of those became executable, and almost 10% of those had rich IO.

[Our note] Table 1 reports 8,362,855 GitHub functions, while Table 2's total is 8,473,899 and Β§6.2 says "8.5M". The paper does not reconcile these.

Table 3: final ExeBench subsets after deduplication [Paper Table 3, Β§7.1]

Subset Size Suggested use
Not compilable 735,700 Unsupervised pretraining
Synth compilable 4,189,813 Compilation benchmarking
Real compilable 893,561 Compilation benchmarking
Compilable (synth βˆͺ real) 4,485,817 Compilation benchmarking
Synth simple IO 644,758 Optimization benchmarking
Real simple IO 43,085 Optimization benchmarking
Synth rich IO 120,148 IO-guided program synthesis, code generation, code search
Real rich IO 4,464 IO-guided program synthesis, code generation, code search
Total functions 5,221,517

Arithmetic on these numbers [ours, not stated in the paper]:

  • 735,700 + 4,485,817 = 5,221,517 (the total).
  • 4,189,813 + 893,561 βˆ’ 4,485,817 = 597,557 functions compile both ways.
  • The paper's 687,843 executable (Β§1, Β§8) equals synth simple IO + real simple IO (644,758 + 43,085) exactly. The paper does not say whether the rich-IO rows are counted inside the simple-IO rows.
  • Real rich IO (4,464) equals valid-real + test-real in Table 4 (2,232 + 2,232).

Table 4: v1.00 splits [Paper Table 4, Β§7.2]

Reproduced as printed (βœ“ = has the attribute):

Split Synth comp Real comp Synth Exe Real Exe Synth Rich IO Real Rich IO Size
train-not-compilable βœ— βœ— βœ— βœ— βœ— βœ— 735,700
train-synth-compilable βœ“ βœ— βœ— βœ— βœ— βœ— 4,179,345
train-real-compilable βœ— βœ“ βœ— βœ— βœ— βœ— 884,543
train-synth-simple-io βœ“ βœ— βœ— βœ“ βœ— βœ— 644,758
train-real-simple-io βœ— βœ“ βœ— βœ— βœ“ βœ— 43,085
train-synth-rich-io βœ“ βœ— βœ“ βœ— βœ“ βœ— 109,920
valid-synth βœ“ βœ— βœ“ βœ— βœ“ βœ— 5,000
valid-real βœ— βœ“ βœ— βœ“ βœ— βœ“ 2,232
test-synth βœ“ βœ— βœ“ βœ— βœ“ βœ— 5,000
test-real βœ— βœ“ βœ— βœ“ βœ— βœ“ 2,232

Disjointness. [Paper Table 4 caption]

  • Train, valid and test are disjoint.
  • train-not-compilable is disjoint from the other train sets.
  • train-synth-simple-io and train-synth-rich-io are disjoint.
  • train-synth-compilable and train-real-compilable intersect with all the train subsets with IO.

[Our note] Two rows contradict their own names: train-synth-simple-io has its executable βœ“ under Real Exe, and train-real-simple-io has a βœ“ under Synth Rich IO. These look like column slips in the printed table.

4. Versions: v1.00 (paper) vs v1.01 (current release)

Version Where What it is
v1.00 jordiae/exebench_legacy, gated [README] "The original dataset (v1.00) with the exact same data studied in the paper", available on request.
v1.01 jordiae/exebench, public [README] "a version with some improvements with respect to the original one presented in the paper. The statistics and studies presented in the paper remain consistent with respect to the new ones."

Split sizes side by side. v1.00 is [Paper Table 4], v1.01 is [README], and the difference is our arithmetic. The authors do not document what changed or why the counts differ.

Split v1.00 (paper) v1.01 (README) Difference
train_not_compilable 735,700 2,357,000 (given as 2.357M) +1,621,300
train_synth_compilable 4,179,345 2,308,373 βˆ’1,870,972
train_real_compilable 884,543 675,074 βˆ’209,469
train_synth_simple_io 644,758 550,116 βˆ’94,642
train_real_simple_io 43,085 43,769 +684
train_synth_rich_io 109,920 97,250 βˆ’12,670
valid_synth 5,000 5,000 0
valid_real 2,232 2,133 βˆ’99
test_synth 5,000 5,000 0
test_real 2,232 2,134 βˆ’98

Other notes:

  • Not-compilable vs compilable. The large shift from synth-compilable to not-compilable suggests a stricter compilability check in v1.01. That is a guess: the authors do not say. [Interpretation]
  • Assembly targets. The paper lists x86 and ARM at O0, Ofast, Os [Paper Β§7.3]. The v1.01 files contain {real,angha}_gcc_{x86,arm}_{O0,Os,O3}, i.e. O3, not Ofast. [Measured]
  • File dates. All v1.01 files on the Hub date from 2023-03-09 (repository revision 093085f8558cfd53de8e2c8f4ccc7b9e73dc22ae). [Measured]
  • Loader version. The loading script declares builder version 1.0.4; that is the script's version, not the dataset's. [Loader]

5. The v1.01 splits in practice

Counts are the [README]'s; compressed .tar.gz sizes are [Measured]. The archive for train_not_compilable is named train_no_compilable.tar.gz [Loader].

Split Functions File size Meaning [Paper Β§3.1, Β§5.1.2–5.1.3, Table 3–4] What we found [Measured]
train_not_compilable 2.357M 465.6 MB Not compilable either way. Paper's suggested use: unsupervised pretraining –
train_synth_compilable 2,308,373 8.26 GB Compiles with synthetic declarations; compilation benchmarking –
train_real_compilable 675,074 1.57 GB Compiles with real definitions; compilation benchmarking First 22,981 rows: 1,078 have real I/O and 2,625 synthetic I/O, all flagged trivial (the Table 4 overlap with the I/O splits)
train_synth_simple_io 550,116 1.30 GB Synthetic I/O, simple (constant or identity) First 500 rows: 500 flagged trivial
train_real_simple_io 43,769 36.0 MB Real I/O, simple First 500 rows: 500 flagged trivial
train_synth_rich_io 97,250 368.7 MB Synthetic I/O, rich First 500 rows: 0 flagged trivial
valid_synth 5k 16.6 MB Held out, all attributes, synthetic –
valid_real 2,133 13.4 MB Held out, all attributes, real rich I/O 2,133/2,133 non-trivial real I/O, 10 pairs each
test_synth 5k 16.0 MB Held out, all attributes, synthetic 5,000/5,000 non-trivial synthetic I/O, 30 pairs each
test_real 2,134 9.2 MB Held out, all attributes, real rich I/O 2,134/2,134 non-trivial real I/O, 10 pairs each

6. Other findings

Representativeness (Β§6.3, Fig. 3–4)

Code metrics. [Paper Β§6.3, Fig. 3]

  • Executable subsets are compared against the larger compilable GitHub population (github-compilable).
  • Metrics: cyclomatic complexity; Halstead difficulty, effort, program length and volume; lines of code; maximum AST width and depth; number of basic blocks in unoptimized LLVM IR.
  • The executable distributions "align with this reference distribution, albeit the features are slightly smaller, indicating less complex samples", notably the Halstead metrics and AST depth.
  • The simple-IO subsets match the reference better than the rich ones.

Code embeddings. [Paper Β§6.3, Fig. 4]

  • Functions are embedded with InferCode and projected with UMAP.
  • Fig. 4a: functions from the 10 largest AnghaBench projects mostly share a feature space; FFmpeg and qmk_firmware stand apart.
  • Fig. 4b: compilable and executable functions overlap, which the authors read as executable functions being a representative subset.

Error analysis (Β§6.4, Fig. 5)

  • Compilation errors. [Paper Β§6.4] The most common errors are:
    • synthetic definitions: syntax errors from unexpanded macros;
    • real definitions: header files that could not be found.
  • I/O generation. [Paper Β§6.4, Fig. 5] It does worst on pointer arithmetic and pointer conversions, and on complex control flow.
    • Fewer than 5% of functions doing pointer manipulation (inttoptr, ptrtoint, bitcast) get I/O.
    • continue, goto and labels also give low success. The lowest bar in Fig. 5 is clang.ContinueStmt.
    • Fig. 5's success rate is the share of compilable functions containing the feature that became executable. Its dashed line is the geometric mean over all features.

Duplication (Β§6.4, Table 1)

[Paper Β§6.4] Exact duplicates after tokenization, counted over all extracted functions including non-compilable ones:

  • close to 14% of AnghaBench (13.64% in Table 1);
  • almost half of GitHub (48.73% in Table 1).

Broader impact

[Paper, Broader Impact] The authors see the main concern as legal and ethical use of other developers' code. They point to two mitigations: the code was already part of a public dataset, and every row carries metadata to locate its repository and license.

7. Record fields

[Paper Β§7.3] names the fields func_def, func_name, func_sig, path, syn_defs, real_defs, syn_io, real_io, wrapper, asm. The v1.01 files use different names [Measured]. The loading script renames angha_* to synth_* and drops a few fields [Loader]. Raw records are wrapped as {"text": {...}, "meta": ...} [Measured].

v1.01 raw field (β†’ loader name) Paper name What it is
path path File in the original GitHub repository
ref – Git ref of that repository; with path, identifies the function's license
fname func_name Function name
func_def func_def C function definition (after macro expansion, Β§3)
func_head – Header as written; sometimes wrong per [Helpers]
func_head_types – Header with normalized parameter types, used to declare the function for the harness
signature func_sig Return type then parameter types, e.g. ["void", "char *", "int"]
doc – Doc comment if any (dropped by loader)
asm asm {real,angha}_gcc_{x86,arm}_{O0,Os,O3} β†’ {pre_asm, func_asm} or null; see section 4 of this card
real_deps / angha_deps (β†’ synth_deps) real_defs / syn_defs C declarations/definitions needed to compile and run func_def
real_io_pairs / angha_io_pairs (β†’ synth_io_pairs) real_io / syn_io List of {input, output, dummy_funcs, dummy_funcs_seed}; input/output map variable β†’ JSON value, returnv for the return value
real_io_pairs_are_trivial / angha_… – Simple (trivial) vs rich flag; see section 2.4 of this card (dropped by loader)
real_exe_wrapper / angha_exe_wrapper (β†’ synth_exe_wrapper) wrapper C++ harness (Β§5.1.4); needs nlohmann/json.hpp and clib/synthesizer.h from the GitHub repo
real_iospec / angha_iospec (β†’ synth_iospec) – The FACC-style I/O spec; see section 2.3 of this card
real_error, angha_error, *_io_error – Pipeline error messages (dropped by loader)

8. How to load it

Why load_dataset('jordiae/exebench') fails today:

  • It depends on the loading script exebench.py, and recent datasets releases (4.x) no longer run loading scripts.
  • Even with an older datasets, the script sets _URL = "", so every split URL is a bare file name. [Loader]
  • The Hub viewer is disabled for the same reason.

Read the files directly. Each split is a .tar.gz holding .jsonl.zst files. [Measured]

import io, json, tarfile, zstandard
from huggingface_hub import hf_hub_download

path = hf_hub_download("jordiae/exebench", "test_real.tar.gz", repo_type="dataset",
                       revision="093085f8558cfd53de8e2c8f4ccc7b9e73dc22ae")
with tarfile.open(path) as tar:
    for member in tar:
        if not member.name.endswith(".jsonl.zst"):
            continue
        stream = zstandard.ZstdDecompressor().stream_reader(tar.extractfile(member))
        for line in io.TextIOWrapper(stream, encoding="utf-8"):
            row = json.loads(line)["text"]      # raw names: real_*, angha_*
            print(row["fname"], row["real_io_pairs"][0])
            break

To run a function, use the wrapper with exebench/clib and exebench/nlohmann from GitHub. Compare outputs with diff_io [Helpers]: types must match, dicts are compared on the observed keys, floats with math.isclose. Follow the paper's advice and run real-dependency code in a container [Paper Β§5.2].

9. How Infinite RL uses it

Infinite RL (AI@UNC) studies agents trading in prediction markets about compiled programs. Pod A ("dataset + oracle") turns ExeBench functions into labeled binaries. [Interpretation: our project]

  • Sample. Seeded uniform draws from valid_real + test_real: 4,267 functions, all with rich real I/O (the paper's held-out real-rich-IO splits). Rows whose I/O is flagged trivial are excluded everywhere.
  • Compile. Build from C (real_deps + func_def) ourselves, for x86-64 and AArch64 at -O0 and -O2 with GCC 13. We do not use ExeBench's asm field, whose levels are O0/Os/O3 (Ofast in the paper).
  • Run. Execute in QEMU user mode inside a Docker container, in line with the paper's safety advice (Β§5.2). Record output, exit status, timeouts and instruction counts. Compare with ExeBench's expected output using diff_io semantics.
  • Label.
    • Tier 0: instruction count above a per-target threshold.
    • Tier 1: low bit of the primary output.
    • Failed runs get no label, never a negative one.

Code: github.com/ai-unc/infinite-rl (pods/dataset_oracle/; private repository, team access).

10. License

[README] "All C functions keep the original license as per their original Github repository (available in the metadata). All ExeBench contributions (I/O examples, boilerplate to run functions, etc) are released with an MIT license."

  • Use path and ref to find each function's repository and license.
  • The supplementary appendix is MIT-licensed (Β© 2022 ExeBench Authors).
  • The GitHub repository has no LICENSE file; the MIT terms above come from the README. [Measured]

11. Citation

From the ExeBench README:

@inproceedings{10.1145/3520312.3534867,
author = {Armengol-Estap\'{e}, Jordi and Woodruff, Jackson and Brauckmann, Alexander and Magalh\~{a}es, Jos\'{e} Wesley de Souza and O'Boyle, Michael F. P.},
title = {ExeBench: An ML-Scale Dataset of Executable C Functions},
year = {2022},
isbn = {9781450392730},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3520312.3534867},
doi = {10.1145/3520312.3534867},
abstract = {Machine-learning promises to transform compilation and software engineering, yet is frequently limited by the scope of available datasets. In particular, there is a lack of runnable, real-world datasets required for a range of tasks ranging from neural program synthesis to machine learning-guided program optimization. We introduce a new dataset, ExeBench, which attempts to address this. It tackles two key issues with real-world code: references to external types and functions and scalable generation of IO examples. ExeBench is the first publicly available dataset that pairs real-world C code taken from GitHub with IO examples that allow these programs to be run. We develop a toolchain that scrapes GitHub, analyzes the code, and generates runnable snippets of code. We analyze our benchmark suite using several metrics, and show it is representative of real-world code. ExeBench contains 4.5M compilable and 700k executable C functions. This scale of executable, real functions will enable the next generation of machine learning-based programming tasks.},
booktitle = {Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming},
pages = {50–59},
numpages = {10},
keywords = {Code Dataset, Program Synthesis, Mining Software Repositories, C, Machine Learning for Code, Compilers},
location = {San Diego, CA, USA},
series = {MAPS 2022}
}
Downloads last month
42