Reference Architecture

Snowflake ML and Data Science Reference Architecture

A Snowflake ML and data science reference architecture: ingest, transform, train with Snowpark, and serve predictions to apps without moving the data.

  • Machine Learning
  • Data Engineering
  • Generative AI
  • Analytics
  • Cloud
  • Cross-industry

The challenge

Training models on data that already lives in the warehouse, without exporting it to a separate ML stack and maintaining two copies, two governance models and two sets of pipelines.

Layered diagram of a Snowflake ML and data science reference architecture, from streaming and data lake ingestion through Snowflake storage, transformation and Snowpark training to inference, Cortex, external ML platforms and Streamlit apps, beside a cloud platform rail for AWS, Azure and Google Cloud
Snowflake ML and Data Science Reference Architecture — reference architecture

The usual ML architecture has a seam down the middle: data lives in the warehouse, models are trained somewhere else, and the pipeline between them is the part that breaks. This reference architecture removes the seam by making the warehouse the training environment — the same governed tables that feed reporting also feed feature engineering, training and inference, and the model that comes out is a schema-level object in the same account.

How it works

Training data starts where the application produces it. A streaming service buffers it for continuous ingestion, then batches it to the data lake or sends it directly to Snowflake. From there the ingestion path depends on the format and the layout: Snowpipe for files landing in a stage, Snowpipe Streaming and the Kafka connector for row-level ingestion, external tables for data that should be queried without being copied, and Iceberg Tables where reads and writes must operate on Parquet and Iceberg metadata in storage the customer owns.

Once the data is queryable, tasks schedule stored procedures to transform it, and streams chain into tasks to build a real pipeline rather than a single job. That is what produces the curated tiers a data scientist actually wants to train on.

Training happens in the same place. Snowpark gives an API for querying and processing data in the pipeline, and the Snowpark ML Modeling API brings scikit-learn and XGBoost feature engineering and model training to that data without moving it out. Heavier runs go to Snowpark-optimized warehouses through Python stored procedures; GPU work goes to Snowpark Container Services. Teams that would rather train on Dataiku, Hex or Azure ML still can — the Snowpark DataFrame API pushes preprocessing and training down to the warehouse, and the resulting model is registered back to the Snowflake Model Registry, which stores models and their metadata as first-class schema-level objects whatever their origin.

Serving splits by latency. Real-time predictions are a UDF call, an External Function to an API-hosted endpoint, or an online inference service in Container Services. Batch predictions read an input table and write an output table the application reads. Cortex sits beside both: LLM and ML-based functions callable from one line of SQL or Python, hosted and managed by Snowflake so no GPU infrastructure has to be provisioned to use them. Streamlit in Snowflake closes the loop, letting a data scientist put an interface on the results without leaving the platform.

The original design

The diagrams above are redrawn in the site’s own style from Snowflake’s ML and data science reference architecture, published in 7 Snowflake Reference Architectures for Application Builders. Credit for the original architecture and diagram belongs to Snowflake.

What to get right

  • Decide what actually needs to be ingested. External tables and Iceberg Tables exist so data already sitting in object storage does not need a second copy and a second pipeline to keep it fresh. Copy what benefits from being copied.
  • Snowpark-optimized warehouses are a different resource, not a bigger one. They exist for the memory profile of training runs; putting that work on a standard warehouse is where “it worked on the sample” becomes an out-of-memory error on the full dataset.
  • Register every model, including the ones trained elsewhere. The Model Registry is only a control point if the externally-trained models are in it too — otherwise half the fleet is governed and half is a notebook someone ran.
  • Pick batch or real-time per prediction, not per project. Batch scoring into an output table is cheaper and simpler; keep UDF and endpoint inference for the predictions that genuinely have to happen inside the request.
  • Reach for Cortex before standing up GPUs. For classification, forecasting and LLM tasks that a hosted function already covers, managed inference removes an entire layer of infrastructure from the architecture.

How it fits together

  1. Ingest and sources

    The application emits training data into a streaming service, which buffers it for reliable continuous ingestion and then either batches it to the data lake or sends it straight to Snowflake. Snowpipe, Snowpipe Streaming and the Kafka connector cover the ingest paths; Spark Streaming and SDK-based producers cover the rest.

  2. Snowflake storage and access

    Depending on the lake layout and file format, data is ingested into raw tables, queried in place as an external table, or reached through a directory table over a stage. Iceberg Tables serve the read-and-write cases where Parquet and Iceberg metadata must stay in customer-supplied storage.

  3. Transform and curate

    Tasks schedule stored procedures to run transformations, and streams chain into tasks to build a multi-stage pipeline from raw through silver, gold and platinum tiers. Refined materialized tables and materialized views hold the curated results; Marketplace and Secure Data Sharing bring in data nobody has to copy.

  4. Train and experiment

    Data scientists work on training data in place with Snowpark, scaling compute instantly for feature engineering and experimentation. The Snowpark ML Modeling API runs scikit-learn and XGBoost workloads without moving data out; Python stored procedures on Snowpark-optimized warehouses handle the memory-hungry runs, and DataFrame operations push down to the SQL engine.

  5. Model Registry and Feature Store

    The Snowflake Model Registry stores models as first-class schema-level objects with their metadata, regardless of where they were trained — Snowpark, an external notebook, or an ML platform. The Feature Store keeps the feature definitions that training and inference both read, so the two cannot drift apart.

  6. Cortex and Snowpark Container Services

    Cortex LLM and ML-based functions give analysts task-specific and general-purpose models from a single line of SQL or Python, fully hosted so no GPU fleet has to be stood up. Container Services runs containerized jobs, services and service functions on Snowflake-managed infrastructure with configurable hardware, including GPUs.

  7. External ML platforms

    Dataiku, Hex, Azure ML and notebook or IDE workflows train against Snowflake data, pushing preprocessing and training down to the warehouse through the Snowpark DataFrame API. Trained models are registered back to the Model Registry, run on external compute, or served from an API-hosted endpoint reached through External Functions.

  8. Inference and serving

    Real-time predictions are called from the application as a Python UDF, an External Function, or an online endpoint in Container Services. Batch predictions read an input table and write results to an output table where the app picks them up.

  9. Apps and consumption

    Streamlit in Snowflake lets data scientists build Python apps that analyze and visualize ML data where it already sits, alongside the predictive application itself, notebooks and BI tools.

Layered diagram of a Snowflake ML and data science reference architecture, from streaming and data lake ingestion through Snowflake storage, transformation and Snowpark training to inference, Cortex, external ML platforms and Streamlit apps, beside a cloud platform rail for AWS, Azure and Google Cloud — detailed architecture
Snowflake ML and Data Science Reference Architecture — detailed architecture

Typically built with

  • Snowpark for Python
  • Snowpark ML Modeling API
  • Snowflake Model Registry
  • Snowpark Container Services
  • Snowflake Cortex
  • Snowpipe / Snowpipe Streaming
  • Streamlit in Snowflake

More reference architectures