Synthetic Data Generation with Templates
Data acquisition gathers data through four routes: sourcing public data, purchasing proprietary data, annotating data, and synthesizing data, and real datasets usually combine several of them.
Why the Model Is Not the Hardest Part
Many people who start building a model assume the difficult part is the model itself. In practice, a team often spends more effort deciding what data the model should learn from. A dataset is rarely something you find ready-made. It usually has to be assembled from several places, cleaned, extended, and labeled before a model can use it.
The name for this assembly work is data acquisition. Like a supply chain, it has to be planned: you need to know which inputs you need, where they can come from, what they cost, and what state they will be in when they arrive. The goal is a dataset that is large enough, varied enough, and accurate enough for the task, collected in a way that respects user privacy and the rules that apply to the data.
What do you think happens?
Your dataset holds 4,200 records and you remove 300 of them. How many records remain?
Reveal answer
3,900
Removing records lowers the record count directly, so 4,200 minus 300 leaves 3,900. The harder question, which the rest of this article returns to, is what that removal does to quality.
Before looking at any acquisition route, keep one question in mind: for each record in the eventual dataset, where did it come from, and what has happened to it since?
The Four Routes to Data
Acquisition draws on four broad routes. Sourcing public data means finding datasets that other people have released. Purchasing proprietary data means paying a provider for data it holds and you do not. Annotating data means people add labels or other information to examples that already exist. Synthesizing data means new examples are generated from existing data or from templates.
These routes are not alternatives you choose between once. They are combined. A single dataset can contain records from several sources, and the same dataset can pass through annotation and synthesis more than once. The sourcing routes supply raw records, while annotation and synthesis change the records or add to them.
Read the diagram as a set of inputs and transformations. The two sourcing routes bring in records that already exist. Annotation and synthesis then either attach information to records or create new ones. A finished dataset is usually the result of several of these arrows, applied in some order, rather than a single one.
Application Data as the Starting Point
Of the four routes, the one that usually matters most is the data your own application produces. The reason is distribution. Your application's records reflect the kinds of inputs your users actually send, in the proportions they actually send them. Public and purchased datasets were gathered for someone else's purpose, so their match to your task is often only partial. Matching the distribution of the data you care about is hard to achieve with other sources, which is why application data is described as ideal for the task.
Application data can also feed back into the product. A useful pattern is a loop: users generate data, that data is used to improve the product, and the improved product generates more useful data. Teams often call this a data flywheel.
- User content, which users create while using the product
- System-generated data, which records how the product is used
- User feedback
The design of a feedback system is a topic of its own, and it is covered later in the course.
Checking Public Data Before Use
Before you invest in creating data, check whether a suitable dataset already exists. Data marketplaces hold both open and proprietary datasets, and some may match your requirements closely. In many projects, though, the result is a combination of several partial matches rather than one perfect dataset. The useful habit is to search first, then decide which parts still have to be built.
Public data has a second requirement that is easy to forget. A public dataset is not automatically safe to use. Before using one, check its license, and try to understand where its contents came from. A license that permits commercial use can still cover a dataset that includes material collected under different terms. Public data is worth using, but it has to be inspected and validated like any other input.
The check happens before the dataset is used, not after. Once a public record has entered the training data, its license and provenance problems travel with it.
Evaluation harness tools are another source of ready-made data. Some host benchmark datasets large enough for parameter-efficient fine-tuning. One example is the lm-evaluation-harness from EleutherAI, which hosts more than 400 benchmark datasets, averaging over 2,000 examples each. Such sources are still public data and follow the same check of license and provenance.
Following a Dataset Through Acquisition
A dataset changes at every step of acquisition, and the easiest way to see how is to follow one through the process. The example below is a generated illustration, not a figure from a real project. Suppose you are building a dataset of customer support conversations, where each record pairs a customer message with a good agent reply. Watch how the count and the quality change as each step is applied.
Tracing the support-conversation dataset
Start from a dataset of 4,200 support conversations, of which 1,000 have been rewritten. The team removes 300 records that annotators flagged as unanswerable, then generates 400 new conversations from 10 templates. What is the final record count, and which operations change the count?
- 1Starting state
The dataset has 4,200 records. Rewriting 1,000 of them did not change that number, which is the key point of the rewrite step.
- 2Remove the flagged records
Removing 300 records from 4,200 leaves 3,900. Removal changes the record count, and it also changes quality, because the unanswerable records are taken out.
- 3Generate new conversations
Synthesis adds 400 conversations from 10 templates, so 3,900 plus 400 gives 4,300. Synthesis changes the count, and it adds records whose quality depends on the templates they came from.
- 4Compare the two operations
Removal and synthesis both change the count. Rewriting did not, but it still changed quality. Tracking the count alone would miss that change.
The final dataset has 4,300 records. Removal and synthesis changed the count, while the earlier rewrite changed quality without changing size.
The diagram shows only the count. The rewrite step is absent from it because it did not change the size of the dataset, even though it carried out one of the most important quality improvements in the plan. To judge a dataset properly, you need both measurements at every step.
Rewriting Improves Quality Without Changing Size
Acquisition changes both the size and the quality of a dataset. Steps such as rewriting and relabeling can improve quality without changing the record count. In the support-conversation example, rewriting 1,000 records left the total at 4,200 while making those records better.
Synthesis and the Repetition Risk
Synthesis adds data from existing material. A common pattern is to write a small number of templates by hand, then use an AI model to produce many instances from them. Synthesis is useful for increasing the size of a dataset, particularly where real examples are scarce.
Its limitation is that the output inherits the shape of its templates. If each template produces too many instances, the dataset can become repetitive. The suggested fix is to write more templates and generate fewer instances from each one.
Suppose 10 templates each generate 40 conversations, giving 400 records. If the 400 records share the same phrasing, the dataset is large but narrow. Writing 20 templates and generating 20 conversations from each keeps the total at 400 while spreading the variety across more starting shapes. The count is identical; the coverage is not.
Annotation Loops and Their Cost
Annotation adds the labels or other information that make data usable for training. Manual annotation is central to a high-quality dataset, and it is rarely a single pass. Once annotators start working, a team often discovers that some labels are not helpful. The response is to revise the annotation guidelines and relabel the affected records.
Some errors are factual rather than stylistic, and those may call for a second group of annotators who check the first group's work. The cost of these loops is part of the acquisition budget, not an unexpected extra.
Mistakes in Planning an Acquisition Pipeline
Common mistake Trusting public data without checking it
What it looks likeA team downloads a public dataset and adds it straight to training data.
Why it failsPublic data is not automatically safe. Its license may not cover the intended use, and its contents may come from sources collected under different terms.
Do this insteadCheck the license, try to understand where the contents came from, and validate quality before use.
Common mistake Building new data before searching for existing data
What it looks likeA team starts annotating from scratch without first looking at marketplaces or public sources.
Why it failsA suitable dataset may already exist, or several partial matches may cover most of the need.
Do this insteadSearch first, then decide which parts still have to be built.
Common mistake Tracking only the record count
What it looks likeA team reports that the dataset is unchanged after rewriting, so it assumes nothing happened.
Why it failsRewriting and relabeling can improve quality without changing size.
Do this insteadMeasure size and quality separately at each step.
Common mistake Generating many instances from few templates
What it looks likeTen templates each produce a large batch of near-identical conversations.
Why it failsSynthetic output inherits the shape of its templates, so the dataset becomes repetitive.
Do this insteadWrite more templates and generate fewer instances from each.
Common mistake Treating annotation as a single pass
Why it failsSome labels turn out to be unhelpful, and factual errors may need a second group of annotators.
Do this insteadBudget for guideline revisions, relabeling, and review loops from the start.
Practice: Tracing Your Own Dataset
Start from a dataset of 4,200 records, of which 1,000 have been rewritten. Your team next removes 300 records flagged as unanswerable, and then generates 400 new conversations from 10 templates. Work out the final record count. Then decide which of the two changes alters the count and which only alters quality.
Hints
- Apply the operations in the order given and subtract or add the record counts at each step.
- Ask whether removing a flagged record changes only the count, only the quality, or both.
Name the four acquisition routes, then say which one usually matters most for a model's distribution and why.
Hints
- Sourcing public data, purchasing proprietary data, annotating data, and synthesizing data are the four routes.
- Think about whose purpose the data was gathered for.
Key Takeaways
- Data acquisition gathers data through four routes: sourcing public data, purchasing proprietary data, annotating data, and synthesizing data, and real datasets usually combine several of them.
- Application data is usually the most relevant starting point because it matches the distribution of the inputs your task actually involves, and it can feed a loop that improves the product.
- Public data must be checked for license terms, provenance, and quality before use, and it should be searched for before new data is built.
- Acquisition changes both size and quality. Rewriting and relabeling can improve quality without changing the record count, so track both measurements at every step.