Prepare and test your skills
Prepare and test your skills
Building models with low-code tools means matching the business goal, data location, and latency need to the right training environment. BigQuery ML (opens in a new tab) trains with SQL where warehouse data already lives, Vertex AI AutoML automates architecture search and tuning, and custom training on Gemini Enterprise Agent Platform (opens in a new tab) handles everything else. Data flows from storage to training through the BigQuery Storage API, BigQuery I/O connector, or Cloud Storage sharded reads, and the correct choice preserves data locality while avoiding custom code when a predefined routine is enough.
The three training environments differ by where data lives, how much automation they provide, and where models can serve. BigQuery ML keeps tabular workflows in the warehouse, AutoML automates model search for supported modalities, and custom training removes constraints on model type and platform consistency. Selection follows a fixed order: first confirm BigQuery locality and SQL fit for BigQuery ML, then confirm AutoML format and latency fit for AutoML, and only after both fail select custom training.
| ML environment | Training and serving model | Choose when |
|---|---|---|
| BigQuery ML | Data, infrastructure, and predefined types operate in one BigQuery system with SQL training | All data is in BigQuery, the team uses SQL, and an available model type matches the problem |
| AutoML | Prebuilt routines automate architecture choice, tuning, and provisioning; models serve from Google Cloud or edge | Data and objective match a supported format, and text, video, or tabular use tolerates greater than 100ms latency |
| Custom training on Agent Platform | User-owned routines run serverless with tuning, TensorBoard, metadata, and monitoring | The problem fits neither option, or training must stay consistent with on-premises or other-cloud pipelines |
BigQuery ML can also train AutoML tabular models from the BigQuery ML environment, so SQL workflows can invoke automated tabular search without moving data. For large tables, partitioning improves performance and cost, and materialized tables are preferred over views or subqueries for training speed.
Exam tip: Choose BigQuery ML only when data is in BigQuery, builders use SQL, and the model type is supported; choose AutoML for text, video, or tabular models only when greater than 100ms inference latency is acceptable.
Mapping business problems to low-code model types means selecting the modeling objective first and then supplying the columns that objective requires. Classification predicts a category label, regression predicts a numeric value, forecasting predicts a future value, and clustering assigns group membership without a label. Hyperparameter tuning is enabled with the NUM_TRIALS option, where available tuning arguments vary by model type.
INPUT_LABEL_COLS for the label column, using boosted trees or AutoML regression.TIME_SERIES_TIMESTAMP_COL for time points and TIME_SERIES_DATA_COL for values to forecast, using ARIMA_PLUS and related options.RATING_COL, USER_COL, and ITEM_COL.AutoML tabular and forecasting jobs bind a managed dataset to a business objective and then search, train, and ensemble candidates into one artifact. An AutoMLTabularTrainingJob uses target_column, optimization_prediction_type such as regression, and optimization_objective such as minimize-rmse, with built-in preprocessing handling transformations automatically. Binary classification needs less data than multi-class classification or regression, and the search considers neural networks and boosted trees before ensembling top performers.
| Training class | Method | Choose when |
|---|---|---|
| AutoMLForecastingTrainingJob | AutoML | Maximum accuracy is needed with no special Seq2seq+ or TFT benefit |
| SequenceToSequencePlusForecastingTrainingJob | Seq2seq+ | Fast experimentation is needed on datasets smaller than 1 GB |
| TemporalFusionTransformerForecastingTrainingJob | Temporal Fusion Transformer (TFT) | Multi-horizon forecasting needs attention-based deep learning |
| TimeSeriesDenseEncoderForecastingTrainingJob | Time-series Dense Encoder (TiDE) | Linear-model speed with covariates plus non-linear dependencies is needed |
Tabular Workflow for End-to-End AutoML exposes control at every step in order: data splitting, feature engineering, architecture search, model training, model ensembling, and model distillation. It supports multiple terabytes and up to 1000 columns, while Tabular Workflow for Forecasting supports up to 1 TB and 200 columns. Compute is capped by budget_milli_node_hours, splits use training_fraction_split, validation_fraction_split, and test_fraction_split such as 0.6, 0.2, and 0.2, and unstructured inputs should use files of at least 100 MB sharded between 100 and 10,000 shards.
Feature engineering in BigQuery DataFrames (opens in a new tab) and BigQuery ML keeps transformation logic inside the warehouse so raw tables flow directly to training without an external cluster. The TRANSFORM clause in CREATE MODEL defines custom preprocessing during training, and learned statistics are automatically reused during prediction with ML.PREDICT. Performance comes from minimizing repeated scans and changing defaults only where accuracy gains justify compute cost.
Automatic preprocessing in BigQuery ML is the imputation and transformation that runs inside CREATE MODEL and is reapplied at prediction time. Because the logic lives with the model, training and serving stay consistent without a separate preprocessing service. Missing-data handling is deterministic by type: numeric NULL values are replaced with the column mean, one-hot and multi-hot NULL values map to an additional category while unseen prediction categories get weight 0, TIMESTAMP features mix mean Unix time with NULL categories, and each field of a STRUCT follows its type rule. Reusable supply through Knowledge Catalog discovery, BigQuery sharing, Agent Platform Feature Store, object tables, and Vector Search indexes avoids copying data for every model.
The TRANSFORM execution model defines how custom SQL moves from training to prediction in BigQuery ML. Manual functions can be used inside TRANSFORM and outside it for ad-hoc preparation, and analytic functions save training-time statistics for prediction. Every ML analytic function requires an empty OVER() clause to signal collection across all rows, and ML.TRANSFORM returns the actual preprocessed rows that enter the model.
| Function type | Input scope | Prediction behavior |
|---|---|---|
| Scalar function | Operates on one row, for example ML.BUCKETIZE | Applies the same row rule in training and prediction |
| Analytic function | Operates on all rows and returns one result per row, for example ML.QUANTILE_BUCKETIZE | Reuses training statistics for prediction input |
| Table-valued function | Operates on all rows and outputs a table, for example ML.FEATURES_AT_TIME | Performs point-in-time lookup over feature tables |
Temporal decomposition extracts hour, day-of-week, or Unix time for seasonality, polynomial expansion with ML.POLYNOMIAL_EXPAND lets linear models learn curves, and bucketization handles non-linearity. ML.BUCKETIZE uses caller-supplied boundaries while ML.QUANTILE_BUCKETIZE learns balanced-count buckets from training data. Categorical work uses ML.ONE_HOT_ENCODER, ML.MULTI_HOT_ENCODER, ML.LABEL_ENCODER, ML.HASH_BUCKETIZE for high-cardinality columns, and ML.FEATURE_CROSS to combine columns so the model learns joint effects such as device and hour-bucket together.
Exam tip: Boosted tree and random forest models skip standardization, while k-means standardizes only when STANDARDIZE_FEATURES is enabled — do not pay for scaling where tree splits do not use it.
Automated feature selection in BigQuery ML uses saved model weights to rank which inputs most influence predictions. Linear and logistic regression expose coefficients through ML.WEIGHTS (opens in a new tab), k-means exposes centroids through ML.CENTROIDS, matrix factorization exposes user and item latent factors through ML.WEIGHTS, PCA exposes eigenvectors and variance through ML.PRINCIPAL_COMPONENTS and ML.PRINCIPAL_COMPONENT_INFO, and ARIMA_PLUS exposes trend coefficients through ML.ARIMA_COEFFICIENTS. High-magnitude coefficients and frequent split features are retained, while near-zero or unused features are candidates for removal.
Boosted tree, random forest, deep neural network (DNN), wide-and-deep, and AutoML Tables models have no in-warehouse weight function and require export for inspection:
EXPORT MODEL from BigQuery ML to a Cloud Storage bucket.model.bst file from the bucket locally.model.bst to the Files area of a Colab notebook.xgb.Booster and call xgb.plot_tree per iteration to render trees.Exported trees use encoded identifiers such as f0, which map to real columns through assets/model_metadata.json, while categorical split values map by position to vocabulary files in assets/. There is no weight retrieval method for AutoML Tables models.
Continue with this study guide: Performing feature engineering or selection using BigQuery ML
Prediction in BigQuery ML runs large language model inference, vector creation, and tabular scoring directly inside SQL workflows. BigQuery ML sends rows from tables or object tables to models hosted on Vertex AI, and predictions flow back as query result rows. This design unifies batch scoring, text generation, and vector creation without moving data into separate Python serving systems.
A remote model in BigQuery ML is a model object that points to a Vertex AI foundation model or deployed endpoint. The remote model depends on a Cloud Resource connection, which provides a dedicated service account as the identity for calls from BigQuery to Vertex AI and Cloud Storage. The trust boundary sits between BigQuery on one side and Vertex AI APIs and Cloud Storage on the other, and the connection account must hold the Vertex AI User role plus read access to buckets used by object tables.
CREATE MODEL with REMOTE WITH CONNECTION naming the connection and Vertex AI ENDPOINT.ML.PREDICT, ML.GENERATE_TEXT, or ML.GENERATE_EMBEDDING where BigQuery authenticates as the connection identity.ML.GENERATE_TEXT (opens in a new tab) sends prompts to a large language model and returns generated text as structured rows. Input rows flow from a query with prompt columns into the remote text model, and output rows flow back with text, safety attributes, and metadata. Common practices include instructions plus few-shot examples, constraining output to JSON for parsing into STRUCT fields, and batching prompts for summarization, classification, extraction, and question answering. Choose this function when the output is human-readable language rather than a score or vector.
ML.GENERATE_EMBEDDING (opens in a new tab) converts text or multimodal content into dense floating-point vectors that preserve semantic distance. Source text flows to a text-embedding remote model and one vector flows back per row for storage, vector-search indexing, and joins to business data. Production pipelines normalize and chunk long documents, use the same embedding version for stored and query vectors, and save outputs with source keys. An object table maps Cloud Storage files to queryable rows without copying bytes, so URIs plus prompts feed directly into generative functions for classification, captioning, and metadata enrichment at scale.
Exam tip: Use ML.GENERATE_TEXT for new text, ML.GENERATE_EMBEDDING for vectors for search, and ML.PREDICT against a remote endpoint for custom-model scores — the remote model and connection determine where inference executes.
Batch inference with ML.PREDICT, ML.FORECAST, ML.RECOMMEND, and ML.DETECT_ANOMALIES scores large stored tables in bulk. Inputs must provide the series and target structure the model expects, or validation fails for the missing series identifier. A quantile-loss forecast returns parallel arrays where predicted_Sales.quantile_values holds probability levels and predicted_Sales.quantile_predictions holds values, for example 0.1 mapping to 4484.04, 0.5 mapping to 5615.64 for point planning, and 0.9 mapping to 6853.29. Normalized global feature importance divides each aggregated attribution by total attribution to compare time, marketing, calendar, history, location, and item influence on one scale.
Row-level failures return NULL for that row rather than failing the whole query when a row exceeds quota such as RESOURCE_EXHAUSTED. The error ratio equals failed rows divided by total rows processed, the default failure threshold is 1.0, and lowering it such as to 0.2 makes the query fail with partial results. LIMIT is applied after the model processes a batch, so a LIMIT 10 query can show a higher NULL rate in the final rows than the overall error ratio.
Serving architecture is the choice between scoring where data lives and exporting for low-latency serving elsewhere. In-database scoring applies the model to BigQuery tables with ML.PREDICT and writes results back to BigQuery, which fits large-scale batch scoring when data gravity favors BigQuery. Real-time inference on Vertex AI Endpoints receives one request at a time from the client, loads the artifact from Cloud Storage, and returns without a BigQuery query, often using Vertex AI Feature Store with BigQuery tables or views as the offline store. A TensorFlow export consists of saved_model.pb plus a variables folder stored as gs://bucket_name/[folder_name/]*, while PyTorch uses ONNX format; loading into BigQuery ML requires model_type = 'TENSORFLOW' or 'ONNX' with model_path ending in /*. Image inputs add a dependency where object-table bytes flow through ML.DECODE_IMAGE, then ML.CONVERT_COLOR_SPACE and ML.CONVERT_IMAGE_TYPE, and only then into ML.PREDICT.
Continue with this study guide: Generating predictions using BigQuery ML
Training with AutoML on Gemini Enterprise Agent Platform (opens in a new tab) automates architecture search, tuning, and provisioning for tabular, forecasting, image, text, and video problems. The AutoML TrainingPipeline resource always executes training and can optionally export data from a Dataset, upload the resulting Model, and evaluate the Model. Data flows from the Dataset into training, from training to Model Registry for versioning, and from the registry to an endpoint or batch service for inference.
Data source configuration defines which managed data becomes training input and how it is reused. The same managed dataset can train both custom and AutoML models to compare performance under identical inputs, with Cloud Storage for objects, BigQuery for tabular analysis, and high-performance file systems such as NetApp Volumes or Filestore for shared files. Agent Platform Pipelines orchestrates stages where each container component passes artifacts to the next, with metadata linking every step.
Dataset export.For forecasting, ProphetTrainerOp and the AutoML forecasting, image, and tabular job operators create the corresponding model resources. Preprocessing can use Dataflow for Beam, Managed Service for Apache Spark, BigQuery for SQL, and TensorFlow Data Validation (TFDV) for schema checks.
Model objective selection matches task complexity to training mode. AutoML handles simpler tabular, image, and forecasting tasks without custom code, custom training handles complex or generative architectures, and Model Garden provides foundation models for fast starts or fine-tuning.
| Training mode | Best for | Compute and control tradeoff |
|---|---|---|
| AutoML | Simpler tabular, image, and forecasting tasks | Low setup effort; platform controls architecture and tuning |
| Agent Platform custom training | Custom architectures, large language models, diffusion models | High control; configure TPUs or GPUs at higher cost |
| Model Garden | Common text, image, and code tasks from pretrained models | Fastest value; fine-tune when domain performance requires it |
Hyperparameter tuning tests multiple trials across a user-defined search space, with Stage1TunerOp searching and CvTrainerOp cross-validating. Training code must load from Google Cloud services, use platform environment variables, export to the designated location, and resume after VM restarts. A custom job first provisions one VM or many VMs for distributed training, then runs the container, and only after completion deletes the VMs.
Exam tip: The AutoML TrainingPipeline always runs training, but Dataset export, Model upload, and Model evaluation are optional steps in the same resource.
Version control keeps code, data, features, and binaries reproducible and rollback-ready. Model Registry versions model binaries and metadata, Artifact Registry versions containers and pipeline components, and Feature Store versions feature data with BigQuery as the offline store. Because BigQuery retains historical features, a deployed version can be joined back to point-in-time training features, with catalog pointers tying dataset, container, and model versions together.
| Artifact type | Service | Versioning role |
|---|---|---|
| Container images and pipeline components | Artifact Registry | Versions code and integrates with Cloud Build and Cloud Deploy |
| Training and evaluation datasets | BigQuery or Cloud Storage | Stores and versions data for large-scale analysis |
| Feature data | Agent Platform Feature Store | Maintains consistent versioned features with BigQuery offline store |
Automated deployment uses Agent Platform Pipelines with scheduled runs, execution metrics, reusable templates, and Cloud Scheduler, plus Cloud Build validation including stress tests with Locust, k6, or JMeter, bulk evaluation in BigQuery, and Dataflow feature validation. After deployment, Model Monitoring detects drift, performance loss, and anomalies, including quality and safety shifts for generative systems, and versioned lineage enables rollback or retraining.
Continue with this study guide: Training models using Agent Platform AutoML
Fine-tuning with Gemini in BigQuery (opens in a new tab) adapts a Gemini foundation model to an enterprise task with supervised tuning. The job reads a labeled JSONL dataset from Cloud Storage, learns adapter parameters on the frozen base model, and outputs a tuned model with its own resource, endpoint, and checkpoints. In-database ML eliminates movement for SQL teams, while the managed pipeline supports versioning, evaluation, and deployment through Model Registry.
Preparing training data for fine-tuning means building validated prompt-response pairs inside BigQuery where the job will read them. Data flows from operational sources into BigQuery materialized tables, where built-in transformations preprocess it before CREATE MODEL runs. For maximum speed, store training data as materialized partitioned tables rather than views or subqueries, and read through the BigQuery Storage API with a managed tabular dataset. Feature history can sit in BigQuery tables or views behind Feature Store for offline reuse.
Data quality for generative tuning covers accuracy, relevance, diversity of phrasing, and alignment of labels with quality, relevance, and safety, because the tuned model reproduces judgments in those labels. Validate schemas with TensorFlow Data Validation (TFDV) and BigQuery quality scans, create text data through the Agent Platform console for classification, extraction, and sentiment tasks, and use synthetic data from Agent Platform or BigQuery DataFrames when real data is insufficient. Managed datasets link a snapshot to the tuned model with train, test, and validation splits and descriptive statistics.
| Option | Best for | Processing approach |
|---|---|---|
| BigQuery | Structured and semi-structured data with SQL | Built-in transformations with partitioning for large datasets |
| Dataflow | Large unstructured volumes | Apache Beam conversion to TFRecord for faster ingestion |
| Managed Service for Apache Spark | Teams with existing Spark code | Serverless Spark, with pandas plus Dataflow for non-SQL or streaming |
Supported base models for supervised tuning are Gemini 3.5 Flash, Gemini 3.1 Flash-Lite, Gemini 2.5 Pro, Gemini 2.5 Flash, and Gemini 2.5 Flash-Lite. Each job selects one base model, a tuned display name up to 128 characters, a tuning region, and training plus optional validation datasets. User data stays in the tuning region while compute can offload to other US or EU regions, and thinking-capable models should use thinking budget 0 for Gemini 2.5 or MINIMAL for Gemini 3 and higher because tuning omits thinking.
| Parameter | Meaning | Tradeoff |
|---|---|---|
| Epoch count | Complete passes over the dataset | More epochs increase token cost; too many overfit small data |
| Adapter size | Size of added adapter; values 1, 2, 4, 8, and 16 or 1, 2, 4, and 8 by model | Larger adapters learn complex tasks but need more data and time |
| Learning rate multiplier | Step-size multiplier; default 1 | Higher values train faster but risk instability |
Execution follows the same order in every interface: configure model details, configure tuning settings, attach datasets, and start the pipeline. Console creation uses Agent Platform Studio with Create tuned model, code uses client.tunings.tune, REST uses tuningJobs.create, and Colab Enterprise uses Tuning cells. Jobs expose JOB_STATE_PENDING and JOB_STATE_RUNNING until completion, then tuned_model.model, tuned_model.endpoint, checkpoints with ID, epoch, and step, and experiment records. Limits include 131,072 input and output tokens per example, 1 GB JSONL size, 10M text-only or 300K multimodal examples, validation capped at 5000 examples, tuning in us-central1 and europe-west4, and no customer-managed encryption keys (CMEK).
Exam tip: Leave epochs, adapter size, and learning rate multiplier at defaults for the first run; the platform auto-tunes default epochs to dataset size, and token cost equals dataset tokens multiplied by epochs.
Vertex AI Model Registry manages BigQuery ML models alongside Agent Platform models for versioning, evaluation, and online prediction without a serving container. Registration needs aiplatform.googleapis.com enabled via Owner or Service Usage Admin plus the Agent Platform Administrator role, and appears with Source showing BigQuery ML. CREATE MODEL supports MODEL_REGISTRY to auto-register, VERTEX_AI_MODEL_ID to set the registry ID, and VERTEX_AI_MODEL_VERSION_ALIASES to manage versions. Each BigQuery ML model can register to only one model ID, so iterations use aliases under that ID.
Comparison starts from business KPIs and tests tuning from three angles: baseline aggregates such as accuracy, precision, recall, loss, perplexity, and generative quality versus the base model; data slices for safety, relevance, and quality; and versions, hyperparameters, datasets, and architectures to choose the promotion candidate. Vertex AI TensorBoard tracks loss, accuracy, graphs, and embeddings, Experiments with Vertex ML Metadata links parameters, metrics, datasets, and artifacts, and Workbench with What-If Tool (WIT), Language Interpretability Tool (LIT), and Vertex Explainable AI attributions explains predictions. Deployment serves batch SQL inference in BigQuery ML or online endpoints from the registry, with Pipelines, Cloud Build CI/CD, stress testing, Cloud Monitoring, and Model Monitoring for drift and quality shifts keeping releases consistent and rollback-ready.
Continue with this study guide: Fine-tuning Gemini models using BigQuery
INPUT_LABEL_COLS for classification and regression, TIME_SERIES_TIMESTAMP_COL and TIME_SERIES_DATA_COL for forecasting, RATING_COL, USER_COL, and ITEM_COL for recommendation, and NUM_TRIALS for hyperparameter tuning.TRANSFORM clause defines preprocessing that is automatically reused at prediction time, ML analytic functions require an empty OVER() clause, and ML.WEIGHTS serves linear models while boosted trees and DNNs require EXPORT MODEL to Cloud Storage for XGBoost or TensorFlow inspection.ML.GENERATE_TEXT returns language, ML.GENERATE_EMBEDDING returns vectors, and row failures return NULL with a default threshold of 1.0.Choose BigQuery ML when all data is in BigQuery, the team uses SQL, and an available model type matches the problem, choose AutoML when data and objective match a supported format and text, video, or tabular use tolerates greater than 100ms latency, and choose custom training on Gemini Enterprise Agent Platform only when neither option fits. Selection follows a fixed order of first confirming BigQuery locality and SQL fit for BigQuery ML, then confirming AutoML format and latency fit, and only after both fail selecting custom training.
Classification and regression require INPUT_LABEL_COLS for the label column, time-series forecasting requires TIME_SERIES_TIMESTAMP_COL for time points and TIME_SERIES_DATA_COL for values to forecast, and matrix factorization for recommendation requires RATING_COL, USER_COL, and ITEM_COL. K-means clustering needs no label column and hyperparameter tuning is enabled with the NUM_TRIALS option where available tuning arguments vary by model type.
A remote model in BigQuery ML points to a Vertex AI foundation model or deployed endpoint through a Cloud Resource connection whose service account holds the Vertex AI User role plus bucket read access. Use ML.GENERATE_TEXT for new human-readable language, ML.GENERATE_EMBEDDING for dense vectors for search, and ML.PREDICT against a remote endpoint for custom-model scores, where row-level failures return NULL for that row with a default failure threshold of 1.0.
Last updated