# Concepts: Inferences This section introduces _inferences_ and _schemas,_ the starting concepts needed to use Phoenix with inferences. {% hint style="info" %} * For comprehensive descriptions of `phoenix.Inferences` and `phoenix.Schema`, see the [API reference](https://github.com/Arize-ai/phoenix/blob/main/docs/inferences/broken-reference/README.md). * For tips on creating your own Phoenix inferences and schemas, see the [how-to guide](how-to-inferences/define-your-schema/). {% endhint %} ## Inferences _Phoenix inferences_ are an instance of `phoenix.Inferences` that contains three pieces of information: * The data itself (a pandas dataframe) * A [schema](https://github.com/Arize-ai/phoenix/blob/main/docs/inferences/broken-reference/README.md) (a `phoenix.Schema` instance) that describes the [columns](how-to-inferences/define-your-schema/) of your dataframe * A name that appears in the UI For example, if you have a dataframe `prod_df` that is described by a schema `prod_schema`, you can define inferences `prod_ds` with ```python prod_ds = px.Inferences(prod_df, prod_schema, "production") ``` If you launch Phoenix with these inferences, you will see inferences named "production" in the UI. ### How many inferences do I need? > You can launch Phoenix with zero, one, or two sets of inferences. With no inferences, Phoenix runs in the background and collects trace data emitted by your instrumented LLM application. With a single inference set, Phoenix provides insights into model performance and data quality. With two inference sets, Phoenix compares your inferences and gives insights into drift in addition to model performance and data quality, or helps you debug your retrieval-augmented generation applications.
| Use Zero Inference sets When: |
|
| Use a Single Inference set When: |
|
| Use Two Inference sets When: |
|
train_ds = px.Inferences(train_df, schema, "training")
prod_ds = px.Inferences(prod_df, schema, "production")
Sometimes, you'll encounter scenarios where the formats of your primary and reference inference sets differ. For example, you'll need two schemas if:
* Your production data has timestamps indicating the time at which an inference was made, but your training data does not.
* Your training data has [ground truth](how-to-inferences/define-your-schema/#predictions-and-actuals) (what we call _actuals_ in Phoenix nomenclature), but your production data does not.
* A new version of your model has a differing set of features from a previous version.
In cases like these, you'll need to define two schemas, one for each inference set. For example, if you have dataframes `train_df` and `prod_df` that are described by schemas `train_schema` and `prod_schema`, respectively, then you can define inference sets `train_ds` and `prod_ds` with
train_ds = px.Inferences(train_df, train_schema, "training")
prod_ds = px.Inferences(prod_df, prod_schema, "production")
#### Schema for Corpus Inferences (Information Retrieval)
A [corpus](how-to-inferences/define-your-schema/corpus-data.md) inference set, containing documents for information retrieval, typically has a different set of columns than those found in the model data from either production or training, and requires a separate schema. Below is an example schema for a corpus inference set with three columns: the `id`, `text`, and `embedding` for each document in the corpus.
{% code fullWidth="false" %}
```python
corpus_schema=Schema(
id_column_name="id",
document_column_names=EmbeddingColumnNames(
vector_column_name="embedding",
raw_data_column_name="text",
),
),
corpus_ds = px.Inferences(corpus_df, corpus_schema)
```
{% endcode %}