Group split identity audit - Leviathan Systems
Original offline utility. Python 3.10+ standard library only. Version 1.0.

Run either fictional GV-272 comparison:
  python audit_group_splits.py gv272-plan-r.csv
  python audit_group_splits.py gv272-plan-g.csv
Run the included tests:
  python -m unittest -v test_group_splits.py

The JSON result goes to stdout. This program makes no network requests, writes
no files, fits no model and installs no packages. It can be used offline with
your own CSV. Keep sensitive record/group identifiers on your own computer.

INPUT CONTRACT
UTF-8 CSV (optional BOM), exactly this header and order:
  record_id,group_id,split
Use train, validation or test for split. IDs are exact case-sensitive strings.
Leading/trailing whitespace, blank fields, ASCII control characters and fields
over 256 characters are rejected rather than silently normalized. One record ID
must map to the same group ID everywhere. Repeated occurrences with that same
mapping are allowed and counted separately from distinct IDs. Limit:100,000
data rows and10,000,000input bytes. Files with ambiguous mappings are rejected.

OUTPUT
Each split has occurrence, distinct-record and distinct-group counts. Each
split pair has the exact shared record IDs and group IDs and their counts.
both_splits_present=false means at least one side has no supplied rows; an empty
intersection in that case is not evidence of a completed held-out evaluation.

GV-272 EXAMPLES
The examples reproduce the explicitly fictional device/record identities in
the companion article, with sixteen distinct records A1..D4. Plan R trains on
records1..3 from every device and validates on record4 from every device. Plan G
trains on every A/B/C record and validates on all D records. Both have12training
and4validation occurrences, no shared record IDs. R shares4device group labels;
G shares0. Neither provides a trained model, score or adequate population claim.
The suffixes do not imply chronological ordering or a recommended split ratio.

LIMITS
This is supplied-label identity arithmetic, not an automatic data-leakage or
statistical-independence certificate. Unrecorded relationships can remain.
Different labels can refer to the same real entity. It does not infer those
identities, inspect features, establish representativeness, assess group sizes,
evaluate learned preprocessing isolation or measure model quality. The example
does not configure or operate AI infrastructure or establish a software service.

Companion explanation:
https://www.leviathansystems.co/articles/training-validation-group-overlap-and-data-leakage
Conceptual primary sources, version1.7.2 verified October20,2026:
https://scikit-learn.org/1.7/modules/cross_validation.html#cross-validation-iterators-for-grouped-data
https://scikit-learn.org/1.7/common_pitfalls.html#data-leakage
These sources explain the evaluation distinction; no source code is copied.
