<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Attributing Costs in Databricks Model Serving in Technical Blog</title>
    <link>https://community.databricks.com/t5/technical-blog/attributing-costs-in-databricks-model-serving/ba-p/64818</link>
    <description>&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Authors:&lt;/STRONG&gt; Sean Wilkinson, Ashwin Srikant, Cathy Zdravevski&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks Model Serving provides a scalable, low-latency hosting service for AI models. It supports models ranging from small custom models to best-in-class large language models (LLMs). In this blog we’ll describe the pricing model associated with Databricks Model Serving and demonstrate how to allocate costs per endpoint or per use case.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Understanding billable usage&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks Model Serving now includes three distinct pricing methods. Regardless of the method you choose, the price is inclusive of all cloud infrastructure costs. The three different methods are covered briefly here:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Model and Feature Serving&lt;/STRONG&gt;&lt;SPAN&gt;: Choose a compute type (CPU/GPU) and a size that corresponds to a range of concurrent requests that the endpoint can handle. The serverless endpoint will scale seamlessly within this range and you pay for the actual compute allocated. If “scale to zero” is enabled, a $.07 charge per launch is incurred (max 2/hour).&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Foundation Model APIs (Provisioned Throughput)&lt;/STRONG&gt;&lt;SPAN&gt;: For large language model use cases that require consistent, low latency responses with high concurrency. It provides dedicated compute that scales between a configured set range. Databricks only charges for the actual compute used.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Foundation Model APIs (Pay-per-Token)&lt;/STRONG&gt;&lt;SPAN&gt;: Choose one of the available &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/en/machine-learning/foundation-models/index.html#pay-per-token-foundation-model-apis" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;state-of-the-art Foundation Models&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; and query it directly. Customers pay only for the input and output tokens consumed and produced by the model.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;The best way to track model servings costs in Databricks is through the &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/en/administration-guide/system-tables/billing.html" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;billable usage system table&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;. Once &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/en/administration-guide/system-tables/index.html#enable-system-table-schemas" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;enabled&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, the table automatically populates with the latest usage in your Databricks account. No matter which of the three model serving methods you choose, your costs will appear in the &lt;/SPAN&gt;&lt;I&gt;&lt;SPAN&gt;system.billing.usage&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt; table with column &lt;/SPAN&gt;&lt;I&gt;&lt;SPAN&gt;sku_name&lt;/SPAN&gt;&lt;/I&gt; &lt;SPAN&gt;as either:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;tier&amp;gt;&lt;/STRONG&gt;&lt;SPAN&gt;_SERVERLESS_REAL_TIME_INFERENCE_LAUNCH_&lt;/SPAN&gt;&lt;STRONG&gt;&amp;lt;region&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;which includes all DBUs accrued when an endpoint starts after scaling to zero. All other model serving costs are grouped under:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;tier&amp;gt;&lt;/STRONG&gt;&lt;SPAN&gt;_SERVERLESS_REAL_TIME_INFERENCE_&lt;/SPAN&gt;&lt;STRONG&gt;&amp;lt;region&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;where ti&lt;/SPAN&gt;&lt;SPAN&gt;er corresponds to your &lt;/SPAN&gt;&lt;A href="https://www.databricks.com/product/pricing/platform-addons" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Databricks platform tier&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; and region corresponds to the cloud region of your Databricks deployment.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Querying and visualizing Model Serving usage&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;You can easily query the &lt;/SPAN&gt;&lt;I&gt;&lt;SPAN&gt;system.billing.usage&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt; table to aggregate all DBUs (Databricks Units) associated with Databricks model serving. Here is an example query that aggregates model serving DBUs per day for the last 30 days:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE style="border-style: hidden; width: 100%;" border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;&lt;LI-CODE lang="python"&gt;SELECT

 SUM(usage_quantity) AS model_serving_dbus,

 usage_date

FROM

 system.billing.usage

