The Snowflake Model Registry enables secure management of machine learning models and metadata as schema-level objects, supporting multiple versions and facilitating collaboration across organizations.
The Snowflake Model Registry allows you to securely manage models and their metadata in Snowflake, regardless of their origin. The Model Registry stores machine learning models as first-class, schema-level objects in Snowflake so they can be easily found and used by others in your organization. You can create registries and store models in them using the Snowpark ML library classes. Models can have multiple versions, and you can set one version as the default version.
Once you have saved a model, you can call its methods (which correspond to functions or stored procedures) to perform model operations, such as inferences, in a Snowflake virtual warehouse.
The most important classes in the Snowflake Model Registry API are:
The Snowflake Model Registry supports the following types of models.
Availability
The Snowflake Model Registry is now generally available as of package version 1.5.01. It is accessible from both Python and SQL3.
Snowflake Notebooks sets up a Snowpark session when the notebook is connected to the kernel. Let's use this session object to verify our connection.
Create and train an XGBoost model for regression tasks using your prepared data.
Assess model performance using appropriate evaluation metrics.
Adding a model to the registry is called logging the model. Log a model by calling the log_model method of the registry. This method:
Use the registered model to make predictions on new data.
You can assign an alias to a model version by using the SQL command ALTER MODEL. You can use an alias wherever a version name is required, e.g. when retrieving a reference to a model version in Python or in SQL.
In addition to the aliases you create, the following system aliases are available in all models.
Alias names that you create must not match existing version names or aliases in the model, including system aliases.
Set up a role and user, then link the role to the user and allow access to the database, schema, and model. This allows the model to be used by another user.
Show versions
native_registry.get_model(model_name).show_versions()
Shows the versions of a model for machine learning. Models can have multiple versions, one of which must be set as the default version. The output returns the metadata and properties of the table, sorted lexicographically by database, schema, and model name.
Show Models
native_registry.show_models()
Lists the machine learning models to which you have access rights. The output returns the metadata and properties of the table, organized lexicographically by database, schema, and model name.
DROP MODEL
Removes a model for machine learning from the current/specified schema.
Syntax:
DROP MODEL <name>
Example:
native_registry.delete_model(model_name)
To create a model, you must either be the owner of the schema in which the model is created or you must have the CREATE MODEL privilege for this schema. To use a model, you must either be the owner of the model or have the USAGE privilege for the model. With the USAGE privilege, you can use the model for inference without being able to view its internals.
Model Registry can be used to automate the training and inference pipeline for machine learning models. This includes training a model, storing it in the Model Registry and then using the latest version of the model for inference on new data.
Model registration can be used to perform parallelized inference on new data. The latest version of the model is applied to new data in parallel, which can significantly speed up the inference process.
The model registry can be used to manage multiple versions of a model. To do this, different versions of a model are stored in the model registry and their performance metrics are tracked.
The model registry can be used to serve models for real-time inference. This is done by serving a model to the model registry and using it to make predictions about new data in real-time.
The Model Registry can be used to collaborate with other data scientists and engineers. Models are stored in the Model Registry and shared with others, which can improve collaboration and reproducibility.
The Model Registry can be used to check and track model performance and data sequencing. To do this, models are stored in the Model Registry and their performance metrics are tracked, which can improve model auditing and compliance.
The Snowflake Model Registry currently has the following limitations:
Versions 1.5.0 and 1.5.1 of the snowflake-ml-python package have the following known issues. Until these are resolved, use the provided workaround.
registry.log_model(..., options={"embed_local_ml_library": True, ...})The following limits apply to models and model versions.
ModelsLimitModelsMaximum of 50 versionsModel versionsMaximum 10 methods, Maximum 10 imports, Maximum 500 arguments per method, Maximum metadata (including metrics) of 100 KB, Maximum total model size of 5 GB, Maximum configuration file size of 250 KB, including conda.yml and other manifest files that log_model generates internally
Using the Snowflake Model Registry incurs the usual Snowflake consumption-based costs. These include the cost of:
The advantages of Snowflake's model registration are summarized below:
Snowflake's Model Registry is a powerful tool that enables organizations to realize the full potential of their machine learning investments. By providing a centralized, automated and scalable platform for model management, Snowflake Model Registry is poised to revolutionize the way organizations approach machine learning and AI.
Get started with Snowflake's Model Registry today and discover the power of optimized machine learning workflows!