splitsafe
Check your audio train / validation / test folders for leakage before you train.
🚀 Interactive 1-Click Demo: Run the Interactive Google Colab Quickstart to test SplitSafe's data leakage detection live in your browser.
Core Architectural Finding:
SplitSafe brings established spectral landmark fingerprinting techniques into an integrated, partition-aware audio ML dataset auditing workflow—guaranteeing zero evaluation contamination and speaker boundary integrity before model training.
If the same recording (or a re-encoded, resampled, louder, trimmed or clipped copy of it) sits on both sides of a split, your test score is measured on something the model has already seen, so it looks better than it really is. splitsafe finds those files, and also shows which speakers appear in more than one split.
It is small, runs on your own computer, never changes your files, and uses classic signal processing (spectral-peak fingerprints). There is no neural network and no model download.
Install
pip install splitsafe
(Python 3.10 or newer.)
Use
splitsafe check train/ val/ test/
Each folder is one split (subfolders are included). Example output from a small synthetic demo (two recordings were copied into the test folder, one resampled, one cut into a short clip):
splitsafe verdict: FAIL
Splits: test (4 files), train (5 files)
LEAKAGE: 2 file pair(s) appear on both sides of a split (4 files involved).
[same audio (re-encoded / trimmed / re-leveled)] test/leaked_copy.wav <-> train/spk9_a.wav (aligned matches: 925, overlap: 100%)
[same audio (re-encoded / trimmed / re-leveled)] test/leaked_clip.flac <-> train/spk1_a.wav (aligned matches: 93, overlap: 29%)
SPEAKERS in more than one split: 1
spk0: train=1, test=1
The exit code is 0 for PASS or WARN, 1 for FAIL, 2 for a usage error, so it can run in CI.
Speakers
Speaker overlap is only checked if you tell it who is who:
splitsafe check train val test --speaker-regex '^[^/]+/(spk[0-9]+)_' # one capture group = the speaker id
splitsafe check --manifest data.csv # columns: file,split[,speaker]
Shared speakers give a WARN (for speech recognition this is often acceptable). Add --strict-speakers to make it a FAIL, which is usually right for speaker ID or voice cloning.
Options
| Option | What it does |
|---|---|
--names a,b,c |
Split names (default: the folder names) |
--manifest file.csv |
Use a CSV with file,split[,speaker] instead of folders. --base DIR sets what the file paths are relative to |
--out DIR |
Write splitsafe_report.json, cross_split_duplicates.csv, splitsafe_report.txt, and splitsafe_report.html |
--html PATH |
Write interactive HTML listening report with side-by-side audio players |
--json |
Print JSON instead of text |
Use from Python
from pathlib import Path
from splitsafe import check_splits
from splitsafe.scan import items_from_folders
from splitsafe.report import to_text
res = check_splits(items_from_folders([Path("train"), Path("test")]))
print(res.verdict()) # "PASS", "WARN" or "FAIL"
for m in res.matches: # every leaked pair
print(m.a, m.b, m.kind, m.votes)
print(to_text(res))
What it checks
| Check | Finds |
|---|---|
| Exact copies | Byte-identical files in different splits |
| Same audio | The same recording after re-encoding (wav/flac), resampling, gain change, noise, trimming, or a short clip cut from a longer file |
| Shared speakers | Speakers (from your labels) that appear in more than one split |
Duplicates inside one split are not reported, because they are not leakage.
Real-Data Benchmark (LibriSpeech)
Validated on real human speech across LibriSpeech dev-clean (2,703 files) vs. test-clean (2,620 files) — 5,323 real .flac recordings (--min-votes 30, CPU runtime 55s):
- Baseline Clean Audit (False Alarms): 0 false positives (0 cross-split matches, 0 shared speakers, 0 skipped files).
- Adversarial Planted Leak Detection: 56 of 56 (100.0%) planted leaks detected across every distortion tested:
| Modification Planted | Planted | Found | Missed | Min Aligned Votes | Median Votes | Recall |
|---|---|---|---|---|---|---|
| Exact copy | 10 | 10 | 0 | 306 | 764 | 100% |
| Resampled (11.025 kHz) | 10 | 10 | 0 | 275 | 820 | 100% |
| Quieter (-12 dB gain) | 10 | 10 | 0 | 216 | 461 | 100% |
| Trimmed (front 20% cut) | 10 | 10 | 0 | 80 | 369 | 100% |
| Noisy (~20 dB SNR) | 10 | 10 | 0 | 217 | 735 | 100% |
| 3-second sub-clip | 6 | 6 | 0 | 76 | 214 | 100% |
Reproduce anytime via scripts/real_data_check.py (see docs/REAL_DATA_CHECK.md).
Limitations (please read)
- Tested on real speech and synthetic audio (21 automatic tests, run on Linux, macOS and Windows in CI). While benchmarked across 5,323 LibriSpeech speech recordings, dense multi-instrument music datasets or different recording lengths may benefit from tuning
--min-votesand checking a few reported pairs by listening. - A PASS is not a guarantee. Only the checks above are done. It cannot tell that two different recordings contain the same sentence, and it cannot find the same speaker without labels.
- Heavy changes can hide a copy: strong time-stretching, pitch-shifting, or very low-bitrate re-encoding may drop below the threshold.
- Files that cannot be fingerprinted (shorter than 1 second, silent, or unreadable) are listed under "NOT fully checked". Only exact byte copies are checked for them.
- Speaker embeddings (finding the same voice without labels) are planned for v0.2.0, not included in v0.1.x.
- The fingerprint idea (spectral peak pairs with time-offset voting) is a well-known technique. Chromaprint-based tools such as audiomatch compare whole files. splitsafe's contribution is packaging it for train/test checks, including partial and clipped copies, with a clear verdict.
How it works
Each file is turned into hashes of pairs of loud spectral peaks (frequency 1, frequency 2, time gap). Two files that share audio share many hashes at one consistent time offset. Random coincidences between different recordings do not line up in time, so counting aligned matches separates real copies from chance.
Development
pip install -e ".[dev]"
python -m pytest -q
Contributing
Bug reports with a small example are the most useful. If splitsafe flags two files that are not the same audio, or misses a copy, please open an issue with the numbers from the report.
License
MIT. Copyright (c) 2026 Boobalan Arjunan.
Metadata
Release files for splitsafe 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| splitsafe-0.1.1.tar.gz | 22.9 kB | Without provenance | Details for splitsafe-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| splitsafe-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for splitsafe-0.1.1-py3-none-any.whl |
Total release size: 41.2 kB
Release files / splitsafe-0.1.1.tar.gz
| Download URL | splitsafe-0.1.1.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bbeea04310855ec1c8c693ac92b7e9ba8f96649c2ce8ecfb39b2bb1e93b4612e
|
|
BLAKE2b-256 checksum How to use checksums |
dcbf51c5b94983817f18434be52771283efd1bfab0b103f9d4c863a33f96e277
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / splitsafe-0.1.1-py3-none-any.whl
| Download URL | splitsafe-0.1.1-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c4c3dd74b65844c4b62932a5c5929389ab154d09626b436cc29896a2afa3522
|
|
BLAKE2b-256 checksum How to use checksums |
87bbbaade8899113fe63a57c7e0e55fc45aefdb3f095f0c9892646c6b3fb0b5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for splitsafe 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.