WHERE

 sku_name LIKE '%SERVERLESS_REAL_TIME_INFERENCE%'

GROUP BY(usage_date)

ORDER BY

 usage_date DESC

LIMIT 30&lt;/LI-CODE&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Model Serving DBUs per Day For Last 30 Days" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/6836i3CD8CAA8262B8A93/image-size/large?v=v2&amp;amp;px=999" role="button" title="sewi_ml_0-1711555204535.png" alt="Model Serving DBUs per Day For Last 30 Days" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Model Serving DBUs per Day For Last 30 Days&lt;/span&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Cost attribution with custom tags&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;Aggregated costs may be sufficient for simple use cases, but as the number of endpoints grows it is desirable to break out costs based on use case, business unit, or other custom identifiers. Optional key/value tags can be applied to custom models endpoints. All custom tags applied to Databricks Model Serving endpoints propagate to the &lt;/SPAN&gt;&lt;I&gt;&lt;SPAN&gt;system.billing.usage&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt; table under the &lt;/SPAN&gt;&lt;I&gt;&lt;SPAN&gt;custom_tags&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt; column and can be used to aggregate and visualize costs. Databricks recommends adding descriptive tags to each endpoint for precise cost tracking.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Applying Custom Tags" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/6837i67F06DB2AA938D71/image-size/large?v=v2&amp;amp;px=999" role="button" title="sewi_ml_1-1711555204609.png" alt="Applying Custom Tags" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Applying Custom Tags&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is an example query that separates model serving costs by values of a specific tag for the Databricks account over the last 30 days.&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE style="border-style: hidden; width: 100%;" border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;&lt;LI-CODE lang="python"&gt;SELECT

 value,

 SUM(usage_quantity) AS DBUs

FROM

 (

   SELECT

     usage_date,

     usage_quantity,

     -- Use the built in EXPLODE() function to create a new row per tag.

     EXPLODE(custom_tags)

   FROM

     system.billing.usage

   WHERE

     sku_name LIKE '%SERVERLESS_REAL_TIME_INFERENCE%'

     AND usage_date &amp;gt; DATE_SUB(CURRENT_DATE(), 30)

   ORDER BY

     usage_date DESC

 )

WHERE

 key = {{ filter_key }}

GROUP BY

 value

ORDER BY

 DBUs DESC&lt;/LI-CODE&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;SPAN&gt;Running the query in the Databricks SQL Editor breaks out model serving costs by value of the tag over the past month:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="DBUs by Endpoint Owner Over Past 30 Days" style="width: 754px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/6838i0AE3EDAAAAB9DC38/image-size/large?v=v2&amp;amp;px=999" role="button" title="sewi_ml_2-1711555204565.png" alt="DBUs by Endpoint Owner Over Past 30 Days" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;DBUs by Endpoint Owner Over Past 30 Days&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;&lt;BR /&gt;Conclusion&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;This is just the start of what you can view and visualize using the &lt;/SPAN&gt;&lt;I&gt;&lt;SPAN&gt;system.billing.usage&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt; tables in Databricks! Stay tuned as Databricks plans to roll out additional tables and metrics within the system catalog.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 14:34:51 GMT</pubDate>
    <dc:creator>sewi_ml</dc:creator>
    <dc:date>2024-08-14T14:34:51Z</dc:date>
    <item>
      <title>Attributing Costs in Databricks Model Serving</title>
      <link>https://community.databricks.com/t5/technical-blog/attributing-costs-in-databricks-model-serving/ba-p/64818</link>
      <description>&lt;P&gt;Learn how to allocate Databricks Model Serving costs per endpoint, use case, or other custom identifier!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 14:34:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/attributing-costs-in-databricks-model-serving/ba-p/64818</guid>
      <dc:creator>sewi_ml</dc:creator>
      <dc:date>2024-08-14T14:34:51Z</dc:date>
    </item>
  </channel>
</rss>

