

# Machine Learning Workflows in IAM-based domains
<a name="sagemaker-iam-based-domains"></a>

Amazon SageMaker Unified Studio provides a comprehensive machine learning environment within IAM-based domains that enables you to discover, deploy, and manage machine learning models through a unified interface.
+ Discover Foundation Models and Registered Models from multiple model providers, easily deploy them using sample notebooks
+ Customize foundation models using Jupyterlab IDE or Data Notebooks, a new serverless Notebook for ML Practitioners
+ Create and track Experiments and identify the best model for your usecase using MLflow
+ Use Agentic AI is Notebooks to easily create and train models
+ Monitor training jobs and model performance metrics
+ Manage model lifecycle through the integrated model registry

The machine learning capabilities in Amazon SageMaker Unified Studio integrate seamlessly with your project's IAM permissions and compute resources, providing secure access to models and deployment infrastructure within your domain's governance framework.

# Discover Foundation models
<a name="discover-foundation-models"></a>

1. Navigate to your Amazon SageMaker Unified Studio project using the URL provided by your administrator.

1. From the left navigation menu, choose **Models**.

1. Use the Model finder to search for models by task type:
   + Choose **Text** for natural language processing models
   + Choose **Image** for computer vision models
   + Choose **Audio** for speech and audio processing models
   + Choose **Multimodal** for models that handle multiple input types
   + Choose **Video** for video processing models

1. Browse Featured providers to explore models from specific providers.

1. Switch between Foundation Models and Registered Models tabs:
   + Foundation Models displays pre-trained models available for immediate use
   + Registered Models shows models you have registered in your project's model registry

1. Use the search functionality to find specific models by name or capability.

# Deploy Foundation models
<a name="deploy-foundation-models"></a>

1. From the Models page, select a Foundation Model you want to deploy.

1. On the model details page, review the model information including:
   + Model architecture and capabilities
   + Supported languages and input modalities
   + Training data information
   + License requirements

1. Choose **Deploy** to access deployment options. This will create a Sample notebook that you can use to review and deploy.

1. Review and execute the sample notebook content which demonstrates:
   + Model selection and configuration
   + Endpoint deployment procedures
   + Example inference code

1. Wait for the deployment to complete. The deployment process may take several minutes.

1. After successful model deployment, navigate to **Endpoints** from the left navigation menu.

1. View your deployed endpoints in the endpoints list, which displays:
   + Endpoint name and status
   + Creation and modification timestamps
   + Endpoint configuration details

1. Monitor endpoint status:
   + In Service indicates the endpoint is ready for inference requests
   + Creating shows the endpoint is being deployed
   + Failed indicates deployment issues that need attention

# Track experiments using MLflow
<a name="use-mlflow-experiments"></a>

Amazon SageMaker Unified Studio supports two options for tracking experiments with MLflow: MLflow Apps and MLflow Tracking Servers. MLflow Apps are the latest offering with faster startup times and cross-account sharing, while MLflow Tracking Servers provide traditional MLflow functionality.

