Datasets:
File size: 5,667 Bytes
1c01ed6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | ---
license: apache-2.0
language:
- en
- fi
pretty_name: Kreatix Code Debug
size_categories:
- 1K<n<10K
task_categories:
- text-generation
tags:
- code
- python
- debugging
- bug-fixing
- reasoning
- finnish
- synthetic
- procedurally-generated
- verified
configs:
- config_name: default
data_files:
- split: train
path: data/train.jsonl
- split: test
path: data/test.jsonl
---
# Kreatix Code Debug
**1,364 debugging conversations in English and Finnish. Each one shows a Python solution with one real bug. The
reply finds the line, explains the cause, fixes it, and shows the input that failed. Every bug was checked: the
buggy code really fails, and the fix restores a solution verified against an independent brute-force solver.**
The user asks in one of three ways:
| Mode | The user gives | The reply starts from |
|---|---|---|
| failing call | a call that returns the wrong value | the expected and actual values |
| traceback | the real traceback from running the buggy file | the line that raised the error |
| no hint | only the code and the task | finding a failing input first, then the bug |
Bugs are the kind people actually make: a flipped comparison (`<` vs `<=`), `+` and `-` swapped, `and` and `or`
swapped, `min` and `max` swapped, `bisect_left` and `bisect_right` swapped, an off-by-one in `range()`, index `0`
and `-1` swapped, a wrong starting value, a dropped minus sign, or a statement missing from a loop.
Made by [KreatixLabs](https://huggingface.co/KreatixLabs). Every row is built by a program: no language model wrote
any text or code in this dataset.

## What it looks like
**User**
````text
I get an exception for `rooms_needed([[0, 1]])`:
```
Traceback (most recent call last):
File "solution.py", line 14, in <module>
rooms_needed([[0, 1]])
~~~~~~~~~~~~^^^^^^^^^^
File "solution.py", line 7, in rooms_needed
if ends or ends[0] <= start:
~~~~^^^
IndexError: list index out of range
```
```python
import heapq
def rooms_needed(meetings: list[list[int]]) -> int:
ends = []
for start, end in sorted(meetings):
if ends or ends[0] <= start:
heapq.heapreplace(ends, end)
else:
heapq.heappush(ends, end)
return len(ends)
```
````
**Assistant**
````text
The crash comes from line 7: on this input the bug drives the code into an invalid operation (`IndexError`).
**Bug:** line 7
```python
if ends or ends[0] <= start:
```
The two conditions are joined with `or`, but the logic needs `and` (both conditions must hold).
**Fix:**
```python
if ends and ends[0] <= start:
```
**Corrected code:**
```python
import heapq
def rooms_needed(meetings: list[list[int]]) -> int:
ends = []
for start, end in sorted(meetings):
if ends and ends[0] <= start:
heapq.heapreplace(ends, end)
else:
heapq.heappush(ends, end)
return len(ends)
```
With the fix, `rooms_needed([[0, 1]])` returns `1` instead of raising an error, and the code gives the expected result on all 18 test inputs, including the edge cases.
````
`meta`: `{"kind": "code.debug.bool_flip.meeting_rooms", "lang": "en", "generator": "kreatix-code-debug", "version": "0.1.0", "mode": "traceback", "bug_line": 7, "entry": "rooms_needed", "checked_by": "buggy code fails on [[[0, 1]]]...; fix == verified reference (oracle-checked on 18 inputs)", "problem_id": "a177e8982e5d", "program_id": "0788d5ac5157"}`
## How it was checked
1. The starting solution comes from [Kreatix Code Hard](https://huggingface.co/datasets/KreatixLabs/kreatix-code-hard):
it agrees with an independent brute-force solver on every test input and passes a large-input time limit.
2. One bug is injected by editing an exact span of the source found through Python's AST, so comments and layout
are untouched and the diff is a single line.
3. The buggy program is run on all of the problem's inputs. It is kept only if it compiles and fails at least one
of them; the smallest failing input is the one shown.
4. Tracebacks are real output from running the buggy file (file name shown as `solution.py`).
5. The fix shown restores the verified solution exactly, so "with the fix, all N test inputs pass" is true.
`meta.bug_line` is the line of the bug in the code the user shows.
## Size and repetition
| Split | Rows | en | fi | Distinct buggy programs |
|---|---|---|---|---|
| train | 1,196 | 809 | 387 | 642 |
| test | 168 | 116 | 52 | 84 |
About 0.8M tokens in total.
Each buggy program appears at most twice (with different request styles or failing inputs), and each problem family
at most 80 times. `meta.program_id` identifies the buggy program and `meta.problem_id` the solution it came from.
**Test split:** bugs in five families that never appear in train (two-colouring, decode ways, next greater element,
trapped water / container, running median), so the test measures debugging code the model has not seen.
`stats.json` has the counts per bug type and problem family; `samples.md` shows examples in full.
## Limitations
- **One bug per program.** Real code often has several interacting bugs; this dataset teaches the core loop:
reproduce, localise, explain, fix, re-check.
- **Explanations** come from a template per bug type, filled with the actual line, values and error.
- **Python only.** The Finnish text is awaiting review by native speakers.
## License
Apache-2.0.
|