Cost governance of Document AI

This topic provides best practices for cost governance of Document AI.

Understanding cost for Document AI

Document AI incurs cost in the following ways:

AI Services compute:

Document AI enables extracting information from documents using the <model_build_name>!PREDICT method, which incurs compute cost.

Virtual warehouse compute:

To run queries in worksheets (including using the <model_build_name>!PREDICT method), you select a warehouse. Additionally, Document AI can incur costs for other operations related to retrieving data in the worksheets. For information about selecting warehouse size for Document AI, see Determining optimal warehouse size for Document AI.

Storage:

To test the Document AI model, you upload the documents to the Document AI user interface in Snowsight, where you review the results and optionally fine-tune the model by training. These operations might incur storage costs because the results are stored within a Snowflake class object in your account. To extract information by using SQL, you upload the documents to either an internal or external stage, which might also incur storage costs. For information about viewing incurred storage costs, see Exploring storage cost.

For more information about overall cost at Snowflake, see Understanding overall cost.

AI Services compute cost

Document AI uses Snowflake-managed compute resources, which are automatically scaled up or down by Snowflake as required for each Document AI workload. With the Snowflake-managed compute structure, the consumption is based on the time spent actually using these resources. In contrast, user-managed virtual warehouses consume credits while running, regardless of whether they are performing any work, so they might be idle or overused.

The calculation of credit consumption for Document AI is based on the total amount of compute resources used to complete the job. The amount of compute resources used is measured by the type of compute and the time spent and calculated on a per-second basis across all resources used by the workload, rounded up to the nearest whole second.

For more information about compute cost at Snowflake, see Understanding compute cost.

For more information about credit consumption, see the Snowflake Service Consumption Table.

Estimating credit consumption

Credit consumption for Document AI depends on the following:

  • Number of pages (for document formats consisting of pages)

  • Number of documents

  • Page density

    Processing a document that is mostly blank (for example, an invoice) takes less time than a text-heavy document (for example, a research paper), which reduces credit consumption.

  • Number of data values to be extracted

    Extracting more data values takes more time, which increases credit consumption.

The following table describes the estimated credit consumption for 1,000 pages based on different types of workloads:

Number of documents

Number of pages per document

Page density

Estimated credit range for 10 values

Estimated credit range for 20 values

Estimated credit range for 40 values

10

100

Low; for example, an invoice or a slide

From 3 to 5

From 4 to 6

From 6 to 8

100

10

Low; for example, an invoice or a slide

From 5 to 7

From 7 to 10

From 10 to 12

1,000

1

Low; for example, an invoice or a slide

From 10 to 12

From 11 to 13

From 12 to 14

10

100

Medium; for example, business correspondence or financial statements

From 4 to 6

From 7 to 9

From 12 to 14

100

10

Medium; for example, business correspondence or financial statements

From 7 to 9

From 10 to 12

From 16 to 18

1,000

1

Medium; for example, business correspondence or financial statements

From 10 to 12

From 12 to 14

From 15 to 17

10

100

High; for example, a research paper or a legal document

From 5 to 7

From 9 to 11

From 16 to 18

100

10

High; for example, a research paper or a legal document

From 8 to 10

From 12 to 14

From 21 to 23

1,000

1

High; for example, a research paper or a legal document

From 11 to 13

From 13 to 15

From 17 to 19

Consider the following example:

  • You process 30,000 documents per year.

  • Each document has 10 pages on average.

  • Each document is of medium page density.

  • You want to extract 10 values.

In this case, the estimated credit range for 1,000 pages is 7 to 9, resulting in 210 to 270 credits for 30,000 documents per year.

For more information about credit consumption, see the Snowflake Service Consumption Table.

Monitoring cost of Document AI

Usage of Document AI appears in the METERING_DAILY_HISTORY view in the ORGANIZATION_USAGE schema with a service type of AI_SERVICES.

To view credit consumption for AI services for all accounts in an organization, use the following query:

SELECT * FROM SNOWFLAKE.ORGANIZATION_USAGE.METERING_DAILY_HISTORY
  WHERE service_type ILIKE '%ai_services%';
Copy

Note

The SNOWFLAKE.ORGANIZATION_USAGE.METERING_DAILY_HISTORY view can take up to four hours to update.

To view usage data for Document AI for your account, including credits used, use the DOCUMENT_AI_USAGE_HISTORY view.

Determining optimal warehouse size for Document AI

Snowflake recommends using an X-Small, Small, or Medium warehouse. Scaling up the warehouse does not increase the speed of query processing, but might result in unnecessary costs.

Consider scaling up the warehouse if you perform additional operations that require warehouse resources.