Book a free call

How AI and Machine Learning Improve Data Quality

Machine learning finds the bad rows humans miss: duplicates, wrong values and missing fields. Here is how it works and where it fits in a data pipeline.

Hertiv engineering teamReviewed by a senior engineer
8 min read
How AI and Machine Learning Improve Data Quality
On this page

Short answer

Machine learning improves data quality by learning what good data looks like, then flagging values that break the pattern, matching records that refer to the same thing, and filling gaps from similar records. It works best as a set of checks inside a data pipeline, with people reviewing the cases the model is unsure about.

What does AI do for data quality?

AI improves data quality by learning the patterns in a dataset and flagging the values that break them. Instead of a person writing a rule for every possible error, a model learns what normal looks like from the data itself.

A customer table illustrates the idea. Most names have two or three words, most postcodes follow one pattern, and most order dates fall after the account was created. A model that has seen thousands of rows can spot the postcode with a letter where a number should be, or the order dated before the account existed, without anyone writing those rules by hand.

This is a different job from the one covered in why data quality decides whether AI projects work. That article explains why bad data breaks models. This one explains the reverse: how models can be used to find and fix bad data before it causes harm.

How does machine learning find bad data?

Machine learning finds bad data by comparing each value with what the rest of the dataset suggests it should be. The most common technique is anomaly detection, where a model scores every row and ranks the strangest ones first.

Three approaches cover most cases. Statistical checks flag values far from the usual range, such as a product price ten times higher than every similar product. Clustering groups similar rows together, so a row that sits alone in its own group is worth a look. Sequence models learn the order things usually happen in, such as a payment following an order, and flag steps that arrive out of order.

The key point is that the model ranks suspects, it does not decide. A flagged row might be a genuine error, or it might be a real but unusual case, such as a bulk order from a new customer. That is why the output of these checks goes to a review queue, not straight into a delete job.

Anomaly detection works best on data with clear patterns, such as prices, dates and counts. It works worst on free text, where unusual wording is often just a different way of saying the same thing. For text fields, matching and classification matter more than outlier scores.

How does ML match duplicate records?

Machine learning matches duplicate records by learning which fields matter when two rows refer to the same thing. This job is called entity resolution, and it is one of the oldest uses of ML in data quality.

A simple rule would match only exact names, which misses the duplicate where one row says "Jon Smith" and the other says "John Smyth" at the same address. A model trained on pairs of records learns that a shared phone number outweighs a spelling difference, while a shared surname alone is weak evidence.

SignalWhat it tells youStrength
Same phone or emailAlmost certainly the same personStrong
Same name and addressLikely the same personStrong
Same name onlyCould be two different peopleWeak
Similar name, same postcodePossible typo of one recordMedium
Same card numberSame account, even with a new nameStrong

The model returns a score for each pair, and the team sets two thresholds. Pairs above the high threshold merge automatically, pairs below the low threshold stay separate, and pairs in between go to a person. That middle band is where the model earns its keep: it is also where most of the mistakes would happen without review.

How does ML fill in missing values?

Machine learning fills in missing values by predicting them from the fields that are present. This is called imputation, and it is useful when a field is missing for some rows but the rest of the row carries enough signal.

A product record missing its category can often be inferred from its name and description. A customer record missing a region can often be inferred from its postcode. A sensor reading missing for one hour can often be estimated from the readings before and after it. In each case the model uses the relationships between fields that it learned from the complete rows.

Imputation has clear limits. It cannot invent information that the dataset never contained, and it should never fill in values that will be used to make decisions about a person, such as income or health status. A filled value is an estimate, and it should be marked as one so that later checks know not to trust it the same way as a measured value.

As a rule, impute only when the missing rate is low and the field can be predicted well from the rest of the row. When a field is missing for most rows, or when the prediction would be a guess, leave it blank and let the missingness itself be the signal.

How does ML keep formats and schemas consistent?

Machine learning keeps formats and schemas consistent by learning the shape of each field and flagging values that break it. Dates written as 03/04/2025 in one feed and 2025-04-03 in another are the same day in two shapes, and a model can learn to recognise both.

Classification models sort free text into a fixed list of categories, such as routing support tickets to the right team or tagging products with a category from the name and description. This replaces long lists of keyword rules that break every time someone writes a new phrase.

Schema matching is the harder version of the same job. When two systems call the same thing by different names, such as "cust_id" in one and "customer_number" in another, a model can suggest which fields line up by comparing their values and their names. A person still confirms the mapping, but the model does the tedious first pass.

These checks belong at the point where data enters the system, not after it has spread. Catching a wrong date format at the intake step costs one fix; catching it after it has been copied into three reports costs three fixes and a meeting. How to organise that intake is part of keeping training data ready.

How do you put ML data-quality checks into a pipeline?

