Skip to content
AI.info

MLOps

Production Data Quality and Training–Serving Skew

Monitor availability, freshness, coverage, semantics, transformations, and online-offline consistency for production features.

By the end you can

Example

A default value becomes a new customer segment

A categorical feature starts reporting one of its values far more often than it used to. Google's data validation system in TFX watches exactly that, batch to batch, and the worked example its authors give for the alert is not a hypothetical: “if the highest change in frequency is observed in value '-1' then this might be an issue with some backend failing and producing a default value. (This is an actual situation observed in one of our production pipelines.)”

Nothing is missing in that pipeline. The feature is present, typed, in range, and populated on every request. Only its meaning has changed: from a measurement to a receipt for a failed lookup. A monitor watching nulls sees a clean field. A model that learned what '-1' meant in training now reads a growing cohort of lookup failures as a real population.

  • Serving default: a backend fails and the feature arrives as the placeholder value '-1' rather than as a null.
  • Monitoring gap: null rate and freshness both stay clean, because the default is populated and populated on time.
  • Detection metric: the team compares batches with the max-probability-change metric d∞, so the alert names the culprit value instead of reporting a distance.
  • Why not a naive test: replacing 0.01% of 100 million N(0,1) points with N(0,2) samples made a chi-square test fire a spurious skew alert in 7 of 10 trials.
  • Scale of the check: the system is used by hundreds of product teams to validate several petabytes of production data per day.

The value is present, fresh, and wrong

NASA lost the Mars Climate Orbiter on 23 September 1999 to a number that was present, well-formed, and inside its expected range. The ground software file SM_FORCES expressed thruster performance data in English units. The Angular Momentum Desaturation file that software produced was specified in metric units, and the trajectory modellers read it as metric, exactly as the interface documentation told them to. The mishap investigation board stated the root cause in November 1999 in one sentence: “The MCO MIB has determined that the root cause for the loss of the MCO spacecraft was the failure to use metric units in the coding of a ground software file, “Small Forces,” used in trajectory models.” At Mars insertion the spacecraft was approximately 170 kilometres lower than planned. Its development had cost $75 million, and it had launched on 11 December 1998.

No null check, no freshness check, and no range check anywhere in that chain would have fired. The producer wrote one unit. The consumer's contract declared another. Every value in between was valid. Quality checks that cover nulls and freshness miss semantic breakage. Production data quality is the degree to which inputs satisfy the meaning, timing, population, and compatibility required by the decision contract. A feature store that returns `account_age = 12` with a current timestamp has satisfied none of that by returning it.

Visual

A production feature quality stack

Quality failures can preserve shape while breaking meaning, and each layer of the stack fails in its own way. Coverage is the layer that is hardest to see. Rows that never arrive leave no trace in the rows that did.

Between 25 September and 2 October 2020, 15,841 positive COVID-19 cases never reached the UK's reported daily figures. Public Health England announced the gap on 4 October and put it down to a fault in the data-load process into the reporting dashboards. The peer-reviewed analysis of the episode is more specific: case rows were truncated once a spreadsheet row limit was reached. Fetzer and Graeber put the mechanism in one sentence: “Because of a coding error involving spreadsheet data used by the health authorities, a total of 15,841 COVID-19 cases (around 20% of all cases) failed to have timely contact tracing.” They estimate between 126,836 and 185,188 additional reported infections and between 1,521 and 2,049 additional reported deaths over the following six weeks.

Every figure that did arrive was well-formed. The silent exclusion was the whole failure, and its cost was measurable only afterwards.

FigureHierarchy · 5 levels
  • Availability

    The required source and feature can be retrieved for the eligible decision.

    • Freshness and timing

      The value was available before the scoring cutoff and meets age limits.

      • Coverage and population

        Expected entities, cohorts, and partitions are represented without silent exclusion.

        • Semantic validity

          Units, categories, sign, window, and missingness preserve the declared meaning.

          • Parity

            Training, replay, and serving compute equivalent values under equivalent inputs.

Key idea

Statistical thresholds can normalize a broken baseline

If the reference period already contains stale or misinterpreted data, drift checks can report stability while the system remains wrong. Baselines need provenance, semantic review, and periodic revalidation.

