Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Escolher uma função de processamento de linguagem natural
Neste documento, você encontra uma comparação das funções de processamento de linguagem natural disponíveis no BigQuery ML, que são ML.GENERATE_TEXT, ML.TRANSLATE e
ML.UNDERSTAND_TEXT.
ML.GENERATE_TEXT também pode realizar tarefas que as outras duas funções também podem realizar, como
mostrado na imagem a seguir:
Use as informações deste documento para decidir qual função usar nos casos em que as funções têm recursos sobrepostos.
De modo geral, a diferença entre essas funções é a seguinte:
ML.GENERATE_TEXT é uma boa opção para executar tarefas personalizadas de processamento
de linguagem natural (PLN) a um custo menor. Essa função oferece mais
suporte a linguagens, capacidade de processamento mais rápida e capacidade de ajuste de modelos, além de
funcionar com modelos multimodais.
ML.TRANSLATE é uma boa opção para executar tarefas de PLN específicas de tradução,
em que você precisa oferecer suporte a uma alta taxa de consultas por minuto.
ML.GENERATE_TEXT: é possível usar um subconjunto do modelo Gemini ou PaLM da Vertex AI para gerar texto. Para mais informações sobre modelos compatíveis, consulte a
sintaxe ML.GENERATE_TEXT.
ML.GENERATE_TEXT: é possível executar qualquer tarefa de PLN. A tarefa que o modelo executa
é baseada no comando especificado. Por exemplo, para executar uma
tarefa de responder a perguntas, forneça um comando semelhante a
CONCAT("What are the key concepts in the following article?: ", article_text).
Também é possível fornecer contexto como parte do comando. Por exemplo,
CONCAT("context: Only output 'yes' or 'no' to the following question: ", question).
ML.TRANSLATE: é possível realizar as seguintes tarefas:
Ao escolher qual função usar, considere se os dados podem ser analisados isoladamente ou se exigem contexto adicional para dar suporte à análise.
Caso seus dados precisem de mais contexto, usar ML.GENERATE_TEXT com um
modelo da Vertex AI é a melhor opção, já que esses modelos permitem
fornecer contexto como parte do comando enviado. Lembre-se de que fornecer mais contexto à medida que a entrada aumenta a contagem e o custo de tokens.
Se os dados puderem ser analisados sem que outro contexto seja considerado pelo
modelo, por exemplo, traduzir uma string de texto sem saber por que ela foi
escrito, o uso de ML.TRANSLATE ou ML.UNDERSTAND_TEXT poderá ser uma melhor escolha, desde que a tarefa que você quer realizar tenha suporte.
Estrutura de saída
ML.GENERATE_TEXT retorna resultados de maneira consistente na coluna de saída ml_generate_text_llm_result. Também é possível
usar seu comando para definir a estrutura de saída. Por exemplo, é possível instruir
o modelo a retornar o resultado como JSON com campos pais e filhos personalizados
e fornecer um exemplo de como produzir esse resultado.
ML.TRANSLATE e ML.UNDERSTAND_TEXT produzem a mesma saída para um determinado tipo de tarefa em cada chamada bem-sucedida para a API. Além disso, a saída dessas funções inclui outros metadados sobre os resultados. Por exemplo, a saída ML.TRANSLATE inclui informações sobre o idioma de entrada, e a saída ML.UNDERSTAND_TEXT inclui informações sobre a magnitude do sentimento para tarefas de análise de sentimento. A geração desses metadados é possível
com os modelos da Vertex AI, mas isso requer uma engenharia de comando
significativa e provavelmente não fornecerá a mesma granularidade.
Preços
O preço é o seguinte:
ML.GENERATE_TEXT: para conferir os preços dos modelos da Vertex AI que você usa com essa função, consulte Preços da Vertex AI.
O ajuste supervisionado de modelos compatíveis é cobrado em dólares por hora de uso do nó de acordo com os
preços do treinamento personalizado da Vertex AI.
ML.TRANSLATE: para saber os preços do serviço de IA do Cloud que você usa com essa função, consulte Preços da API Cloud Translation.
ML.GENERATE_TEXT: oferece suporte aos mesmos idiomas de
Gêmeos
ou Embeddings, dependendo do modelo da Vertex AI escolhido para o endpoint do modelo remoto do BigQuery ML. Os modelos de texto do PaLM oferecem suporte
nas mesmas linguagens dos modelos de embeddings.
ML.TRANSLATE: oferece suporte aos idiomas da API Cloud Translation.
ML.UNDERSTAND_TEXT: oferece suporte aos idiomas da API Cloud Natural Language.
Disponibilidade por região
A disponibilidade por região é a seguinte:
ML.GENERATE_TEXT: disponível em todas as regiões de IA generativa para a Vertex AI.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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."]]