You put ML data-quality checks into a pipeline by placing them where data enters, changes or leaves, and by treating their output as a queue for people, not as an automatic fix.

  1. Profile the data first. Measure missing rates, duplicates and value ranges before you build anything, so you know which problems are worth solving.
  2. Start with one check. Pick the problem that costs the most, such as duplicate customers or missing prices, and build a single check for it.
  3. Train on labelled examples. Give the model pairs of records marked as duplicates or not, and rows marked as correct or wrong, so it learns from real decisions.
  4. Set two thresholds. Auto-fix only the cases the model is sure about, auto-accept only the cases it is sure are fine, and send the middle band to a person.
  5. Log every decision. Record what was flagged, what was changed and who approved it, so a bad fix can be traced and reversed.
  6. Watch for drift. Re-check the model as new data arrives, because a model trained on last year's patterns will miss this year's errors.

Keep the checks small and separate. One check for duplicates, one for missing values, one for format errors. When a check starts failing, you can switch it off without touching the rest of the pipeline, and when a new data source arrives, you can add a check for it without rebuilding the old ones.

Example (hypothetical): a retailer cleans its product data

Example (hypothetical): an online retailer holds 40,000 product records. A profile shows 6,000 records missing a price, which is 15 in every 100, and 2,400 duplicate records, which is 6 in every 100. The team decides to fix both with machine learning.

First it trains a matching model on 500 pairs of records that staff have marked as duplicates or not. The model scores every pair, and the team sets its thresholds so that pairs scoring above 90 merge automatically and pairs below 40 stay separate. The 2,400 duplicates are found, and 2,100 of them merge automatically while 300 go to review.

Next it trains an imputation model on the 34,000 records that have a price, using name, category and brand as inputs. The model fills 4,500 of the 6,000 missing prices, and the team marks each filled price as estimated. The remaining 1,500 have too little signal to predict, so they stay blank and go to the merchandising team.

The result is 36,100 clean records: 40,000 minus 2,400 duplicates is 37,600, and 4,500 of the missing prices are recovered, leaving 1,500 held out for manual work. The team also keeps a log of every automatic merge and every filled price, so any mistake can be found and undone.

What are the common mistakes?

The most common mistakes with ML data quality are trusting the model too far, training on dirty data, and fixing values that should have been left alone.

  • Auto-fixing everything. A model that merges records without review will merge two different people who share a name. Keep a human in the middle band.
  • Training on the dirty data. A model trained on data that already contains duplicates will learn that duplicates are normal. Clean a sample by hand first.
  • Imputing sensitive fields. Never use a model to fill in income, health or identity fields. A guessed value there is worse than a blank one.
  • Ignoring drift. A model trained on last year's product names will miss this year's new brands. Re-train on a schedule, not when someone complains.
  • No audit trail. If you cannot say which values a model changed and when, you cannot undo a bad run. Log every change.

For the wider picture of how quality, governance and engineering fit together, see data engineering best practices.

Key takeaways

  • ML improves data quality by learning what good data looks like, then ranking the rows that break the pattern
  • Entity resolution matches duplicates a rule would miss, such as Jon Smith and John Smyth at the same address
  • Imputation can fill gaps from similar records, but a filled value is an estimate and should be marked as one
  • Use two thresholds: auto-fix only what the model is sure about, and send the uncertain middle band to a person
  • Log every automatic change and re-train on a schedule, because data patterns drift over time

Frequently asked questions

Can machine learning clean data on its own?

No. ML can rank suspects, suggest matches and fill gaps, but it cannot decide what is true. The safest setup auto-fixes only the cases the model is sure about and sends the uncertain middle band to a person for review.

What is entity resolution?

Entity resolution is matching records that refer to the same real thing, such as two customer rows for one person. A model learns which fields matter, so a shared phone number outweighs a spelling difference in the name, and it returns a score for each pair.

When should you not impute a missing value?

Do not impute when the missing rate is high, when the field cannot be predicted well from the rest of the row, or when the value will be used to make decisions about a person, such as income or health status. A blank is safer than a guessed value in those cases.

How is ML data quality different from rules?

Rules check for known errors, such as a postcode in the wrong shape. ML learns the patterns in the data, so it can catch errors nobody wrote a rule for, such as a price that is wrong for that product but plausible on its own.

What data does an ML quality check need to start?

It needs a sample of labelled examples: pairs marked as duplicates or not, and rows marked as correct or wrong. A few hundred labelled cases is usually enough to start, and the model improves as reviewers confirm or correct its suggestions.

Does ML data quality replace data governance?

No. ML checks are tools inside a governance programme, not a replacement for it. Ownership, access rules, retention and audit trails still need people and policy, and the checks themselves need logging and review like any other system.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Need cleaner data for your AI project? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Data Engineering service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call