--- task_categories: - text-generation - code-generation - code-understanding tags: - diff-understanding - benchmark 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 |