ziadatalabs's picture
Upload README.md with huggingface_hub
1d38d08 verified
|
Raw
History Blame Contribute Delete
3.68 kB
metadata
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

import pandas as pd
df = pd.read_parquet("synthetic_code_diffs_100M.parquet")
from datasets import load_dataset
ds = load_dataset("ziadatalabs/FreeSyntheticCodeDiffs100M")
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