

# View a model lineage graph
<a name="model-dashboard-lineage"></a>

When you train a model, Amazon SageMaker AI creates a visualization of your entire ML workflow from data preparation to deployment. This visualization is called a model lineage graph. The following page describes how to view a model lineage graph in the SageMaker AI console.

Model lineage graphs use entities to represent individual steps in your workflow. For example, a basic model lineage graph might have an entity representing your training set, which is associated with an entity representing your training job, which is associated with another entity representing your model. In addition, the graph stores information about each step in your workflow. With this information, you can recreate any step in the workflow or track model and dataset lineage. For example, SageMaker AI Lineage stores the S3 URI of your input data sources with each job so you can perform further analysis of the data sources for compliance verification.

While the model lineage graph can help you view the steps in individual workflows, there are many other capabilities that you can leverage using the AWS SDK. For example, with the AWS SDK you can create or query your entities. For more information about the full set of features in SageMaker AI Lineage and example notebooks, see [Amazon SageMaker ML Lineage Tracking](lineage-tracking.md).

# Introduction to entities
<a name="model-dashboard-lineage-intro-entities"></a>

Amazon SageMaker AI automatically creates tracking entities for SageMaker AI jobs, models, model packages, and endpoints if the data is available. For a basic workflow, suppose you train a model using a dataset. SageMaker AI automatically generates a lineage graph with three entities: 
+ **Dataset** : A type of artifact, which is an entity representing a URI addressable object or data. An artifact is generally either an input or an output to a trial component or action.
+ **TrainingJob**: A type of trial component, which is an entity representing processing, training, and transform jobs.
+ **Model**: Another type of artifact. Like the **Dataset** artifact, a **Model** is a URI addressable object. In this case, it is an output of the **TrainingJob** trial component. 

Your model lineage graph expands quickly if you add additional steps to your workflow, such as data preprocessing or postprocessing, if you deploy your model to an endpoint, or if you include your model in a model package, among many other possibilities. For the complete list of SageMaker AI entities, see [Amazon SageMaker ML Lineage Tracking](lineage-tracking.md).

## Entity properties
<a name="model-dashboard-lineage-entity-properties"></a>

Each node in the graph displays the entity type, but you can choose the vertical ellipsis to the right of the entity type to see specific details related to your workflow. In our previous barebones lineage graph, you can choose the vertical ellipsis next to **DataSet** to see specific values for the following properties (common to all artifact entities):
+ **Name**: The name of your dataset.
+ **Source URI**: The Amazon S3 location of your dataset.

For the `TrainingJob` entity, you can see the specific values for the following properties (common to all `TrialComponent` entities):
+ **Name**: The name of the training job.
+ **Job ARN**: The Amazon Resource Name (ARN) of your training job.

For the **Model** entity, you see the same properties as listed for **DataSet** since they are both artifact entities. For a list of the entities and their associated properties, see [Lineage Tracking Entities](lineage-tracking-entities.md).

## Entity queries
<a name="model-dashboard-lineage-entity-queries"></a>

Amazon SageMaker AI automatically generates graphs of lineage entities as you use them. However if you are running many iterations of an experiment and don't want to view every lineage graph, the AWS SDK can help you perform queries across all your workflows. For example, you can query your lineage entities for all the processing jobs that use an endpoint. Or, you can see all the downstream trails that use an artifact. For a list of all the queries you can perform, see [Querying Lineage Entities](querying-lineage-entities.md).

## View a model’s lineage graph
<a name="model-dashboard-lineage-view"></a>

**To view the lineage graph for a model, complete the following steps:**

1. Open the [SageMaker AI console](https://console.aws.amazon.com/sagemaker/).

1. Choose **Governance** in the left panel.

1. Choose **Model Dashboard**.

1. In the **Models** section of the Model Dashboard, select the model name of the lineage graph you want to view.

1. Choose **View lineage** in the **Model Overview** section.