AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Oct 5, 2026, 22:00 JST

ML.GENERATE_TEXT vs AI.GENERATE: model objects no longer needed

ML.GENERATE_TEXT vs AI.GENERATE: model objects no longer needed

3 Key Points

  1. What happened

    A Zenn series explains that ML.GENERATE_TEXT needs a model object created via CREATE MODEL and returns a row set, while AI.GENERATE takes a connection_id and endpoint like gemini-2.5-flash and returns a STRUCT.

  2. Why it matters

    Because ML.GENERATE_TEXT returns a row set while AI.GENERATE returns a STRUCT, teams that move to the newer style change how they store and read results, which can affect downstream queries and dashboards.

  3. What to watch

    The article advises running both generations in parallel on the same 50-row sample and comparing null counts, differences, and totals before switching, since outputs may not match exactly. Watch whether classification or judgment work should be moved to AI.CLASSIFY at the same time.

WHO IT HITSData analysts and analytics engineers who maintain BigQuery pipelines using ML.GENERATE_TEXT will need to check how their queries store and read results if they adopt AI functions, while teams with stable production workloads may choose to keep the older generation for now.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The article frames the confusion as a generational split: older guides use CREATE MODEL to build a remote model object and then call ML.GENERATE_TEXT as a table function, while newer material calls AI functions such as AI.GENERATE directly as scalar functions. It notes that articles on the web mix both generations, so following a tutorial without noticing which generation it belongs to is a common cause of queries that fail to run.

The practical guidance for teams with existing assets is to start by finding where ML.GENERATE_TEXT is used, checking INFORMATION_SCHEMA.JOBS_BY_PROJECT and INFORMATION_SCHEMA.MODELS or searching the code repository with grep. It then recommends running the old and new styles side by side on a small sample, such as 50 rows, and comparing null outcomes and differences before switching. It also warns that downstream dashboards, filters, and assumptions about text length can break, especially for classification and judgment tasks where a small label change can make a WHERE condition miss.

What the outcome hinges on is whether the parallel comparison shows acceptable differences and whether downstream consumers survive the change, so the article's advice to keep the old model object for a while and not drop it immediately is a hedge against needing to switch back. For teams doing classification, the piece suggests this may be a natural moment to consider AI.CLASSIFY instead of free-text labeling.

FAQ
When should I keep using ML.GENERATE_TEXT instead of switching to AI functions?
The article says you may keep it if the system is already stable in production, if you want to manage the model as an object on the BigQuery side, or if you need fine-grained control over parameters like temperature.
Do I need to redo the IAM and connection setup when migrating?
No. The article states that the region and connection are common to both generations, so if ML.GENERATE_TEXT is already running, you can reuse the connection and its permissions.
Does the cost structure change when moving to AI functions?
The article says the cost structure does not change. Both call the model per row, and AI functions are billed by the number of rows processed, so principles like starting with LIMIT and filtering early still apply.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleStrata runs 125B Qwen3.8-Flash-Next on gaming PCs