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 file
  1. 1.0000

    the score hotel-cancellations claimed on its first run

  2. 95,309

    of 95,457 training rows changed when we scrambled only the test rows

  3. 0.9096

    the honest score once the leaks were removed

A leak makes a broken model look perfect.

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.

Training rows Test rows: the answers the split

It scrambles the answers and watches what moves.

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.

  1. Train normally

    Hexperiment records exactly what training produced.

    8 training rows, 2 test rows

  2. Scramble the test rows, train again

    Same script, same seed. Only the test rows are shuffled.

    the test rows are scrambled

  3. Compare

    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

Five ghosts it hunts.

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.

The Doppelganger
The same rows sit in training and test.
The Possession
One column gives the answer away, like a status filled in after the booking ends.
The Peeking Spirit
Training saw the test rows. The canary test catches it.
The Prophet
Training uses rows from after the test period.
The Shapeshifter
Identical runs give different results, so nothing can be verified.

Two haunted apps, caught and fixed.

Every number here comes from a recorded run. Open a case file to see each run and every finding.

  • hotel-cancellations

    Predict whether a hotel booking will be cancelled.

    Found The Possession and The Peeking Spirit. 4 recorded runs.

    1.0000first run, rejected
    0.9096last run, approved
    Open the case file
  • flight-delays

    Predict whether a 2013 New York flight arrives more than 15 minutes late, from its schedule.

    Found The Prophet. 4 recorded runs.

    0.7971first run, rejected
    0.6193last run, approved
    Open the case file

The honest score is lower. That is the point: it is an honest estimate of how the model will do on new data.

Benchmark

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.

Leaky scripts rejected, by leakage type and mechanism
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%)

Not measured

  • L3.3 Sampling bias in test distribution: It depends on the population a claim is about, which neither the code nor the data shows.

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.

It lives inside Kiro.

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.

Steering
Before it writes training code, the agent reads the rules: split first, no columns from the future, always end with an audit.
Save hook
Saving a training script runs a fast check and clears the old verdict, so an old approval stops counting once the code changes.
MCP tools
The agent can list apps, run the audit, read the verdict and its history, and ask what a ghost means.
Guardrails
The agent cannot edit the verdict, the model card, the thresholds or the data. It has to fix the cause.

Then it fixes the leak and checks again.

/workflow run exorcise hands an app to the ghost-hunter agent and repeats until the full audit approves it.

  1. Edit

    The ghost hunter changes the training code to remove the cause of each finding.

  2. Audit

    The full audit runs again, canary test included.

  3. Repeat

    Still rejected? It reads the new findings and tries again, up to five times.

  4. Hand back

    Approved, or out of tries: it stops and shows you the latest verdict.

If your model looks too good to be true, it’s haunted.

Open a case file to see every recorded run, or read the source.