Is your model too good to be true?
Hexperiment is a Kiro power that catches data leaks in machine-learning code: test answers that sneak into training and fake a high score. Kiro’s agent then fixes them.
Open the case fileHexperiment is a Kiro power that catches data leaks in machine-learning code: test answers that sneak into training and fake a high score. Kiro’s agent then fixes them.
Open the case filethe score hotel-cancellations claimed on its first run
of 95,457 training rows changed when we scrambled only the test rows
the honest score once the leaks were removed
A model learns from training rows, then gets graded on test rows it has never seen. A data leak lets information from the test rows slip into training. The model has seen the answers, so it aces the test and fails on real data.
It’s like a unit test that reads its expected value from the code it tests: it always passes and proves nothing. When an AI agent writes the training code, a leak is easy to miss. Nothing crashes. The score just goes up.
Hexperiment runs your training script twice. The second time, it scrambles only the test rows. Honest code never uses the test rows to train, so nothing in training should change. This is the canary test.
Hexperiment records exactly what training produced.
8 training rows, 2 test rows
Same script, same seed. Only the test rows are shuffled.
the test rows are scrambled
If any training row changed, the test rows leaked into training. In hotel-cancellations, 95,309 of 95,457 changed.
orange rows changed: a leak
Each check names the leak it found, so a failed run reads like a story. A model is approved only when a full run passes every check and reaches its target score.
Every number here comes from a recorded run. Open a case file to see each run and every finding.
Predict whether a hotel booking will be cancelled.
Found The Possession and The Peeking Spirit. 4 recorded runs.
Predict whether a 2013 New York flight arrives more than 15 minutes late, from its schedule.
Found The Prophet. 4 recorded runs.
The honest score is lower. That is the point: it is an honest estimate of how the model will do on new data.
Each leaky script was run through hexperiment run; its clean twin is the same script with the leak removed.
30 of 39 leaky scripts rejected; 0 false alarms in 39 clean twins.
The data is synthetic and the cases were written by the authors of the checks, so this shows that the checks see the leaks they were built for, not how often they find leaks in real projects.
| Leakage type | Mechanism | Designed to catch | Rejected | Rejected by |
|---|---|---|---|---|
| L1.1 No test set | The model is scored on the rows it was trained on. | The Doppelganger | rejected 3 of 3 (100.0%) | The Doppelganger (3) |
| L1.2 Pre-processing on training and test set | A standard scaler is fitted on all rows before the split. | The Peeking Spirit | rejected 3 of 3 (100.0%) | The Peeking Spirit (3) |
| A mean imputer is fitted on all rows before the split. | The Peeking Spirit | rejected 3 of 3 (100.0%) | The Peeking Spirit (3) | |
| The rare class is randomly over-sampled before the split. | The Doppelganger | rejected 3 of 3 (100.0%) | The Doppelganger (3) | |
| A category's mean label is computed from all rows and used as a feature. | The Peeking Spirit | rejected 3 of 3 (100.0%) | The Peeking Spirit (3) | |
| L1.3 Feature selection on training and test set | The 15 best columns are chosen with the labels of all rows before the split. | The Peeking Spirit | rejected 3 of 3 (100.0%) | The Peeking Spirit (3) |
| L1.4 Duplicates in datasets | Part of the rows appear twice in the source file, and the split is random. | The Doppelganger | rejected 3 of 3 (100.0%) | The Doppelganger (3) |
| L2 Model uses features that are not legitimate | A column recorded after the outcome copies the label. | The Possession | rejected 3 of 3 (100.0%) | The Possession (3) |
| A noisy measurement of the label is used as a feature. | The Possession | rejected 3 of 3 (100.0%) | The Possession (3) | |
| A weaker proxy of the label (stand-alone AUC about 0.89) is used as a feature. | No check is designed for it | rejected 0 of 3 (0.0%) | none | |
| L3.1 Temporal leakage | Time-ordered data is split at random by the script instead of with `hexperiment.split`. | The Prophet | rejected 3 of 3 (100.0%) | The Prophet (3) |
| The time column is not declared in `hex.toml`, so `hexperiment.split` splits at random. | The Prophet | rejected 0 of 3 (0.0%) | none | |
| L3.2 Nonindependence between training and test samples | Several rows of one entity, each differing by small noise, are split at random. | No check is designed for it | rejected 0 of 3 (0.0%) | none |
| Clean twins | 0 false alarms in 39 scripts (0.0%) | |||
Leakage types follow Kapoor and Narayanan, Leakage and the reproducibility crisis in machine-learning-based science, Patterns 4(9), 100804, 2023, doi:10.1016/j.patter.2023.100804.
Measured with hexperiment 0.1.0, Python 3.13.2 and scikit-learn 1.9.1 on 2026-11-23, in 78 runs.
Hexperiment installs as a Kiro power. Kiro’s agent gets the rules, the tools, and a loop that does not stop until the leak is gone.
/workflow run exorcise hands an app to the ghost-hunter agent and repeats until the full audit approves it.
The ghost hunter changes the training code to remove the cause of each finding.
The full audit runs again, canary test included.
Still rejected? It reads the new findings and tries again, up to five times.
Approved, or out of tries: it stops and shows you the latest verdict.
Open a case file to see every recorded run, or read the source.