🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Vertex AI: Feature Store, Pipelines & Data Labeling

GCP Data EngineeringVertex AIđŸŸĸ Free Lesson

Vertex AI for Data Engineering

Master Vertex AI including Feature Store, Pipelines, data labeling, and ML integration patterns for data engineers.

18 min readAdvanced

What You'll Learn

  • 1Explain training-serving skew and describe how an offline and online feature store remove it
  • 2Ingest BigQuery features into a Feature Store entity type and publish them to the online store
  • 3Compile a Kubeflow Pipelines v2 workflow and run it as a Vertex AI PipelineJob
  • 4Choose between BigQuery ML, AutoML, and custom training using cost, latency, and control

A data engineer owns the seam between a table and a model that scores in production. On Vertex AI that seam is a stack of four services with separate billing units and separate failure modes: a feature layer that keeps training and serving values identical, a pipeline layer that reruns every step as a versioned artifact, a training layer spanning AutoML and custom containers, and a serving layer that exposes online endpoints and batch jobs. A mistake in one layer surfaces months later as skew, a silent retraining loop, or an invoice nobody can explain.

Where skew comes from and what a feature store changes

Training-serving skew appears when a nightly SQL job builds training rows while the live endpoint reads an application database, and the two implementations round, bucket, or default differently. The model learns one distribution and scores against another, accuracy decays, and nothing raises an error. A feature store removes the second implementation: definitions live in one place, historical values stay in an offline store so training queries can perform point-in-time joins, and the online store serves the newest accepted value at scoring time. Both paths then read the same definition, so the only remaining difference is latency.

The object model is small and worth memorising. A feature store contains entity types such as users or orders, each entity type holds typed features, and every feature is addressed by a stable entity id that you choose. Offline values live in BigQuery tables you can audit with SQL; online values live in a Google-managed store read by prediction requests. A sync step moves accepted rows from offline to online, which is why a value can already be visible in BigQuery and still miss at scoring time.

Ingesting features from BigQuery

Ingestion is a load job, not a streaming design. You declare each feature with a value type, point the loader at a BigQuery table, and name the column that carries the entity id. Declared types are enforced on write, so an INT64 feature rejects a FLOAT64 source instead of silently coercing it and schema drift surfaces at load time rather than at scoring time. Backfills reuse the same command over the full history, and incremental loads append only the rows that changed since the last watermark.

python
from google.cloud import aiplatform

aiplatform.init(project='my-project', location='us-central1')

featurestore = aiplatform.featurestore.Featurestore.create(
    featurestore_id='user_features',
    online_store_fixed_node_count=10
)

entity_type = featurestore.create_entity_type(
    entity_type_id='users',
    description='User features keyed by user_id'
)

entity_type.create_feature(
    feature_id='age',
    value_type=aiplatform.featurestore.ValueType.INT64,
    description='Age in whole years'
)
entity_type.create_feature(
    feature_id='segment',
    value_type=aiplatform.featurestore.ValueType.STRING,
    description='Marketing segment label'
)

entity_type.ingest_from_bq(
    feature_ids=['age', 'segment'],
    bq_source_uri='bq://project.dataset.users',
    entity_id_field='user_id'
)

latest = entity_type.read(
    entity_ids=['user_123', 'user_456'],
    feature_ids=['age', 'segment']
)
print(latest)

After ingestion, training reads through the same entity type with an as-of timestamp so the join cannot see a value that arrived after the label was recorded. That single call is what stops accidental leakage from future columns into training rows.

Pipelines make the workflow rerunnable

Notebooks are fine for exploration and hostile to review. Vertex AI Pipelines compiles a Kubeflow Pipelines v2 definition into an immutable JSON template, stores it in your bucket, and runs each task as a container on a managed cluster. Every run records parameters, artifacts, and logs in Vertex ML Metadata, so you can compare yesterday's run against today's without reading a terminal scrollback. Two properties matter for data engineers: a component that already produced its artifact can be served from cache on the next run, and a single failed task can be retried without replaying the whole graph.

python
from google_cloud_pipeline_components.v1 import BigQueryQueryJobOp
from kfp import dsl

@dsl.component(base_image='python:3.11')
def report_job_stats(job: str) -> None:
    """Log rows and bytes for the upstream query so regressions are visible."""
    from google.cloud import bigquery

    parts = job.split('/')
    client = bigquery.Client(project=parts[1])
    rows = client.get_job(parts[5], location=parts[3]).query_results()
    print(f'rows={rows.total_rows} bytes={rows.total_bytes_processed}')

@dsl.pipeline(
    name='churn-feature-pipeline',
    pipeline_root='gs://my-pipeline-root'
)
def churn_pipeline(project: str):
    extract = BigQueryQueryJobOp(
        query='SELECT * FROM `project.dataset.raw_features`',
        project=project,
        location='us-central1'
    )
    report_job_stats(job=extract.outputs['job'])

The compiled template is submitted with aiplatform.PipelineJob, which takes the template path, the pipeline root, and a service account whose only rights are the ones the steps need. Run the pipeline under a narrow service account rather than your own credentials; a pipeline that can impersonate a human will eventually do so in an automated context.

Choosing a training path

How much of the lifecycle you hand to the platform is a cost decision as much as a modelling one. The table below frames the four paths data engineers are asked to defend in design reviews.

PathTraining interfaceFeature reuseServing shapePay for
BigQuery MLSQL CREATE MODELViews in the same datasetSQL prediction queriesBytes scanned
Vertex AutoMLUI, CLI, or PythonFeature Store entity typesEndpoint or batch jobTraining and node hours
Vertex custom trainingYour container and frameworkFeature Store entity typesEndpoint or batch jobTraining and node hours
Pipelines plus Feature StoreKubeflow componentsCentral, versioned registryEndpoint plus batch backfillOrchestration and serving nodes