**Topics**
+ [Use MLflow Apps for experiment tracking](#use-mlflow-apps)
+ [Use MLflow Tracking Servers to track experiments](#use-mlflow-tracking-servers)

## Use MLflow Apps for experiment tracking
<a name="use-mlflow-apps"></a>

**Note**  
MLflow Apps are different from MLflow Tracking Servers. MLflow Apps offer additional features such as faster startup time and cross-account sharing. For information about connecting to existing MLflow Tracking Servers, see [Use MLflow Tracking Servers to track experiments](#use-mlflow-tracking-servers).

MLflow Apps are the latest managed MLflow offering in Amazon SageMaker Unified Studio and provide faster startup times, cross-account sharing, and integration with SageMaker AI features. MLflow Apps use MLflow 3.0 and support experiment tracking, model registry, and tracing for generative AI applications.

### Connect to an MLflow App
<a name="connect-mlflow-app"></a>

You can connect to an existing MLflow App created in SageMaker AI Studio to track experiments and manage model versions. Note that you can't create a new MLflow App in Amazon SageMaker Unified Studio. You have to create this using SageMaker AI APIs or in SageMaker AI Studio.

To connect to an MLflow App, perform the following steps:

1. From your project's main page, choose **MLflow** from the left navigation menu.

1. Choose **Connect MLflow App**.

1. Enter an MLflow App Name

1. Provide a Connection name for identification

1. Enter the MLflow App ARN for your project

1. Choose **Connect to app**

### Manage MLflow Apps
<a name="manage-mlflow-apps"></a>

After you connect to an MLflow App, you can perform the following actions from the **MLflow** page:
+ Open MLflow – Choose the **Open** button next to the MLflow App to launch the MLflow UI and view experiments, models, and traces.
+ Edit – Update the connection with a new ARN.
+ Delete – Remove the connection to the MLflow App.

To access the **MLflow** page, choose **MLflow** from the left navigation menu.

## Use MLflow Tracking Servers to track experiments
<a name="use-mlflow-tracking-servers"></a>

To get started, you should have an existing MLflow server created in SageMaker AI Studio. Make sure that you have the ARN to get started.

1. From your project's main page, choose **MLflow** from the left navigation menu.

1. Connect to an existing MLflow Tracking Server. Note that you can't create a new MLflow Server in Amazon SageMaker Unified Studio. You have to create this using SageMaker AI APIs or in SageMaker AI Studio.

1. Choose **Connect Tracking Server**

1. Enter a Tracking Server Name

1. Provide a Connection name for identification

1. Enter the MLflow Tracking Server ARN for your project

1. Choose **Connect to server**

1. Once connected, choose **Open MLflow** to launch the MLflow UI.

1. In the MLflow interface, view your experiments:
   + Experiments tab shows all tracked experiments
   + Models tab displays registered model versions
   + Prompts tab contains prompt templates and versions

1. You can perform additional actions such as
   + Stop ML Server
   + Use server to train model – this will launch a sample notebook which will provide instructions on how to use MLflow to train a linear regression model
   + Edit the connection with new ARNs
   + Delete the connection

# Create and monitor custom training jobs
<a name="create-monitor-training-jobs"></a>

You can use Jupyter Notebooks or SageMaker AI Notebooks to train your ML jobs. Refer to SageMaker AI documents on how to train ML jobs.

```
model_trainer = ModelTrainer(
    training_image=image_uri,
    source_code=source_code,
    base_job_name=job_name,
    compute=compute_configs,
    distributed=Torchrun(),
    stopping_condition=StoppingCondition(
        max_runtime_in_seconds=7200
    ),
    hyperparameters={
        "config": "/opt/ml/input/data/config/args.yaml" # sample path
    },
    output_data_config=OutputDataConfig(
        s3_output_path=output_path
    ),
)
# starting the train job with our uploaded datasets as input
model_trainer.train(input_data_config=data, wait=True)
```

You can monitor the results of the training job by selecting **Training Jobs** on the left panel

You can stop the jobs, monitor the artifacts, hyper parameters, security configurations and tags that you have setup during the training.

# Manage Registered Models
<a name="manage-registered-models"></a>

Your registered models can be accessed and managed in Amazon SageMaker Unified Studio.

1. Navigate to **AI/ML** > **Models** and select the **Registered Models** tab to view the models.

1. You can review the following information
   + Model group name - Logical grouping for related model versions
   + Model version - Specific version identifier
   + Model artifacts - Location of model files in Amazon S3
   + Description - Optional description of the model and its purpose

1. Select specific models to review key model information like
   + Framework - Machine learning framework used (e.g., PyTorch, TensorFlow)
   + Algorithm - Algorithm or approach used for training
   + Performance metrics - Accuracy, precision, recall, or other relevant metrics

## Model lifecycle management
<a name="model-lifecycle-management"></a>

The model registry provides version control and lifecycle management:
+ Version tracking - Each model registration creates a new version with unique metadata
+ Approval workflows - Models can have approval status (Approved, Pending, Rejected)
+ Deployment status - Track which versions are deployed to endpoints
+ Model comparison - Compare metrics and metadata across versions

To manage model versions:

1. Choose a model group name to view all versions.

1. Review version details including:
   + Version number - Sequential version identifier
   + Description - Version-specific notes and changes
   + Deployment Status - Current deployment state
   + Approval Status - Workflow approval state
   + Modified Date - Last update timestamp

1. Use the **Actions** dropdown to:
   + Deploy using Notebooks - Use a pre-created notebook to deploy the model to SageMaker AI Endpoint
   + Deploy using Jupyter Notebook - Use a pre-created JupyterLab notebook to deploy the model to SageMaker AI Endpoint
   + Approve/Reject - Update approval status
   + Delete - Delete the selected version