Synthetic Data Pipelines › The Pipeline Is the Product
Language AI HandbookAll chapters Before the mechanics, it is worth being precise about what a pipeline outputs, because the answer determines everything about how you engineer it.
The output is not a pile of text. It is a dataset plus a set of claims about that dataset:
- which generator produced it, at which revision, with which decoding parameters;
- which prompt template was used, and what that template looked like at the time;
- which filters ran, in what order, with what thresholds;
- what fraction of raw samples survived each stage;
- what verification was applied and what it could and could not catch;
- what the seeds were and under what terms they were licensed.
Those details give readers a way to check how a corpus was built. Dataset Lineage and Provenance in Part XXI covers the governance side. Here we build the artifacts those checks rely on.
A README paragraph can make a checkable claim if a reader has the evidence they need. To check “filtered at a near-duplicate threshold of 0.90,” for example, retain the relevant configuration and the record of which filter ran.
Overall yield is the fraction of generated rows that survives to the final corpus. A stage's conditional yield is the fraction of the rows reaching it that pass. Use overall yield to calculate generation cost per kept item. Track filtering and review costs separately.
The yield ledger
Suppose a run retains at least one row. Let be the stage acceptance rates, each measured among rows that reach its stage. If each raw sample costs to generate, the generation cost per kept sample is
With four stages each retaining half its input, generation costs sixteen times as much per kept example as per raw example. Running the filters adds to that cost. For example, if lowering a judge threshold raised yield from 20% to 45% at a loss of three precision points, compare the reduced generation cost per retained sample at a fixed raw cost with the value of the precision lost.
A pipeline can save work in later stages by applying inexpensive, high-recall checks before costly ones where their dependencies allow it. For example, judge fewer rows by removing exact duplicates first when that ordering preserves the decision you want.
A cheap check that rejects half its input can halve the cost of later per-row checks, provided it leaves their cost per row unchanged. The best order also depends on which rows the checks reject and which earlier outputs they require. Compare both compute and acceptance on representative data.
A final count alone cannot locate a yield drop. Log the number of rows reaching and passing each stage. If one stage drops from 60% to 15% acceptance, compare its inputs, including generator and prompt revisions, and its own settings and implementation before assigning the cause.
Best-of-n with a fixed generator
Best-of-n can help when the generator sometimes produces an acceptable result and the verifier recognizes it.
Generate independent samples from a model, score each with a verifier, and keep the best or the ones above a threshold. If a single sample is acceptable with probability and the verifier is perfect, then best-of- produces an acceptable sample with probability .
With , eight independent draws give . With , forty give . For fixed positive , success approaches certainty as the number of independent draws grows.
With a verifier that identifies acceptable results, repeated draws can increase the chance of collecting an acceptable example. The formula describes that collection step. It gives no estimate of the student’s performance after training.
If the teacher assigns zero probability to an acceptable answer for a task, no number of draws from that fixed distribution can supply one. Search with tools, a new prompt, or an external verifier used during generation can change the distribution that the pipeline samples.
When filtering plateaus, test whether the teacher ever supplies acceptable examples for the missing task types under the same prompt and sampler. A student may generalize from related tasks, but the retained examples alone do not show that it did.
The formula also assumes independent draws with the same success probability. Lower temperature can produce repeated answers even when draws are independent. The simulator below models a different mechanism: it deliberately copies a previous result on some draws, so observing an earlier draw changes the distribution of a later one.
In this simulator the first draw is fresh, and each later draw is fresh with probability one-half. An echo cannot turn a run of failures into a success. The chance of at least one acceptable result is therefore for this copy process. At eight draws with , the independent formula gives about 0.942, while the seeded simulation succeeds in about 0.776 of runs by the eighth draw.
PythonIn [4]Expand
NS = np.arange(1, 41)
PS = [0.05, 0.30, 0.50]
indep_curves = {p: 1.0 - (1.0 - p) ** NS for p in PS}
# Correlated decoder: each draw is fresh with probability 1 - ECHO_SHARE, and
# otherwise a verbatim copy of an earlier draw from the same run. Simulation is
# seeded with the chapter SEED and uses TRIALS independent runs, each tracked over all sample counts.
ECHO_SHARE = 0.5
BASE_P = 0.30
TRIALS = 4000
corr_rng = np.random.default_rng(SEED)
draws = np.zeros((TRIALS, NS.size), dtype=bool)
for t in range(TRIALS):
pool = []
for i in range(NS.size):
if pool and corr_rng.random() < ECHO_SHARE:
good = pool[corr_rng.integers(len(pool))]
else:
good = corr_rng.random() < BASE_P
pool.append(good)
draws[t, i] = good
corr_curve = np.maximum.accumulate(draws, axis=1).mean(axis=0)VisualizationOut [5]Expand

Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!