Snowflake for Gen AI · Topic 6 of 13
Bringing Your Own Models: Model Registry and Snowpark Container Services
Bring your own models into Snowflake with the Model Registry and Snowpark Container Services: when to choose each, how models run and the privileges.
- 4 min
- Model Registry:
log_model, versions, aliases, schema level object, CREATE MODEL. - Custom model: you supply all dependencies.
target_platforms: WAREHOUSE, SNOWPARK_CONTAINER_SERVICES or both.
What it is
Cortex gives you hosted models, but sometimes the model you need is your own: a custom trained model, an open source model or a specialized vision model. Snowflake lets you bring it in two main ways. The Snowflake Model Registry stores and versions the model as a schema level object. Snowpark Container Services (SPCS) runs it inside containers on compute you control, often with GPUs.
The two work together. You log a model in the registry, then deploy it to a service on SPCS when it needs a GPU or a custom runtime.
How it works
Snowflake Model Registry
Adding a model to the registry is called logging it, done with log_model from Snowpark ML. Each call creates a version, and the name and version pair must be unique in the schema. Models are schema level objects, so normal grants apply.
- Custom model: when no built in type fits, you wrap your own code and supply every dependency yourself.
log_modelfails if a custom model cannot run in a warehouse when that platform is requested. - Arguments: common ones are
conda_dependencies,pip_requirements,sample_input_dataorsignatures,metricsandtarget_platforms. - target_platforms:
WAREHOUSE,SNOWPARK_CONTAINER_SERVICESor both. Models that need a GPU go to SPCS. - Versions: a model can have many versions, with a default version and aliases such as DEFAULT, FIRST and LAST.
| Privilege | Allows |
|---|---|
| CREATE MODEL on the schema (or owning it) | Log a model |
| USAGE on the model | Run inference in a warehouse |
| READ on the model | SPCS inference and viewing metadata |
Warehouse deployments have a size ceiling (the docs state 15 GB total model size), which is one reason large models go to SPCS.
Snowpark Container Services
SPCS is a managed container platform inside Snowflake. You package the application as an OCI image and Snowflake runs it.
| Object | Role |
|---|---|
| Image repository | Stores your images (CREATE IMAGE REPOSITORY) |
| Compute pool | VM nodes that run services; some machine types have GPUs (CREATE COMPUTE POOL) |
| Service specification | YAML that defines the containers |
| Service | Long running workload started with CREATE SERVICE; restarted if a container exits |
| Job service | Finite run started with EXECUTE JOB SERVICE; not restarted |
Because you control the whole container, you can bring custom runtimes and libraries. Typical workloads are model serving and GPU training. Network policies control ingress and external access integrations control egress.
For online inference the registry can create the service for you with create_service. Batch inference can run through run_batch.
Using a hosted model from Cortex functions
AI_COMPLETE can use a text generation or vision language model deployed as an SPCS inference service by passing the service name as the model argument. The documentation labels this open preview. Such models have their own access requirements, separate from SNOWFLAKE.CORTEX_USER.
If the scenario needs Cortex style SQL calls on a model Snowflake does not host, the answer is a model on SPCS, called through the model argument of AI_COMPLETE.
Choosing
| Need | Choose |
|---|---|
| Versioning, governance and sharing of a model | Model Registry |
| GPU, custom runtime, long running service | Snowpark Container Services |
| Hosted model with no ops | Cortex AI functions |
Registry models do not run themselves on GPUs. A GPU needs an SPCS compute pool with GPU capable machines.
Common mistakes
Using SPCS to store model versions. Version control belongs in the Model Registry.
Logging a warehouse only model that needs a GPU. Set target_platforms to include SPCS.
Forgetting READ. SPCS inference needs READ on the model, not only USAGE.
Treating a service like a job. Services restart on exit; job services finish.
Expecting Cortex roles to cover your own model. SPCS hosted models have their own access requirements.
What to remember for the exam
- Model Registry:
log_model, versions, aliases, schema level object, CREATE MODEL. - Custom model: you supply all dependencies.
target_platforms: WAREHOUSE, SNOWPARK_CONTAINER_SERVICES or both.- SPCS: image repository, compute pool, service spec,
CREATE SERVICE. - GPU and custom runtimes need SPCS.
Check yourself
What is logging a model?
Adding it to the Model Registry as a new version of a schema level object.
Which privilege lets a role use a model on SPCS?
READ on the model.
When must a model go to SPCS rather than a warehouse?
When it needs a GPU, a custom runtime or exceeds warehouse limits.
Topic 6 of 13 in Snowflake for Gen AI
Test yourself on Snowflake for Gen AI
The full Snowflake GES-C02 question bank has 585 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.