Snowflake Architecture · Topic 10 of 18
AI/ML Pipelines, Snowflake ML Functions and Cortex LLM Functions
Design a basic AI/ML pipeline on Snowflake and choose between Snowflake ML functions, Cortex LLM functions, Snowpark and containers for each stage.
- 5 min
- Pipeline: ingest, prepare, model, serve, all inside Snowflake governance.
- Snowflake ML functions: forecasting, anomaly detection, classification, top insights. You call them with SQL and do not choose an algorithm.
- Cortex LLM functions work on text, documents and audio:
AI_COMPLETE,AI_CLASSIFY,AI_SENTIMENT,AI_SUMMARIZE,AI_EXTRACT,AI_TRANSLATE.
What it is
An AI/ML pipeline on Snowflake moves data through four stages: ingest, prepare, build or call a model, and serve the result. The exam gives you a business need such as "forecast daily sales", "classify support tickets" or "summarize call notes" and asks which Snowflake feature fits with the least effort and the least data movement.
The architect's rule is simple. Use the most managed option that meets the requirement, and move to custom code or containers only when a managed function cannot do the job. All the options keep data inside Snowflake governance, so roles, masking and row access policies still apply.
How it works
Pipeline stages and the feature for each
| Stage | Typical Snowflake feature | Why |
|---|---|---|
| Ingest | Snowpipe, Snowpipe Streaming, COPY | Files or rows arrive without a warehouse you manage |
| Prepare | Dynamic tables, streams and tasks, Snowpark | Keep features fresh with declarative or code based transforms |
| Build a model | Snowflake ML (Model Registry, Feature Store), Snowpark, Snowpark Container Services for GPUs or custom stacks | Train and register models next to the data |
| Use a model | Snowflake ML functions, Cortex functions, model inference in SQL | A function call replaces a model server |
| Serve | Tables and views, Streamlit in Snowflake, Snowflake Native App Framework | Share results with people, apps or other accounts |
A basic pipeline needs no external system. Data lands in a table, a dynamic table or task prepares it, a function scores it, and the result is written to a table that a dashboard or Streamlit app reads.
Snowflake ML functions
Snowflake ML functions are built in, SQL callable machine learning for common analytics. You do not choose an algorithm or write training code.
| Function | What it does | Needs time series? |
|---|---|---|
| Forecasting | Predicts future values of a metric from past trends | Yes |
| Anomaly detection | Flags metric values that differ from what is expected | Yes |
| Classification | Sorts rows into two or more classes from their most predictive features | No |
| Top insights | Finds dimensions and values that move a metric in unexpected ways | No |
You train a model object with a CREATE statement (for example a forecast model over a table or view) and then call its method, such as FORECAST, using the model name. Training and prediction use compute you pay for, and each trained model instance uses storage, so delete models you no longer need.
CREATE SNOWFLAKE.ML.FORECAST sales_fc(
INPUT_DATA => TABLE(SELECT day, revenue FROM daily_sales),
TIMESTAMP_COLNAME => 'DAY',
TARGET_COLNAME => 'REVENUE');
CALL sales_fc!FORECAST(FORECASTING_PERIODS => 14);
If the question says "no data science team", "SQL only" and "forecast" or "detect anomalies in a metric", the answer is a Snowflake ML function, not a custom model on a container.
Cortex LLM functions
Snowflake Cortex runs large language models inside Snowflake, so prompts and data stay on the platform. The task specific functions are called from SQL like any other function, and Snowflake manages the models and the GPUs.
| Need | Function |
|---|---|
| Free form prompt, chat, structured JSON output | AI_COMPLETE (older name COMPLETE) |
| Label text or files with categories you provide | AI_CLASSIFY |
| Sentiment of text | AI_SENTIMENT |
| Summarize one text or many rows | AI_SUMMARIZE, AI_SUMMARIZE_AGG |
| Pull values or answers out of text or documents | AI_EXTRACT, AI_PARSE_DOCUMENT |
| Translate or transcribe | AI_TRANSLATE, AI_TRANSCRIBE |
| Filter or aggregate rows by natural language | AI_FILTER, AI_AGG |
| Embeddings and similarity for search | AI_EMBED, AI_SIMILARITY |
These are the Cortex AISQL functions. Some individual functions are Preview Features, so check the status of a function before relying on it in production.
SELECT ticket_id,
AI_CLASSIFY(body, ['billing', 'outage', 'how to']):labels[0]::STRING AS category,
AI_SUMMARIZE(body) AS summary
FROM support_tickets;
Access is controlled with privileges. Your role needs the USE AI FUNCTIONS account privilege and the CORTEX_USER database role (or the AI_FUNCTIONS_USER database role). Cortex functions are billed by the amount of text processed, counted in tokens, so long prompts and long rows cost more.
Choosing between the options
Cortex also includes services built on these models, such as Cortex Search for retrieval and Cortex Analyst for natural language questions over structured data. They sit in the use and serve stages of a pipeline.
Common mistakes
Building a container for a job a function does. If a built in function covers sentiment, summary or forecast, a custom service adds cost and operations for no gain.
Forgetting the privileges. A role without USE AI FUNCTIONS and the CORTEX_USER database role cannot call the Cortex functions, even with access to the data.
Treating ML functions and Cortex LLM functions as the same thing. ML functions work on numeric metrics and tabular features. Cortex LLM functions work on text, documents and audio.
Ignoring cost drivers. Calling an LLM function on every row of a very large table on every refresh is expensive. Run it on new rows only, for example from a stream.
What to remember for the exam
- Pipeline: ingest, prepare, model, serve, all inside Snowflake governance.
- Snowflake ML functions: forecasting, anomaly detection, classification, top insights. You call them with SQL and do not choose an algorithm.
- Cortex LLM functions work on text, documents and audio:
AI_COMPLETE,AI_CLASSIFY,AI_SENTIMENT,AI_SUMMARIZE,AI_EXTRACT,AI_TRANSLATE. - Access needs
USE AI FUNCTIONSplus theCORTEX_USERorAI_FUNCTIONS_USERdatabase role. - Most managed option first; containers or custom Snowpark code only for needs functions cannot meet.
Check yourself
A team with only SQL skills must forecast weekly demand per region. What do they use?
The Snowflake ML forecasting function, trained on a table or view with a timestamp and a target column.
An Architect must tag thousands of support emails as billing, outage or how to without leaving Snowflake. Which feature?
A Cortex function such as
AI_CLASSIFY, called in SQL with the category list.A role gets an authorization error when calling a Cortex function on data it can read. What is missing?
The
USE AI FUNCTIONSprivilege or theCORTEX_USER(orAI_FUNCTIONS_USER) database role.
Topic 10 of 18 in Snowflake Architecture
Test yourself on Snowflake Architecture
The full Snowflake ARA-C01 question bank has 687 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.