Skip to content

Creating Evaluation Datasets for LLM Applications

Cover: Creating Evaluation Datasets for LLM Applications Evaluating the quality of an LLM application is impossible without a high-quality evaluation dataset. In this article, I will discuss how to create and maintain evaluation datasets, what data sources to use, and how to automate the process.

Why Do You Need an Evaluation Dataset

An evaluation dataset is a set of 'input → expected output' pairs used to measure the quality of a model or system. Without it, it's impossible to track regressions when updating the model, changing prompts, or pipelines. A good dataset is the foundation for LLM metrics and RAG system evaluation.

Data Sources for the Dataset

1. Production Logs

The most valuable source is real user requests. I collect logs from the LLM observability stack and select a representative sample. Important: logs contain PII, so they need to be anonymized before use.

2. Synthetic Data

When real data is scarce, I generate synthetic data. For this, I use an LLM assistant that creates query variants based on typical scenarios. More details on generation are in the article about synthetic data.

3. Manual Composition

For critical scenarios, I manually compose benchmark examples. This is labor-intensive but provides full control over coverage.

Dataset Structure

Each example should contain: - id — unique identifier - input — input query - expected_output — expected response - metadata — category, difficulty, source

{
  "id": "qa-001",
  "input": "How to set up two-factor authentication?",
  "expected_output": "To set up 2FA, go to the Security section...",
  "metadata": {
    "category": "support",
    "difficulty": "medium",
    "source": "production-logs"
  }
}

Data Annotation

Annotation is the most expensive stage. I use three approaches: 1. Manual annotation — for benchmark responses in complex scenarios. 2. LLM-as-a-judge — for mass annotation, when the model evaluates responses based on criteria. 3. Hybrid — LLM proposes annotation, human verifies. For LLM-as-a-judge, it's important to set clear evaluation criteria. Example prompt:

Evaluate the assistant's response on a scale of 1 to 5 based on the following criteria:
1. Completeness — does the response cover all aspects of the question.
2. Accuracy — are there factual errors.
3. Relevance — does the response fit the context.

Question: {question}
Answer: {answer}

Return JSON: {"score": 4, "reason": "..."}

Metrics for Evaluation

The choice of metrics depends on the task type. For generative responses, I use Faithfulness and Answer Relevancy. For classification — Accuracy and F1. Full list — in the article about evaluation metrics.

Automation of Evaluation

I run evaluation in the CI/CD pipeline. With each prompt or model change, the dataset is automatically run through, and results are compared to previous ones. If metrics drop below the threshold — the pipeline fails.

# Example of running evaluation
from eval_framework import run_evaluation

results = run_evaluation(
    dataset_path="data/eval_dataset.jsonl",
    model="deepseek-chat",
    metrics=["faithfulness", "answer_relevancy"]
)

print(results)

Maintaining Relevance

The dataset needs to be regularly updated: - Add new scenarios from production logs. - Remove outdated examples. - Re-evaluate benchmark responses when the product changes. I update the dataset once a month and store versions in the model registry.

Practical Recommendations

  • Start with 50–100 examples covering main scenarios.
  • Use stratified sampling from logs to make the dataset representative.
  • Store the dataset in a Git repository for change tracking.
  • Automate evaluation, but don't forget manual verification of critical scenarios. A high-quality evaluation dataset is an investment that pays off through the stability and predictability of the LLM application. For deeper insights, I recommend the guide on RAG evaluation and the article on metrics.