Skip to content
AI.info

ML data engineering

ML Data Engineering as an Evidence System

Map the full evidence lifecycle behind training, evaluation, serving, feedback, and recovery.

By the end you can

Example

The data system often dominates the project

These examples show why model choice is only one part of the engineering problem. The last of them is not a thought experiment.

The Epic Sepsis Model runs at hundreds of US hospitals. Two teams have validated it externally. Wong and colleagues at Michigan Medicine went first, in JAMA Internal Medicine in 2021. Ostermayer and colleagues repeated the exercise in 2024, in two Texas county emergency departments, across 145,885 encounters in 2023. They found a sensitivity of 14.7% and a positive predictive value of 7.6%. Their abstract closes on one sentence: “The ESPMv1 provides suboptimal diagnostic characteristics for undifferentiated patients in a county ED.”

Nothing in either study is a statement about the algorithm. Both are statements about which patients, which encounters, which time windows and which recorded outcomes the system was fed.

  • Fraud detection: transactions must be linked to accounts, devices, merchants, and later investigation outcomes without leaking future decisions.
  • Recommendations: impressions, clicks, skips, purchases, catalog state, and eligibility rules must share consistent user and item identities.
  • Predictive maintenance: sensor readings need clock alignment, device-health flags, maintenance windows, and labels tied to actual failure horizons.
  • Demand forecasting: sales must be reconciled with stockouts, promotions, returns, store closures, holidays, and changing product hierarchies.
  • Clinical operations: encounters, measurements, interventions, and outcomes require careful time anchoring, because treatment can alter later observations. In the Michigan validation — 27,697 patients, 38,455 hospitalizations, 6 December 2018 to 20 October 2019 — the Epic Sepsis Model reached an AUC of 0.63 (95% CI, 0.62–0.64) against the vendor's claimed 0.76–0.83. Sensitivity was 33%. The alert threshold score of 6 or higher was reached in 18% of hospitalizations.

The model is the visible tip of a larger system

A trained model is usually a small artifact at the end of a long data path. Along that path, events are generated, transported, stored, joined, filtered, labeled, transformed, split, versioned, and finally consumed.

Most silent failures happen before optimization begins. A missing event, a reused identifier, a late label, or a future-looking join can create impressive metrics that collapse in production. That last failure has been counted, not merely warned about. Kapoor and Narayanan went through the reviews published in fields that had taken up machine learning, and summarised what they found in Patterns in 2023: “Through a survey of literature in fields that have adopted ML methods, we find 17 fields where leakage has been found, collectively affecting 294 papers and, in some cases, leading to wildly overoptimistic conclusions.” Seventeen fields, 294 papers, and eight types of leakage, temporal leakage and illegitimate features among them. None of those papers went wrong at the optimizer.

ML data engineering makes those upstream assumptions explicit and testable. It treats data as a maintained product with consumers, service expectations, change control, and recovery procedures.

The discipline is broader than cleaning. It connects business meaning, time, identity, statistics, software, and operations so that a model sees the evidence the team believes it sees.

The structural version of that argument came out of Google in 2015. Sculley and nine colleagues drew the model as a small black box in the middle of the page, and the caption says why the drawing looks like that: “Only a small fraction of real-world ML systems is composed of the ML code, as shown by the small black box in the middle. The required surrounding infrastructure is vast and complex.” The debts the paper names accumulate out there in the surrounding boxes, not in the model. Boundary erosion, entanglement, hidden feedback loops, undeclared consumers and data dependencies are all on the abstract's list.

Reliable learning begins with a reliable account of what happened, to whom, and when.

Visual

From real-world activity to a model-ready example

The stages are connected. Each stage still answers to a different owner and fails in a different way.

The shape of that path is not a house convention. Amershi and eight colleagues at Microsoft studied software teams there building AI applications, and published what they saw in 2019; the paper took Best Paper. Their Figure 1 draws nine stages, and its caption states both the split and the loops: “The nine stages of the machine learning workflow. Some stages are data-oriented (e.g., collection, cleaning, and labeling) and others are model-oriented (e.g., model requirements, feature engineering, training, evaluation, deployment, and monitoring). There are many feedback loops in the workflow.”

Three of the nine — collection, cleaning, labeling — are data work that happens before there is a model to speak of. Their abstract names that data work as the first of the three ways in which AI differs fundamentally from prior software domains.

FigureProcess · 5 steps
  1. 1. Generate

    Products, sensors, people, and external systems create observations with business meaning.

  2. 2. Capture

    Instrumentation records events, identifiers, timestamps, consent state, and source metadata.

  3. 3. Curate

    Pipelines validate schemas, resolve entities, join sources, and publish dependable datasets.

  4. 4. Learn

    Training code selects features, labels, splits, and snapshots under a reproducible protocol.

  5. 5. Operate

    Serving, monitoring, feedback, and refresh decisions create new data and new obligations.

