

# Lineage for Amazon SageMaker AI

Amazon SageMaker AI sends lineage to the AWS Glue Data Catalog as your processing, training, and fine-tuning jobs run. The Data Catalog adds these events to the same lineage graph that holds lineage from AWS Glue and Amazon EMR, so you can follow a model back through the jobs that produced it to the datasets and tables it was trained on.

With lineage from SageMaker AI, you can answer questions such as:
+ Which datasets, feature groups, and tables trained this model version?
+ Which models does a change to a column in a source table affect?
+ Which job produced this model, and which identity ran it?

## AI assets in the lineage graph
<a name="catalog-lineage-sagemaker-ai-what-s-captured"></a>

SageMaker AI resources appear in the graph as AI assets, alongside your Data Catalog tables:
+ **Model.** A model group in SageMaker Model Registry that holds the versions of a model built for the same use case. The catalog records its name, description, owner, and versions.
+ **Model version.** One iteration of a model, from a training run or registered as a versioned entry. The catalog records its approval status, lifecycle stage, source URI, model artifacts, and inference containers.
+ **Deployable model.** A model that's ready to deploy to an endpoint. The catalog records its containers, instance types, execution modes, and network isolation settings.
+ **Feature group.** A set of features in Amazon SageMaker Feature Store, with an online store, an offline store, or both. A feature is a named, typed data attribute that you use for training and inference. The catalog records the schema, record identifier, event time feature, and storage locations, including the AWS Glue table behind the offline store.
+ **Dataset.** A versioned record of a dataset and its schema, created as a model customization asset. The catalog records its version, status, and keywords.
+ **Evaluator.** A versioned scoring framework that measures model performance, created as a model customization asset. The catalog records its version, status, and keywords.


| SageMaker AI resource | Lineage | 
| --- | --- | 
| Training job | Inputs: training data (S3 locations, Data Catalog tables, feature groups). Output: model artifacts | 
| Model | Upstream: the training job | 
| Endpoint | Upstream: the model. For online feature stores, the feature group the endpoint reads | 
| Feature Store feature group (offline store) | A dataset node, created by a CreateFeatureGroup job | 

SageMaker AI resources are identified by their ARN, for example `arn:aws:sagemaker:us-west-2:111122223333:training-job/my-training-job`.

## Scope
<a name="catalog-lineage-sagemaker-ai-scope"></a>

Lineage is sent only for workflows anchored on a SageMaker AI resource. Consumers that aren't SageMaker AI resources, such as AWS Lambda functions or Amazon Bedrock model invocations, aren't included.

## Viewing SageMaker AI lineage
<a name="catalog-lineage-sagemaker-ai-viewing-sagemaker-ai-lineage"></a>

Call `GetLineageNode` with the resource ARN:

```bash
aws glue get-lineage-node \
  --identifier arn:aws:sagemaker:us-west-2:111122223333:training-job/my-training-job \
  --region us-west-2
```

You can also view lineage in SageMaker AI Studio. See [Viewing lineage in SageMaker AI Studio](catalog-lineage-view-sagemaker-studio.md).

## Related topics
<a name="catalog-lineage-sagemaker-ai-related-topics"></a>
+ For how SageMaker AI tracks machine learning lineage, see [Amazon SageMaker ML Lineage Tracking](https://docs.aws.amazon.com/sagemaker/latest/dg/catalog-assets.html) in the Amazon SageMaker AI Developer Guide.
+ For the structure of the OpenLineage facets that SageMaker AI adds to each event, see [OpenLineage facets for SageMaker AI lineage](https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html) in the Amazon SageMaker AI Developer Guide.
+ For how ML lineage works in SageMaker AI, see [Amazon SageMaker ML Lineage Tracking](https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking.html) in the Amazon SageMaker AI Developer Guide.