Skip to main content

Snowflake ML Overview

What Is Snowflake ML?​

Snowflake ML is a suite of built-in machine learning functions that run natively inside Snowflake. Models are trained and predictions are generated using SQL — no external tools, Python environments, or data movement required. All computation happens within the Snowflake compute layer, governed by the same access controls as the rest of your data.

Supported Algorithms​

Snowflake ML provides purpose-built functions for common ML tasks:

FunctionUse CaseSQL Object
ClassificationPredict categorical outcomes (yes/no, categories)SNOWFLAKE.ML.CLASSIFICATION
RegressionPredict continuous numeric valuesSNOWFLAKE.ML.REGRESSION
ForecastingPredict future values from time series dataSNOWFLAKE.ML.FORECAST
Anomaly DetectionIdentify unusual data pointsSNOWFLAKE.ML.ANOMALY_DETECTION
Contribution ExplorerFind dimensions driving metric changesSNOWFLAKE.ML.CONTRIBUTION_EXPLORER
Top InsightsAutomated root cause analysisSNOWFLAKE.ML.TOP_INSIGHTS

Architecture Overview​

Snowflake ML models are first-class schema-level objects. The lifecycle follows three stages:

  1. Create — Train a model by referencing a table or query as input data.
  2. Predict — Call the model to generate predictions on new data.
  3. Manage — Drop, replace, or grant access to models like any other Snowflake object.
-- Step 1: Train a model
CREATE OR REPLACE SNOWFLAKE.ML.CLASSIFICATION my_model(
INPUT_DATA => SYSTEM$REFERENCE('TABLE', 'TRAINING_DATA'),
TARGET_COLNAME => 'LABEL'
);

-- Step 2: Generate predictions
SELECT my_model!PREDICT(INPUT_DATA => SYSTEM$REFERENCE('TABLE', 'NEW_DATA'));

-- Step 3: Manage the model
DROP SNOWFLAKE.ML.CLASSIFICATION my_model;

When to Use Built-In ML​

Built-in ML is the right choice when:

  • The problem maps to a supported algorithm (classification, regression, forecasting, anomaly detection).
  • The team works primarily in SQL and does not maintain a Python ML stack.
  • Speed to production matters more than fine-tuning hyperparameters.
  • Data cannot leave Snowflake due to governance or compliance constraints.

Advantages of Built-In ML​

AdvantageDetail
SQL-firstTrain and predict with standard SQL statements
No infrastructureNo Spark clusters, notebooks, or package management
Auto-tuningHyperparameters are selected automatically
GovernedModels respect RBAC, row access policies, and masking policies
ScalableTraining runs on Snowflake warehouses and scales with warehouse size
No data movementData stays in Snowflake throughout the entire workflow

Built-In ML vs Other Approaches​

CriteriaBuilt-in MLSnowpark MLExternal (SageMaker, Vertex AI)
LanguageSQLPythonPython / various
Setup complexityNoneModerateHigh
Algorithm flexibilityFixed setFull scikit-learn, XGBoost, etc.Unlimited
Data movementNoneNone (runs in Snowflake)Data must be exported
Hyperparameter controlAutomaticFull controlFull control
GovernanceNative RBACNative RBACExternal IAM + Snowflake

Prerequisites​

Before using Snowflake ML functions, verify:

-- Check that your role has the required privileges
GRANT CREATE SNOWFLAKE.ML.CLASSIFICATION ON SCHEMA my_db.my_schema TO ROLE analyst;
GRANT CREATE SNOWFLAKE.ML.FORECAST ON SCHEMA my_db.my_schema TO ROLE analyst;
GRANT CREATE SNOWFLAKE.ML.ANOMALY_DETECTION ON SCHEMA my_db.my_schema TO ROLE analyst;

-- Confirm the warehouse is active
ALTER WAREHOUSE ml_wh RESUME IF SUSPENDED;
USE WAREHOUSE ml_wh;

Key Concepts​

  • SYSTEM$REFERENCE — A secure reference to a table or view passed as input. This ensures the model respects access control on the source data.
  • Model object — A schema-level object stored in the Snowflake metadata layer. It persists until explicitly dropped.
  • !PREDICT — A method invoked on the model object to generate predictions against new data.

Best Practices​

  1. Start with built-in ML before investing in custom model pipelines. Many business problems are well served by classification or forecasting.
  2. Use dedicated warehouses for training to avoid contention with query workloads.
  3. Version your training data using clones or time travel so results are reproducible.
  4. Monitor model freshness — retrain periodically as source data evolves.
  5. Grant minimal privileges — only the roles that need predictions should have USAGE on the model.

Next Steps​

The following lessons cover each built-in ML function in detail: