Combine Amazon SageMaker Mannequin Playing cards with the mannequin registry


Amazon SageMaker Model Cards allow you to standardize how fashions are documented, thereby attaining visibility into the lifecycle of a mannequin, from designing, constructing, coaching, and analysis. Mannequin playing cards are supposed to be a single supply of reality for enterprise and technical metadata concerning the mannequin that may reliably be used for auditing and documentation functions. They supply a factsheet of the mannequin that’s essential for mannequin governance.

Till now, mannequin playing cards had been logically related to a mannequin within the Amazon SageMaker Model Registry utilizing mannequin title match. Nonetheless, when fixing a enterprise drawback by a machine studying (ML) mannequin, as prospects iterate on the issue, they create a number of variations of the mannequin and they should operationalize and govern a number of mannequin variations. Due to this fact, they want the power to affiliate a mannequin card to a selected mannequin model.

On this put up, we talk about a brand new characteristic that helps integrating mannequin playing cards with the mannequin registry on the deployed mannequin model degree. We talk about the answer structure and finest practices for managing mannequin card variations, and stroll by easy methods to arrange, operationalize, and govern the mannequin card integration with the mannequin model within the mannequin registry.

Resolution overview

SageMaker mannequin playing cards aid you standardize documenting your fashions from a governance perspective, and the SageMaker mannequin registry helps you deploy and operationalize ML fashions. The mannequin registry helps a hierarchical construction for organizing and storing ML fashions with mannequin metadata info.

When a company solves a enterprise drawback utilizing ML, reminiscent of a buyer churn prediction, we advocate the next steps:

  1. Create a mannequin card for the enterprise drawback to be solved.
  2. Create a mannequin package deal group for the enterprise drawback to be solved.
  3. Construct, practice, consider, and register the primary model of the mannequin package deal model (for instance, Buyer Churn V1).
  4. Replace the mannequin card linking the mannequin package deal model to the mannequin card.
  5. As you iterate on new mannequin package deal model, clone the mannequin card from the earlier model and hyperlink to the brand new mannequin package deal model (for instance, Buyer Churn V2).

The next determine illustrates how a SageMaker mannequin card integrates with the mannequin registry.

As illustrated within the previous diagram, the combination of SageMaker mannequin playing cards and the mannequin registry means that you can affiliate a mannequin card with a particular mannequin model within the mannequin registry. This lets you set up a single supply of reality on your registered mannequin variations, with complete and standardized documentation throughout all phases of the mannequin’s journey on SageMaker, facilitating discoverability and selling governance, compliance, and accountability all through the mannequin lifecycle.

Greatest practices for managing mannequin playing cards

Working in machine studying with governance is a essential requirement for a lot of enterprise organizations right this moment, notably in extremely regulated industries. As a part of these necessities, AWS offers a number of companies that allow dependable operation of the ML atmosphere.

SageMaker mannequin playing cards doc essential particulars about your ML fashions in a single place for streamlined governance and reporting. Mannequin playing cards aid you seize particulars such because the supposed use and danger score of a mannequin, coaching particulars and metrics, analysis outcomes and observations, and extra call-outs reminiscent of issues, suggestions, and customized info.

Mannequin playing cards must be managed and up to date as a part of your growth course of, all through the ML lifecycle. They’re an essential a part of steady supply and pipelines in ML. In the identical approach {that a} Nicely-Architected ML venture implements steady integration and steady supply (CI/CD) below the umbrella of MLOps, a steady ML documentation course of is a essential functionality in a number of regulated industries or for increased danger use circumstances. Mannequin playing cards are a part of the very best practices for accountable and clear ML growth.

The next diagram reveals how mannequin playing cards must be a part of a growth lifecycle.

Think about the next finest practices:

  • We advocate creating mannequin playing cards early in your venture lifecycle. Within the first part of the venture, when you find yourself engaged on identifying the business goal and framing the ML problem, it is best to provoke the creation of the mannequin card. As you’re employed by the completely different steps of enterprise necessities and essential efficiency metrics, you’ll be able to create the mannequin card in a draft standing and decide the enterprise particulars and supposed makes use of.
  • As a part of your model development lifecycle phase, it is best to use the mannequin registry to catalog fashions for manufacturing, handle mannequin variations, and affiliate metadata with a mannequin. The mannequin registry permits lineage monitoring.
  • After you could have iterated efficiently and are able to deploy your mannequin to manufacturing, it’s time to replace the mannequin card. Within the deployment lifecycle phase, you’ll be able to replace the mannequin particulars of the mannequin card. You also needs to replace coaching particulars, analysis particulars, moral issues, and caveats and suggestions.