The floor under the pipeline is lower than most monitoring assumes. Facebook ran silent-error test scenarios across hundreds of thousands of machines over more than 18 months and found hundreds of defective CPUs. In its case study, a Scala power function computing Int(1.1^53) returned 0 on Core 59 of one machine, so a Spark decompression pipeline treated valid files as zero-size and dropped them from the database. Google described the same class of defect in 2021 and named it a "mercurial" core. Its paper opens with the operator's view of it: “Imagine you are running a massive-scale data-analysis pipeline in production, and one day it starts to give you wrong answers – somewhere in the pipeline, a class of computations are yielding corrupt results.” No schema check, no null rate, and no distributional test catches a single core that computes the wrong number.

A threshold should also reflect consequence. A small change in a rare critical feature may matter more than a large shift in an unused field.

Stable statistics are not evidence of stable meaning.

Case

Which detector actually caught the shift

Shift detectors do not all do the same job, and in 2019 three researchers put them head to head. They perturbed covariates and labels at varying magnitudes and measured what caught them. The result is stated plainly: “across the dataset shifts that we explore, a two-sample-testing-based approach, using pre-trained classifiers for dimensionality reduction, performs best”. Domain-discriminating methods did a different job — they “tend to be helpful for characterizing shifts qualitatively and determining if they are harmful”.

Noticing that something moved and explaining what moved are separate jobs, done well by different machinery. A team that has bought only one of them will keep mistaking the answer it can compute for the question it asked.

Skew is a relationship between two computations

Training–serving skew occurs when logically equivalent examples receive different values or transformations across environments. Google's data validation team ranked the causes rather than listing them: “One of the issues that frequently occurs in production pipelines is skew between training and serving data. Several factors contribute to this issue but the most common is different code paths used for generation of training and serving data”. Their taxonomy splits the problem three ways: feature skew, distribution skew, and scoring/serving skew.

The rates are measured rather than estimated. Over a 30-day window in production, a "new feature column" anomaly fired in 10% of evaluation pipelines and out-of-domain categorical values in 6%. More than 70% of pipelines had at least one model unit test. Those tests were executed more than 80K times in a month, and 6% of the executions failed. Duplicated code, different join cutoffs, unavailable online fields, inconsistent defaults, and stateful transformations are all instances of the same shape.

Population drift is different. The pipeline may be consistent while the real world changes. Diagnose parity before treating a distribution shift as a modeling problem.

Comparison

Four changes that can look like drift

The containment action depends on the cause, and the two hardest to tell apart are a semantic contract change and a legitimate population shift. Google Flu Trends separates them. The model had been running high for two years before the count appeared in print: “GFT also missed by a very large margin in the 2011–2012 flu season and has missed high for 100 out of 108 weeks starting with August 2011 (see the graph).” That is Lazer and three colleagues, writing in Science in 2014. They traced it to "algorithm dynamics": Google's own search blog reported 86 changes in June and July 2012 alone.

The flu had not changed its behaviour. The upstream provider had changed the data-generating process while the modelled world stayed where it was — a semantic contract change wearing the costume of a population shift. The model looked stable and was wrong.

The failure had already been found running in the other direction. A 2013 reassessment in PLOS Computational Biology reported that the original model missed the spring 2009 A/H1N1 pandemic wave, giving incidence estimates 30–40 fold lower than ILI surveillance, and greatly overestimated the 2012/2013 A/H3N2 season.

FigureComparison · 4 columns

Source or pipeline fault

Data is missing, stale, duplicated, corrupted, or delayed.

  • Contain and repair evidence path
  • May require fallback
  • Backfill carefully
  • Do not retrain on corrupted output

Semantic contract change

Unit, category, definition, or eligibility meaning changed.

  • Version the contract
  • Assess compatibility
  • Migrate deliberately
  • Historical comparability may break

Training–serving skew

Equivalent examples are transformed differently across paths.

  • Run parity checks
  • Unify logic or state
  • Audit cutoffs and defaults
  • Can degrade without population change

Legitimate population shift

The system is consistent but the world changed.

  • Analyze impact and cause
  • Review model and policy
  • May require new data or retraining
  • Not every shift is harmful

Steps

Investigate a production feature anomaly

