Concepts / Synthetic Data for Model Training

Synthetic Data for Model Training

A template is a predefined structure with placeholder fields, and it does not contain real data by itself.

  • Programming

Why Build Data From a Shape

Imagine you need thousands of realistic records to test or train a system, but you are not allowed to use real customer records to do it. One practical answer is to stop thinking about individual records and instead design the shape a record must have. Once that shape is fixed, you can produce as many instances of it as you like. This article follows that idea from the simplest case, a fill-in-the-blank form, through to the way transformed copies of existing data can expand a dataset.

Structure Fixed, Values Varied

Definition

A template is a predefined structure with placeholder fields, and it does not contain real data by itself. Each placeholder is a slot, and the template states what kind of value belongs in each slot.

The source gives a concrete case. To create a credit card transaction, you start with a transaction template and use a random generator, such as Faker, to populate each field in that template. The template is the fixed part. The random generator is the source of variation. Each field in the template is a slot, and the generator decides what goes into each slot.

A template is therefore a description of what a transaction must look like, not a transaction itself. Nothing in the template is a real transaction yet. The diagram below traces how the template becomes a usable record: the generator reads the template, fills in each field, and the result is a synthetic record that can be used downstream.

Transactiontemplatethree empty slotsTransactionidentifierfilled firstSynthetic recordall slots setDatefilled secondTimefilled thirdgenerator fillsthenthencomplete
In which order does the generator fill the slots, and what does the record look like after each fill?

Notice what this pipeline implies. The structure of the output is decided before any generation happens, because the template makes that decision. The variety of the output comes from the generator, one field at a time. This split is what makes the method predictable in shape and varied in content.

Filling a Transaction Template Step by Step

Take the transaction template from the source, which has three slots: a transaction identifier, a date, and a time. The template states the expected format of each slot, so the generator must produce values in those formats. The walkthrough below uses an invented template layout to show the process; the slot names come from the source, and the example values are illustrative only.

Worked example

Generating one synthetic transaction record

A transaction template has three empty slots: [transaction identifier], [date], and [time]. A random generator must produce one complete record that respects each slot's expected format.

  1. 1
    Read the template

    The generator reads the fixed structure and sees three slots, each with a stated expected format. The structure is now settled and will not change for any record.

  2. 2
    Fill the identifier slot

    The generator chooses a value that matches the identifier format, for example TX-0001. This is the only part of the record that depends on this one slot.

  3. 3
    Fill the date slot

    The generator chooses a date in the required date format, for example 2024-03-15. The choice is independent of the identifier.

  4. 4
    Fill the time slot

    The generator chooses a time in the required time format, for example 14:32. Once all three slots hold values, the template has become a complete record.

  5. 5
    Repeat for more records

    Running the same process again with new random choices produces a different record with the same shape. Every record is structurally identical, but the values vary.

Result

One complete synthetic record, such as TX-0001 on 2024-03-15 at 14:32, that has the template's fixed shape and generator-chosen content.

Templates for Documents and Grammars

Templates are not limited to records with named fields. The source lists two other broad uses. The first is documents that follow a specific structure, such as invoices, resumes, tax forms, bank statements, event agendas, product catalogs, contracts, and configuration files. In each case the document has a fixed layout, and the content that fills the layout can vary.

The second use is data that follows a grammar or syntax, such as regular expressions and math equations. The source notes that templates can generate math equations for AI models to solve. Here the template encodes the rules of a valid expression, and the generator chooses the parts that the rules allow. The grammar decides which pieces may appear and in what order; the generator decides which allowed pieces actually appear.

In both cases the split is the same as in the transaction example. Anything the grammar or layout fixes is structure. Anything the rules leave open is a slot for the generator. A generated invoice keeps its header, line-item layout, and totals arrangement, while the amounts, item names, and dates change from one copy to the next.

The source also points to a large-scale use of this idea. DeepMind trained an Olympiad-level geometry model, AlphaGeometry, using 100 million synthetic examples. That scale shows why generating data from structured templates can be worth the effort when real examples are limited.

Augmentation: Starting From Data You Already Have

