File size: 3,681 Bytes
1d38d08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-nc-4.0
task_categories:
- text-classification
language:
- en
tags:
- code
- synthetic
- code-review
- static-analysis
pretty_name: Free Synthetic Code Diffs (100M)
size_categories:
- 10M<n<100M
---

# Free Synthetic Code Diffs (100M)

A 100-million-row synthetic dataset of code diffs labeled for destructive-change detection — the kind of change that silently drops data, tables, or columns in a migration or deploy. Every diff in this dataset is fabricated; none of it comes from real repositories, so there's no copyright or licensing entanglement.

Detecting a truly destructive change is harder than it looks. A plain regex for `DROP TABLE` or `DELETE FROM` catches the obvious cases and misses (or wrongly flags) a long tail of edge cases: destructive intent expressed through an ORM instead of raw SQL, casing or whitespace tricks that dodge a literal pattern match, a dangerous string sitting harmlessly inside a comment or log line, or a `DROP` that's actually just test-suite cleanup. This dataset is built specifically to stress-test detectors against that edge-case distribution, not just reward pattern recall.

## Schema

| Column | Type | Description |
|---|---|---|
| diff_id | string | Unique identifier for the diff |
| change_category | string | One of 7 categories (see below) |
| language | string | Source language of the changed file |
| file_path | string | Fabricated file path for the change |
| commit_message | string | Synthetic commit message |
| diff_text | string | The unified diff text |
| sql_pattern | string | SQL pattern present in the diff, if any |
| is_destructive_ground_truth | bool | Ground-truth label — whether the change is actually destructive |

### Change categories

- `raw_sql_destructive` (15%) — literal destructive SQL (DROP/DELETE/TRUNCATE)
- `raw_sql_safe` (15%) — literal SQL that looks risky but isn't destructive
- `orm_schema_change` (15%) — destructive change made through an ORM migration, no raw SQL to match on
- `obfuscated_destructive` (10%) — destructive SQL disguised via casing/whitespace/newline variation
- `mentioned_in_comment` (10%) — destructive-looking SQL sitting in a comment, docstring, or log string — not executed
- `test_suite_cleanup` (10%) — a DROP/DELETE inside test setup/teardown — not a production risk
- `general_code_change` (25%) — unrelated code changes, for class balance

`is_destructive_ground_truth` is set independently of whether a literal SQL keyword is present, so the dataset actually tests classification quality rather than keyword matching.

## Format

Single Parquet file, Snappy compression, ~2.9 GB, 100,000,000 rows.

## Quick start

```python
import pandas as pd
df = pd.read_parquet("synthetic_code_diffs_100M.parquet")
```

```python
from datasets import load_dataset
ds = load_dataset("ziadatalabs/FreeSyntheticCodeDiffs100M")
```

```python
import duckdb
con = duckdb.connect()
con.sql("SELECT * FROM 'synthetic_code_diffs_100M.parquet' LIMIT 10").show()
```

## Notes

- All diffs, file paths, and commit messages are fabricated — no real repository content.
- Categories are stratified as listed above; use `change_category` to filter or rebalance for your task.
- `is_destructive_ground_truth` is the label to train/evaluate against — don't infer it purely from `sql_pattern`.

## License & Usage

Released under CC BY-NC 4.0 — free for personal, research, and educational use, with attribution. Not licensed for commercial use.

No real people, repositories, or organizations are represented in this data. It is entirely synthetic.

---

Created by Zia Data Labs. Questions or feedback: zia.data.team@protonmail.com