Move from contract to source before changing the model. In one regulated domain that is not house style but a written expectation. In October 2021 the U.S. FDA, Health Canada and the UK MHRA jointly identified 10 Good Machine Learning Practice guiding principles — non-binding guiding principles rather than regulation. Principle 10 reads: “Deployed Models Are Monitored for Performance and Re-training Risks Are Managed: Deployed models have the capability to be monitored in “real world” use with a focus on maintained or improved safety and performance. Additionally, when models are periodically or continually trained after deployment, there are appropriate controls in place to manage risks of overfitting, unintended bias, or degradation of the model (for example, dataset drift) that may impact the safety and performance of the model as it is used by the Human-AI team.” Principle 3 states that clinical study participants and data sets, including the training and test datasets, are representative of the intended patient population. That is the coverage layer, made a condition of the product rather than a dashboard.

For the parity step, Google publishes its own remedy as Rule #29 of its Rules of Machine Learning: log the features actually used at serving time, and train on that log. Two code paths cannot disagree if only one of them ever produced the training data.

FigureProcess · 5 steps
  1. 1. Confirm the decision contract

    Check unit, timing, eligibility, missingness, and expected source.

  2. 2. Trace the lineage

    Follow the value through source, joins, transformations, store, and request.

  3. 3. Run parity samples

    Compare matched historical and online examples before and after imputation.

  4. 4. Classify the cause

    Fault, semantic change, skew, or legitimate population shift.

  5. 5. Contain and repair

    Fallback, pause, fix, backfill, recalibrate, or retrain according to evidence.

Monitor missingness before it is hidden

Defaults, imputations, clipping, and category buckets can convert data failures into valid-looking numbers. Both hidden failures in this lesson have that shape. A backend fails and the feature arrives as '-1', so the null rate never moves and the anomaly is visible only as a change in how often one value appears. Case rows past a spreadsheet row limit were dropped, so the 15,841 missing positives left no mark on the daily figures that were published.

Capture raw missingness and transformation-path metadata. Operators can then tell a real zero from an unavailable value, and an alert can name a culprit value rather than a distance. The monitoring design should preserve enough evidence to explain one affected decision without logging every sensitive input.

Case

Unit tests for data, compiled down to Spark queries

Amazon runs quality checks over its production datasets the way engineers run tests over code, and in 2018 it published the system that does it. The abstract states the design in one line: “Our system provides a declarative API, which combines common quality constraints with user-defined validation code, and thereby enables ‘unit tests’ for data.”

The constraint workload is executed “by translating it to aggregation queries on Apache Spark”, and the platform “supports the incremental validation of data quality on growing datasets”, so checks re-run as data arrives instead of rescanning history. It is built for terabyte-sized tables with several billions of rows. And it is not a paper-only system: AWS states that the released library, Deequ, “is being used internally at Amazon for verifying the quality of many large production datasets”.

Position

“The model degraded” is a verdict reached before the pipeline was questioned

“The model degraded” names a suspect before anyone has taken evidence. The failures in this lesson leave the model exactly as it was. SM_FORCES wrote thruster performance data in English units into a file specified in metric, the arithmetic downstream was correct on every line, and the orbiter arrived approximately 170 kilometres lower than planned. A backend fails and a feature arrives as '-1' on every request, fresh and non-null, and a model that learned what that value meant in training now scores a cohort of lookup failures as a population. Public Health England's daily figures stayed well-formed while 15,841 positive cases sat outside them. Stable statistics are not evidence of stable meaning.

Retraining fits none of those cases. Run on corrupted output, it builds a worse model out of a broken pipeline. Parity comes first. Matched examples get compared before and after imputation, cutoffs and defaults are audited, and the cause is classified as a source fault, a semantic contract change, training–serving skew, or a legitimate population shift, because the containment action differs for all four. Google Flu Trends shows how expensive that classification is to skip: for 100 out of 108 weeks starting with August 2011 the model ran high, and the movement was in the search product, not in the flu.

The detection literature argues for the same order of operations from the other end. The head-to-head comparison of shift detectors found two-sample testing on top of pre-trained classifiers best at noticing that something had moved, while domain-discriminating approaches “tend to be helpful for characterizing shifts qualitatively and determining if they are harmful”. Noticing and explaining are separate jobs done by different machinery. A team with neither has only the retrain button, so the retrain button is what it presses. Three regulators have already written the alternative down, and Amazon and Google have both shipped the plumbing for it — a declarative constraint suite that compiles to Spark queries, and a serving-time feature log to train on.

Four different causes in this lesson can look like drift. Only the last of them may be a reason to touch the model.

Key takeaways