Choose a document processing function
This document provides a comparison of the document processing functions
available in BigQuery ML, which are
ML.GENERATE_TEXT
and
ML.PROCESS_DOCUMENT
.
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_TEXT
is a good choice for performing natural
language processing (NLP) tasks where some of the content resides in
documents. This function offers the following benefits:
- Lower costs
- More language support
- Faster throughput
- Model tuning capability
- Availability of multimodal models
For examples of document processing tasks that work best with this
approach, see
Explore document processing capabilities with the Gemini API.
ML.PROCESS_DOCUMENT
is a good choice for performing document processing
tasks that require document parsing and a predefined, structured response.
Supported models
Supported models are as follows:
ML.GENERATE_TEXT
: you can use a subset of the Vertex AI
Gemini models to
generate text. For more information on supported models, see the
ML.GENERATE_TEXT
syntax.
ML.PROCESS_DOCUMENT
: you use the default model of the
Document AI API. Using the Document AI API
gives you access to many different document processors, such as the
invoice parser, layout parser, and form parser. You can use these document
processors to work with PDF files with many different structures.
Supported tasks
Supported tasks are as follows:
ML.GENERATE_TEXT
: you can perform any NLP task where the input is a
document. For example, given a financial document for a company,
you can retrieve document information by providing a prompt such as What is
the quarterly revenue for each division?
.
ML.PROCESS_DOCUMENT
: you can perform specialized document processing for
different document types, such as invoices, tax forms, and financial
statements. You can also perform document chunking. For more information,
on how to use the ML.PROCESS_DOCUMENT
function fo this task, see
Parse PDFs in a retrieval-augmented generation pipeline.
Pricing
Pricing is as follows:
Supervised tuning
Supervised tuning support is as follows:
ML.GENERATE_TEXT
: supervised tuning
is supported for some models.
ML.PROCESS_DOCUMENT
: supervised tuning isn't supported.
Queries per minute (QPM) limit
QPM limits are as follows:
ML.GENERATE_TEXT
: 60 QPM in the default us-central1
region for
gemini-1.5-pro
models, and 200 QPM in the default us-central1
region for
gemini-1.5-flash
models. For more information, see
Generative AI on Vertex AI quotas.
ML.PROCESS_DOCUMENT
: 120 QPM per processor type, with an overall limit of
600 QPM per project. For more information, see
Quotas list.
To increase your quota, see
Request a quota adjustment.
Token limit
Token limits are as follows:
ML.GENERATE_TEXT
: 700 input tokens, and 8196 output tokens.
ML.PROCESS_DOCUMENT
: No token limit. However, this function does have
different page limits depending on the processor you use. For more
information, see Limits.
Supported languages
Supported languages are as follows:
ML.GENERATE_TEXT
: supports the same languages as
Gemini.
ML.PROCESS_DOCUMENT
: language support depends on the document processor
type; most only support English. For more information, see
Processor list.
Region availability
Region availability is as follows:
ML.GENERATE_TEXT
: available in all Generative AI for Vertex AI regions.
ML.PROCESS_DOCUMENT
: available in the EU
and US
multi-regions for all processors.
Some processors are also available in certain single regions. For more
information, see
Regional and multi-regional support.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003e\u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e is suitable for natural language processing tasks within documents, offering benefits like lower costs, broader language support, faster processing, model tuning, and multimodal model options.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.PROCESS_DOCUMENT\u003c/code\u003e excels in document processing tasks requiring structured responses and document parsing, and also supports working with different PDF file structures.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e uses a subset of Vertex AI Gemini models and supports a wide array of natural language processing tasks, while \u003ccode\u003eML.PROCESS_DOCUMENT\u003c/code\u003e utilizes the Document AI API, with specialized document processing for tasks like parsing invoices or tax forms.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e supports supervised tuning for certain models, while \u003ccode\u003eML.PROCESS_DOCUMENT\u003c/code\u003e does not have supervised tuning support.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.GENERATE_TEXT\u003c/code\u003e has higher language support and lower token limits, whereas \u003ccode\u003eML.PROCESS_DOCUMENT\u003c/code\u003e depends on the document processor for language support and has no token limit, only page limits.\u003c/p\u003e\n"]]],[],null,["# Choose a document processing function\n=====================================\n\nThis document provides a comparison of the document processing functions\navailable in BigQuery ML, which are\n[`ML.GENERATE_TEXT`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-generate-text)\nand\n[`ML.PROCESS_DOCUMENT`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-process-document).\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 natural\n language processing (NLP) tasks where some of the content resides in\n documents. This function offers the following benefits:\n\n - Lower costs\n - More language support\n - Faster throughput\n - Model tuning capability\n - Availability of multimodal models\n\n For examples of document processing tasks that work best with this\n approach, see\n [Explore document processing capabilities with the Gemini API](https://ai.google.dev/gemini-api/docs/document-processing).\n- `ML.PROCESS_DOCUMENT` is a good choice for performing document processing\n tasks that require document parsing and a predefined, structured response.\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) models 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.PROCESS_DOCUMENT`: you use the default model of the [Document AI API](/document-ai). Using the Document AI API gives you access to many different document processors, such as the invoice parser, layout parser, and form parser. You can use these document processors to work with PDF files with many different structures.\n\nSupported tasks\n---------------\n\nSupported tasks are as follows:\n\n- `ML.GENERATE_TEXT`: you can perform any NLP task where the input is a document. For example, given a financial document for a company, you can retrieve document information by providing a prompt such as `What is\n the quarterly revenue for each division?`.\n- `ML.PROCESS_DOCUMENT`: you can perform specialized document processing for different document types, such as invoices, tax forms, and financial statements. You can also perform document chunking. For more information, on how to use the `ML.PROCESS_DOCUMENT` function fo this task, see [Parse PDFs in a retrieval-augmented generation pipeline](/bigquery/docs/rag-pipeline-pdf).\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. For more information, see [Vertex AI custom training pricing](/vertex-ai/pricing#custom-trained_models).\n- `ML.PROCESS_DOCUMENT`: For pricing of the Cloud AI service that you use with this function, see [Document AI API pricing](/document-ai/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.PROCESS_DOCUMENT`: supervised tuning isn't supported.\n\nQueries per minute (QPM) limit\n------------------------------\n\nQPM limits are as follows:\n\n- `ML.GENERATE_TEXT`: 60 QPM in the default `us-central1` region for `gemini-1.5-pro` models, and 200 QPM in the default `us-central1` region for `gemini-1.5-flash` models. For more information, see [Generative AI on Vertex AI quotas](/vertex-ai/generative-ai/docs/quotas).\n- `ML.PROCESS_DOCUMENT`: 120 QPM per processor type, with an overall limit of 600 QPM per project. For more information, see [Quotas list](/document-ai/quotas#quotas_list).\n\nTo increase your quota, see\n[Request a quota adjustment](/docs/quotas/help/request_increase).\n\nToken limit\n-----------\n\nToken limits are as follows:\n\n- `ML.GENERATE_TEXT`: 700 input tokens, and 8196 output tokens.\n- `ML.PROCESS_DOCUMENT`: No token limit. However, this function does have different page limits depending on the processor you use. For more information, see [Limits](/document-ai/limits).\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).\n- `ML.PROCESS_DOCUMENT`: language support depends on the document processor type; most only support English. For more information, see [Processor list](/document-ai/docs/processors-list).\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.PROCESS_DOCUMENT`: available in the `EU` and `US` [multi-regions](/bigquery/docs/locations#multi-regions) for all processors. Some processors are also available in certain single regions. For more information, see [Regional and multi-regional support](/document-ai/docs/regions)."]]