Core concept

Datasets

Evaluation uses two kinds of data. The dataset is the test you hold still. The experiment result is what the system produced, plus the metric scores, for one run of that test.

Two directories datasets / experiments

Splitting them keeps the test data reusable across every variant you score.

datasets/inputs + expectedSystemexperiments/row + response + scoresame dataset, new CSV after each change

What a row contains Input, expected, metadata

A RAG row might hold the query, grading notes, and a complexity tag you can filter on later.

Evaluation datasetExperiment result
RequiredInputs the system will processEvery dataset column, copied forward
OptionalExpected outputs or grading notesThe system response and each metric result
ExtraMetadata for slicing (complexity, language)A URI to the trace for that input

Metadata is how you slice the same run: complex queries versus simple ones, or one language versus another. A RAG result row then reads as query, grading notes, response, accuracy, and a link to the trace.

The Dataset class Create, append, load

Fields are whatever the evaluation needs. Common ones are id, query or input, expected_output, and metadata.

dataset = Dataset(name="my_evaluation", backend="local/csv", root_dir="./data")

dataset.append({
    "id": "sample_1",
    "query": "What is the capital of France?",
    "expected_answer": "Paris",
    "metadata": {"complexity": "simple", "language": "en"},
})
dataset = Dataset.load(
    name="my_evaluation",
    backend="local/csv",
    root_dir="./data",
)

Local CSV

backend="local/csv" and a root_dir such as ./datasets. Enough for local development.

Shared storage

A cloud backend such as gdrive (experimental) when the set is large or the team shares it.

Versions

Put the version in the name, my_eval_v1.2, so an old experiment still points at the rows it used.

Building a set worth scoring Quality over volume

The dataset is the test suite. A thin or drifted one makes every later score hard to trust.

  • Representative. Cover the scenarios the system will actually see.
  • Balanced. Mix difficulty, topics, and edge cases.
  • Small and curated. Fewer well-checked rows beat a large noisy dump.
  • Metadata-rich. Tag the dimensions you will want to filter on.
  • Versioned. Track edits so a score from last month can be reproduced.
@experiment()
async def my_experiment(row):
    response = await my_ai_system(row["query"])
    return {
        **row,
        "response": response,
        "experiment_name": "baseline_v1",
    }

results = await my_experiment.arun(dataset)

Key takeaways

  • Datasets stay under datasets/. Results stay under experiments/.
  • **row in the experiment return value is what copies inputs and expected outputs into the result file.
  • A versioned name is the link between a CSV of scores and the exact questions that produced them.