The lifecycle is a loop because deployed systems change the data that future models will receive.

Key idea

Data dependencies accumulate hidden technical debt

What looks like one column may depend on many upstream services, definitions, and schedules. A small source change can then alter model behavior without anyone touching the training code. Sculley and nine Google colleagues gave this family of failures its vocabulary in Hidden Technical Debt in Machine Learning Systems, in 2015. One entry is the undeclared consumer: a team removes a field that appears unused and breaks a shadow pipeline, or an offline evaluation dataset it never knew existed. Section 2 of the paper, “Complex Models Erode Boundaries”, explains why this is the normal case rather than a lapse: “Undeclared consumers may be difficult to detect unless the system is specifically designed to guard against this case, for example with access restrictions or strict service-level agreements (SLAs). In the absence of barriers, engineers will naturally use the most convenient signal at hand, especially when working against deadline pressures.” The same paper coins the principle that makes every input suspect. No input is ever really independent, which the authors name CACE, “Changing Anything Changes Everything”. Amershi and colleagues reached the same conclusion from the industrial side, reporting from Microsoft teams that data discovery, management and versioning is the fundamental difference, and that models may be “entangled”.

The dependency that decides the outcome need not be a column anyone declared. Zech and colleagues trained pneumonia-screening CNNs on 158,323 chest radiographs drawn from three hospital systems. In PLOS Medicine in 2018 they reported what the networks could actually read off an image: “CNNs were able to directly detect hospital system of a radiograph for 99.95% NIH (22,050/22,062) and 99.98% MSH (8,386/8,388) radiographs.” The same networks performed worse on outside hospitals in 3 of 5 natural comparisons. Geirhos and colleagues recount the case in Nature Machine Intelligence, in a paper on shortcut learning: “The model had unexpectedly learned to identify particular hospital systems with near-perfect accuracy (e.g. by detecting a hospital-specific metal token on the scan…)”. Provenance was never a feature in the training code. It was in the pixels, and disease prevalence differs by site, so the shortcut paid.

Dependency control is therefore an operational discipline: ownership, contracts, lineage, deprecation windows, and tests at boundaries. Monitoring only the final model score detects these failures late. In the radiograph case it would not have detected them at all — not until the model met a hospital it had never been trained on.

The most dangerous dependency is one that exists operationally but is absent from the system map.

Case

Data cascades: pervasive, invisible, delayed

Somebody has put a number on how widespread these problems are in applied AI work. Sambasivan and colleagues at Google Research interviewed 53 practitioners applying AI in India, East and West African countries, and the USA, and published the study in 2021 under a title taken from what they heard: “Everyone wants to do the model work, not the data work”. They named the pattern data cascades: compounding events with negative downstream effects that begin in the data.

Their one-line summary of the finding is blunt enough to be worth quoting exactly. Data cascades are “pervasive (92% prevalence), invisible, delayed, but often avoidable”.

Every adjective in that sentence is an engineering instruction. Pervasive means the default assumption should be that a cascade is present. Invisible and delayed together mean the detection has to be designed in advance, because the failure will not announce itself at the moment it is created. Avoidable is the reason the rest of this lesson exists.

Comparison

Three ways teams relate to data

The same team can use all three patterns. Critical ML systems need the guarantees of a maintained data product.

FigureComparison · 3 columns

Ad hoc extract

A person assembles a dataset for one experiment.

  • Fast for exploration
  • Definitions live in notebooks or memory
  • Reproduction depends on the original author
  • Best for disposable questions, not recurring decisions

Automated pipeline

Code turns named sources into repeatable outputs.

  • Inputs and transformations are reviewable
  • Schedules and retries reduce manual work
  • Tests can block malformed outputs
  • Still needs ownership and consumer contracts

Data product

A team operates a dataset for known consumers.

  • Meaning, freshness, and quality are documented
  • Breaking changes follow a migration plan
  • Lineage supports impact analysis and debugging
  • Appropriate for business-critical ML workflows

Steps

A boundary walk for any ML project

Before selecting tools, trace one prediction from the real-world event back to every data dependency.

The walk has a published target list. Kapoor and Narayanan's leakage taxonomy sorts the failures into eight types, temporal leakage and illegitimate features among them. What one of those types is worth has since been measured in a single field. Working across four datasets and over 400 pipelines in neuroimaging, Rosenblatt and colleagues reported in Nature Communications in 2024 that leakage through feature selection inflated the reported correlation by Δr = 0.03–0.52, and that small datasets made it worse: “Leakage via feature selection and repeated subjects drastically inflates prediction performance, whereas other forms of leakage have minor effects.”

