Evaluate Summarization Classifications
Summarization Classification Evals
The purpose of this notebook is:
- to evaluate the performance of an LLM-assisted approach to evaluating summarization quality,
- to provide an experimental framework for users to iterate and improve on the default classification template.
Note: This notebook was last updated on May 30, 2025.
Install Dependencies and Import Libraries
ℹ️ 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.
Download 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. We will be using the CNN Daily News Mail dataset. This dataset is commonly used for text summarization models as a benchmark.
Display Binary Summarization Classification Template
View the default template used to classify summarizations. You can tweak this template and evaluate its performance relative to the default.
Eval template variables:
- input : The document text to summarize
- output : The summary of the document
Configure the LLM
Configure your OpenAI API key.
Benchmark Dataset Sample
Sample size determines run time Recommend iterating small: 100 samples Then increasing to large test set
LLM Evals: Summarization Evals Classifications GPT-4
Run summarization classifications against a subset of the data.
Instantiate the LLM and set parameters.
Evaluate the predictions against human-labeled ground-truth summarization labels.
LLM Evals: Summarization Evals Classifications GPT-3.5
Run summarization classifications against a subset of the data.
LLM Evals: Summarization Evals Classifications GPT-4 Turbo
Run summarization classifications against a subset of the data.