Notebooks
A
Arize AI
Generating Synthetic Datasets

Generating Synthetic Datasets

agentsllmsLlamaIndexarize-phoenixopenaitutorialsevalsllmopsai-monitoringaiengineeringprompt-engineeringdatasetsllm-evalai-observabilityllm-evaluationsmolagentsanthropiclangchainexperiments

Open In Colab

Generating Synthetic Datasets using LLMs

Synthetic datasets are a powerful way to test and refine your LLM applications, especially when real-world data is limited, sensitive, or hard to collect. By guiding the model to generate structured examples, you can quickly create datasets that cover common scenarios, complex multi-step cases, and edge cases like typos or out-of-scope queries.

In this notebook, we’ll walk through different strategies for dataset generation and show how they can be used to run experiments and test evaluators.

Set up Dependencies and Keys

[ ]
[ ]
[ ]
[ ]

Creating Synthetic Benchmark Datasets to Test Evaluators

Goal: Create a synthetic dataset that allows you to test the accuracy and coverage of your evaluator.

Use Case: Feed the generated dataset into an LLM-as-a-Judge or other evaluator to ensure it correctly labels intent, identifies errors, and handles a variety of query types including edge cases and noisy inputs.


Synthetic data is especially useful when you want to stress-test evaluators such as an LLM-as-a-Judge across a wide range of scenarios. By generating examples systematically, you can cover straightforward cases, tricky edge cases, ambiguous queries, and noisy inputs, ensuring your evaluator captures different angles of behavior.

A strong synthetic dataset, in this case, serves as the benchmark dataset, providing a reliable benchmark for evaluating and comparing application changes.

In the example below, we generate customer support queries in JSON, each with a user query, intent label, and sample response. This dataset can then be used to check how well your evaluator identifies intent and judges correctness across varied cases.

[ ]
[ ]
[ ]

Upload Dataset

[ ]

Example Usage: Test LLM Judge Effectiveness

[ ]
[ ]
[ ]

Using Few Shot Examples for Synthetic Dataset Generation

Goal: Guide the LLM to generate synthetic examples that reflect different types of queries and scenarios while maintaining consistent labeling and structure. This approach allows for more customization and higher-quality examples in your dataset. Your few-shot examples can be real data as well.


Few-shot prompting allows you to guide an LLM by showing a handful of examples, which helps produce more consistent and realistic outputs. In this approach, we provide a few labeled customer queries with their intents and sample responses, and ask the model to generate additional examples in the same format.

This is particularly useful for testing evaluators such as an LLM-as-a-Judge, because it ensures the synthetic dataset reflects patterns, labels, and structures the evaluator is expected to handle. By controlling the examples in the prompt, you can produce a dataset that covers a variety of scenarios, including tricky or ambiguous queries, to check whether your evaluator captures different angles of behavior.

[ ]
[ ]
[ ]

Upload Dataset

[ ]

Example Usage: Test LLM Judge Effectiveness

[ ]
[ ]
[ ]

Creating Synthetic Datasets for Agents

Goal: Build synthetic test data that captures a wide range of queries to evaluate an agent’s reliability and safety.

Use Case: Test how an agent handles in-scope requests, refuses out-of-scope queries, and manages edge cases, adversarial inputs, and noisy data.


When creating synthetic datasets, first define the agent’s capabilities and boundaries (tools, in-scope vs. out-of-scope). Then organize queries into categories to ensure balanced coverage:

  1. Happy-path: simple, common requests
  2. Complex: multi-step or reasoning-heavy
  3. Adversarial / refusal: out-of-scope or unsafe
  4. Edge cases: ambiguous or incomplete inputs
  5. Noise: typos, slang, multilingual

This structure makes it easier to stress-test the agent across realistic scenarios and confirm it behaves consistently.

Why This Approach?

This structure ensures comprehensive evaluation (core tasks, edge conditions, and safety) and systematic coverage (no major scenario overlooked). By simulating a wide range of real-world interactions, you can validate that the agent is reliable, robust, and safe.

[ ]
[ ]
[ ]

Upload Dataset

[ ]