File size: 4,782 Bytes
b055d8c 720595f b055d8c 720595f b055d8c 631c689 a7c8492 631c689 |
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 |
---
dataset_info:
features:
- name: repo
dtype: string
- name: commit
dtype: string
- name: path
dtype: string
- name: lang
dtype: string
- name: license
dtype: string
- name: message
dtype: string
- name: old_code
dtype: string
- name: new_code
dtype: string
- name: n_added
dtype: int64
- name: n_removed
dtype: int64
- name: n_hunks
dtype: int64
- name: change_kind
dtype: string
- name: udiff
dtype: string
- name: udiff-h
dtype: string
- name: udiff-l
dtype: string
- name: search-replace
dtype: string
splits:
- name: test
num_bytes: 5891980
num_examples: 1000
download_size: 2695508
dataset_size: 5891980
configs:
- config_name: default
data_files:
- split: test
path: data/test-*
---
# Diff-XYZ
This is a dataset for the paper: [Diff-XYZ: A Benchmark for Evaluating Diff Understanding](https://arxiv.org/abs/2510.12487).
Diff-XYZ contains 1,000 real-world code edits sampled and filtered from
the [CommitPackFT](https://huggingface.co/datasets/bigcode/commitpackft) dataset.
Each example provides three components: the original file contents (`old_code`), the modified contents (`new_code`), and
multiple diff representations (`udiff`, `udiff-h`, `udiff-l`, and `search-replace`).
These formats enable evaluation of LLM capabilities on three code editing tasks:
- **Apply**: Given old code and diff, generate new code
- **Anti-Apply**: Given new code and diff, generate old code
- **Diff-Generation**: Given old and new code, generate the diff
## How it's built
Examples were systematically filtered from CommitPackFT to ensure high quality:
- **Scope**: Single-file changes only, excluding binary files, vendor directories, and generated code
- **Quality**: Removed trivial changes (whitespace-only) and likely test files
- **Size**: Required 40+ lines in at least one version of the code (old or new); excluded very large files (1000+ lines)
- **Sampling**:
- Target 50/50 split between single-hunk and multi-hunk edits (hunks counted via `@@` markers in the unified diff).
- Within each hunk group, stratify by change size (lines added + removed) using the 40th/80th percentiles of that
group, targeting ≈40% small, 40% medium, 20% large.
- Cap examples to ≤5 per repository per language.
## Dataset Statistics
- **Total examples:** 1,000
- **Languages:** Python (200), JavaScript (200), Java (200), Kotlin (200), Rust (200)
**Hunks:**
- **1 hunk:** 500 (50.0%)
- **2+ hunks:** 500 (50.0%)
**Change size (added + removed), stratified within hunk groups:**
- **Small** (≤40th pct): 424 (42.4%)
- **Medium** (40th–80th): 388 (38.8%)
- **Large** (>80th): 188 (18.8%)
**Change type:**
- **Mixed** (additions + deletions): 815 (81.5%)
- **Add-only:** 163 (16.3%)
- **Delete-only:** 22 (2.2%)
**Repository diversity:** 891 unique repositories.
## Schema
| Field | Type | Description |
|------------------|--------|------------------------------------------------------------------------|
| `repo` | string | Repository identifier (e.g., "owner/name") |
| `commit` | string | Commit SHA that produced the change |
| `path` | string | File path relative to repo root |
| `lang` | string | One of: `python`, `javascript`, `java`, `kotlin`, `rust` |
| `license` | string | SPDX license identifier of the repo |
| `message` | string | Original commit message |
| `old_code` | string | Complete file contents before change |
| `new_code` | string | Complete file contents after change |
| `n_added` | int | # of `+` lines (excluding headers) |
| `n_removed` | int | # of `-` lines (excluding headers) |
| `n_hunks` | int | # of `@@` (hunk) sections |
| `change_kind` | string | `add_only`, `del_only`, or `mixed` |
| `udiff` | string | Standard unified diff (1-line context, numeric hunk headers) |
| `udiff-h` | string | Unified diff with relaxed hunk headers written as `@@ ... @@` |
| `udiff-l` | string | Unified diff with explicit line markers: `ADD`, `DEL`, and `CON` |
| `search-replace` | string | Search/replace representation: pairs of `SEARCH`/`REPLACE` edit blocks |
|