Hallucination Eval Benchmark
âšī¸ To enable async request submission in notebook environments like Jupyter or Google Colab, optionally use nest_asyncio. nest_asyncio globally patches asyncio to enable event loops to be re-entrant. This is not required for non-notebook environments.
Without nest_asyncio, eval submission can be much slower, depending on your organization's rate limits. Speed increases of about 5x are typical.
Set up tracing to log runs to your Phoenix instance.
Prepare Benchmark Dataset
We'll evaluate the evaluation system consisting of an LLM model and settings in addition to an evaluation prompt template against benchmark datasets of queries and retrieved documents with ground-truth relevance labels. Currently supported datasets include "halueval_qa_data" from the HaluEval benchmark:
Baseline: Arize's Built-In Binary Hallucination Classification Template
Configure the LLM
View the default template used to classify hallucinations. You can tweak this template and evaluate its performance relative to the default.
Define the experiment task (hallucination classification)
Define evaluators
Accuracy: does the expected label match the eval?
Note: The accuracy evaluator rounds the output/expected to the nearest integer, so if we move to continuous score [0,1], then the accuracy evaluator still works. We could also add a mean-squared-error (MSE) evaluator for continuous scores down the line.
We should also calculate F1, precision, recall at the dataset level for better understanding of the eval performance.