Synthetic Data Generation Guide

Synthetic data generation for LLM and GenAI projects, as a do-and-don't guide. Generate data on purpose, not on autopilot: research real data first, control exactly what you produce, prototype and debug small, inspect by hand, and compare strategies before scaling.

Do

Ten practices that turn synthetic data from a guess into a controlled, inspectable process.

1

Research existing data first

  • Search for relevant real datasets before generating synthetic data.
  • Do not create synthetic data when suitable real data already exist.
Consider repurposing existing datasets through:
  • Data augmentation
  • Relabeling
  • Attribute extraction
  • Signal extraction
  • Controlled modification
  • Combining real and synthetic samples
2

Control what you generate

  • Define the ground-truth labels or target attribute space.
  • Define a nuance space to create meaningful diversity.
  • Specify a clear sampling strategy across classes, attributes, and nuances.
  • Generate every sample according to explicitly sampled target values.
Examples of attributes:
  • Positive / negative
  • Summer / winter
  • Formal / informal
  • Expert / inexperienced
  • Easy / difficult
3

Translate vague concepts into explicit attributes

Do not rely on concepts that you cannot define or recognize.

Instead of asking: “Generate code written by an inexperienced programmer.”

Define specific characteristics, such as:
  • Poor variable names
  • Repeated code
  • Missing error handling
  • Inefficient loops
  • Hard-coded values
  • Missing input validation
  • Incorrect abstractions
  • Excessive global variables
  • Unclear control flow
  • Inconsistent formatting

Then sample one or more mistakes and instruct the model to generate an example containing those specific mistakes.

4

Prototype with the ChatGPT interface before using the API

  • Use the ChatGPT interface first to explore ideas and test prompts interactively.
  • Inspect initial examples and refine the task definition.
  • Test the labels, nuances, constraints, and expected output format.
  • Move to the API only after the generation approach produces satisfactory results.
5

Use the API for controlled generation

  • Use the API for reproducible and scalable data generation.
  • Generate data programmatically according to the defined sampling strategy.
  • Store the sampled target attributes, prompt, model, parameters, and generated output for each example.
  • Use structured outputs when possible.
  • Include automatic validation and retry mechanisms.
6

Generate data in small batches

  • Generate a small batch first.
  • Inspect the results before continuing.
  • Correct the prompt, sampling strategy, or model configuration between batches.
  • Gradually increase batch size only after quality becomes stable.
7

Debug before scaling

  • Test prompts on a small number of samples.
  • Verify that each output matches its sampled target attributes.
  • Review examples from every class and important attribute combination.
  • Evaluate whether the generated data are realistic, diverse, and correctly labeled.
  • Generate large datasets only after the small-scale process is reliable.
8

Inspect generated data manually

  • Visually inspect images, videos, diagrams, and control signals.
  • Read representative text and code samples.
  • Find unrealistic, contradictory, ambiguous, or incorrectly labeled examples.
Investigate the root cause of each problem:
  • Inappropriate model
  • Weak or ambiguous prompt
  • Poorly defined attribute
  • Invalid attribute combination
  • Incorrect sampling strategy
  • Inadequate control signal
  • Generation or parsing error
9

Use suitable control signals for vision tasks

For ControlNet and related vision models, consider:

  • Synthetically constructed depth maps
  • Skeletons or pose maps
  • Segmentation maps
  • Edge maps
  • Layouts and spatial constraints
  • Control signals extracted from real images
  • Extracted control signals that are subsequently modified

Validate both the control signals and the generated images.

10

Compare multiple generation strategies

Consider and evaluate:

  • Direct generation
  • Template-based generation
  • Few-shot generation
  • Modification of real examples
  • Attribute-controlled generation
  • Extraction followed by augmentation
  • Multi-step generation and validation
  • Generation followed by filtering
  • Generation followed by correction
  • Hybrid real and synthetic datasets

Select the approach based on data quality, controllability, realism, diversity, and cost.

Don't

The failure modes each of the practices above is meant to prevent.

Skipping the search for real data

  • Do not generate synthetic data before checking whether appropriate real data exist.

Vague or unverified control

  • Do not ask the model to generate a concept that you cannot clearly define, produce, or recognize yourself.
  • Do not use vague prompts for complex labels or attributes.
  • Do not assume that mentioning a label in the prompt guarantees that the generated sample has that label.

Scaling before it is ready

  • Do not generate data blindly without debugging and manual inspection.
  • Do not generate the entire dataset in a single API call.
  • Do not generate all data in one large uninterrupted batch.
  • Do not move directly to large-scale API generation before testing prompts interactively.
  • Do not assume that a prompt that works for several examples will remain reliable across thousands of samples.
  • Do not generate data in bulk before you are satisfied with the quality of small test batches.

Size over quality

  • Do not accept unrealistic, contradictory, ambiguous, or incorrectly labeled data.
  • Do not prioritize dataset size over quality, realism, controllability, and label reliability.
  • Do not assume that random variation automatically provides useful diversity.

Cherry-picked inspection

  • Do not inspect only convenient or successful examples.
  • Do not ignore rare classes, difficult combinations, and failure cases.

One approach, pushed blindly

  • Do not stop with the first model, prompt, or generation approach.
  • Do not treat direct synthetic generation as the only possible solution.
  • Do not ignore multi-step approaches combining extraction from real data, augmentation, modification, generation, filtering, and validation.
  • Do not continue generating after identifying a systematic problem; stop, diagnose the cause, fix the pipeline, and retest on a small scale.