Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Google Cloud · Professional Data Engineer

Data for ML and AI

Professional Data Engineer · Lesson 18 of 23 · 2:10:45

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Google Cloud Professional Data Engineer exam, on the official exam guide. In this lesson: features, leakage, and training-serving skew, Feature Store, BigQuery ML with the transform clause, imported and remote models, embeddings and vector search, and preparing unstructured data in chunks for retrieval-augmented generation. Includes three original practice questions, with Cymbal Mobility, a fictional ride-hailing and scooter company, as the example.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Two AI projects

Cymbal Mobility wants to predict which riders are about to stop using the app. Support agents also want to ask questions, in plain language, about thousands of policy documents. Both projects depend on the data engineer: clean features for the model, and well-prepared documents for the assistant.

Feature engineering

Good models start with clean data: handle missing values and outliers, and remove repeated rows. Encode categories, scale numbers, bucket values like distances, and build features from history, like the trips of the last thirty days. Avoid leakage: never use information that would not be known at prediction time, and split training and evaluation data by time, when the data has a time order. Apply exactly the same preprocessing at training and at serving, or predictions drift, which is called training-serving skew. To share features across teams and serve them online, Feature Store reads them directly from BigQuery tables or views.

BigQuery ML

BigQuery ML trains and runs models with SQL, inside the warehouse, so the data does not move. It supports linear and logistic regression, boosted trees, random forests, k-means clustering, time series forecasting, and more. The transform clause defines preprocessing inside the model, and BigQuery applies it automatically at evaluation and prediction time. The evaluate function measures quality, and the predict function scores new rows, in the same SQL. Remote models call models deployed on Gemini Enterprise Agent Platform, and imported models, like ONNX or TensorFlow, run inside BigQuery.

Embeddings and vector search

An embedding is a vector of numbers that captures the meaning of text, an image, or audio, so similar items get close vectors. In BigQuery, create a remote model over an embedding model, then call the AI dot generate embedding function on a column. Autonomous embedding generation can maintain an embedding column for you, as the source column changes. Vector search finds the embeddings nearest to a query, for semantic search or recommendations. A vector index, of the IVF or TreeAH type, uses approximate nearest neighbor search, trading a little recall for much lower latency and cost.

Unstructured data and RAG

Unstructured data, like PDF files and images, stays in Cloud Storage, and object tables expose it to BigQuery, with access delegated to the table. The process document function calls Document AI to parse each file, and the text is then split into chunks, small enough to embed and retrieve. Retrieval-augmented generation, or RAG, answers a question in three steps: embed the question, find the nearest chunks with vector search, and pass them to a Gemini model with the question. The answers rely on trusted and current data, not only on what the model learned. Keep the chunks and embeddings fresh as documents change, and keep access controls on the source files.

Recap

Let's recap. Clean features, avoid leakage, and apply the same preprocessing at training and at serving. BigQuery ML trains models with SQL, and its transform clause travels with the model. Remote and imported models bring outside models to the warehouse. Embeddings capture meaning, and a vector index makes vector search fast at scale. And RAG chunks and embeds documents, retrieves the nearest chunks, and grounds Gemini in current data.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. A churn model in BigQuery ML scales distances and encodes cities in its training query, but production predictions look wrong, because the scoring query prepares the data differently. What should the data engineer do?

    • Move the preprocessing into a TRANSFORM clause
    • Retrain the model every hour with fresh data
    • Add several more years of training data
    • Replace it with a remote model on Agent Platform
    Show the answer

    Move the preprocessing into a TRANSFORM clause

    Preprocessing in the transform clause is stored with the model, and applied the same way at prediction time. “Retrain the model every hour with fresh data” would retrain with the same mismatch, again and again. “Add several more years of training data” adds data, but leaves the two preparations different. And “Replace it with a remote model on Agent Platform” only moves the model elsewhere, with the same skew.

  2. Agents search past tickets by meaning, not keywords, over fifty million ticket embeddings, and each search is too slow and too expensive. What should the data engineer add?

    • A search index on the ticket text column
    • Clustering of the table on the ticket date
    • A larger BI Engine reservation in the region
    • A vector index on the embedding column
    Show the answer

    A vector index on the embedding column

    A vector index uses approximate nearest neighbor search, which cuts latency and cost. “A search index on the ticket text column” speeds up keyword searches, not searches by meaning. “Clustering of the table on the ticket date” helps filters on dates, not the distance between vectors. And “A larger BI Engine reservation in the region” accelerates dashboards, not vector search.

  3. Support agents must ask questions in plain language about two thousand policy PDF files in Cloud Storage, and answers must rely on the current policies only. What should the data engineer build?

    • A model fine-tuned once on all the policies
    • Retrieval over embedded chunks, then Gemini
    • A logistic regression model in BigQuery ML
    • A search index on the PDF file names only
    Show the answer

    Retrieval over embedded chunks, then Gemini

    Retrieval over embedded chunks gives Gemini the current policy text for each question. “A model fine-tuned once on all the policies” would freeze the policies at training time, and miss every later change. “A logistic regression model in BigQuery ML” predicts numbers or classes, and cannot answer questions in plain language. And “A search index on the PDF file names only” only matches file names, not the content of the policies.