ML.GENERATE_TEXTcan do tasks that the other two functions can do as well, as
shown in the following image:
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.GENERATE_TEXT: you can use a subset of the Vertex AIGeminiorPaLMmodel to
generate text. For more information on supported models, see theML.GENERATE_TEXTsyntax.
ML.GENERATE_TEXT: you can perform any NLP task. What task the model
performs is based on the prompt you specify. 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).
You can also provide context as part of the prompt. For example,CONCAT("context: Only output 'yes' or 'no' to the following question: ", question).
ML.TRANSLATE: you can perform the following tasks:
When choosing what function to use, consider whether your data can be analyzed
in isolation, or whether it requires additional context to support the analysis.
If your data requires additional context, usingML.GENERATE_TEXTwith a
Vertex AI model is a better choice, as those models allow you to
provide context as part of the prompt you submit. Keep in
mind that providing additional context as input increases token count and cost.
If your data can be analyzed without other context being considered by the
model—for example, translating a string of text without knowing why it was
written, then usingML.TRANSLATEorML.UNDERSTAND_TEXTmight be a better
choice, provided that the task you want to perform is supported.
Output structure
ML.GENERATE_TEXTconsistently returns results in theml_generate_text_llm_resultoutput column. You can also
use your prompt to define your output structure. For example, you can instruct
the model to return your result as JSON with custom parent and child fields,
and provide an example of how to produce this result.
ML.TRANSLATEandML.UNDERSTAND_TEXTproduce the same output for a given
task type for each successful call to the API. Additionally, the output from
these functions includes additional metadata about their results. For example,ML.TRANSLATEoutput includes information about the input language, andML.UNDERSTAND_TEXToutput includes information about the magnitude of the
sentiment for sentiment analysis tasks. Generating this metadata is possible
with the Vertex AI models, but this requires significant prompt
engineering, and isn't likely to provide the same granularity.
Pricing
Pricing is as follows:
ML.GENERATE_TEXT: For pricing of the Vertex AI models that
you use with this function, seeVertex AI pricing.
Supervised tuning of supported models is charged at dollars per node hour atVertex AI custom training pricing.
ML.TRANSLATE: For pricing of the Cloud AI service that
you use with this function, seeCloud Translation API pricing.
ML.GENERATE_TEXT: supports the same languages asGeminiorEmbeddings, depending on the Vertex AI model you choose for the BigQuery ML remote model endpoint. The PaLM text models support
the same languages as the Embeddings models.
[[["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-04 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,["# Choose a natural language processing function\n=============================================\n\nThis document provides a comparison of the natural language processing functions\navailable in BigQuery ML, which are\n[`ML.GENERATE_TEXT`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-generate-text),\n[`ML.TRANSLATE`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-translate),\nand\n[`ML.UNDERSTAND_TEXT`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-understand-text).\n\n`ML.GENERATE_TEXT` can do tasks that the other two functions can do as well, as\nshown in the following image:\n\nYou can use the information in this document to help you decide which function\nto use in cases where the functions have overlapping capabilities.\n\nAt a high level, the difference between these functions is as follows:\n\n- `ML.GENERATE_TEXT` is 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.\n- `ML.TRANSLATE` is a good choice for performing translation-specific NLP tasks where you need to support a high rate of queries per minute.\n- `ML.UNDERSTAND_TEXT` is a good choice for performing NLP tasks [supported by the Cloud Natural Language API](#supported_tasks).\n\nSupported models\n----------------\n\nSupported models are as follows:\n\n- `ML.GENERATE_TEXT`: you can use a subset of the Vertex AI [Gemini](/vertex-ai/generative-ai/docs/learn/models#gemini-models) or [PaLM](/vertex-ai/generative-ai/docs/learn/models#palm-models) model to generate text. For more information on supported models, see the [`ML.GENERATE_TEXT` syntax](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-generate-text#syntax).\n- `ML.TRANSLATE`: you use the default model of the [Cloud Translation API](/translate).\n- `ML.UNDERSTAND_TEXT`: you use the default model of the [Cloud Natural Language API](/natural-language).\n\nSupported tasks\n---------------\n\nSupported tasks are as follows:\n\n- `ML.GENERATE_TEXT`: you can perform any NLP task. What task the model performs is based on the prompt you specify. For example, to perform a question answering task, you could provide a prompt similar to `CONCAT(\"What are the key concepts in the following article?: \", article_text)`. You can also provide context as part of the prompt. For example, `CONCAT(\"context: Only output 'yes' or 'no' to the following question: \", question)`.\n- `ML.TRANSLATE`: you can perform the following tasks:\n\n - [`TRANSLATE_TEXT`](/translate/docs/advanced/translating-text-v3)\n - [`DETECT_LANGUAGE`](/translate/docs/advanced/detecting-language-v3)\n- `ML.UNDERSTAND_TEXT`: you can perform the following tasks:\n\n - [`ANALYZE_ENTITIES`](/natural-language/docs/analyzing-entities)\n - [`ANALYZE_ENTITY_SENTIMENT`](/natural-language/docs/analyzing-entity-sentiment)\n - [`ANALYZE_SENTIMENT`](/natural-language/docs/analyzing-sentiment)\n - [`ANALYZE_SYNTAX`](/natural-language/docs/analyzing-syntax)\n - [`CLASSIFY_TEXT`](/natural-language/docs/classifying-text)\n\nData context\n------------\n\nWhen choosing what function to use, consider whether your data can be analyzed\nin isolation, or whether it requires additional context to support the analysis.\nIf your data requires additional context, using `ML.GENERATE_TEXT` with a\nVertex AI model is a better choice, as those models allow you to\nprovide context as part of the prompt you submit. Keep in\nmind that providing additional context as input increases token count and cost.\n\nIf your data can be analyzed without other context being considered by the\nmodel---for example, translating a string of text without knowing why it was\nwritten, then using `ML.TRANSLATE` or `ML.UNDERSTAND_TEXT` might be a better\nchoice, provided that the task you want to perform is supported.\n\nOutput structure\n----------------\n\n`ML.GENERATE_TEXT` consistently returns results in the\n`ml_generate_text_llm_result` output column. You can also\nuse your prompt to define your output structure. For example, you can instruct\nthe model to return your result as JSON with custom parent and child fields,\nand provide an example of how to produce this result.\n\n`ML.TRANSLATE` and `ML.UNDERSTAND_TEXT` produce the same output for a given\ntask type for each successful call to the API. Additionally, the output from\nthese functions includes additional metadata about their results. For example,\n`ML.TRANSLATE` output includes information about the input language, and\n`ML.UNDERSTAND_TEXT` output includes information about the magnitude of the\nsentiment for sentiment analysis tasks. Generating this metadata is possible\nwith the Vertex AI models, but this requires significant prompt\nengineering, and isn't likely to provide the same granularity.\n\nPricing\n-------\n\nPricing is as follows:\n\n- `ML.GENERATE_TEXT`: For pricing of the Vertex AI models that you use with this function, see [Vertex AI pricing](/vertex-ai/generative-ai/pricing). Supervised tuning of supported models is charged at dollars per node hour at [Vertex AI custom training pricing](/vertex-ai/pricing#custom-trained_models).\n- `ML.TRANSLATE`: For pricing of the Cloud AI service that you use with this function, see [Cloud Translation API pricing](/translate/pricing).\n- `ML.UNDERSTAND_TEXT`: For pricing of the Cloud AI service that you use with this function, see [Cloud Natural Language API pricing](/natural-language/pricing).\n\nSupervised tuning\n-----------------\n\nSupervised tuning support is as follows:\n\n- `ML.GENERATE_TEXT`: [supervised tuning](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model#supervised_tuning) is supported for some models.\n- `ML.TRANSLATE`: supervised tuning isn't supported.\n- `ML.UNDERSTAND_TEXT`: supervised tuning isn't supported.\n\nMultimodality\n-------------\n\nMultimodality support is as follows:\n\n- `ML.GENERATE_TEXT`: supports text and text + image input.\n- `ML.TRANSLATE`: supports text input.\n- `ML.UNDERSTAND_TEXT`: supports text input.\n\nQueries per minute (QPM) limit\n------------------------------\n\nQPM limits are as follows:\n\n- `ML.GENERATE_TEXT`: ranges from a [100 to a 1,600 QPM limit in the default `us-central1` region](/vertex-ai/generative-ai/docs/quotas#quotas_by_region_and_model), depending on the model used.\n- `ML.TRANSLATE`: [6,000 QPM limit for v3](/translate/quotas#rate_quotas).\n- `ML.UNDERSTAND_TEXT`: [600 QPM limit](/natural-language/quotas#requests).\n\nToken limit\n-----------\n\nToken limits are as follows:\n\n- `ML.GENERATE_TEXT`: ranges from a [8,192 to a 24,576 token limit](/vertex-ai/generative-ai/docs/learn/models), depending on the model used.\n- `ML.TRANSLATE`: No token limit. However, this function does have a [30,000 bytes limit](/translate/quotas#content-limit).\n- `ML.UNDERSTAND_TEXT`: [100,000 token limit](/natural-language/quotas#content).\n\nSupported languages\n-------------------\n\nSupported languages are as follows:\n\n- `ML.GENERATE_TEXT`: supports the same languages as [Gemini](/vertex-ai/generative-ai/docs/learn/models#languages-gemini) or [Embeddings](/vertex-ai/generative-ai/docs/learn/models#languages-palm), depending on the Vertex AI model you choose for the BigQuery ML remote model endpoint. The PaLM text models support the same languages as the Embeddings models.\n- `ML.TRANSLATE`: supports Cloud Translation API [languages](/translate/docs/languages).\n- `ML.UNDERSTAND_TEXT`: supports Cloud Natural Language API [languages](/natural-language/docs/languages).\n\nRegion availability\n-------------------\n\nRegion availability is as follows:\n\n- `ML.GENERATE_TEXT`: available in all Generative AI for Vertex AI [regions](/vertex-ai/generative-ai/docs/learn/locations#available-regions).\n- `ML.TRANSLATE`: available in the `EU` and `US` [multi-regions](/bigquery/docs/locations#multi-regions).\n- `ML.UNDERSTAND_TEXT`: available in the `EU` and `US` multi-regions."]]