An inflation of 0.52 in correlation is not a rounding artifact. It is the difference between a publishable result and nothing. Neither of those two failures is visible in the feature table. Both are decided upstream, in what was joined and when.

FigureProcess · 5 steps
  1. 1. Name the decision

    Write the action, prediction time, subject, and consequence in one sentence.

  2. 2. Identify evidence

    List the observations legitimately available before that decision.

  3. 3. Trace production

    Follow each observation to its source, owner, timestamp, and transformation.

  4. 4. Mark guarantees

    Record required freshness, completeness, uniqueness, privacy, and historical correctness.

  5. 5. Plan failure handling

    Define what happens when a source is late, missing, duplicated, or semantically changed.

A useful architecture diagram includes assumptions and failure responses, not only boxes and arrows.

Analogy

Calibration decides what the researcher can see

No microscope creates its specimen, and yet calibration determines what the researcher can observe. An ML data system sits in the same place. Source events are the specimen. Instrumentation, joins, and transformations are the lenses. Validation checks are calibration routines, while lineage records which settings produced each observation.

A specimen does not react to being looked at. This instrument changes the data it will later receive: recommendations change clicks, fraud controls change attacker behavior, medical decisions change outcomes. It is part of the environment it measures.

Google Flu Trends is the documented case. Lazer and three colleagues reconstructed it for Science in 2014. The method had been to find the best matches among 50 million search terms against 1,152 CDC data points. What that search found was in part a season rather than a disease: “In short, the initial version of GFT was part flu detector, part winter detector.”

The system missed the 2009 H1N1 pandemic. Then it over-predicted flu for 100 of the 108 weeks starting August 2011. The authors name two causes, “big data hubris” and “algorithm dynamics” — the search service being changed by its engineers and used differently by its users, so that the signal the model had been calibrated against moved underneath it. Olson and colleagues had documented the same behaviour independently in PLOS Computational Biology, describing the system “completely missing the first wave of the 2009 influenza A/H1N1 pandemic” and “greatly overestimating the intensity of the A/H3N2 epidemic during the 2012/2013 season”.

A microscope that reshaped its specimen every quarter would need recalibrating every quarter. So does this.

A dataset is not a neutral window onto reality; it is a measurement produced by a designed system.

What “model-ready data” should mean

Model-ready does not mean that a table can be loaded into a notebook. It means the team can explain the row, the target, the time boundary, the allowed sources, and the transformation version. The dataset should be reproducible from named inputs or a preserved snapshot. Its known limitations, intended uses, restricted uses, and quality checks should be available to downstream users. A mature team should also answer operational questions about ownership, freshness, consumers, change impact, and rollback.

That list is not only a house standard. On 27 October 2021 three regulators — the US FDA, Health Canada and the UK's MHRA — jointly published “Good Machine Learning Practice for Medical Device Development: Guiding Principles”. Ten numbered principles, of which three are squarely about the data layer: principle 3, representativeness of the intended patient population; principle 4, independence of training and test sets; principle 5, reference datasets built by best available methods, with the limitations of the reference understood. A fourth, principle 2, names “data quality assurance, data management” and “data authenticity and integrity” among the software-engineering and security fundamentals.

Principle 4 is worth reading in full, because it is an evidence contract rather than a metric: “Training and test datasets are selected and maintained to be appropriately independent of one another. All potential sources of dependence, including patient, data acquisition, and site factors, are considered and addressed to assure independence.” Site factors, in the language of three regulators, is the failure Zech and colleagues measured.

What the absence of such a contract costs was measured twice on the same literature. Roberts and colleagues screened 2,212 studies of machine learning for COVID-19 from chest radiographs and CT scans. Initial screening left 415, quality screening left 62, and in Nature Machine Intelligence in 2021 they reported: “Our review finds that none of the models identified are of potential clinical use due to methodological flaws and/or underlying biases.” Wynants and colleagues ran the same exercise for the BMJ, in a living review whose literature search closed on 7 April 2020. They reviewed 51 studies describing 66 prediction models, rated every one at high or unclear risk of bias, and closed: “Hence, we do not recommend any of these reported prediction models to be used in current practice.”

Two review teams, two publishers, 66 models on one side and 62 surviving studies on the other, and not one recommendation between them. Not because the architectures were wrong, but because of how the data had been assembled.

Together, those answers form the definition of done for the data layer. Accuracy cannot compensate for uncertainty about what the training examples actually represent.

Model-ready is a set of verifiable guarantees, not a file format.

Key takeaways