AutoML buys speed and automatic feature engineering for tabular, image, text, and video tasks; you pay per training node hour and give up control of the model class. Custom training keeps your preprocessing, which is exactly the code that must match serving, and shifts the maintenance burden to you. BigQuery ML wins when predictions are consumed by other SQL and nobody needs millisecond latency.

Labeling data for supervised tasks

Managed labeling turns raw rows, images, or text into a training set with a review loop. You create a dataset, define annotation specs that act as the class taxonomy, open a labeling queue, and assign reviewers. Each item records who labeled it, when, and with what comment, and a queue can demand agreement between reviewers so disagreements surface before training rather than after a recall regression. A pre-label pass can run a model over each item first, turning the reviewer's job into verification; that cuts time per label but anchors weak reviewers to weak predictions, so keep a blind sample in the queue to measure pre-label quality.

Labels export back to BigQuery or GCS as a versioned table, and the version is the thing you pin in a training run. A model whose training metadata points at "the labels table as of Friday" cannot be reproduced, which is the whole reason to keep labeling inside the pipeline rather than in a spreadsheet.

Serving predictions and watching the model

Two serving shapes cover almost every requirement. An online endpoint holds a model behind an autoscaling replica pool, and you control cost with a minimum and maximum replica count; scale to zero when traffic is bursty and the endpoint stops billing for idle capacity. Batch prediction reads a BigQuery table or a set of files, runs asynchronously, and writes results where downstream jobs expect them, which is the right tool for a nightly backfill of two hundred million rows.

gcloud ai models upload \
  --display-name=churn-v3 \
  --container-image-uri=us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-0:latest \
  --artifact-uri=gs://my-models/churn/3

gcloud ai endpoints create --display-name=churn-serving

gcloud ai endpoints deploy-model 1234567890 \
  --model=9876543210 \
  --display-name=churn-v3 \
  --machine-type=n1-standard-2 \
  --min-replica-count=1 \
  --max-replica-count=4

Model Monitoring then learns a baseline from the training data and compares live requests and predictions against it, raising log entries and alert policies when a feature drifts or predictions cluster in an implausible range. Prediction request logging copies inputs and outputs into BigQuery so you can join drift reports against business outcomes after the fact.

When BigQuery ML is the better home

If the features already live in BigQuery, the consumers are other SQL queries, and latency budgets are measured in seconds rather than milliseconds, create the model in SQL and skip the serving tier entirely. BigQuery ML trains gradient boosted trees, logistic regression, matrix factorisation, and embedding-based models, evaluates them with ML.EVALUATE, and scores with ML.PREDICT inside the same warehouse where governance already applies. You give up custom frameworks, custom loss functions, and a low-latency endpoint, and you gain a deployment step that is a reviewed pull request against a SQL file.

Common Mistakes

Training from a CSV exported to a laptop while the endpoint reads Feature Store

Fix: Pull training rows through an as-of read of the same entity type the endpoint uses so both sides share definitions.

Ingesting features and calling predict in the same deployment step

Fix: Ingest, then run the offline-to-online sync, then deploy; online values lag the offline copy until the sync finishes.

Running every pipeline under a human service account

Fix: Create a pipeline service account with least privilege and grant it only the dataset, bucket, and endpoint roles the steps need.

Best Practices

  • Pin every training run to a feature snapshot and a label version so results are reproducible
  • Keep feature transformations in one component that both training and backfill pipelines call
  • Alert on drift and on prediction volume, not only on errors, because a silent model is a silent failure

Key Takeaways

  • Feature Store keeps one definition: offline values in BigQuery for point-in-time training joins, online values for scoring
  • Ingestion enforces declared value types on write, so schema drift fails at load time instead of at predict time
  • Vertex AI Pipelines compiles Kubeflow v2 into an immutable template and records every run, artifact, and retry in ML Metadata
  • AutoML trades control for speed, custom training trades speed for parity with serving, BigQuery ML trades latency for SQL simplicity

Interview Questions

Q1: What is training-serving skew and how does Feature Store reduce it?

Skew is the difference between the feature values a model trained on and the values it receives at scoring time. Feature Store gives both paths a single definition and a single ingest, so training reads historical values with a point-in-time join and serving reads the synced online copy; only latency differs.

Q2: Why does a freshly ingested feature sometimes not appear in predictions?

Ingestion writes the offline store first. A separate sync publishes accepted rows to the online store, so between ingest and sync the prediction request still reads the previous value. Check the sync status before blaming the endpoint.

Q3: When would you choose AutoML over custom training?

Choose AutoML for standard tabular, image, text, or video tasks where time to first model matters and the feature set is already clean. Choose custom training when you must control the algorithm, apply bespoke preprocessing, or keep training code identical to serving code.

Q4: How do batch and online prediction differ operationally?

Online prediction serves small requests from an autoscaling replica pool you size with min and max replicas, and bills for node time. Batch prediction runs asynchronously over a table or files and writes results to BigQuery or GCS, which suits nightly backfills without holding capacity open.

Q5: What does a Vertex AI Pipeline give you that a cron job does not?

A compiled immutable template, parameterised runs, per-task retries and caching, artifacts tracked in Vertex ML Metadata, and a run history you can diff. A cron job gives you a log file and whatever state the last successful run left behind.

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-14

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert GCP Data Engineering Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement