Resources/Model training/Datasets

Method

Synthetic data and the Dataset Builder

How a capable model can write the example conversations you don't have yet, and how the Dataset Builder's brief, plan, checks and review keep those chats varied, grounded and under your control.

Chapter 47 min read5 references

What synthetic data is

The best training data is real conversations with your users. Often there are too few of them, they cover only the easy cases, or the assistant you want to train doesn't exist yet. Synthetic data fills the gap: a capable model writes example conversations that show the behaviour you want, and a smaller or cheaper model is then trained on them.

This is now a standard technique. The Self-Instruct paper (2022) had GPT-3 write its own instructions and answers, filtered out invalid and near-duplicate ones, and fine-tuned GPT-3 on the result: a 33% absolute improvement on the Super-NaturalInstructions benchmark. Stanford's Alpaca (2023) used the same idea to create 52,000 demonstrations for less than $500. UltraChat generated 1.5 million multi-turn dialogues, and Microsoft's phi-1 showed that a 1.3-billion-parameter code model trained partly on synthetic textbooks could reach 50.6% on the HumanEval benchmark.

The risk: the student copies the writer

A model trained on another model's writing learns its habits as faithfully as its knowledge. If every generated user opens with “Hi, I have a question about…”, the trained model only handles polite, well-formed questions. If the writer never declines anything, neither will the student. Research on training models repeatedly on generated text (Shumailov and colleagues, 2023) found that the rare cases — the tails of the distribution — are the first thing to disappear. Good synthetic data is therefore mostly about two things: variety, so the rare and awkward cases are present, and control, so you decide what good looks like.

Briefscope, audience, counts, documents
→model plansPlanscenarios you read and edit
→you approveGeneratein the background; pause or resume
→as chats arriveChecksshape fixed, problems flagged
→you readReview and addmarked Synthetic in the dataset
The Dataset Builder in five steps. Nothing is written until you have approved the plan, and nothing reaches a dataset until you have reviewed the chats.

How the Dataset Builder works

The brief describes what to build. Scope says what the assistant covers and, just as important, what it doesn't: out-of-scope chats, where the assistant politely declines or redirects, teach the model where its job ends. The goal and storyline say what a good answer achieves and who the assistant is — tone, persona, rules. The audience says who the users are, which shapes the questions. Instructions carry anything else (“always end with a next step”, “never quote prices”). Then come the counts and limits: how many chats, turns per chat, the longest reply, the longest user message and the language. Optional documents supply your facts.

1. Plan. Before writing any chat, the model writes a plan: a list of scenarios, each with a topic, a user type, a difficulty (easy, hard, edge case or out of scope) and the user's intent, plus how many chats each gets. Planning first is what produces variety: without it, a model asked for 100 chats tends to write 100 versions of the same three questions. You read the plan, edit or delete rows and add your own before anything is written.

TopicUser typeDifficultyIntentChats
Reporting a burst pipefirst-time claimanteasystart a home claim8
Claim turned down for late noticefrustrated customer, tersehardunderstand why and appeal9
Damage covered by two policieslandlordedge casefind out which policy pays8
Sending photos and receiptsolder customer, unsure with appseasyupload evidence7
Suing the upstairs neighbourclaimantout of scopeget legal advice8
An illustrative plan for 40 chats with topics on Auto: about one scenario per 8 chats gives 5. Each row fixes who is asking, how hard it is and what they want, so the 40 chats cannot all be the same polite question.

2. Generate. Once you approve the plan, the chats are written in the background, each drawing on the parts of your documents that fit its scenario. You can pause, resume or cancel at any time, and the builder shows a rough estimate of how long is left.

3. Checks. Every chat is checked as it arrives. The shape must be right: user and assistant take turns, starting with the user and ending with an assistant reply. Models often write one turn more or fewer than asked; such chats are kept and trimmed, because they are still good examples. Only broken chats — wrong roles, empty messages — are dropped and rewritten. Other problems raise a flag: the chat is kept but marked for your review.

Shape check
Brokenwrong roles, empty messages→dropped and rewritten
One turn too many or too fewstill a good conversation→kept, trimmed to the requested turns
Flags · kept, marked for review
duplicatetoo longemptyrefusalungrounded

A flag is a question, not a verdict: a refusal is exactly right in an out-of-scope scenario and a warning sign anywhere else.

Every chat is checked as it arrives. Only broken chats are thrown away and rewritten; everything else is kept, and the doubtful ones carry a flag so you know where to look first.

4. Review, then add. You read the chats, filter by scenario or flag, edit or delete any, and add them to a new or existing dataset. There they are marked Synthetic, so they can always be told apart from real chats. Adding the same build again only adds what isn't already in.

A 40-chat build for a claims helpdesk (illustrative)
  1. Brief. An insurance claims assistant for home policies. Out of scope: legal advice and anything about other insurers. Audience: policyholders, some stressed, some not used to apps. 40 chats, mixed turns, replies up to 400 tokens, two help-centre articles as documents.
  2. Plan. Topics on Auto: 40 ÷ 8 = 5 scenarios, from an easy “report a burst pipe” to an out-of-scope “can I sue my neighbour?”. You add a sixth, hard scenario — a claim filed twice by mistake — and move 2 chats to it.
  3. Generate. The builder estimates a few minutes. You pause after the first chats to read them, then resume.
  4. Checks. 40 chats arrive: 3 are trimmed to the requested turns, 1 broken chat is rewritten, 2 are flagged as possible refusals (both in the out-of-scope scenario, so correct) and 1 as ungrounded.
  5. Review. You fix the ungrounded reply against the article, delete one bland chat, and add 39 chats to the dataset next to 120 real ones.

How to use it well

  • Mix with real data when you have it. Synthetic chats are cleaner than real ones, and a model trained only on them can be thrown by messy input. Ask for terse, typo-filled and frustrated users in the brief.
  • Review a sample, especially the hard and out-of-scope scenarios: that is where the writer most often gets the ideal answer wrong.
  • Use the strongest model you have to write. The student can at best match the writer.
  • Ground it in documents whenever the answers depend on your facts, so replies use your policies rather than the model's general knowledge.
  • Hold out real chats for evaluation. Testing a model trained on synthetic chats with more synthetic chats overstates how good it is.

Settings

Topics (scenarios)Typical Auto#

How many scenarios the plan contains. Auto picks about one per 8 chats, at least 5 and at most 60; or set an exact number. More topics give more variety and fewer chats per topic; fewer topics go deeper into each situation.

Turns per chatTypical Mixed#

How many user/assistant exchanges each chat has: 1 to 4, or mixed. Single-turn chats are quick to write and review; multi-turn chats teach the model to use what was said earlier. Mixed is usually closest to real use.

Max output tokens#

The longest assistant reply, in tokens. Set it to the length you want the trained model to answer at: the student learns the length as well as the content. Longer limits make the build slower, though less than proportionally, because replies rarely fill the limit.

Max input characters#

The longest user message, in characters. Real users are often brief; a low limit keeps the generated questions short and realistic instead of long and over-explained.

Documents#

Optional help pages, manuals or policies, so answers use your facts. Without documents the writer relies on its general knowledge, which may be wrong or out of date for your product.

Flags

Duplicate#

Very similar to another chat in the build. Keep one and delete or rewrite the other; near-copies over-weight one example and reduce variety.

Too long#

A reply over the output token limit, or a user message over the character limit. Shorten it, or the model learns answers longer than you asked for.

Empty#

A message with no text. Delete the chat or write the missing message; an empty reply teaches nothing and an empty question teaches the model to answer nothing.

Refusal#

A reply that looks like a refusal (“I can't help with that”). Expected in out-of-scope scenarios; elsewhere it is a warning sign, because training on it teaches the model to refuse questions it should answer.

Ungrounded#

Only when documents were used: a reply that may not be based on your documents, relying on the model's general knowledge rather than your facts. Check it against the document and correct it.

Common mistakes

  • Leaving out out-of-scope scenarios, so the trained model answers everything, including what it shouldn't.
  • Writing hundreds of chats without reading the plan, then discovering they all ask the same thing.
  • Training only on synthetic chats when real ones exist; the model is then thrown by real, messy input.
  • Ignoring flags on the hard and edge-case scenarios, where the writer is most often wrong.
  • Evaluating a model trained on synthetic chats with more synthetic chats.
  • Writing with a weaker model than the one you will train; the student can at best match the writer.

References and further reading

External sources open in a new tab.

  1. 01Self-Instruct: Aligning Language Models with Self-Generated InstructionsWang et al., 2022 · arXiv · arxiv.orgA model writing its own training instructions, with filtering for invalid and near-duplicate ones.
  2. 02Alpaca: A Strong, Replicable Instruction-Following ModelStanford CRFM, 2023 · crfm.stanford.edu52,000 generated demonstrations for under $500, and the limits of the result.
  3. 03Enhancing Chat Language Models by Scaling High-quality Instructional ConversationsDing et al., 2023 · arXiv · arxiv.orgUltraChat: generating 1.5 million varied multi-turn conversations.
  4. 04Textbooks Are All You NeedGunasekar et al., 2023 · arXiv · arxiv.orgphi-1: how much carefully generated data can do for a small model.
  5. 05The Curse of Recursion: Training on Generated Data Makes Models ForgetShumailov et al., 2023 · arXiv · arxiv.orgWhy rare cases vanish when models learn only from other models' output.

Turn weeks of expert work into minutes

See how Scalata fits your team, your data, and your controls.