Practical guides

How to verify that two model runs used the same dataset file

RedditLinkedInBlueskyXFacebookEmailText message
Copy link

A label changes from wind to rain while the filename, row count and byte count stay the same. Pin the original file’s SHA-256 digest and catch the change before comparing model scores.

By Backprop Bulletin.Comment on this guide Published 2026-12-01. Last checked 2026-11-30.

Prerequisites

Checked November 30, 2026 with Bash and Python 3.12.14. Use Python 3.11 or later for hashlib.file_digest. Run the blocks in order in a new, empty directory. The invented label files stay on your machine.

Worked example

  1. Suppose two sound classifiers predict labels for the same clips. If someone edits the answer key between runs, the scores can change even when the predictions are identical. Before the first run, freeze the exact label file your scorer will read. Record its full digest alongside the dataset revision, split name and run ID. Keep that record separately from the working copy.
  2. Create two copies of a tiny test split. In the second copy, clip 002 has been relabeled. Both files are named labels.csv and both contain two rows of labels.
  3. mkdir run-a run-b
    printf 'clip,label\n001,rain\n002,wind\n' > run-a/labels.csv
    printf 'clip,label\n001,rain\n002,rain\n' > run-b/labels.csv
  4. Save this checker. It reads the file in binary mode, prints a short fingerprint for inspection and compares all 64 hex characters. An exit status of 1 signals a mismatch.
  5. cat > check_split.py <<'PY'
    import hashlib
    import sys
    from pathlib import Path
    
    expected, filename = sys.argv[1:]
    path = Path(filename)
    with path.open('rb') as stream:
        actual = hashlib.file_digest(stream, 'sha256').hexdigest()
    match = actual == expected
    status = 'MATCH' if match else 'MISMATCH'
    print(f'{path}: {status} ({actual[:12]})')
    sys.exit(0 if match else 1)
    PY
  6. The reference below was calculated from the first file. Use that same value for both checks. Run the commands one line at a time. The last command intentionally exits with status 1.
  7. expected=d81bdb11b27f23253d2c0c2a2b25665fce5f5cd7574995af3724951740770bdc
    python3 check_split.py "$expected" run-a/labels.csv
    python3 check_split.py "$expected" run-b/labels.csv
  8. In a real run, calculate the reference once from your reviewed file. The command below prints its full digest. On later runs, pass the value from the saved run record to check_split.py. Recalculating the reference from the candidate just before checking would let every edit pass.
  9. python3 - run-a/labels.csv <<'PY'
    import hashlib
    import sys
    
    with open(sys.argv[1], 'rb') as reviewed:
        print(hashlib.file_digest(reviewed, 'sha256').hexdigest())
    PY
  10. On a mismatch, pause the score comparison. If the edit was accidental, restore the reviewed split and check it again. If it was an intentional correction, record a new dataset revision and rescore both models against it.

Expected output

run-a/labels.csv: MATCH (d81bdb11b27f)
run-b/labels.csv: MISMATCH (63c1d2fe03b1)
d81bdb11b27f23253d2c0c2a2b25665fce5f5cd7574995af3724951740770bdc

Limitations

A digest checks byte identity. A line-ending conversion or reordered rows will also change it. A match cannot establish label accuracy, licensing or the origin of the reference. The example covers one labels file. For a multi-file evaluation, record relative paths and digests for every input, including the clips, and check the file list for additions or omissions.

Sources