Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- code
|
| 9 |
+
- synthetic
|
| 10 |
+
- code-review
|
| 11 |
+
- static-analysis
|
| 12 |
+
pretty_name: Free Synthetic Code Diffs (100M)
|
| 13 |
+
size_categories:
|
| 14 |
+
- 10M<n<100M
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Free Synthetic Code Diffs (100M)
|
| 18 |
+
|
| 19 |
+
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.
|
| 20 |
+
|
| 21 |
+
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.
|
| 22 |
+
|
| 23 |
+
## Schema
|
| 24 |
+
|
| 25 |
+
| Column | Type | Description |
|
| 26 |
+
|---|---|---|
|
| 27 |
+
| diff_id | string | Unique identifier for the diff |
|
| 28 |
+
| change_category | string | One of 7 categories (see below) |
|
| 29 |
+
| language | string | Source language of the changed file |
|
| 30 |
+
| file_path | string | Fabricated file path for the change |
|
| 31 |
+
| commit_message | string | Synthetic commit message |
|
| 32 |
+
| diff_text | string | The unified diff text |
|
| 33 |
+
| sql_pattern | string | SQL pattern present in the diff, if any |
|
| 34 |
+
| is_destructive_ground_truth | bool | Ground-truth label — whether the change is actually destructive |
|
| 35 |
+
|
| 36 |
+
### Change categories
|
| 37 |
+
|
| 38 |
+
- `raw_sql_destructive` (15%) — literal destructive SQL (DROP/DELETE/TRUNCATE)
|
| 39 |
+
- `raw_sql_safe` (15%) — literal SQL that looks risky but isn't destructive
|
| 40 |
+
- `orm_schema_change` (15%) — destructive change made through an ORM migration, no raw SQL to match on
|
| 41 |
+
- `obfuscated_destructive` (10%) — destructive SQL disguised via casing/whitespace/newline variation
|
| 42 |
+
- `mentioned_in_comment` (10%) — destructive-looking SQL sitting in a comment, docstring, or log string — not executed
|
| 43 |
+
- `test_suite_cleanup` (10%) — a DROP/DELETE inside test setup/teardown — not a production risk
|
| 44 |
+
- `general_code_change` (25%) — unrelated code changes, for class balance
|
| 45 |
+
|
| 46 |
+
`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.
|
| 47 |
+
|
| 48 |
+
## Format
|
| 49 |
+
|
| 50 |
+
Single Parquet file, Snappy compression, ~2.9 GB, 100,000,000 rows.
|
| 51 |
+
|
| 52 |
+
## Quick start
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
import pandas as pd
|
| 56 |
+
df = pd.read_parquet("synthetic_code_diffs_100M.parquet")
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
from datasets import load_dataset
|
| 61 |
+
ds = load_dataset("ziadatalabs/FreeSyntheticCodeDiffs100M")
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
import duckdb
|
| 66 |
+
con = duckdb.connect()
|
| 67 |
+
con.sql("SELECT * FROM 'synthetic_code_diffs_100M.parquet' LIMIT 10").show()
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Notes
|
| 71 |
+
|
| 72 |
+
- All diffs, file paths, and commit messages are fabricated — no real repository content.
|
| 73 |
+
- Categories are stratified as listed above; use `change_category` to filter or rebalance for your task.
|
| 74 |
+
- `is_destructive_ground_truth` is the label to train/evaluate against — don't infer it purely from `sql_pattern`.
|
| 75 |
+
|
| 76 |
+
## License & Usage
|
| 77 |
+
|
| 78 |
+
Released under CC BY-NC 4.0 — free for personal, research, and educational use, with attribution. Not licensed for commercial use.
|
| 79 |
+
|
| 80 |
+
No real people, repositories, or organizations are represented in this data. It is entirely synthetic.
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
Created by Zia Data Labs. Questions or feedback: zia.data.team@protonmail.com
|