# Git History Is a Pangenome: Repetition in Code Training Corpora and What Deduplication Removes, Keeps and Misses

Saurabh Chopra · arXiv · 2026-11-20

- **Problem** Training sets now include repository history, so one file can enter a corpus as many near-identical versions, and the deduplicators built for snapshots were never measured on that history.
- **Method** Measures repetition, deduplicator output, kept versions and benchmark-fix recurrence across a pre-registered random sample, a set of mature repositories and the SWE-bench repositories, using BigCode's released script and two custom instruments.
- **Results** A typical repository history holds 19× the current code, and BigCode's script at Jaccard 0.7 reduces that to 2.0×. Keep-newest retains the current version of 94% of mature-set files, against 40% under the script's default rule.

![Figure 1: Bytes relative to the current code (HEAD text) along the pipeline, for the random sample and the mature set: the history corpus, what survives exact…](https://refivu.com/papers/e41b20d4-9277-4a45-937e-f9458ded119e/figures/figure-a94786e97fdf4285fbf975fc5eb14b9e.png?thumb=512)

**Fig. 1** . Bytes relative to the current code (HEAD text) along the pipeline, for the random sample and the mature set: the history corpus, what survives exact and near-duplicate deduplication at three thresholds, the keep-newest alternative, and git’s own delta-compressed storage of every version. The mature set’s history and git-storage bars are medians over all 25 repositories; its near-deduplication and keep-newest bars come from the 10 repositories that could be deduplicated across all versions (Section IX).

[Original paper](https://arxiv.org/abs/2611.27154v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Saurabh Chopra · Git History Is a Pangenome: Repetition in Code Training Corpora and What Deduplication Removes, Keeps and Misses · Original paper figure · Extracted the figure area from page 5 of the original PDF.

## Why one file fills a training corpus many times

Code models were trained for years on one snapshot per repository, so a file such as utils.py entered a corpus once.

Exact deduplication cannot see these copies, because each version has its own hash. Commit-level deduplication compares the change itself, and each of the edits to the file is a different change. Similarity-based deduplication with MinHash and locality-sensitive hashing (LSH) would group these versions, but large pipelines run it on the snapshot, comparing each current file with files from other repositories.

That leaves two open questions: which version survives the grouping, and whether a benchmark fix sitting in an older version survives it too.

The authors separate three kinds of code corpus, since the findings bear on each in a different way. Snapshot corpora keep one version of each repository, full-file history corpora treat every version as a training document charged on the whole file, and edit corpora train on the change while keeping intermediate versions. Benchmark fixes are to be kept out of all three kinds.

## Populations and what each instrument counts

The mature set holds 25 repositories with 613,849 non-merge commits between them. The SWE-bench repositories contribute 2,294 test instances, of which 2,229 have a gold patch that applies cleanly to its base commit.

The repeat counter sums the sizes of distinct versions per path and weights versions per path by the size of the latest version, so a version recommitted unchanged counts once. The script keeps the member of a group that came first in its input, and the authors fed it versions sorted by hash.

The byte attributor builds a suffix array over the reference text and the new text and parses the new text into relative Lempel–Ziv factors at a factor length L, labelling each byte as copied from the same file, copied from other files, repeated earlier in the new text, or new. The overlap test marks a later version as a carrier of a fix when at least 90% of the fix's substantive added lines, those with 12 or more non-space characters, appear verbatim in it.

As a baseline, git's delta-compressed storage of every version reachable from HEAD is divided by the bytes of HEAD text.

## How much a history repeats and what deduplication keeps

In the random sample, every version of every file adds up to a population-weighted median of 19× the current code, with a 95% CI of 17–23. Across the 25 mature repositories the same corpus is 89× the current code, with a range of 18–175×. Counting only files still present at HEAD gives 13× in the sample and 53× in the mature set.

Running the script across versions at the default Jaccard threshold of 0.7 keeps 11% of the sample's history bytes and 2% of the mature set's. Raising the threshold to 0.85 leaves 3.3× in the random sample and 3.7× in the mature set, and 0.9 leaves 4.4× and 5.8×.

The authors' own implementation gives 3.1× (CI 2.7–3.4) on the sample, above the range their addendum anticipated, and they treat it as an upper bound because the released script is what pipelines run. In the 10-repository mature subset, the median source file falls from 44 versions to 2 survivors at 0.7 and to 7–8 at 0.9.

Git's delta-compressed storage holds every version at a median 2.6× the current code in the sample and 4.7× in the mature set.

## How much new content a single commit adds

In the mature set, 1.9% of bytes are new and 95.8% already occur.

Most of the copied content comes from the same file: 77% of the sample's post-image bytes, pooled over 80,225 modifying commits, were already in the previous version of that file. In the mature set the same share is 93% pooled, and 95% for the median repository.

For edit corpora, a typical training example is mostly text that is repeated unchanged, so a model charged loss on the whole file spends much of its compute on copying. The authors measured the share of new bytes but not the effect on model quality.

## Which version the deduplicator keeps

Its cost is 2.1× the current code in the random sample against 2.0× for the default rule, and 2.2× in the mature set against 2.0×. It needs only a commit date per version, and it adds 0.1–0.2× the current code in extra bytes.

Without training any model, the authors argue that a survivor chosen without regard to time can predate a fix, since the fixes benchmarks use spread into later versions.

Run locally on a 1.28 GB snapshot corpus of 31 repositories, its hashing removed 15.6% of bytes against 16.5% for the local script.

## Why deduplication leaves benchmark fixes in place

Within a year of the fix the median is 8, and repository medians run from 10 for Django and Astropy to 44 for Matplotlib.

Django, SymPy, xarray and Flask all-refs counts are lower bounds, since their clones expose only four remote branches.

Deduplication keeps one version of each group and so never removes every copy, but whether the survivor carries the fix depends on the keep rule. Under keep-newest, a group containing fixed versions keeps its newest member, which still holds the fix unless later edits rewrote the fixed lines; under the default rule a group mixing pre-fix and post-fix versions may keep a pre-fix one.

Run before deduplication, the filter deletes every fixed version and keep-newest keeps the newest unfixed one, which leaves a stale state. Run after deduplication, the filter scans about 2× HEAD instead of 19–89×, but it may leave only older, dissimilar versions of a fixed file.

## Rules for teams that train on history

The pass costs compute at corpus scale, but the authors note it is one the pipeline already knows how to run.

For edit corpora, keep every version and spend training on the change rather than on the rest of the file. Computing loss only on changed lines stops the model being taught to copy, but the rest is still read, so the authors cite StarCoder's window around each change as the alternative.

Every pipeline should also keep a count of versions per file, using one pass over git log with the raw output and version sizes. The first three rules follow one observation applied three times: the deduplicator treats each version as a separate document, so the surplus versions are removed, the surviving version is chosen by date, and the benchmark versions are removed.

## Limitations

The Stack v2 Spark job was not run end to end; only its hashing was run, on a local corpus.

The random sample excludes repositories under 200 commits, and the corpus multiple rises with commit count, so the excluded tail is likely lower. RQ4 concerns one benchmark and its 12 repositories, all Python.

## Paper info

- **Authors**: Saurabh Chopra
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-20
- **Added**: 2026-11-23
- **Updated**: 2026-11-20
- **Version**: v1
- **arXiv**: 2611.27154
- **Category**: cs.SE · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.27154v1) · [PDF ↗](https://arxiv.org/pdf/2611.27154v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Code models are increasingly trained on the full history of software repositories, every version of every file, rather than on a single snapshot. The tools that deduplicate training data were built for snapshots, and what they do to a history has not been measured. We measured it on a pre-registered random sample of 306 public repositories, 25 mature projects, and the 12 repositories behind the SWE-bench benchmark. A history is mostly repetition: in the vocabulary of text indexing, a pangenome, one text in many near-identical variants. The history of a typical repository holds the equivalent of 19 copies of its current code, and a mature repository holds 89. The reason is that each edit changes a few lines and leaves the rest of the file in place: nine tokens in ten of a changed file already existed before the change. Exact-match deduplication removes none of these copies, since no two versions are identical. Large training pipelines already deduplicate their snapshots by grouping near-identical files and keeping one. Applied across versions, the same step brings the repetition down to about two copies. But two problems remain. The deduplicator keeps one version of each file, and in widely used implementations, including the one we measured, the rule for choosing that version ignores dates, so for half of all files the version kept for training is an old one. Sorting versions newest first before deduplicating fixes the problem at almost no cost. The second problem is benchmark answers. Benchmarks such as SWE-bench test a model on real bug fixes, and a merged fix survives in a median of 18 later versions of the files it changed. Therefore, removing benchmark fixes needs a separate step that checks every version. We turn the measurements into a short set of rules for teams that train on code history, and release the instruments and frozen outputs.

## Quote from the paper

Saurabh Chopra (2026). Git History Is a Pangenome: Repetition in Code Training Corpora and What Deduplication Removes, Keeps and Misses. arXiv:2611.27154v1. https://arxiv.org/abs/2611.27154v1

**BibTeX**

```
@misc{chopra2026history,
  title = {{Git History Is a Pangenome: Repetition in Code Training Corpora and What Deduplication Removes, Keeps and Misses}},
  author = {Saurabh Chopra},
  year = {2026},
  eprint = {2611.27154},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.27154v1}
}
```

## Other paper commentary

- [Stability Bands for Feature Attribution: The Core, the Nucleolus and the Bargaining Set of Explained-Variance Games](https://refivu.com/en/papers/ed098127-e14a-4e36-99fd-a392e52f9224-stability-bands-for-feature-attribution-the-core-the.md)
- [Auditing Learned Dynamics in Weather Models](https://refivu.com/en/papers/7aceaa3b-5a74-4803-87bb-b10902d4883e-auditing-learned-dynamics-in-weather-models.md)
- [Equal Steps, Unequal Curvature: Where Muon's Update Goes Wrong](https://refivu.com/en/papers/fb6483b8-4d92-41c0-9d58-f42a67ef93b2-equal-steps-unequal-curvature-where-muon-s-update.md)
- [The Limits of Closed-Form Couplings for Few-Step Generation](https://refivu.com/en/papers/254fde74-7780-45e4-b340-aabe17435e8a-the-limits-of-closed-form-couplings-for-few.md)
- [Bounded-Order Non-Identifiability in Latent Structure Block Models: The Fiber in Closed Form](https://refivu.com/en/papers/6de500e1-e5ca-43be-ace9-8dbd37ea685c-bounded-order-non-identifiability-in-latent-structure-block.md)
- [Higher-Scoring Coding Models Did Not Get More Work Done](https://refivu.com/en/papers/6a4ee9be-efbe-4d03-a7f4-c3f4d8edf535-higher-scoring-coding-models-did-not-get-more.md)
- [Blind Spots Travel, Knowledge Stays Home: What RL Inherits from an LLM Judge](https://refivu.com/en/papers/15195618-95e7-4506-97eb-7e05e703dcd5-blind-spots-travel-knowledge-stays-home-what-rl.md)
- [Moving Generality from Model to Modeler: LLM Agents for PHM on a Deployment-Style Benchmark](https://refivu.com/en/papers/fab81869-0120-4066-88ea-3e5576a53c4d-moving-generality-from-model-to-modeler-llm-agents.md)
- [Reject and Report: Forgery-Evident Undetectable Watermarks for Generative Image Models](https://refivu.com/en/papers/fda73fc0-8e34-4feb-908f-a96954d340bd-reject-and-report-forgery-evident-undetectable-watermarks.md)
- [Old-School Planners Drive (Sometimes) Better Than Learned Ones](https://refivu.com/en/papers/86d15622-9cd7-4b0d-a676-7055e1f62255-old-school-planners-drive-sometimes-better-than-learned.md)
- [Calibrated Decision Rewards: Training Language Models with a Judge That Knows How Sure It Is](https://refivu.com/en/papers/1251eed1-b95d-4ab6-9776-f4df7659a2e0-calibrated-decision-rewards-training-language-models-with-a.md)
- [Living off the Local Model: Abusing Browser-Embedded Language Models for Post-Exploitation](https://refivu.com/en/papers/cc11723b-a01f-4ed7-af46-3a3fa7856062-living-off-the-local-model-abusing-browser-embedded.md)

## Terms in this paper

- [decontamination](https://refivu.com/en/terms/b1a3383896c3-decontamination)
- [StarCoder](https://refivu.com/en/terms/ec09b5c02abe-starcoder)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/e41b20d4-9277-4a45-937e-f9458ded119e-git-history-is-a-pangenome-repetition-in-code)
