Datasets:
code_trace: 24142 train rows
Browse files- README.md +108 -0
- data/train-00000-of-00001.parquet +3 -0
README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
task_categories:
|
| 6 |
+
- question-answering
|
| 7 |
+
- text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- code
|
| 10 |
+
- python
|
| 11 |
+
- code-tracing
|
| 12 |
+
- program-execution
|
| 13 |
+
- synthetic
|
| 14 |
+
size_categories:
|
| 15 |
+
- 10K<n<100K
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# code_trace: execution-verified Python tracing questions
|
| 19 |
+
|
| 20 |
+
Each document shows a short piece of Python (one function plus the helpers, constants and classes it needs) and asks a
|
| 21 |
+
question about what happens when one specific call runs. Every answer was obtained by running that exact code in a sandbox.
|
| 22 |
+
|
| 23 |
+
The questions, answers and worked traces are produced by deterministic code from recorded executions; no language model
|
| 24 |
+
wrote or checked any question, answer or trace. The Python source code itself is ALEA's own synthetic code written by
|
| 25 |
+
language models: GLM-5.3-Flash, DeepSeek-V4.1-Flash and Qwen3.8 for the OpenLemma modules, gpt-6-luna for the R3 functions,
|
| 26 |
+
and OpenAI Codex agents for the code library.
|
| 27 |
+
|
| 28 |
+
## Question kinds
|
| 29 |
+
|
| 30 |
+
- **final_output**: what a call returns (as a Python repr) or prints.
|
| 31 |
+
- **var_at_line**: the value of a named local variable just before a marked line runs for the k-th time.
|
| 32 |
+
- **loop_state**: the values of one or two variables after the body of a marked loop has completed N passes (stated as
|
| 33 |
+
"just before pass N+1 begins"), or how many times the loop body runs.
|
| 34 |
+
- **exception**: whether the call raises, and if so which exception class; otherwise the returned value.
|
| 35 |
+
- **return_type**: the type name of the returned value, asked on a version of the code with parameter / return annotations,
|
| 36 |
+
local variable annotations and docstrings removed.
|
| 37 |
+
- **call_count**: how many times a helper or recursive function is called during the call.
|
| 38 |
+
|
| 39 |
+
Minimal pairs: many questions come in twins that share the code and differ in one element of the input (input twins), or
|
| 40 |
+
share the input and differ in one token of the code, such as `<` vs `<=` or a constant (code twins), with different answers.
|
| 41 |
+
Functions whose return type depends on the branch taken contribute type twins. About 29% of the documents show a short
|
| 42 |
+
step-by-step trace (line-by-line variable updates, per-pass loop values or the list of calls, all copied from the recorded
|
| 43 |
+
execution) before a final `Answer:` line; the same questions also appear elsewhere with the answer only. About 5% of the
|
| 44 |
+
documents start with one or two solved examples from other code. Documents are rendered as plain instructions, Q/A pairs or
|
| 45 |
+
chat turns.
|
| 46 |
+
|
| 47 |
+
## Source code
|
| 48 |
+
|
| 49 |
+
ALEA's own synthetic Python code from three pools: verified function modules with tests from the OpenLemma code collection
|
| 50 |
+
(excluding every item that matches the OpenLemma held-out evaluation set), verified single functions with assertion checks
|
| 51 |
+
from the KL3M R3 verified-code collection, and larger tested modules from ALEA's synthetic code library (from which only the
|
| 52 |
+
self-contained functions are cut out, at most about 80 lines with their dependencies). Only the Python standard library is
|
| 53 |
+
used.
|
| 54 |
+
|
| 55 |
+
## How the answers were made
|
| 56 |
+
|
| 57 |
+
1. Each code unit's own tests were run in an isolated sandbox (no network, no file system access outside a temporary
|
| 58 |
+
directory, memory and time limits) with a profiler that records the arguments of calls to the unit's functions.
|
| 59 |
+
2. Those recorded arguments were changed by one edit at a time (a number up or down, a list element dropped, duplicated or
|
| 60 |
+
swapped, a string character changed, an empty value) to make new inputs; a second edit of an edited input gives the
|
| 61 |
+
input twins. The original test inputs are used only for the trace-state kinds, never for final-output questions.
|
| 62 |
+
3. Every call was executed in the sandbox under a line tracer, on the cut-out snippet and on the full original module (the
|
| 63 |
+
two must agree), at two hash seeds (the two must agree). Answers with memory addresses, unordered sets of strings, very
|
| 64 |
+
long floats or long output were dropped.
|
| 65 |
+
4. Every document was then re-executed independently (plain evaluation, a counting wrapper for call counts, and an inserted
|
| 66 |
+
recording statement for line and loop questions) at six hash seeds; any function unit with a disagreement was removed.
|
| 67 |
+
|
| 68 |
+
## Surface-cue controls
|
| 69 |
+
|
| 70 |
+
Exception answers are balanced between "raises" and "returns" overall (1,752 raise / 1,794 return), within each function, and within
|
| 71 |
+
groups defined by whether the code contains a `raise` statement and whether the input contains an empty, zero or negative
|
| 72 |
+
value. Call-count, iteration-count and return-type answers are capped per value. A classifier that sees only the question
|
| 73 |
+
text, or only the call, was trained with cross-validation grouped by code unit; documents it could answer from the call
|
| 74 |
+
text alone were removed for the exception and return-type kinds until its gain over the majority answer was below 4
|
| 75 |
+
points. On the released documents the largest gain of any question-only or call-only classifier over the majority answer is 4.8 points.
|
| 76 |
+
|
| 77 |
+
## Counts
|
| 78 |
+
|
| 79 |
+
| kind | docs | sw32k tokens |
|
| 80 |
+
|---|---:|---:|
|
| 81 |
+
| final_output | 8,173 | 2,476,007 |
|
| 82 |
+
| var_at_line | 5,154 | 1,860,750 |
|
| 83 |
+
| loop_state | 4,358 | 1,530,879 |
|
| 84 |
+
| exception | 3,546 | 1,259,301 |
|
| 85 |
+
| return_type | 1,621 | 404,657 |
|
| 86 |
+
| call_count | 1,290 | 578,933 |
|
| 87 |
+
| **total** | **24,142** | **8,110,527** |
|
| 88 |
+
|
| 89 |
+
| code pool | docs | share |
|
| 90 |
+
|---|---:|---:|
|
| 91 |
+
| OpenLemma verified code modules | 9,532 | 39.5% |
|
| 92 |
+
| synthetic code library modules | 8,901 | 36.9% |
|
| 93 |
+
| R3 verified functions | 5,709 | 23.6% |
|
| 94 |
+
|
| 95 |
+
3,914 code units, 5,354 function units; no topic or skill above 4.4% of documents. Presentations: qa 7,352, chat 7,113, plain 9,677.
|
| 96 |
+
|
| 97 |
+
## Review
|
| 98 |
+
|
| 99 |
+
Before release, every document was re-executed by independent drivers at six hash seeds, and any function unit with a
|
| 100 |
+
disagreement was removed (about 0.07% of executions disagreed, all from unordered-set iteration or helper call paths). We
|
| 101 |
+
traced 34 documents by hand (all correct) and re-ran 12 encoded documents in the sandbox (all matching); the cosmetic issues
|
| 102 |
+
found (a duplicated word in one loop template, a doubled answer label, sign artifacts such as `-0` in edited inputs, and
|
| 103 |
+
local variable annotations that revealed return types) were fixed before encoding. An independent blind review of 60
|
| 104 |
+
documents, 30 of them re-executed, found 1 ambiguous call-count question about a generator function (a generator's body is
|
| 105 |
+
re-entered on every resume). As a result, all call-count questions about generator functions were removed, together with
|
| 106 |
+
line-state questions whose answer only repeats an unchanged argument; the remaining notes were minor style points. The texts
|
| 107 |
+
were screened for overlap with ALEA's evaluation sets and held-out probes, and documents sharing a 13-word span with the
|
| 108 |
+
OpenLemma held-out evaluation code were removed.
|
data/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8de19cee53cc0b273bc53e3abc941e4e0dfa7d88a83ea6d5bdb8c0292166b5c0
|
| 3 |
+
size 8865006
|