Low-code AI: BigQuery ML, AutoML and prebuilt AI APIs
Section 1 of the exam: building models with SQL in BigQuery ML (model types, TRANSFORM, evaluation, forecasting, explanations, remote Gemini models and tuning), AutoML on Agent Platform, and the prebuilt Vision, Document AI, Translation and Speech APIs. Includes a hands-on BigQuery ML lab.
1. The low-code ladder
Exam section 1 (about 13%) rewards picking the least effort that meets the requirement. Climb only when the rung below can't do the job.
| Rung | You provide | You get | Choose when |
|---|---|---|---|
| 1. Prebuilt API (Vision, Document AI, Translation, Speech, Natural Language) | Nothing but the input | Google's model, no training | The task is generic: OCR, common labels, translation, transcription |
| 2. Gemini prompting (optionally from BigQuery) | A prompt and maybe examples | Flexible extraction, classification, summarization | Unstructured text or images with your own categories, few or no labels |
| 3. BigQuery ML | SQL over labelled tables | A model trained and scored in the warehouse | Tabular data already in BigQuery, SQL team, batch scoring |
| 4. AutoML | Labelled data | A searched architecture and an endpoint-ready model | Your own labels (especially images), best accuracy with no model code |
| 5. Custom training | Code, containers, tuning | Full control | Custom architecture or loss, huge data, distributed training |
2. BigQuery ML: models in SQL
BigQuery ML (BQML) trains and runs models with SQL, inside BigQuery. The data never leaves the warehouse, analysts don't need Python, and prediction runs over whole tables. It's the default answer when "the data is in BigQuery" and "the team knows SQL".
| Business problem | model_type | Notes |
|---|---|---|
| Predict a number (revenue, duration) | LINEAR_REG, BOOSTED_TREE_REGRESSOR, RANDOM_FOREST_REGRESSOR, DNN_REGRESSOR | Start linear for interpretability, boosted trees for accuracy on tabular data |
| Predict a class (churn, fraud) | LOGISTIC_REG, BOOSTED_TREE_CLASSIFIER, DNN_CLASSIFIER, AUTOML_CLASSIFIER | auto_class_weights=TRUE for imbalanced labels |
| Forecast a time series | ARIMA_PLUS, ARIMA_PLUS_XREG (extra regressors), TIMESFM via AI.FORECAST | Handles seasonality, holidays and many series at once with time_series_id_col |
| Group customers with no labels | KMEANS | Unsupervised; also used for anomaly detection by distance to centroid |
| Recommend products | MATRIX_FACTORIZATION | Explicit (ratings) or implicit (clicks) feedback |
| Reduce dimensions / detect anomalies | PCA, AUTOENCODER | Pair with ML.DETECT_ANOMALIES |
| Use a Gemini or other hosted model from SQL | Remote model (REMOTE WITH CONNECTION) | Generate text, embeddings, classify or extract with ML.GENERATE_TEXT / AI.GENERATE, ML.GENERATE_EMBEDDING |
| Bring an existing model | Imported TensorFlow, ONNX, XGBoost | Run batch prediction in SQL on a model trained elsewhere |
-- Train: the TRANSFORM clause stores preprocessing with the model,
-- so ML.PREDICT applies exactly the same steps at prediction time.
CREATE OR REPLACE MODEL `shop.churn_model`
TRANSFORM(
ML.STANDARD_SCALER(tenure_days) OVER () AS tenure_scaled,
ML.QUANTILE_BUCKETIZE(monthly_spend, 10) OVER () AS spend_bucket,
plan_type,
churned
)
OPTIONS(
model_type = 'BOOSTED_TREE_CLASSIFIER',
input_label_cols = ['churned'],
auto_class_weights = TRUE,
data_split_method = 'AUTO_SPLIT',
enable_global_explain = TRUE,
model_registry = 'VERTEX_AI' -- also register it in Model Registry
) AS
SELECT tenure_days, monthly_spend, plan_type, churned
FROM `shop.customers`
WHERE signup_date < '2026-01-01';
SELECT * FROM ML.EVALUATE(MODEL `shop.churn_model`); -- precision, recall, roc_auc, log_loss...
SELECT * FROM ML.GLOBAL_EXPLAIN(MODEL `shop.churn_model`); -- which features matter overall
SELECT * FROM ML.PREDICT(MODEL `shop.churn_model`,
(SELECT * FROM `shop.customers_today`));
SELECT * FROM ML.EXPLAIN_PREDICT(MODEL `shop.churn_model`, -- per-row attributions
(SELECT * FROM `shop.customers_today`), STRUCT(3 AS top_k_features));
| Function | Use |
|---|---|
ML.EVALUATE | Metrics on the held-out split (or a table you pass) |
ML.PREDICT | Batch prediction over a query |
ML.FORECAST, ML.EXPLAIN_FORECAST | Future values with prediction intervals; trend/seasonality decomposition |
ML.EXPLAIN_PREDICT, ML.GLOBAL_EXPLAIN, ML.FEATURE_IMPORTANCE | Local and global explanations (feature importance for tree models) |
ML.CONFUSION_MATRIX, ML.ROC_CURVE | Choose a classification threshold |
ML.DETECT_ANOMALIES | Anomalies from ARIMA_PLUS, k-means, PCA or autoencoder models |
ML.FEATURE_CROSS, ML.BUCKETIZE, ML.ONE_HOT_ENCODER, ML.IMPUTER | Feature engineering, ideally inside TRANSFORM |
CREATE MODEL ... OPTIONS(model_type='PCA') or feature importance | Feature selection and dimensionality reduction |
Splits, tuning and export
| Option | Values and meaning |
|---|---|
data_split_method | AUTO_SPLIT (default, random by size), RANDOM, CUSTOM (a boolean column you provide), SEQ (by an ordering column: use for time), NO_SPLIT |
data_split_col, data_split_eval_fraction | Which column and how much goes to evaluation |
num_trials, max_parallel_trials, hparam_tuning_objectives | Built-in hyperparameter tuning; ranges with HPARAM_RANGE / HPARAM_CANDIDATES; inspect with ML.TRIAL_INFO |
l1_reg, l2_reg, early_stop, max_tree_depth, subsample | Regularization and capacity controls |
class_weights / auto_class_weights | Imbalanced labels |
EXPORT MODEL ... OPTIONS(URI='gs://BUCKET/...') | Export to Cloud Storage (TensorFlow SavedModel or XGBoost booster) to serve elsewhere |
model_registry='VERTEX_AI' | Register in Model Registry; deploy to an endpoint for online predictions |
-- Built-in tuning: 20 trials, 4 at a time, optimizing ROC AUC
CREATE OR REPLACE MODEL `shop.churn_tuned`
OPTIONS(
model_type = 'BOOSTED_TREE_CLASSIFIER',
input_label_cols = ['churned'],
num_trials = 20, max_parallel_trials = 4,
hparam_tuning_objectives = ['roc_auc'],
max_tree_depth = HPARAM_RANGE(3, 10),
learn_rate = HPARAM_RANGE(0.01, 0.3)
) AS SELECT * FROM `shop.training_view`;
SELECT * FROM ML.TRIAL_INFO(MODEL `shop.churn_tuned`);
data_split_method='SEQ' (or a custom split column). The default random split leaks the future into training.When BigQuery ML is the wrong tool
- Custom architectures, custom losses, or frameworks like PyTorch with bespoke training loops.
- Images, audio or video as raw input (use AutoML, Gemini or custom training).
- Strict millisecond online latency directly from BigQuery: register the model and deploy it to an endpoint, or export it.
3. Gemini and remote models from BigQuery
A remote model points BigQuery at a hosted model (Gemini, an embedding model, or your own endpoint) through a connection whose service account has Agent Platform access. Generation and embedding then run as SQL over tables.
| Function | Use |
|---|---|
ML.GENERATE_TEXT / AI.GENERATE, AI.GENERATE_TABLE | Summarize, classify, extract fields (structured output into columns) |
ML.GENERATE_EMBEDDING | Embeddings for text (and images via object tables) |
VECTOR_SEARCH, CREATE VECTOR INDEX | Similarity search in BigQuery: simple RAG or semantic dedup without another database |
| Object tables | Query unstructured files in Cloud Storage (images, PDFs) as rows |
ML.UNDERSTAND_TEXT, ML.TRANSLATE, ML.PROCESS_DOCUMENT, ML.TRANSCRIBE | Prebuilt Cloud AI APIs called from SQL |
BQML can supervised-tune a Gemini model on prompt/response pairs stored in a table, then serve it as a remote model, all from SQL:
CREATE OR REPLACE MODEL `support.ticket_tagger`
REMOTE WITH CONNECTION `us.vertex_conn`
OPTIONS (
endpoint = 'gemini-2.5-flash', -- base model to tune
max_iterations = 300,
prompt_col = 'prompt',
input_label_cols = ['label']
) AS
SELECT prompt, label FROM `support.labelled_examples`;
SELECT * FROM ML.GENERATE_TEXT(MODEL `support.ticket_tagger`,
(SELECT ticket_text AS prompt FROM `support.new_tickets`),
STRUCT(0.0 AS temperature, TRUE AS flatten_json_output));
AI.GENERATE* functions change often. Check the BigQuery ML documentation for your release. The pattern to remember: a connection (a BigQuery connection resource whose service account has Agent Platform access), a remote model, and generation functions run over tables.4. AutoML
AutoML trains a high-quality model from labelled data with no model code: it searches architectures and hyperparameters for you. You pay in node hours and give up control of the architecture and loss.
| Data type | Tasks | Notes |
|---|---|---|
| Tabular | Classification, regression, forecasting | From BigQuery or CSV in Cloud Storage. Set a training budget; enable early stopping. Tabular Workflows give a pipeline-based, more configurable version (End-to-End AutoML, TabNet, Wide & Deep, forecasting). |
| Image | Classification (single/multi-label), object detection | Can export Edge-optimized models (TF Lite, Core ML, container) for on-device use |
| Video | Classification, object tracking, action recognition | Being replaced by Gemini prompting for many uses |
| Text | Classification, entity extraction, sentiment | Google now steers text tasks to Gemini prompting or tuning; legacy AutoML text is retired. Expect "use Gemini" as the modern answer |
| Choose | When |
|---|---|
| BigQuery ML | Data in BigQuery, SQL skills, batch scoring in the warehouse, quick baselines, forecasting many series |
| AutoML | Best accuracy without ML expertise, images or video, or tabular data where you want an online endpoint quickly |
| Custom training | Custom architecture, loss or framework, very large data, distributed training, full control |
AutoML practicalities
| Topic | What to know |
|---|---|
| Data volume | Image classification works from roughly hundreds of images per label; more is better; balance the labels |
| Budget | Training budget in node hours; early stopping ends sooner when quality plateaus |
| Optimization objective (tabular) | Choose to match the business: maximize AU-PRC for rare positives, minimize log loss for probabilities, RMSE/MAE for regression |
| Data split | Random, manual (a column), or chronological (a time column) for forecasting and time-dependent data |
| Explainability | Feature attributions for tabular models; evaluation shows confusion matrix and per-label metrics |
| Deployment | Model Registry → endpoint (online) or batch inference; edge export for image models |
5. Prebuilt AI APIs
| API | Does | Exam cue |
|---|---|---|
| Cloud Vision API | Labels, OCR (text detection, document text detection), faces, landmarks, logos, SafeSearch, objects | "Detect common objects or read text in photos" with no custom labels |
| Document AI | Processors for invoices, receipts, IDs, forms, layout; custom extractors trained from a few documents | "Extract fields from invoices or forms into structured data" |
| Cloud Translation API | Basic and Advanced (glossaries, batch document translation, adaptive translation, custom models) | "Keep product names untranslated" → a glossary |
| Speech-to-Text / Text-to-Speech | Transcription with model adaptation (phrase hints), diarization; natural voices | "Recognize domain terms in calls" → speech adaptation |
| Natural Language API | Sentiment, entities, syntax, content classification | Quick sentiment with no training |
| Video Intelligence API | Shot changes, labels, explicit content, text in video | Catalogue video archives |
| Industry solutions | Healthcare Natural Language, Contact Center AI, Recommendations AI | Domain-specific managed products |
Customizing without training a model
| Need | Feature |
|---|---|
| Keep brand and product names consistent in translation | Translation Advanced glossary |
| Recognize jargon, product names, alphanumeric codes in speech | Speech-to-Text model adaptation (phrase sets, boosts) |
| Who spoke when | Speaker diarization |
| Fields from a document type no prebuilt processor covers | Document AI Custom Extractor (generative, from a few labelled documents) |
| Layout-aware chunks for RAG from PDFs | Document AI layout parser |
| Your own image categories | AutoML image or Gemini with examples (Vision API labels are fixed) |
6. Lab: churn model end to end in BigQuery ML
Use a sandbox project with billing alerts. Placeholders: PROJECT_ID, dataset shop, region us-central1.
- Load a public e-commerce or telco churn table into your dataset, or create
shop.customerswith a label column. - Train a
LOGISTIC_REGbaseline, then aBOOSTED_TREE_CLASSIFIERwith aTRANSFORMclause andauto_class_weights=TRUE. - Compare with
ML.EVALUATE. RunML.CONFUSION_MATRIXat thresholds 0.3, 0.5 and 0.7 and pick one with the confusion-matrix calculator. - Run
ML.EXPLAIN_PREDICTon five rows andML.GLOBAL_EXPLAIN. Is any feature suspiciously dominant (possible leakage)? - Retrain with
num_trials=10and readML.TRIAL_INFO. - Retrain with
model_registry='VERTEX_AI'and find the model in Model Registry. - Create a remote Gemini model through a connection and use
ML.GENERATE_TEXTto summarize the 20 most recent support tickets per churner.
You should be able to say: why TRANSFORM prevents training-serving skew, why PR AUC beats accuracy here, and how batch scoring in SQL avoids running an endpoint. Clean up: DROP MODEL for each model; delete the dataset and the connection.
7. "Which low-code option?" chooser
Pick an item to see what it means, why, and the tempting wrong choice.
8. Sample outputs
What the tools return. Expand an item to see a typical result and what to read in it.
SELECT * FROM ML.EVALUATE(MODEL `shop.churn_model`)Classification metrics from BigQuery ML
precision recall accuracy f1_score log_loss roc_auc
0.412 0.783 0.951 0.540 0.142 0.931What to look at: Accuracy 0.95 looks great but churners are rare, so it means little. Recall 0.78 with precision 0.41 says the model finds most churners at the cost of many false alarms, at the default 0.5 threshold. For a retention campaign where a false alarm costs a discount, check ML.ROC_CURVE or ML.CONFUSION_MATRIX and move the threshold. ROC AUC 0.93 overstates quality on imbalanced data; compare PR AUC.
SELECT * FROM ML.GLOBAL_EXPLAIN(MODEL `shop.churn_model`)Global feature attributions
feature attribution
tenure_scaled 0.318
support_tickets 0.244
spend_bucket 0.131
plan_type 0.087
last_refund_flag 0.512What to look at: last_refund_flag dominates. If refunds are often issued as part of cancelling, the feature leaks the label: it's known only after churn. Suspiciously strong features in attributions are the classic sign of leakage; remove it and retrain.
SELECT * FROM ML.FORECAST(MODEL `retail.sales_arima`, STRUCT(14 AS horizon, 0.9 AS confidence_level))ARIMA_PLUS forecast with intervals
store_id forecast_timestamp forecast_value prediction_interval_lower_bound prediction_interval_upper_bound
s-014 2026-11-15 00:00:00 UTC 1843.2 1611.7 2074.7
s-014 2026-11-16 00:00:00 UTC 2210.9 1958.0 2463.8
s-022 2026-11-15 00:00:00 UTC 932.4 801.3 1063.5What to look at: One model forecasts every store because time_series_id_col was set. The 90% interval is what inventory planning should use for safety stock, not just the point forecast.
9. Scenarios
Exam-style situations: how to diagnose each one, the likely cause and the fix.
10. Searchable reference
| Item | Meaning |
|---|
11. Flashcards (click to flip)
12. Common gotchas in one list
- Data in BigQuery and a SQL team means BigQuery ML, not exporting CSVs to a custom job.
- Use TRANSFORM so preprocessing travels with the model and serving can't drift from training.
- Random splits on time data leak the future; use SEQ or a custom time column.
- Prebuilt APIs win when classes are generic; custom labels need AutoML, Gemini or custom training.
- AutoML text is retired; text classification and extraction now point to Gemini.
- Remote models need a connection, and the connection's service account needs Agent Platform access.
- Batch scoring in SQL avoids endpoint costs; deploy only when you need online latency.
- Glossary for terminology, speech adaptation for jargon: customization without training.
- AutoML isn't automatically cheaper: node hours add up; set budgets and early stopping.
- Match the AutoML objective to the business: AU-PRC for rare positives.