WideChaos's picture
Publish whole-group split planner with audit examples
51269bb verified
|
Raw History Blame Contribute Delete
5.11 kB
metadata
license: apache-2.0
language:
  - en
  - zh
pretty_name: Split Boundary Audit
size_categories:
  - n<1K
configs:
  - config_name: synthetic_split_records
    data_files:
      - split: test
        path: example.jsonl

Split Boundary Audit

Check a declared split inventory before using it to support a model-evaluation claim. The CLI identifies repeated ids, caller-defined groups spanning splits, exact text shared across splits, and a separate list of normalized-text candidates for human review.

It reads records and writes a report. It does not train a model, infer exposure to training data, resplit a dataset, delete records or decide that two similar prompts mean the same thing.

Reproduce the example

Python standard library only:

python -m unittest test_splits -v
python split_audit.py example.jsonl --output fresh-report

The six author-constructed records deliberately contain one cross-split group, one exact text overlap and one whitespace-normalized candidate. The CLI writes a FAIL report and exits 1 for this example; that is the expected result. Choose a new output directory. Existing directories are never overwritten and source data is unchanged.

The output files are report.json and flags.csv. Exit 2 means invalid input or an output error. Exit 0 means the valid input produced either CLEAR or REVIEW; inspect the report status to distinguish them.

Three different kinds of evidence

Check Interpretation under this protocol
Duplicate id A record identity appears more than once, even within a split.
Group overlap A declared indivisible unit appears in multiple splits.
Exact text overlap UTF-8 text bytes hash identically across splits.
Normalized candidate NFC plus collapsed whitespace agrees across splits, but exact text hashes differ. Requires review.

A group must represent a unit the caller intends to keep together, such as a document or a template family. A demographic cohort or broad class label is a different concept and should not be used as this grouping field. null groups are counted as unknown rather than treated as distinct independent units.

Normalization is warning-only. Whitespace and Unicode spelling can carry meaning, especially in code and structured text. The tool does not casefold text, assert semantic equivalence or automatically remove candidates. Exact overlap may also be intentional under another evaluation protocol; the tool flags it under the declared disjointness contract rather than proving accidental leakage.

Input

One UTF-8 JSON object per LF-delimited line, with exactly four keys:

{"id":"case-1","split":"train","group":"document-a","text":"Synthetic prompt"}

id and split are nonempty strings of at most 128 characters. group is a nonempty string up to 128 characters or null. text is a nonempty string up to 16,384 characters. Limits are 2 MiB and 10,000 records. Blank lines are counted and ignored. CRLF records are accepted. A literal U+2028 character inside a JSON string stays part of that record; it is not treated as a record separator.

Duplicate JSON object keys, extra fields, invalid Unicode, malformed JSONL and non-finite constants are rejected. No URLs or file paths in records are followed. Only the explicitly selected local JSONL file is read. No network, keys, dependencies or model calls are required.

Reports and limits

The report includes row counts by split, group coverage, missing-group count, explicit issue memberships and normalization candidates. It does not echo the text field; exact/normalized text is represented by SHA-256 hashes. This is not anonymization: identifiers and group names are retained, and predictable text hashes can be guessed. Use the synthetic example for public sharing.

FAIL means a duplicate-id, group or exact-text issue was found. REVIEW means only normalization candidates were found. CLEAR means these checks found no flag; it does not prove a dataset is free of all contamination, paraphrases, shared upstream sources or hidden training exposure. Empty input is CLEAR with undefined group coverage.

Eight local test groups cover the frozen six-record example, reversed input order, same-split controls, unknown groups, normalization-only status, Unicode variants, malformed records, spreadsheet-safe CSV strings, LF/U+2028 handling and CLI overwrite protection. Recorded local evidence used CPython 3.14.7 on macOS. Other runtimes and large external datasets were not tested. The test corpus is synthetic, not a measured model benchmark.

Apache-2.0; copyright 2026 Renchao Wu. MANIFEST.json hashes all release files except itself.

中文说明

分别检查重复ID、跨拆分的同组记录、跨拆分完全相同文本,以及需要人工确认的规范化文本候选。group必须是调用者约定不可拆开的文档或模板族等单位;缺失group不能自动当成独立样本。规范化相同只标待复核,不自动认定语义相同或删除记录。CLEAR仅表示本工具未发现这些标记,不证明不存在其他形式的数据污染。