Templates create data from nothing but a structure. Data augmentation works differently: it starts with data you already have and produces new data by applying simple transformations to it. The source describes this as procedurally generating new data from existing data.

For images, the transformations named in the source are random rotation, cropping, scaling, and erasing part of the image. Each transformed copy is a new training example derived from an original one. The diagram below shows one original image and the copies that each transformation produces.

Original cat imagelabel: catRandomly rotated copylabel: cat, +1 exampleCropped copylabel: cat, +1 exampleScaled copylabel: cat, +1 exampleCopy with erased partlabel: cat, +1 examplerotationcroppingscalingerasing
How does the original example change after each transformation, and how many new examples does each one add?

Why Transformations Keep the Label

The reason augmentation works is that the transformations are expected to preserve meaning. The label stays the same while the pixels change. The source gives two examples: a flipped image of a cat should still be a cat, and a slightly cropped image of a soccer game should still be a soccer game.

Why Synthetic Data Helps Before Real Data Exists

The main practical motivation appears in the source's discussion of sensitive data. Transaction data is sensitive, so many fraud detection models are first trained on synthetic transaction data generated from templates like the one above. The purpose is to show that the model is feasible before it is given access to real data.

Synthetic data is programmatically generated to supplement real data, and it must be evaluated for quality before training. It became a practical option because acquiring high-quality data is difficult. The source explains that annotating data is hard, but writing annotation guidelines is harder; generating data can be automated to some degree, but verifying that the generated data is correct is harder still. Synthetic data does not remove the need for careful thinking. It changes where the effort goes.

MethodStarting pointWhat variesWhat stays fixed
Template-based generationA predefined structure with empty slotsValues chosen by a random generatorFields, expected formats, and layout
Data augmentationExisting examples that already have labelsPixels or content changed by transformationsThe label, which transformations are expected to preserve

The two ways the source describes creating training data

The Three Criteria for Dataset Design

You begin by deciding what behaviors you want the model to learn, and then you design a dataset that demonstrates those behaviors. Dataset design rests on three criteria: quality, coverage, and quantity. A small amount of high-quality data can outperform a large amount of noisy data.

CriterionQuestion it answersWhat goes wrong without it
QualityAre the examples accurate and useful for the behavior being taught?Noisy examples add volume without adding correct behavior
CoverageDoes the dataset include the range of situations the model will handle?A million examples that all look alike leave gaps the model never learns to fill
QuantityHow much data does the model see?Too little data gives the model too few demonstrations to learn from

The three core dataset design criteria

The three criteria are not independent. Coverage determines whether a large dataset is actually useful. Quality determines whether the quantity you collect helps or hurts. The source also notes that increasing the diversity of a dataset is a key way to improve model performance, which sits at the intersection of coverage and quality.

Checks Generated Data Must Pass Before Training

The source is firm on one point: synthetic data must be evaluated to ensure its quality before it is used to train models. This applies to generated data in the same way it applies to real data. A generated example can be wrong, off-topic, or unrepresentative, and training on it can teach the model those flaws.

  1. 1
    Decide, before generating anything, how you will judge whether each piece of generated data is good enough.
  2. 2
    Check each generated record against the quality criterion: is it accurate and useful for the behavior you are teaching?
  3. 3
    Check the output against the coverage criterion: does the generated set span the situations the model needs, or does it repeat one pattern?
  4. 4
    Check that generated examples meet the expected format and, for augmented data, that each transformation still preserves the label.
  5. 5
    Only pass the generated portion into training after it has been evaluated, in the same way real data is checked first.

The Data Flywheel and Its Conditions

A data flywheel describes a model that continually improves upon itself. The source notes that, in theory, it is possible to train a model that keeps improving this way with synthetic data. Each round of improvement produces material for the next round, so progress builds on itself. The loop below shows the cycle.

Train model onsynthetic dataround NModel generates orfilters datanew candidate examplesFeedback qualitycheckmust separate good from badAccepted data addedto training setfeeds round N+1producesfeedbackif reliablenext round
What happens in each step of the loop, and which condition decides whether each pass improves the model rather than reinforcing its errors?

