What you will be able to do
- Name the compute categories that make up the cost of an ML platform in Snowflake
- Use object tags on warehouses and users to attribute ML spend to teams or projects, within one account or across an organization
- Use query tags and QUERY_ATTRIBUTION_HISTORY to split the cost of a shared ML application
- Explain what drives the cost of a feature view and which settings change it
- Track feature costs at a granular level by separating online feature store service types and giving feature refreshes a dedicated warehouse
Key concept
Chargeback through tags — Snowflake bills credits to resources such as warehouses and compute pools, not to teams. To charge ML spend back to a team or project, you label resources and users with object tags, or label queries with query tags, and then join those labels to the usage views.
1.Where ML credits come from
Before you can attribute ML cost, you need to know which meters run. An ML workload in Snowflake usually uses more than one kind of compute. Feature engineering and training stored procedures run on virtual warehouses. Model serving and GPU training often run in Snowpark Container Services on compute pools. Some features run on Snowflake-managed serverless compute, and the cloud services layer coordinates all of it. Snowflake's compute cost model names these four categories separately, and each one shows up in different usage views.
| Category | What it is | Who manages the resources |
|---|---|---|
| Virtual warehouse compute | Credits consumed as warehouses execute queries, load data and perform DML | User-managed: you directly control credit consumption |
| Serverless compute | Features that use Snowflake-managed compute instead of warehouses | Snowflake |
| Compute pools | The compute resources for Snowpark Container Services | User-defined node count and instance family |
| Cloud Services compute | The layer that handles login, query compilation, metadata and coordination | Snowflake |
Cloud services usage is only billed when it exceeds 10% of that day's warehouse usage. Serverless compute does not count toward this adjustment. In practice, most attributable ML spend sits in warehouses and compute pools, so the rest of this lesson focuses on those two.
Checkpoint 1 of 6· Check yourself
A team's model serving runs in Snowpark Container Services. Which compute category do its credits fall under?
Snowpark Container Services runs jobs and services on compute pools, which are a separate compute category from warehouses and serverless features.
“Compute pools provide the compute resources for Snowpark Container Services.”Source: docs.snowflake.com
Tracking the cost of ML features at a granular level means splitting a feature's spend into the meters it actually uses, instead of reading one lump of warehouse credits. Features served online report under their own service types in the usage views, separate from ordinary warehouse metering, so you can read each one on its own.
| Service type | Description | Unit |
|---|---|---|
| ONLINE_FEATURE_STORE_COMPUTE | Compute used by Online Feature Store | Credits |
| ONLINE_FEATURE_STORE_AUTOSCALE_COMPUTE | Compute used by Feature Store autoscale managed compute pools | Credits |
| ONLINE_FEATURE_STORE_STORAGE | Storage used by Online Feature Store | TiB-Months |
| SNOWPARK_CONTAINER_SERVICES | Compute and resources for Snowpark Container Services workloads | Credits |
For the offline side, a managed feature view refreshes on a warehouse, so the most direct way to attribute its cost is to give it a dedicated warehouse. Every credit on that warehouse then belongs to the refreshes, and you can tag the warehouse with a cost center as shown in the next section. To see the cost of one dynamic table behind a feature view, query DYNAMIC_TABLE_REFRESH_HISTORY and join it with QUERY_HISTORY. Together, the service-type split for online serving and the dedicated, tagged warehouse for offline refreshes give per-feature, per-team figures.
2.Object tags on dedicated ML resources
The simplest case is a resource used by only one team, for example a warehouse that only the fraud-model team uses. You tag the warehouse, and all of its credits go to that team. The recommended setup starts with a dedicated database and schema for tags. You then create a tag whose ALLOWED_VALUES restricts it to the cost centers you recognise, so that misspelled values cannot fragment your reports.
CREATE TAG cost_center
ALLOWED_VALUES 'finance', 'marketing', 'engineering', 'product';Next, you apply the tag. Tag the warehouses that a team owns outright. When a warehouse is shared, tag the users instead, because in that case query costs are attributed to users and the user's tag identifies the department. The documentation recommends automating tagging when resources and users are created, for example by provisioning users through a SCIM identity provider that sets the tag.
ALTER WAREHOUSE warehouse1 SET TAG cost_management.tags.cost_center='SALES';
ALTER WAREHOUSE warehouse2 SET TAG cost_management.tags.cost_center='SALES';
ALTER WAREHOUSE warehouse3 SET TAG cost_management.tags.cost_center='FINANCE';
ALTER USER finance_user SET TAG cost_management.tags.cost_center='FINANCE';
ALTER USER sales_user SET TAG cost_management.tags.cost_center='SALES';To report on dedicated warehouses within one account, join ACCOUNT_USAGE.TAG_REFERENCES to WAREHOUSE_METERING_HISTORY on object_id and warehouse_id. The COALESCE to 'untagged' matters: it shows the spend that nobody has claimed yet.
SELECT
TAG_REFERENCES.tag_name,
COALESCE(TAG_REFERENCES.tag_value, 'untagged') AS tag_value,
SUM(WAREHOUSE_METERING_HISTORY.credits_used_compute) AS total_credits
FROM
SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
LEFT JOIN SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES
ON WAREHOUSE_METERING_HISTORY.warehouse_id = TAG_REFERENCES.object_id
AND TAG_REFERENCES.domain = 'WAREHOUSE'With several accounts, the tags must mean the same thing everywhere. You create them once in a key account, such as the organization account, and replicate the tag database to the other accounts through a replication group. Organization-wide reporting then runs from the organization account, because that is the only place the ORGANIZATION_USAGE TAG_REFERENCES view exists.
Checkpoint 2 of 6· Check yourself
An organization runs ML workloads in ten accounts and wants a single cost_center tag that it can report on across all of them. What is the documented setup?
Tags are created in a key account, such as the organization account, and made available in other accounts through a replication group.
“you make those tags available in other accounts through replication”Source: docs.snowflake.com
Sources4
3.Query tags and per-query cost for shared ML applications
Object tags break down when one application serves many teams. In that case, the application sets a query tag on its session, and every later query in that session carries the tag.
ALTER SESSION SET QUERY_TAG = 'COST_CENTER=finance';The per-query figures come from ACCOUNT_USAGE.QUERY_ATTRIBUTION_HISTORY, where the cost of each query is the warehouse credit usage for executing it. You can group by query tag for applications, or join on user_name to TAG_REFERENCES for shared warehouses. A useful hygiene query finds credits from users with no tag. One limit is easy to miss: this view exists only per account, so per-query attribution cannot be run organization-wide from the organization account.
Checkpoint 3 of 6· Check yourself
Which statement about QUERY_ATTRIBUTION_HISTORY is accurate?
Per-query attribution has to be queried account by account. Only the tag and metering views have organization-level versions.
“The QUERY_ATTRIBUTION_HISTORY view is only available in the ACCOUNT_USAGE schema for an account. There is no organization-wide equivalent of the view.”Source: docs.snowflake.com
Checkpoint 4 of 6· Exam question
A shared warehouse `ML_SHARED_WH` serves data scientists from three departments. Finance wants a monthly chargeback that reflects each department's actual query consumption on that warehouse. Which approach delivers this?
Correct answer: A — Tag each user with a `COST_CENTER` object tag, then join QUERY_ATTRIBUTION_HISTORY to TAG_REFERENCES by user name and sum credits per tag value.
- A. Correct: user-level cost tags joined to per-query credits in QUERY_ATTRIBUTION_HISTORY apportion a shared warehouse by who ran each query.
- B. Incorrect: a warehouse can carry only one tag value at a time, so rotating values gives time-slice guesses instead of per-query consumption.
- C. Incorrect: an even split ignores real usage, and the history view reports credits by day, not per department, so it cannot justify a chargeback.
- D. Incorrect: WAREHOUSE_LOAD_HISTORY reports load (running, queued queries), not credits, and an account-level query tag cannot differ per department.
Sources4
4.What a feature view costs, and the settings that change it
To attribute feature cost at a fine grain, you first need to know what a feature view runs on. Snowflake-managed feature views are backed by dynamic tables, so their refreshes consume compute and their results consume storage, both on dynamic-table terms. External feature views are plain views, so they add no storage cost. If you enable online serving with hybrid tables, key lookups and ingestion consume virtual warehouse credits at standard rates. Cloud services are also used to detect changes in base objects and decide when a refresh is needed.
Each managed feature view is configured with a refresh_freq and a warehouse, and you can change both after registration. This gives you two levers. First, refreshing less often lowers cost when consumers can tolerate older data. Second, pointing the feature view at its own tagged warehouse makes its refresh credits visible as a separate line in the warehouse-tag report from the previous section.
Checkpoint 5 of 6· Fill the gap
Which argument lowers how often a managed feature view refreshes?
fs.update_feature_view(
name="<name>",
version="<version>",
? ="<new_fresh_freq>", # optional
warehouse="<new_warehouse>", # optional
desc="<new_description>", # optional
)update_feature_view accepts refresh_freq and warehouse, which are the two cost levers for a managed feature view.
Source: docs.snowflake.comCheckpoint 6 of 6· Check yourself
Which kind of feature view adds no storage cost of its own?
External feature views are implemented as views. Managed feature views are dynamic tables, which do store data.
“External feature views use views, which do not incur additional storage costs.”Source: docs.snowflake.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Tagging the service user of a shared ML application is enough to split its cost across the departments it serves.Why is that wrong?
A user tag names a single department. When one application queries on behalf of several departments, each query needs a query tag that identifies the department.
Covered in Query tags and per-query cost for shared ML applications
2.Organization-wide tag reports can be run from any account in the organization.Why is that wrong?
The ORGANIZATION_USAGE TAG_REFERENCES view exists only in the organization account.
Covered in Object tags on dedicated ML resources
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Compute pools provide the compute resources for Snowpark Container Services.”
↩︎ Where ML credits come from“Serverless compute does not factor into the 10% adjustment for cloud services.”
↩︎ Where ML credits come from - 2.
“Compute used by Feature Store autoscale managed compute pools.”
↩︎ Where ML credits come from - 3.
“To isolate dynamic table costs during testing, use a dedicated warehouse. This lets you attribute all credits on that warehouse to dynamic table refreshes.”
↩︎ Where ML credits come from - 4.
“In this case, you use object tags to associate each user with a department. The costs of queries are attributed to the users.”
↩︎ Object tags on dedicated ML resources“Ideally, you should have workflows that automate the process of applying these tags when you create resources and users.”
↩︎ Object tags on dedicated ML resources“This associates the COST_CENTER=finance tag with all subsequent queries executed during the session.”
↩︎ Query tags and per-query cost for shared ML applications“The cost per query is the warehouse credit usage for executing the query.”
↩︎ Query tags and per-query cost for shared ML applications“Use object tags to associate resources and users with departments or projects.”
↩︎ Key concept“each query executed by the application is assigned a query tag that identifies the team or cost center of the user”
↩︎ Exam trap 1“In the ORGANIZATION_USAGE schema, the TAG_REFERENCES view is only available in the organization account.”
↩︎ Exam trap 2“you make those tags available in other accounts through replication”
↩︎ Checkpoint“when the queries are made by the same application on behalf of users belonging to multiple departments”
↩︎ Prediction“The QUERY_ATTRIBUTION_HISTORY view is only available in the ACCOUNT_USAGE schema for an account. There is no organization-wide equivalent of the view.”
↩︎ Checkpoint - 5.
“Snowflake-managed feature views use Snowflake dynamic tables.”
↩︎ What a feature view costs, and the settings that change it“External feature views use views, which do not incur additional storage costs.”
↩︎ Checkpoint - 6.https://docs.snowflake.com/en/developer-guide/snowflake-ml/feature-store/online-feature-storeOfficial docs
“Both key lookups and data ingestion operations consume virtual warehouse credits at standard rates.”
↩︎ What a feature view costs, and the settings that change it