Stay organized with collectionsSave and categorize content based on your preferences.
Choose a natural language processing function
This document provides a comparison of the natural language processing functions
available in BigQuery ML, which areML.GENERATE_TEXT,ML.TRANSLATE,
andML.UNDERSTAND_TEXT.
You can use the information in this document to help you decide which function
to use in cases where the functions have overlapping capabilities.
At a high level, the difference between these functions is as follows:
ML.GENERATE_TEXTis a good choice for performing customized natural
language processing (NLP) tasks at a lower cost. This function offers more
language support, faster throughput, and model tuning capability, and also
works with multimodal models.
ML.TRANSLATEis a good choice for performing translation-specific NLP
tasks where you need to support a high rate of queries per minute.
ML.UNDERSTAND_TEXTis a good choice for performing NLP tasks
that are supported by the Cloud Natural Language API.
Function comparison
Use the following table to compare theML.GENERATE_TEXT,ML.TRANSLATE, andML.UNDERSTAND_TEXTfunctions:
For
example, to perform a question answering task, you could provide a prompt
similar toCONCAT("What are the key concepts in the following article?: ", article_text).
Incurs BigQuery ML charges for data processed. For more information, seeBigQuery ML pricing.
Incurs Vertex AI charges for calls to the model. If you are using
a Gemini 2.0 or greater model, the call is billed at the batch
API rate. For more information, seeCost of building and deploying AI models in Vertex AI.
Incurs BigQuery ML charges for data processed. For more information, seeBigQuery ML pricing.
Supports both text and unstructured data from BigQuery standard tables and object tables.
Supports text data from BigQuery standard tables.
Supports text data from BigQuery standard tables.
Function output
Output can vary for calls to the model, even with the same prompt.
Produces the same output for a given
task type for each successful call to the API. The output includes
information about the input language.
Produces the same output for a given
task type for each successful call to the API. The output includes
information about the magnitude of the
sentiment for sentiment analysis tasks.
Data context
You can provide data context as part of the prompt you submit.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-10 UTC."],[[["\u003cp\u003eBigQuery ML offers three natural language processing (NLP) functions: \u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e, \u003ccode\u003eML.TRANSLATE\u003c/code\u003e, and \u003ccode\u003eML.UNDERSTAND_TEXT\u003c/code\u003e, each with distinct capabilities.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e is the most versatile function, allowing for customized NLP tasks, supporting various languages and multimodal models, and offering model tuning, albeit at potentially a higher cost.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.TRANSLATE\u003c/code\u003e is specialized for translation tasks, offering high query rates and no token limit, making it suitable when dealing with only translation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.UNDERSTAND_TEXT\u003c/code\u003e is tailored for specific NLP tasks supported by the Cloud Natural Language API, such as sentiment analysis, entity recognition, and text classification.\u003c/p\u003e\n"],["\u003cp\u003eThe choice of function also depends on data context and the need for additional information, with \u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e better suited for data requiring context and \u003ccode\u003eML.TRANSLATE\u003c/code\u003e or \u003ccode\u003eML.UNDERSTAND_TEXT\u003c/code\u003e better suited when context is not necessary.\u003c/p\u003e\n"]]],[],null,[]]