← Writing 12 min read Applied AI · Data

Your data cleaner will rot, and it won't tell you

A degrading model doesn't crash. It keeps running, producing confident output at a steadily worsening error rate, until something downstream breaks badly enough to investigate.

Most organisations treat an AI data cleaning system like a dishwasher: install it, run it, forget it. The analogy fails in one important way. When a dishwasher stops working, you find out immediately, because the dishes are dirty.

When a data cleaning model degrades, nothing stops. It keeps matching, keeps scoring, keeps producing output that looks exactly like the output it produced when it was accurate. The error rate climbs quietly for months, and the first symptom is usually something downstream and expensive — a supplier disputing a rebate calculation, or a finance team unable to reconcile a quarter.

This is the guide I wish I'd had before deploying ML-based product matching on a rebate platform.

Why cleaning models rot faster than most

Every model was trained on a snapshot. Reality moves; the snapshot doesn't. That is true of all machine learning, but data cleaning is especially exposed, because the thing it cleans — incoming data — is the thing most likely to change.

In our case, changes arrived constantly. New suppliers onboarded with naming conventions nobody had seen. Existing suppliers changed catalogue systems. Regulators renamed active ingredients. Manufacturers were acquired, so Monsanto products became Bayer products mid-catalogue. Seasonal lines appeared and vanished. Every one of those is an opportunity for the model to quietly get worse.

The problem, concretely

Thirty-plus suppliers send product catalogues every quarter. The same glyphosate-based herbicide arrives like this:

Supplier A:  ROUNDUP PRO BIACTIVE 360 — 20L
Supplier B:  Rndup ProBio 360g/L Glyphosate 20 Litre
Supplier C:  MONSANTO GLYPHOSATE 360 PROBIO 20LTR
Supplier D:  RoundUp Pro Bio 360 (Bayer) — 20L Drum

One product. A human agronomist identifies all four instantly. Naive string matching sees four distinct products, and if the matching is wrong the rebate is wrong, the distributor is out of pocket, and you have a client conversation you'd rather not have.

The loop

The thing to internalise is that this is not a project with a deployment date. It is a loop, and the loop is the product.

  1. Bootstrap — rules and labelling functions generate noisy initial labels
  2. Label — domain experts validate and correct the uncertain cases
  3. Train — build the model, validate against a held-out golden dataset
  4. Deploy — confidence thresholds, with humans handling the middle band
  5. Monitor and retrain — track drift, collect corrections, return to step 2

Steps two through five repeat indefinitely. If your plan has a deploy milestone with nothing after it, you are building something with a shelf life.

Bootstrap: rules before ML

Don't start with machine learning. Start by encoding what your domain experts already know as labelling functions — small rules that vote on whether two products match, and abstain when they don't know.

def lf_active_ingredient(a, b):
    ia, ib = extract_actives(a.description), extract_actives(b.description)
    if ia and ia == ib:
        return MATCH
    return ABSTAIN

def lf_concentration_and_size(a, b):
    if conc(a) == conc(b) and pack(a) == pack(b):
        return MATCH
    if conc(a) and conc(b) and conc(a) != conc(b):
        return NON_MATCH        # different strength = different product
    return ABSTAIN

Six to eight of these, run across every candidate pair, with a label model combining the noisy votes. That got us roughly 70% accurate labels across 50,000 candidate pairs without a single human annotation. Not production-grade — but an excellent starting point that cost nothing.

Label: spend expert time only where it counts

Sort by confidence. Anything above 90% or below 10% is accepted as-is. The uncertain band in between — about 8,000 pairs for us — goes to product specialists.

This is where domain expertise is irreplaceable and unautomatable. A specialist knows that "Pro Biactive" and "ProBio" are the same formulation, that the Monsanto-to-Bayer transition explains a manufacturer mismatch, and that 360 is grams per litre of active ingredient rather than a product code. Two weeks of part-time labelling produced 12,000 high-confidence pairs.

Train, then deploy behind thresholds

