Quickstart: Inferences
Observability for all model types (LLM, NLP, CV, Tabular)
Overview
Phoenix Inferences allows you to observe the performance of your model through visualizing all the model’s inferences in one interactive UMAP view.
This powerful visualization can be leveraged during EDA to understand model drift, find low performing clusters, uncover retrieval issues, and export data for retraining / fine tuning.
Quickstart
The following Quickstart can be executed in a Jupyter notebook or Google Colab.
We will begin by logging just a training set. Then proceed to add a production set for comparison.
Step 1: Install and load dependencies
Use pip
or conda
to install arize-phoenix
. Note that since we are going to do embedding analysis we must also add the embeddings extra.
Step 2: Prepare model data
Phoenix visualizes data taken from pandas dataframe, where each row of the dataframe compasses all the information about each inference (including feature values, prediction, metadata, etc.)
For this Quickstart, we will show an example of visualizing the inferences from a computer vision model. See example notebooks for all model types here.
Let’s begin by working with the training set for this model.
Download the dataset and load it into a Pandas dataframe.
Preview the dataframe with train_df.head()
and note that each row contains all the data specific to this CV model for each inference.
Step 3: Define a Schema
Before we can log these inferences, we need to define a Schema object to describe them.
The Schema object informs Phoenix of the fields that the columns of the dataframe should map to.
Here we define a Schema to describe our particular CV training set:
Important: The fields used in a Schema will vary depending on the model type that you are working with.
For examples on how Schema are defined for other model types (NLP, tabular, LLM-based applications), see example notebooks under Embedding Analysis and Structured Data Analysis.
Step 4: Wrap into Inferences object
Wrap your train_df
and schema train_schema
into a Phoenix Inferences
object:
Step 5: Launch Phoenix!
We are now ready to launch Phoenix with our Inferences!
Here, we are passing train_ds
as the primary
inferences, as we are only visualizing one inference set (see Step 6 for adding additional inference sets).
Running this will fire up a Phoenix visualization. Follow in the instructions in the output to view Phoenix in a browser, or in-line in your notebook:
You are now ready to observe the training set of your model!
✅ Checkpoint A.
Optional - try the following exercises to familiarize yourself more with Phoenix:
Discuss your answers in our community!
Step 6 (Optional): Add comparison data
In order to visualize drift, conduct A/B model comparisons, or in the case of an information retrieval use case, compare inferences against a corpus, you will need to add a comparison dataset to your visualization.
We will continue on with our CV model example above, and add a set of production data from our model to our visualization.
This will allow us to analyze drift and conduct A/B comparisons of our production data against our training set.
a) Prepare production inferences
b) Define model schema
Note that this schema differs slightly from our train_schema
above, as our prod_df
does not have a ground truth column!
When do I need a different schema?
In general, if both sets of inferences you are visualizing have identical schemas, you can reuse the Schema object.
However, there are often differences between the schema of a primary and reference dataset. For example:
Your production set does not include any ground truth, but your training set does.
Your primary dataset is the set of prompt-responses in an LLM application, and your reference is your corpus.
Your production data has differing timestamps between all inferences, but your training set does not have a timestamp column.
Read more about comparison dataset Schemas here: How many schemas do I need?
c) Wrap into Inferences object
d) Launch Phoenix with both Inferences!
This time, we will include both train_ds
and prod_ds
when calling launch_app
.
What data should I set as `reference` and as `primary`? Select the inferences that you want to use as the referential baseline as your reference
, and the dataset you'd like to actively evaluate as your primary.
In this case, training is our referential baseline, for which we want to gauge the behavior (e.g. evaluate drift) of our production data against.
Once again, enter your Phoenix app with the new link generated by your session. e.g.
You are now ready to conduct comparative Root Cause Analysis!
✅ Checkpoint B.
Optional - try the following exercises to familiarize yourself more with Phoenix:
Discuss your answers in our community!
Step 7 (Optional): Export data
Once you have identified datapoints of interest, you can export this data directly from the Phoenix app for further analysis, or to incorporate these into downstream model retraining and finetuning flows.
See more on exporting data here.
Step 8 (Optional): Enable production observability with Arize
Once your model is ready for production, you can add Arize to enable production-grade observability. Phoenix works in conjunction with Arize to enable end-to-end model development and observability.
With Arize, you will additionally benefit from:
Being able to publish and observe your models in real-time as inferences are being served, and/or via direct connectors from your table/storage solution
Scalable compute to handle billions of predictions
Ability to set up monitors & alerts
Production-grade observability
Integration with Phoenix for model iteration to observability
Enterprise-grade RBAC and SSO
Experiment with infinite permutations of model versions and filters
Create your free account and see the full suite of Arize features.
Where to go from here?
Read more about Embeddings Analysis here
Questions?
Join the Phoenix Slack community to ask questions, share findings, provide feedback, and connect with other developers.
Last updated