CV Courseversity

Data Engineering for AI

Covers data pipeline design — collection, ingestion, transformation, validation, and storage — plus data provenance and lineage as the discipline that keeps AI training data trustworthy and traceable.

“A model trained on last quarter's data starts making bizarre predictions in production, and nobody can say for certain which raw data source those training records came from, how they were cleaned, or whether a formatting bug crept in during ingestion. Could you retrace, step by step, where every row in a training set actually came from — and would your pipeline have caught the bad data before it ever reached the model? This module is about building pipelines that can answer both questions.”

Data Collection, Ingestion, and Pipelines · 15 min

A data pipeline, in Google Cloud's framing, fundamentally "moves data from one system to another" by reading from sources and writing to sinks, and successful pipeline design starts not with the technical stages but with defining measurable Service Level Objectives (SLOs) — targets like data freshness, correctness, and processing deadlines — before any implementation begins. Worked example: a pipeline feeding a fraud-detection model might set an SLO of "new transaction data must be available to the model within 15 minutes of occurring, with fewer than 0.1% of records dropped or malformed"; that single sentence then dictates architectural choices — whether the pipeline streams continuously or runs in scheduled batches, how much retry logic ingestion needs, and how aggressively validation must reject bad records before they reach the model.

Ingestion is the first concrete stage: pulling raw data from its source system, whether that is an API, a file drop, a database change stream, or a third-party data feed, and landing it somewhere the rest of the pipeline can process it reliably. Google Cloud's guidance notes that because a pipeline reads from external sources and writes to external sinks, the pipeline's achievable performance is directly limited by those external systems' own scalability and quota limits — a pipeline cannot promise 15-minute freshness if the upstream API it depends on only refreshes its own data hourly, so understanding a source's real update cadence and rate limits is a precondition for setting any SLO honestly rather than aspirationally.

The same guidance discusses the architectural choice between a single pipeline handling all data flows and multiple specialized pipelines, noting that when different data flows carry meaningfully different priorities or deadline requirements, separate pipelines can isolate resources so a slow, low-priority batch job cannot starve a time-critical stream of the compute or network capacity it needs to hit its own SLO. This decomposition mirrors the modular software design covered elsewhere in this domain: just as splitting a monolithic script into independently testable functions contains bugs and eases change, splitting a data platform into pipelines scoped to distinct SLOs contains performance problems and makes each pipeline's behavior easier to reason about on its own.

Transformation, Validation, and Storage · 15 min

Once raw data has been ingested, it rarely arrives in the shape a model or downstream analysis needs directly — timestamps in inconsistent formats, missing fields, categorical labels spelled inconsistently across sources — so a transformation stage cleans, reshapes, and standardizes it before storage. Worked example: a pipeline ingesting customer support tickets from three different systems might need to transform each system's own status vocabulary ("closed," "resolved," "done") into one standardized value before the records can be safely combined into a single training set; skipping this step would leave a model treating three descriptions of the same real-world state as three different categories.

Validation is the step that decides whether transformed data is trustworthy enough to store and use, and it is where an engineering discipline explicitly named in this module's essential question — catching bad data before it reaches the model — actually happens: automated checks for missing required fields, values outside plausible ranges, unexpected duplicate records, or a sudden shift in the distribution of an important column compared to prior data. This connects directly to the practice, described in Google's Machine Learning Crash Course, of partitioning a dataset into training, validation, and test sets before model development begins: validated, clean data flowing consistently through a pipeline is the precondition for that split to mean anything, because a validation or test set contaminated with the same ingestion bugs as the training data will not actually reveal how the model performs on trustworthy, representative inputs.

Storage is the pipeline's final stage for a given run, and the right storage model is exactly the deliberate choice covered in the databases module of this domain: cleaned tabular records with a stable schema often belong in a relational or columnar warehouse table queryable by SQL, semi-structured records with variable shape may belong in a NoSQL document store, and text or image data destined for retrieval by semantic similarity may need to be embedded and written into a vector database. A data engineering pipeline, in other words, is not a separate discipline from the storage decisions covered earlier in this module sequence — it is the mechanism that gets clean, validated, well-understood data into whichever of those storage models actually fits the downstream use case.

Data Provenance and Trustworthy AI Pipelines · 15 min

Even a well-designed, validated pipeline is not fully trustworthy unless it also records where its data came from and what happened to it along the way — this is data provenance, which the W3C's PROV standard defines as "information about entities, activities, and people involved in producing a piece of data or thing, which can be used to form assessments about its quality, reliability or trustworthiness". PROV structures this information around three core concepts: an entity (the object being described, such as a specific version of a training dataset), an activity (a processing step that produces or transforms data, such as the transformation stage from the previous lesson), and an agent (the person, team, or automated system responsible, such as "the nightly ingestion job" or "the data engineering team").

