Skip to main content
Move beyond ad-hoc evaluation to structured experiments that track results, validate against golden labels, and enable side-by-side comparison of RAG pipeline configurations. Use this cookbook when: You want to compare different retrieval strategies, LLM models, or prompt configurations across a standardized test set. Time to complete: ~25 minutes
Prerequisites
  • Fiddler account with API access
  • LLM credential configured in Settings > LLM Gateway
  • pip install fiddler-evals pandas
  • Familiarity with RAG Evaluation Fundamentals recommended

1

Set Up the Experiment Infrastructure

Experiments are organized as: Project > Application > Dataset > Experiment
Replace URL, TOKEN, and credential names with your Fiddler account details. Find your credentials in Settings > Access Tokens and Settings > LLM Gateway.
2

Create Test Cases with Golden Labels

Include expected_quality labels so you can validate whether evaluators correctly identify good and bad responses:
3

Insert Data into the Dataset

Expected output:
The idempotency check (if not list(dataset.get_items())) prevents duplicate inserts if you re-run the notebook. Remove this check if you want to refresh the dataset.
4

Run the Experiment

Define a task function that returns the RAG response, then run the experiment with all three RAG Health evaluators:
Understanding score_fn_kwargs_mapping: This dict maps evaluator parameter names to data sources. Use a lambda to extract values from dataset inputs (x['inputs']['...']), or a string to reference a key from the task function’s return dict.
Expected output:
5

Validate Against Golden Labels

Check whether the evaluators correctly identified quality issues by comparing their scores against your expected labels:
Expected output:
6

View Results

Expected output:

Comparing Pipeline Configurations

To compare different RAG configurations, run multiple experiments against the same dataset:
Replace rag_pipeline_v1 and rag_pipeline_v2 with your actual RAG pipeline functions. Each function must accept (inputs, extras, metadata) and return a dict containing rag_response.
Both experiments appear in the Fiddler UI under the same Application, enabling side-by-side comparison of scores across all test cases.

Next Steps


Source notebook: Fiddler Cookbook: RAG Experiments at Scale