Datasets:
Download README.md from alea-institute/alea-code-comprehend: direct link, hf CLI and curl.
- Browser
- Download file 8.58 kB
-
https://huggingface.co/datasets/alea-institute/alea-code-comprehend/resolve/main/README.md
- Command line
-
hf download hf://datasets/alea-institute/alea-code-comprehend/README.md
-
curl -L -o README.md https://huggingface.co/datasets/alea-institute/alea-code-comprehend/resolve/main/README.md
license: cc-by-4.0
language:
- en
tags:
- code
- python
- program-comprehension
- synthetic
- execution-verified
pretty_name: ALEA code_comprehend
size_categories:
- 10K<n<100K
ALEA code_comprehend
Execution-verified Python code-comprehension tasks built from the ALEA Institute's own synthetic code. Each document shows real, runnable code and asks a question whose answer was obtained by running that code in a sandbox. The set was built for midtraining a small language model. It teaches reasoning about what code does when one line changes, rather than writing code.
Tasks
| kind | question | answer |
|---|---|---|
failing_test |
A module, 4 to 8 short tests and a one-line edit (shown as a diff, a line-number change or a prose edit). Which tests fail after the edit? A single-test variant asks whether one named test still passes. | test names in listing order, or none / yes / no |
edit_output |
A module, a call and its current result, and a one-line edit. What does the call return after the edit? | the Python repr of the value, or raises <Exception> |
fill_line |
Code with one line removed, a few tests, and 3 or 4 candidate lines. Which candidate makes every test pass? | a letter |
spot_bug |
A specification (a natural-language request, or the docstring plus tests), numbered code that may contain a one-line bug, and tests. Which line is wrong and what should it be? | line N: <corrected line> or no bug |
About 28% of rows are worked: they give a short, step-by-step account before a final Answer: line. Every value
stated in a worked row comes from the execution record. This includes how often the edited line ran, which way a
condition went, the values a variable took, and what a call returned before and after the edit. Many worked rows have
a direct-answer twin elsewhere in the set. About 7% of rows start with one or two solved demonstrations taken from
other code units, and a demonstration's answer never equals the target's answer. Rows come in three presentations:
plain instruction, a Q/A frame, or a chat turn. The instruction always comes before the code.
How the gold was produced
- Code. The code comes from three ALEA synthetic pools:
- verified OpenLemma v0.5 code records, each a module with two independent test suites, written by GLM-5.3-Flash, DeepSeek-V4.1-Flash and Qwen3.8 and verified by execution;
- functions from ALEA's verified-code set (R3), written by gpt-6-luna;
- functions sliced from the ALEA synthetic-code corpus, written by OpenAI Codex agents, each re-executed alone and checked to give results identical to the full module.
- Mutations. Edits are single-line, single-node changes made in the code's own formatting:
- comparison or arithmetic operator swaps;
- off-by-one constants that already occur in the module;
- boolean flips and
and/orswaps; - adding or removing a negation;
min/max-style call swaps;- a wrong variable from the same function;
- slice bounds.
- Execution. All execution ran inside a bubblewrap sandbox: no network, a read-only interpreter, a fresh temporary directory, memory, CPU and time limits, and an audit hook that refuses subprocesses and sockets. Every case ran under two hash seeds, and anything whose result differed between them was dropped. Answers containing memory addresses, very long float reprs, sets of strings or timing were dropped.
- failing_test. The original code passes every shown test, and the failing set is the observed set.
- fill_line. Exactly one option passes every shown test (expected values are compared with
==semantics, and only values that can be written in a test are used). Most rows ask for the original line. About 18% are twins with the same code and options whose tests come from executing a comparison, constant or arithmetic alternative; each fill_line row says that the tests, not the names or docstrings, define correctness. - spot_bug. Each buggy version fails at least one shown test. Every unit also has a clean twin, the same unit with no bug, which passes all of them. The tests are introduced neutrally ("The tests describe the intended behavior"), never as already passing.
- Worked traces. When the edited line itself raises, the worked text says so instead of reporting a condition value. Variable values are listed as the sequence of changes (runs that leave a value unchanged are not repeated), and the text says so.
- Shown tests. Duplicate tests and tests with constant-true assertions are not shown.
- Independent re-execution. Every training row was rebuilt from its code and answer and re-run in a fresh sandbox; 16,852 of 16,855 agreed and the 3 others were removed. After the last template changes, all 13,990 failing_test, spot_bug and edit_output rows were re-run again and all agreed.
- LLM use in this build. A language model wrote no row text and no answers. For the R3 verified-code functions,
which had no stored tests, gpt-6-luna (OpenAI, flex tier) proposed only input call expressions such as
f([1, 2], 3). Every expected value was then produced by executing the function in the sandbox. Calls were parsed, restricted to literal arguments, and kept only when they ran deterministically.
Cue controls
Baselines were measured with a 5-fold, code-unit-grouped logistic regression on cue-only inputs. All of them are within about 5 points of the prior:
- failing_test, edit plus test name per test: +3.8 points;
- failing_test, position only: +0;
- edit_output, "unchanged" predicted from the question alone: +1.6;
- fill_line, options only: +1.9 (character and word n-grams), after an out-of-fold adversarial filter that removed fill_line units whose answer the options-only model could pick;
- spot_bug, telling the mutated line from the original line: -0.1;
- spot_bug, ranking the bug line among the unit's mutable lines from line text alone: +2.9.
Several measures went into this:
- answer letters, bug-line positions and the number of failing tests are balanced;
- "none", "unchanged" and "no bug" answers make up 18 to 39% of their kinds;
- test names are neutral (
test_1,check_a, ...) in about half of the rows that come from suites with descriptive names; - three kinds of mutation were excluded from spot_bug because their direction gives them away: removing a negation,
adding a negation, and flipping
+=/-=; - spot_bug pairs whose mutation an out-of-fold classifier could recognise, and fill_line units whose correct option an options-only classifier could pick, were dropped as whole groups.
Counts (encoded training rows)
| rows | sw32k tokens | |
|---|---|---|
| total | 15,419 | 10.81M |
| OpenLemma v0.5 code | 6,163 (40.0%) | 5.41M |
| R3 verified functions | 6,011 (39.0%) | 3.09M |
| synthetic-code snippets | 3,245 (21.0%) | 2.31M |
By kind: spot_bug 4,804 (no bug 1,875), failing_test 4,632, edit_output 4,305, fill_line 1,678. The rows come from 4,344 distinct code units in 350 strata (skills / categories / topics), and no stratum exceeds 5%. Two pools exceed 30% (at most 40%) because the synthetic-code pool is small. Rows are a mean of 701 tokens long, with a maximum of 3,074. A held-out probe split of about 1.5% of code units is kept separately and is not part of the training rows.
Decontamination
Rows were screened against ALEA evaluation references and sibling families' held-out sets at the 8- and 13-gram level. Rows that shared a 13-gram with OpenLemma's held-out evaluation code were removed, apart from widely shared idioms. Any code unit whose id or normalised code matched that evaluation set had already been excluded before generation.
Review
We read 32 rows ourselves and re-executed every training row independently in the sandbox. Two blind reviews followed:
- Blind review 1 (60 rows): 1 HARD, a false premise (a spot_bug prompt said the tests already pass on code that fails one). It was fixed for every row. Its style notes on unnatural fill_line tests led to restricting and filtering that kind.
- Blind review 2 (60 new rows; the reviewer executed all 60, and every answer was correct): 1 HARD, a worked trace that collapsed repeated values into a misleading sequence. The trace wording was fixed for every row. Minor style notes (duplicate or filler tests, an unsuitable system line, two lead-in phrasings) were also addressed.
License
CC BY 4.0. The code is synthetic and was written for ALEA. Any names that appear in it are invented.