The loop is attractive, but the source is careful about whether it works in practice. The flywheel depends on the quality of what the model feeds back into itself. A cycle that reinforces mistakes is not an improvement. The check in the loop is therefore the condition that matters most.

The source offers a case where feedback clearly helped. In one reported study, about 20 percent of solutions were initially incorrect but self-corrected, which indicated that the model learned from execution feedback and improved its performance. The feedback came from running the code, a signal that reliably separated good output from bad.

When Feedback Reinforces Mistakes

The same logic can fail with human annotations. If a human labeler answers a question using knowledge the model does not have, the labeler is effectively teaching the model to hallucinate. The label looks correct to a person but carries information the model cannot reproduce from its own inputs, so the model learns to produce answers without grounds.

Debugging

A flywheel round adds labels that are correct to a human but depend on facts absent from the model's inputs. The next round trains on them, and the model's answers become confident without grounding. The fix is not more rounds. It is a check that the feedback signal can be reproduced from what the model actually sees, the same kind of reliable signal that running code provides.

Mistakes Beginners Make With Generated Data

  • Common mistake

    Treating the template as if it were real data

    What it looks like

    Reading the transaction template and assuming its bracketed slots already describe actual transactions.

    Why it fails

    The source says a template is a predefined structure that does not contain real data by itself.

    Do this instead

    Remember that the template fixes shape only. Values come from the generator, one slot at a time.

  • Common mistake

    Expecting variety to come from the structure

    What it looks like

    Writing a rigid template and hoping its layout will produce different records each time.

    Why it fails

    The structure is fixed, and the variety comes from the random generator filling each field.

    Do this instead

    Put variability in the generator's choices, and keep the template's fields and formats stable.

  • Common mistake

    Assuming every transformation is a safe augmentation

    What it looks like

    Applying a transformation that changes what an image depicts while keeping its original label.

    Why it fails

    Augmentation relies on transformations that are expected to preserve the label.

    Do this instead

    Before adding a transformation, confirm it keeps the meaning the label describes.

  • Common mistake

    Training on generated data without evaluating it

    Why it fails

    Generated examples can be wrong, off-topic, or unrepresentative, and the model learns those flaws.

    Do this instead

    Decide the evaluation method first, and check the generated portion before it enters training.

  • Common mistake

    Counting only quantity when judging a dataset

Practice: Trace a Template Fill

MEDIUM

A template for a product catalog entry has four slots: a product name, a price, a category, and a stock count. The layout and expected formats are fixed. Describe the order in which a generator fills the slots, state which part of the output is structure and which is variety, and explain what you would check on the generated entries before using them to train a model.

Hints
  • The structure is decided by the template before any generation happens.
  • The generator supplies the values for each slot, one field at a time.
  • Ask whether each generated entry matches the expected format and whether the set covers the range of products the model needs.

Putting the Pieces Together

  1. 1
    A template is a predefined structure with placeholder fields and no real data. A random generator, such as Faker, fills each slot, so the structure stays fixed while the values vary.
  2. 2
    Templates also produce documents with fixed layouts and data that follows a grammar or syntax, such as regular expressions and math equations.
  3. 3
    Augmentation starts from existing data and applies transformations such as rotation, cropping, scaling, or erasing, which are expected to preserve the label.
  4. 4
    Quality, coverage, and quantity are the three core dataset design criteria, and generated data must be evaluated before it trains a model.
  5. 5
    A data flywheel can in theory keep improving a model, but it only works when the feedback it reuses is reliable.

Key Takeaways

  • A template fixes the structure of a record through placeholder fields, and a random generator such as Faker supplies the varying values.
  • Templates can generate structured documents and data that follows a grammar or syntax, such as regular expressions and math equations.
  • Data augmentation creates new examples from existing ones through transformations expected to preserve the label.
  • Quality, coverage, and quantity are the three core dataset design criteria, and generated data must be evaluated before training.
  • The data flywheel works only when the feedback it reuses is reliable; feedback that carries errors reinforces them.

Related concepts

More concepts starting with S