What you will be able to do
- Pick the right Cortex AI SQL function for a text task such as classification, extraction or sentiment
- Distinguish Cortex AI functions, Cortex Search and Cortex Analyst by input, output and use case
- Identify the privileges and database roles that control access to Cortex
- Trace a model through Snowflake ML from features to training, registry, serving and monitoring
1.Cortex AI SQL functions: LLMs inside a query
Snowflake Cortex is Snowflake's managed AI service. Its AI functions run large language models from providers including OpenAI, Anthropic, Meta, Mistral AI, DeepSeek and xAI against text and images, and you call them as ordinary SQL functions, with Python available too. A governance point decides many design questions: every LLM Snowflake offers through these features is deployed inside the Snowflake Service perimeter. A retailer whose policy forbids sending review text to an outside API can therefore still run AI_SENTIMENT over a reviews table, because the data never leaves the perimeter.
| Function | What it does |
|---|---|
| AI_COMPLETE | Generates a completion for text or an image with a chosen LLM; the general-purpose choice |
| AI_CLASSIFY | Assigns text or images to categories you define |
| AI_FILTER | Returns True or False, so it can be used in SELECT, WHERE or JOIN … ON |
| AI_EXTRACT | Pulls specific information out of a string or file such as a document |
| AI_SENTIMENT | Extracts sentiment from text |
| AI_SUMMARIZE / AI_SUMMARIZE_AGG | Summarizes one input / summarizes a text column across many rows |
| AI_AGG | Returns insights across many rows from a user-defined prompt |
| AI_EMBED / AI_SIMILARITY | Produces an embedding vector / scores similarity between two inputs |
| AI_TRANSLATE, AI_REDACT, AI_PARSE_DOCUMENT, AI_TRANSCRIBE | Translate text, redact PII, extract text from staged documents, transcribe staged audio and video |
Choose the narrowest function that fits. AI_CLASSIFY(review_text, ['billing', 'shipping', 'product_quality', 'other']) gives each review one of your labels. For a question like "what is the termination notice period in this contract", AI_EXTRACT returns that specific answer, whereas AI_SUMMARIZE would condense the whole document. AI_AGG and AI_SUMMARIZE_AGG work across rows and are not limited by the context window. Helper functions support the others: AI_COUNT_TOKENS checks a prompt against a model's limit, TO_FILE references a staged file, and PROMPT builds prompt objects.
These functions are optimized for throughput, so they suit batch work over large tables. When latency matters, such as an interactive chat turn, use the REST APIs (Complete, Embed, Agents) instead. To call the functions, a role needs the USE AI FUNCTIONS account-level privilege plus the CORTEX_USER or AI_FUNCTIONS_USER database role. CORTEX_USER is granted to PUBLIC by default, so every user has it unless an administrator revokes it.
Checkpoint 1 of 5· Match them up
Match each task to the narrowest Cortex AI function that fits it
Tap a term, then the definition that fits it.
Choose the function built for the task. AI_CLASSIFY assigns your own categories. AI_EXTRACT returns one specific fact. AI_FILTER returns True or False, so it works in WHERE. AI_SUMMARIZE_AGG summarizes across many rows without the context-window limit.
“AI_FILTER: Returns True or False for a given text or image input, allowing you to filter results in SELECT, WHERE, or JOIN … ON clauses.”Source: docs.snowflake.com
Checkpoint 2 of 5· Check yourself
A retailer's policy forbids sending customer review text to any external model provider's API. They want to run AI_SENTIMENT over their reviews table in Snowflake. What is the correct assessment?
All LLMs offered through Snowflake AI features run inside the Snowflake Service perimeter, whoever the model provider is. Running AI_SENTIMENT therefore doesn't send the review text to a third-party API.
“All the LLMs that Snowflake provides access to via our Snowflake AI Features are deployed within the Snowflake Service perimeter.”Source: docs.snowflake.com
2.Cortex Search: managed retrieval over text
Cortex Search is a managed, low-latency hybrid search engine (vector plus keyword) over your text data. You don't have to manage embeddings, infrastructure, quality tuning or index refreshes. It has two main uses. One is retrieval augmented generation (RAG), where it fetches the passages an LLM needs so its answers rest on your current data. The other is enterprise search, as the backend of a search bar in an application. It can also act as the retrieval layer for Cortex Agents.
CREATE OR REPLACE CORTEX SEARCH SERVICE transcript_search_service
ON transcript_text
ATTRIBUTES region
WAREHOUSE = cortex_search_wh
TARGET_LAG = '1 day'
EMBEDDING_MODEL = 'snowflake-arctic-embed-l-v2.0'
AS (
SELECT
transcript_text,
region,
agent_id
FROM support_transcripts
);Each clause has its own job. ON names the column that queries search. ATTRIBUTES names columns you can filter on, and they must appear in the source query. TARGET_LAG sets how far the service may fall behind its base table; with '1 day' it checks for changes about once a day. The warehouse materializes the source query when the service is created and again on each refresh. Snowflake recommends a dedicated warehouse no larger than MEDIUM per service. Because the index is built during CREATE, the statement can take hours on a large table. Other roles need USAGE on the service, its database and its schema, and they then query it from Python, REST or the SEARCH_PREVIEW SQL function.
Checkpoint 3 of 5· Fill the gap
Support agents must be able to limit search results to their own region. Which keyword belongs in the blank so that region becomes a filter column for queries on this service?
CREATE OR REPLACE CORTEX SEARCH SERVICE transcript_search_service
ON transcript_text
? region
WAREHOUSE = cortex_search_wh
TARGET_LAG = '1 day'
EMBEDDING_MODEL = 'snowflake-arctic-embed-l-v2.0'
AS (
SELECT
transcript_text,
region,
agent_id
FROM support_transcripts
);ATTRIBUTES names the columns you can filter on when you query the service, and those columns must also appear in the source query. ON names the column that gets searched, and TARGET_LAG controls how far the service may fall behind its base table.
Source: docs.snowflake.comSources3
3.Cortex Analyst: natural-language questions over structured data
Cortex Analyst is a fully managed, LLM-powered text-to-SQL service for structured data. A business user asks a question in plain language. Cortex Analyst generates SQL, and that SQL runs in your own virtual warehouse under your existing RBAC, so a user never sees rows their role couldn't query directly. It is offered as a REST API, which lets you build it into Streamlit apps, Slack, Teams or a custom chat interface.
A database schema alone doesn't tell an LLM what "active customer" or "net revenue" means. A semantic model fills that gap. It describes logical tables, dimensions, facts, metrics, relationships, synonyms and verified example questions. Semantic Views, which are schema-level objects, are the recommended way to define one; older YAML files on a stage still work. For inference, Cortex Analyst reads only the model's metadata, not the data, and by default it uses Snowflake-hosted models. For access, CORTEX_ANALYST_USER grants Cortex Analyst alone, while CORTEX_USER covers every Covered AI feature, Snowflake's designation for generally available Cortex features (preview ones are Preview AI Features), so it reaches well beyond Cortex Analyst. The role also needs SELECT on the tables the model references.
Checkpoint 4 of 5· Check yourself
When a business user asks Cortex Analyst "how many active customers did we have in March?", what happens to produce the answer?
Cortex Analyst is a text-to-SQL service. It reads only the semantic model's metadata to write the SQL. The query then runs in your warehouse under your role's access controls, so users never see rows their role couldn't query directly. Retrieving text passages is what Cortex Search does.
“This SQL query is then executed in your Snowflake virtual warehouse to generate the final output.”Source: docs.snowflake.com
4.Snowflake ML: the model lifecycle on governed data
Snowflake ML brings the whole machine-learning lifecycle onto the platform where the governed data already lives. Each stage has its own component:
- Feature Store: define features once and let them refresh incrementally from batch and streaming sources. Serve them for batch or low-latency online retrieval, keeping training and inference consistent to avoid training-serving skew.
- Training: runs in Container Runtime, a pre-built ML environment optimized for efficient data loading, distributed model training and hyperparameter tuning on large data. It runs on CPU or GPU compute pools and is opened from Snowflake Notebooks, with PyTorch, XGBoost or scikit-learn preinstalled and any other package installable from PyPI or Hugging Face.
- Experiments: record training runs and compare models against chosen metrics in Snowsight.
- Model Registry: logs and manages models whether they were trained in Snowflake or elsewhere. Models in the registry run inference at scale, and Model Serving deploys them to Snowpark Container Services.
- ML Jobs: automate pipelines and let teams working in VS Code, PyCharm or SageMaker send work to Container Runtime.
- ML Observability, Explainability and Lineage: track performance and drift with alerts, compute Shapley values, and trace models back to their source data.
Registered models are stored as objects in a schema, so they follow the object hierarchy: organization > account > database > schema > objects and its grants. Which compute to train on depends on the job. Custom single-node code that holds its dataset in one node's memory, such as scikit-learn inside a stored procedure, fits the memory-heavy warehouse type covered under warehouse types and sizes (Gen1, Gen2, Snowpark-optimized). Distributed training, GPUs or very large datasets call for Container Runtime. The platform also works in both directions: models built in Snowflake can be deployed outside it, and models trained elsewhere can be brought in for inference. Snowflake CoCo is an agent that autonomously plans, executes and iterates on ML workflows; from a natural-language prompt it can explore data, engineer features, train and evaluate models, debug issues and prepare models for deployment.
Log the model in the Model Registry, which runs inference at scale. Then monitor it with ML Observability, which tracks performance and drift metrics and alerts when a threshold is crossed.
Checkpoint 5 of 5· Match them up
A team is moving its whole ML workflow onto Snowflake. Pair each Snowflake ML component with the job it handles.
Tap a term, then the definition that fits it.
Each lifecycle stage has its own component. The Model Registry logs and manages any model, wherever it was trained, so a model trained outside Snowflake can still be registered and used for inference at scale.
“The Snowflake Model Registry allows for the logging and management of all your ML models, regardless of whether they’re trained on Snowflake or other platforms.”Source: docs.snowflake.com
Practise it for real
Create a Cortex Search service over a small transcripts table and check that it returns filtered results.
1.Create the cortex_search_db database, the services schema, an X-SMALL warehouse named cortex_search_wh, and a support_transcripts table with three VARCHAR columns (transcript_text, region, agent_id). Insert these four rows: ('My internet has been down since yesterday, can you help?', 'North America', 'AG1001'), ('I was overcharged for my last bill, need an explanation.', 'Europe', 'AG1002'), ('How do I reset my password? The email link is not working.', 'Asia', 'AG1003'), ('I received a faulty router, can I get it replaced?', 'North America', 'AG1004').
Why: The service needs a source query and a warehouse to materialize it.
You should see: SELECT * FROM support_transcripts returns the four rows above.
2.Run the CREATE OR REPLACE CORTEX SEARCH SERVICE transcript_search_service statement from this page, with ON transcript_text, ATTRIBUTES region and TARGET_LAG = '1 day'.
Why: CREATE builds the index, so the service can be queried as soon as the statement finishes.
You should see: The statement succeeds; with four rows it finishes quickly, though large tables can take hours.
3.Grant USAGE on the database, the schema and the Cortex Search service to a role such as customer_support.
Why: A querying role needs access to the service and its containers.
You should see: All three GRANT statements succeed.
4.Call SNOWFLAKE.CORTEX.SEARCH_PREVIEW with the query "internet issues", the columns transcript_text and region, the filter {"@eq": {"region": "North America"}} and limit 1.
Why: This confirms that both the hybrid search and the ATTRIBUTES filter work.
You should see: One result: "My internet has been down since yesterday, can you help?" with region North America.
Stuck? Get a nudge
If the filter on region fails, check that region appears in both the ATTRIBUTES clause and the source SELECT.
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Snowflake Cortex features are provided as SQL functions and are also available in Python.”
↩︎ Cortex AI SQL functions: LLMs inside a query“AI_CLASSIFY: Classifies text or images into user-defined categories.”
↩︎ Cortex AI SQL functions: LLMs inside a query“AI_EXTRACT: Extracts information from an input string or file, for example, text, images, and documents.”
↩︎ Cortex AI SQL functions: LLMs inside a query“your role needs the USE AI FUNCTIONS account-level privilege and one of the CORTEX_USER or AI_FUNCTIONS_USER database roles”
↩︎ Cortex AI SQL functions: LLMs inside a query“For more interactive use cases where latency is important, use the REST API.”
↩︎ Cortex AI SQL functions: LLMs inside a query“Generally available functions are Covered AI Features. Preview functions are Preview AI Features.”
↩︎ Cortex Analyst: natural-language questions over structured data“All the LLMs that Snowflake provides access to via our Snowflake AI Features are deployed within the Snowflake Service perimeter.”
↩︎ Exam trap 1“AI_FILTER: Returns True or False for a given text or image input, allowing you to filter results in SELECT, WHERE, or JOIN … ON clauses.”
↩︎ Checkpoint“All the LLMs that Snowflake provides access to via our Snowflake AI Features are deployed within the Snowflake Service perimeter.”
↩︎ Checkpoint - 2.
“By default, the CORTEX_USER role is granted to the PUBLIC role.”
↩︎ Cortex AI SQL functions: LLMs inside a query“ensuring that SQL queries generated and executed adhere to all established access controls”
↩︎ Cortex Analyst: natural-language questions over structured data“Cortex Analyst overcomes this limitation by using a semantic model to bridge the gap between business users and databases.”
↩︎ Cortex Analyst: natural-language questions over structured data“Legacy semantic model YAML files (stored on stages) are still supported for backward compatibility, but Semantic Views are the recommended approach for new implementations.”
↩︎ Cortex Analyst: natural-language questions over structured data“CORTEX_USER provides access to all Covered AI features, while CORTEX_ANALYST_USER provides access only to Cortex Analyst.”
↩︎ Cortex Analyst: natural-language questions over structured data“This SQL query is then executed in your Snowflake virtual warehouse to generate the final output.”
↩︎ Exam trap 2“With Cortex Analyst, business users can ask questions in natural language and receive direct answers without writing SQL.”
↩︎ Prediction“This SQL query is then executed in your Snowflake virtual warehouse to generate the final output.”
↩︎ Checkpoint - 3.https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-search/cortex-search-overviewOfficial docs
“a hybrid (vector and keyword) search engine on your text data in minutes”
↩︎ Cortex Search: managed retrieval over text“The two primary use cases for Cortex Search are retrieval augmented generation (RAG) and enterprise search.”
↩︎ Cortex Search: managed retrieval over text“Snowflake recommends using a dedicated warehouse of size no larger than MEDIUM for each service.”
↩︎ Cortex Search: managed retrieval over text“Columns in the ATTRIBUTES field must be included in the source query”
↩︎ Cortex Search: managed retrieval over text - 4.
“Snowflake ML is an integrated set of capabilities for end-to-end machine learning in a single platform on top of your governed data.”
↩︎ Snowflake ML: the model lifecycle on governed data“ensures consistency between training and inference to reduce training-serving skew”
↩︎ Snowflake ML: the model lifecycle on governed data“You can use Model Serving to deploy the models to Snowpark Container Services for inference.”
↩︎ Snowflake ML: the model lifecycle on governed data“ML Lineage is a capability to trace end-to-end lineage of ML artifacts from source data to features, datasets, and models.”
↩︎ Snowflake ML: the model lifecycle on governed data“Container Runtime, a pre-built ML environment optimized for efficient data loading, distributed model training, and hyperparameter tuning”
↩︎ Snowflake ML: the model lifecycle on governed data“Snowflake CoCo powers agentic ML by autonomously planning, executing, and iterating on machine learning workflows on your behalf.”
↩︎ Snowflake ML: the model lifecycle on governed data“allows for the logging and management of all your ML models, regardless of whether they’re trained on Snowflake or other platforms”
↩︎ Exam trap 3“The Snowflake Model Registry allows for the logging and management of all your ML models, regardless of whether they’re trained on Snowflake or other platforms.”
↩︎ Checkpoint - 5.https://docs.snowflake.com/en/developer-guide/snowpark/python/python-snowpark-training-mlOfficial docs
“can be used for workloads that require a large amount of memory and compute resources”
↩︎ Snowflake ML: the model lifecycle on governed data