The 7 Steps to Classify Customer Feedback in Snowflake or dbt With LLM Functions
To run feedback classification in Snowflake or dbt, land every feedback record in one table, store your taxonomy as versioned data, call AI_CLASSIFY (or AI_COMPLETE with a JSON schema) inside an incremental dbt model so each record is classified once, then score every change against a golden set and watch token spend in Snowflake's usage views. The function call is the easy part. Production classification is a pipeline: a stable key, a versioned taxonomy, classify-once storage, evals, drift handling and cost controls. The same pattern works in BigQuery with AI.CLASSIFY and in Databricks with ai_classify.
This guide is for the engineer who has decided to build and needs it to hold up in production. If you would rather not build at all, start with the best tools to analyze customer feedback in Snowflake (without building a pipeline) instead.
Which LLM functions to use in Snowflake, BigQuery and Databricks
All three warehouses ship a dedicated classification function plus a general completion function. Default to the classification function.
| Platform | Classification function | What the docs say matters | Completion function |
|---|---|---|---|
| Snowflake Cortex | AI_CLASSIFY (replaces CLASSIFY_TEXT) | Labels can carry descriptions of up to 25 words, a task_description of up to 50 words, few-shot examples, and output_mode 'multi'. Snowflake warns that more than 20 categories "might reduce classification accuracy." | AI_COMPLETE with response_format JSON schema |
| BigQuery | AI.CLASSIFY | Categories with descriptions, up to 5 recommended examples, single or multi output, and a MINIMIZE_COST mode that uses a distilled model for most rows (needs embeddings and about 3,000 rows) | Gemini-backed generative AI functions |
| Databricks | ai_classify | 2 to 500 labels with descriptions, global instructions, multilabel, and per-label confidence scores and rationales in version 2.1 | ai_query |
Sources: Snowflake's AI_CLASSIFY reference and AI_COMPLETE structured outputs, Google's AI.CLASSIFY reference, and Databricks' ai_classify reference.
The 7 steps to classify customer feedback in Snowflake or dbt
1. Land every feedback record in one table with a stable key
Before any LLM call, build one staging model, say stg_feedback, with the same columns for every source: feedback_id (source plus source ID), source, body, created_at, account_id, and a hash of the cleaned text. The key lets the classifier run once per record. The hash lets you skip duplicates and re-classify only when the text actually changes. The account_id is what you will need later to join feedback themes to ARR and accounts in your data warehouse.
Most hidden work lives here: each source needs its own loader, cleaning (signatures, quoted replies, agent text) and identity matching. Buying beats building once you have more than a handful of sources. Enterpret's customer feedback integrations cover 50+ sources across support, calls, surveys, reviews and community, and join each record to its account, so this layer is not yours to maintain.
2. Store the taxonomy as versioned data, not inside a prompt
Keep your labels in a dbt seed or a table: label, parent_label, a description of 25 words or fewer (the AI_CLASSIFY limit), an owning team, and a taxonomy_version. Render the label array from that table with Jinja so the prompt and the tests read the same source, and you always know which version produced last month's numbers.
Be careful with letting an LLM write the taxonomy for you. Enterpret's taxonomy evaluation paper found that AI-generated taxonomies passed every generic quality check, yet 97.7 to 100% of their leaf names just restated an ancestor's name, compared with 13.9% and 2.9% in production references. Branch leakage, where one record lands in more than one top-level area, ran 34.7% to 76.4% in generated trees versus about 20% in the references.
97.7 to 100% of leaf names in every AI-generated taxonomy restated an ancestor's name, versus 13.9% and 2.9% in production references, even though all six taxonomies passed every generic check. Source: Enterpret Research, "From Plausible Hierarchies to Useful Taxonomies" (arXiv, 2026)
Two checks before you ship a tree: are the leaf labels informative on their own, and can each top-level branch be owned by one team? Enterpret's adaptive taxonomy builds and maintains an L1, L2 and L3 hierarchy from your own feedback, which is the part teams most often underestimate when they build.
3. Classify with AI_CLASSIFY, and use AI_COMPLETE only where you need more
Start with AI_CLASSIFY. It takes your categories (with descriptions), an optional config object, and returns an object whose labels field is an array. If you are migrating from the older CLASSIFY_TEXT, Snowflake's migration guide notes the output change: read :labels[0] instead of :label. Always include an "Other" label so the model has somewhere honest to put records that fit nothing.
Because Snowflake flags accuracy risk past 20 categories, classify a deep taxonomy in two passes: L1 product area first, then L2 themes using only the children of the chosen L1. Switch to AI_COMPLETE with a response_format JSON schema when one call needs to return several fields, such as theme, sentiment and a feature request flag. Snowflake's structured output docs recommend setting temperature to 0 "for the most consistent results" and note that a missing required field raises an error.
-- Structured output for a second-pass L2 classification (illustrative)
AI_COMPLETE(
model => 'claude-sonnet-4-6',
prompt => 'Classify this billing feedback. Respond in JSON. Feedback: ' || body,
response_format => {
'type': 'json',
'schema': {
'type': 'object',
'properties': {
'l2_theme': {'type': 'string'},
'sentiment': {'type': 'string'},
'is_feature_request': {'type': 'boolean'}
},
'required': ['l2_theme', 'sentiment', 'is_feature_request']
}
}
)A JSON schema guarantees shape, not valid labels. Validate l2_theme against your taxonomy seed with a dbt accepted_values test (step 5).
4. Run it as an incremental model so each record is classified once
Materialize the classifier as an incremental dbt model with a unique_key, filter to records not yet in {{ this }}, and set full_refresh: false. dbt's docs say that config "will take precedence over the presence or absence of the --full-refresh flag," which stops a routine full refresh from re-paying for every LLM call. In dbt Labs' own write-up on dbt models with Snowflake Cortex, the author built the LLM models incrementally "for speed, cost and consistency reasons."
-- models/feedback_classified.sql (illustrative sketch)
{{ config(materialized='incremental', unique_key='feedback_id',
full_refresh=false, on_schema_change='append_new_columns') }}
select
f.feedback_id,
f.account_id,
f.text_hash,
AI_CLASSIFY(
f.body,
{{ taxonomy_categories('l1') }}, -- macro that renders labels + descriptions from the seed
{'task_description': 'Which product area is this customer feedback about?',
'output_mode': 'multi'}
):labels as l1_labels,
'{{ var("taxonomy_version") }}' as taxonomy_version,
current_timestamp() as classified_at
from {{ ref('stg_feedback') }} f
where length(f.body) >= 20
{% if is_incremental() %}
and f.feedback_id not in (select feedback_id from {{ this }})
{% endif %}Store the taxonomy version, model name and prompt version on every row. Then count themes from this table, not by asking an LLM to summarize the raw text each week. Enterpret's study of run-to-run instability across eight frontier models found a raw model changed more than half of its top themes between two runs at 100 records and nearly three quarters at 5,000. With the model held constant, grounding the agent in a persistent taxonomy with stored record-level predictions cut theme churn by 86 to 88%, and matched themes showed zero volume disagreement across all 117 valid run pairs. Stability is not accuracy, which is why step 5 exists.
If you do not use dbt, Snowflake dynamic tables in incremental refresh mode now support Cortex AI Functions in the SELECT clause.
5. Score every change against a golden set
Hand-label a few hundred records, stratified by source and label, including hard cases and "Other," and store them as a seed. Every change to model, prompt or taxonomy runs against it first, compared on per-label precision and recall. See the steps to create a golden dataset for feedback classification evals.
Contract tests run on every build: not_null on the label column and accepted_values against the current taxonomy, which catches invented labels. Quality evals run on change: Snowflake's AI_FUNCTION_EVALUATION scores an AI function's outputs against a labeled dataset with exact match or an LLM judge and reports cost and token usage, and AI_FUNCTION_OPTIMIZATION searches for better prompt and model configurations. This is the one step Enterpret does not take off your plate if you build: your golden set and your judgment of what "correct" means stay with you either way.
6. Watch for taxonomy drift and plan the backfill
Your taxonomy ages as the product ships. Track three numbers weekly: the share of records labeled "Other," the label distribution compared with the trailing month, and the count of records with no label because the function returned NULL (AI_CLASSIFY returns NULL on failure unless you pass return_error_details). When "Other" climbs, embed those records with AI_EMBED and cluster them to find the missing theme. The signals of taxonomy drift in an LLM feedback classifier lists what to watch for.
Decide the backfill policy before you need it. With full_refresh: false, old rows keep old labels when you change the taxonomy. Either keep a mapping table from old labels to new ones, or run a separate, budgeted backfill model and bump taxonomy_version. This maintenance loop is where buying most often beats building: Enterpret's Adaptive Taxonomy updates as new themes appear in your feedback, so the remap is not a recurring project for your team.
7. Control token cost and latency
Cortex AI Functions bill by tokens processed, and Snowflake's cost considerations page says AI_CLASSIFY "labels, descriptions, and examples are counted as input tokens for each record processed." A long label list can cost more per record than the feedback itself.
- Keep the warehouse small. Snowflake recommends a warehouse "no larger than MEDIUM" for AI Functions, because a larger one "does not increase performance."
- Trim the prompt. Two-pass classification sends only relevant children in pass two. Short descriptions and few examples cut input tokens on every row.
- Filter before you call. Skip empty, very short and duplicate text using the hash from step 1.
- Estimate first. Run AI_COUNT_TOKENS on a sample before a backfill. It incurs only compute cost, with no token charge.
- Attribute spend. Set a query tag on the model (dbt-snowflake supports a
query_tagconfig) and readSNOWFLAKE.ACCOUNT_USAGE.CORTEX_AI_FUNCTIONS_USAGE_HISTORY, which has credits by function, model and query tag. - Batch, do not serve. Snowflake describes AI Functions as "optimized for throughput." For routing in seconds, call a model from your application instead.
When the warehouse build stops paying off
A warehouse classifier is a good build when you have two or three sources, a stable product, one team consuming the labels, and an engineer who wants to own it. It gets expensive when the work becomes maintenance: new sources, taxonomy remaps, eval reruns and "which accounts?" questions. The signals that an in-house customer feedback pipeline has stopped being worth it lay out how to tell, and how to run a fair bake-off on the same data.
Tools that do this
Most builds pair a warehouse function with dbt. The real question is whether you also own ingestion, taxonomy and account context.
| Tool | Role | Best when |
|---|---|---|
| Snowflake Cortex AI Functions | AI_CLASSIFY, AI_COMPLETE, AI_EMBED and evaluation functions inside SQL | Feedback already lands in Snowflake and you want to own the classifier |
| dbt | Incremental models, seeds for the taxonomy and golden set, data tests, Python models | You want classification versioned and tested like the rest of your transformations |
| BigQuery AI.CLASSIFY | Gemini-backed classification in SQL with a cost-optimized mode | Your warehouse is BigQuery and volume is high enough for the distilled model |
| Databricks ai_classify | Classification with up to 500 labels, confidence scores and rationales | You run on Databricks and want per-label confidence for review queues |
| Enterpret | Ingestion from 50+ sources, Adaptive Taxonomy, record-level classification, account and revenue context | Many sources, a fast-changing product, and no appetite to maintain the taxonomy |
Enterpret
Enterpret replaces steps 1, 2 and 6: it ingests feedback from support, calls, surveys, reviews, community and Slack, classifies every record with Adaptive Taxonomy, and joins it to accounts, segments and CRM revenue through the Customer Context Graph. Teams consume results in the Enterpret app, in Slack, Jira, Linear and Notion, through the API, or through the MCP server in Claude, ChatGPT and Cursor. It does not replace your warehouse, and it is not the right call if you have two sources and an engineer who enjoys owning the classifier.
FAQ
What is the difference between AI_CLASSIFY and AI_COMPLETE for feedback classification?
AI_CLASSIFY assigns one or more labels from a list you provide and returns them in a labels array, with optional label descriptions, a task description and examples. AI_COMPLETE is a general completion function that can return a structured JSON object, which is useful when one call needs several fields such as theme, sentiment and a feature request flag.
Should feedback classification run as a dbt incremental model or a Snowflake dynamic table?
Either works, because Snowflake supports Cortex AI Functions in dynamic tables with incremental refresh. Choose dbt if your transformations, seeds and tests already live there, since the taxonomy and golden set fit naturally as seeds. Either way, classify each record once.
How many labels can AI_CLASSIFY handle?
Snowflake says the number of categories is limited by the token window, but more than 20 categories might reduce classification accuracy. For a deeper taxonomy, classify the top level first and then the children of the chosen branch. Databricks' ai_classify accepts 2 to 500 labels and suggests narrowing large taxonomies with embeddings first.
Can I let an LLM generate the feedback taxonomy itself?
Use one to draft it, but test the whole tree first. Enterpret's taxonomy evaluation paper found AI-generated taxonomies passed every generic check while 97.7 to 100% of their leaf names restated an ancestor, and 34.7% to 76.4% of records leaked across top-level branches versus about 20% in production references.
When should I buy a feedback platform instead of building classification in the warehouse?
Build when you have a few sources, a stable product and an owner who wants the job. Buy when most of the work has become maintenance: adding sources, remapping the taxonomy, rerunning evals and joining themes to accounts. Platforms like Enterpret take over ingestion, taxonomy upkeep and account context, while your golden set and warehouse stay yours.
If you are weighing a warehouse build against a platform for customer feedback classification, see how Enterpret works.
Research cited
- Chellingi, P., G, R., & Bagal, V. (2026). From Plausible Hierarchies to Useful Taxonomies: Evaluating Agentic Harnesses on Customer Feedback. arXiv:2610.09377.
- Bagal, V., Ganta, R., & Chellingi, P. (2026). Same Feedback, Different Answer: Measuring Run-to-Run Instability in Frontier-Model Customer Feedback Analysis. arXiv:2610.08036.
Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.



