Before you start
You need an Arize AX account and an OpenAI API key.Create a dataset
Connect to Arize AX with the Arize SDK and upload a dataset. We use ten rows from cnn_dailymail, which pairs each news article with a human-written summary. Those reference summaries are what the evaluators score against, so the dataset needs both anarticle and a summary column.
Define our experiment
Now let’s define our experiment. The task summarizes one article per dataset row. Taking the prompt template and the model as arguments is what lets us reuse the identical task across prompt variants later — only the template changes.Define our evaluators
Next, we can run evaluations on the results. Evaluators take the output of a task (in this case, a string) and grade it, often with the help of an LLM. In this case, we will create ROUGE evaluators to compare the LLM-generated summaries with the human reference summaries you uploaded as part of your dataset. There are several variants of ROUGE, but we’ll use ROUGE-1 F1 score for simplicity:- ROUGE-1 precision is the proportion of overlapping tokens (present in both reference and generated summaries) that are present in the generated summary (number of overlapping tokens / number of tokens in the generated summary)
- ROUGE-1 recall is the proportion of overlapping tokens that are present in the reference summary (number of overlapping tokens / number of tokens in the reference summary)
- ROUGE-1 F1 score is the harmonic mean of precision and recall, providing a single number that balances these two scores.
EvaluationResult. Return the full object rather than a bare float: label and explanation are reserved columns that cannot be null, so a float-only return fails the upload.
Run the experiment
Now you can run an experiment with this task, evaluator, and dataset.
Results in the experiments UI