Applied to this module's opening scenario — a model behaving strangely in production and nobody able to say where its training records came from — a pipeline that records provenance at every stage can answer exactly that question: which raw source an entity (a training record) originated from, which activity (which specific run of the ingestion and transformation pipeline, on which date, with which code version) produced its current form, and which agent was responsible for that run. Worked example: if a transformation step's status-vocabulary mapping had a bug for one week, provenance metadata recording the pipeline run and code version associated with every record lets an engineer precisely identify and remediate only the affected records, rather than distrusting the entire dataset or, worse, not being able to tell which records are suspect at all.

This traceability, often called data lineage when described as the path data traveled through a pipeline's stages, is what separates a data pipeline that merely produces output from one that produces defensible, auditable output — a distinction that matters increasingly as AI systems face scrutiny over exactly the question this module opened with: can you actually retrace, step by step, where a given piece of training data came from and how it was handled. Building provenance recording into a pipeline from the start, alongside the SLOs, ingestion, transformation, and validation stages covered earlier in this module, is what turns "we have a data pipeline" into "we have a data pipeline whose outputs we can trust and explain."

Practice

From Raw Source to Trustworthy Data

Source Ingest Transform Validate Store Provenance record Entity (dataset version) · Activity (pipeline run) Agent (job / team responsible)

Raw data moves through ingest, transform, validate, and store stages, with a provenance record tracking the entity, activity, and agent behind every stage.

  • Define a measurable SLO — like data freshness or acceptable error rate — before choosing a pipeline's architecture, not after.
  • Validation is what stops bad data from reaching training, validation, and test sets and silently invalidating what those splits are supposed to measure.
  • Provenance metadata (entity, activity, agent) is what lets an engineer trace a bad production prediction back to the exact pipeline run and code version that produced the underlying data.

Recall Practice

Pipeline designClick to reveal
Before choosing whether a pipeline should stream continuously or run in scheduled batches, what should be defined first, per Google Cloud's guidance?
A measurable Service Level Objective (SLO), such as data freshness or correctness, since that target is what determines the right architectural choices for ingestion and processing.
IngestionClick to reveal
A pipeline promises 15-minute data freshness, but the upstream API it ingests from only refreshes its own data hourly. What does this reveal about the SLO?
The SLO was set without accounting for the source system's real update cadence, which limits the pipeline's achievable performance — an honest SLO must be bounded by what upstream sources can actually deliver.
ValidationClick to reveal
Why does a corrupted or unvalidated dataset undermine the standard practice of splitting data into training, validation, and test sets?
Because that split only reveals genuine model performance if all three sets are clean and representative; if ingestion bugs contaminate the data before the split, the validation and test sets will share the same flaws as training data and fail to expose the problem.
ProvenanceClick to reveal
A transformation step had a bug for one week that mis-mapped some ticket statuses. How does recording provenance at every pipeline stage help fix this without discarding the whole dataset?
Because provenance records which pipeline run (activity), code version, and responsible job (agent) produced each record (entity), an engineer can precisely identify only the records from that buggy week and remediate them rather than distrusting or discarding the entire dataset.

Glossary

Data pipeline
A system that moves data from a source to a destination through stages such as ingestion, transformation, validation, and storage.
Ingestion
The stage of a pipeline that pulls raw data from its source system and lands it for further processing.
Service Level Objective (SLO)
A measurable target, such as data freshness or correctness, that a pipeline's design is meant to satisfy.
Data validation
Automated checks applied to data — for missing fields, out-of-range values, or distribution shifts — to catch problems before storage or use.
Data provenance
Information about the entities, activities, and agents involved in producing a piece of data, used to assess its trustworthiness.
Data lineage
The traceable path data has taken through a pipeline's stages, from its original source to its current form.
Practical Activity

Design a Data Pipeline from a Supplied Data Source Description

Given a supplied written description of a messy raw data source (e.g., customer support tickets exported inconsistently from three different systems) and a target use case, learners diagram on paper the ingestion, transformation, validation, and storage stages a pipeline would need, state one SLO the pipeline should meet, and note what provenance metadata (entity, activity, agent) should be recorded at each stage. This is a virtual, paper-based design exercise — no pipeline software is executed.

Ready to test yourself?

5 questions on this module.

Start Quiz