Mannequin playing cards have variations related to them. A given mannequin model is immutable throughout all attributes aside from the mannequin card standing. If you happen to make some other adjustments to the mannequin card, reminiscent of analysis metrics, description, or supposed makes use of, SageMaker creates a brand new model of the mannequin card to mirror the up to date info. That is to make sure that a mannequin card, as soon as created, can’t be tampered with. Moreover, every distinctive mannequin title can have just one related mannequin card and it might probably’t be modified after you create the mannequin card.

ML fashions are dynamic and workflow automation elements allow you to simply scale your potential to construct, practice, take a look at, and deploy a whole lot of fashions in manufacturing, iterate quicker, cut back errors as a result of guide orchestration, and construct repeatable mechanisms.

Due to this fact, the lifecycle of your mannequin playing cards will look as described within the following diagram. Each time you replace your mannequin card by the mannequin lifecycle, you routinely create a brand new model of the mannequin card. Each time you iterate on a brand new mannequin model, you create a brand new mannequin card that may inherit some mannequin card info of the earlier mannequin variations and comply with the identical lifecycle.

Pre-requisites

This put up assumes that you have already got fashions in your mannequin registry. If you wish to comply with alongside, you need to use the next SageMaker instance on GitHub to populate your mannequin registry: SageMaker Pipelines integration with Model Monitor and Clarify.

Combine a mannequin card with the mannequin model within the mannequin registry

On this instance, now we have the model-monitor-clarify-group package deal in our mannequin registry.

On this package deal, two mannequin variations can be found.

For this instance, we hyperlink Model 1 of the mannequin to a brand new mannequin card. Within the mannequin registry, you’ll be able to see the small print for Model 1.

We will now use the brand new characteristic within the SageMaker Python SDK. From the sagemaker.model_card ModelPackage module, you’ll be able to choose a particular mannequin model from the mannequin registry that you simply wish to hyperlink the mannequin card to.

Now you can create a brand new mannequin card for the mannequin model and specify the model_package_details parameter with the earlier mannequin package deal retrieved. It’s good to populate the mannequin card with all the extra particulars mandatory. For this put up, we create a easy mannequin card for example.

You may then use that definition to create a mannequin card utilizing the SageMaker Python SDK.

When loading the mannequin card once more, you’ll be able to see the related mannequin below "__model_package_details".

You even have the choice to replace an present mannequin card with the model_package as proven within the instance code snippet beneath:

my_card = ModelCard.load(("<model_card_name>")
mp_details = ModelPackage.from_model_package_arn("<arn>")
my_card.model_package_details = mp_details
my_card.replace()

Lastly, when creating or updating a brand new mannequin package deal model in an present mannequin package deal, if a mannequin card already exists in that mannequin package deal group, some info such because the enterprise particulars and supposed makes use of could be carried over to the brand new mannequin card.

Clear up

Customers are accountable for cleansing up assets if created utilizing the pocket book talked about within the pre-requisites part. Please comply with the directions within the pocket book to wash up assets.

Conclusion

On this put up, we mentioned easy methods to combine a SageMaker mannequin card with a mannequin model within the mannequin registry. We shared the answer structure with finest practices for implementing a mannequin card and confirmed easy methods to arrange and operationalize a mannequin card to enhance your mannequin governance posture. We encourage you to check out this answer and share your suggestions within the feedback part.


Concerning the Authors

Ram VittalRam Vittal is a Principal ML Options Architect at AWS. He has over 20 years of expertise architecting and constructing distributed, hybrid, and cloud functions. He’s obsessed with constructing safe and scalable AI/ML and large knowledge options to assist enterprise prospects with their cloud adoption and optimization journey to enhance their enterprise outcomes. In his spare time, he rides his bike and walks together with his 2-year-old sheep-a-doodle!

Natacha Fort is the Authorities Knowledge Science Lead for Public Sector Australia and New Zealand, Principal SA at AWS. She helps organizations navigate their machine studying journey, supporting them from framing the machine studying drawback to deploying into manufacturing, all of the whereas ensuring the very best structure practices are in place to make sure their success. Natacha focuses with organizations on MLOps and accountable AI.

Leave a Reply

Your email address will not be published. Required fields are marked *