Gradient-boosted trees, on features covering name similarity, active ingredient match, concentration, pack size and manufacturer similarity. The specific algorithm matters far less than one property: well-calibrated probabilities, because the whole deployment strategy depends on them.

Three tiers in production:

  • Above 95% confidence — auto-match. Roughly 60% of pairs.
  • 30–95% — routed to a specialist. About 25%.
  • Below 30% — auto-reject. About 15%.

The thresholds come from the precision-recall curve on validation data, not from instinct. And the review queue is not a cost centre to be minimised — it is the retraining pipeline. Every correction a specialist makes is a training example for the next version.

The golden dataset

A few hundred hand-verified pairs that you never train on. It is the exam paper. Four rules:

  1. Never train on it. The moment it leaks into training, your evaluation is fiction.
  2. Version it alongside the model code, with dates.
  3. Refresh it quarterly. A golden set containing only last year's supplier formats cannot tell you anything about this year's.
  4. Make it representative — easy matches, hard matches, near-misses and edge cases in realistic proportion.

We learned rule three the hard way. A certification body adopted different active-ingredient nomenclature, our golden set contained no examples of it, and the dashboards kept reporting excellent scores while the model quietly mishandled everything from the affected suppliers.

If your golden dataset is stale, your evaluation is lying to you — and it will lie confidently, in the direction you want to believe.

Knowing when to retrain

Three triggers running in parallel. Any one alone will miss things.

Calendar. Quarterly, aligned to the seasonal catalogue cycle. Spring brings new varieties, autumn brings new crop protection products.

Performance. Track F1 against the golden set continuously and alert on a meaningful drop from baseline. Watch precision and recall separately, because they cost different things: a false match means a wrong rebate paid, a false non-match means a rebate missed entirely.

Drift. Population Stability Index across key features, computed weekly, comparing production data against the training distribution. This catches the change before the accuracy does.

And the single most reliable signal, which costs nothing to instrument: the human override rate. If your specialists are correcting more than one in ten auto-matches, retrain now, whatever the schedule says. The operators are the canary.

Seven ways to get this wrong

I have made most of these.

Overfitting to current formats. The model learns that one supplier always puts concentration first, then that supplier changes systems and it breaks silently. Train on features, not formatting artefacts.

Not planning for new suppliers. Use leave-one-supplier-out cross-validation: hold out a supplier entirely, train on the rest, test on them. If accuracy collapses, your model has memorised suppliers rather than learned matching.

Evaluating on the training distribution. Same period, same suppliers, of course it looks good. Use a temporal holdout — train on Q1, test on Q2.

Treating it as one-shot. The budget covers build and deploy, with no line for monitoring or retraining. Six months later it is degrading and nobody is looking. Budget for the loop.

Ignoring class imbalance. Around 95% of candidate pairs are non-matches. A model predicting "no match" for everything scores 95% accuracy and is useless. Report precision, recall and F1 — never accuracy alone.

Not versioning training data. You can reproduce your code. Can you reproduce the data that produced model v2.3? If not, you cannot debug a regression or evidence a decision to an auditor.

Automating too early. The most expensive one. The model hits 95% in testing and someone proposes removing the human. But a wrong match becomes a wrong rebate, which becomes a wrong invoice and a supplier relationship problem. A single month of incorrect rebates can cost more than a year of review. Widen the auto-match band gradually, as the golden set earns you the confidence.

The bottom line

Everyone has access to the same models now. The advantage isn't having AI; it's having AI that improves. Every human correction feeds the training set, every new supplier is a stress test, every quarterly refresh sharpens the evaluation. The system gets better because it was designed to get better.

If your cleaning pipeline has no retraining plan, you don't have a pipeline. You have a system that is already degrading, and no instrument pointed at it.

Written by Jeff Bradshaw — CTO, board director, and someone who still ships code. More at about, or get in touch.

Built at Oxbury Earth. Views are my own.

Connect on LinkedIn · GitHub · RSS