Synthetic Fine-Tuning Data Generation Using LLMs: Techniques, Case Studies, and Best Practices
Abstract
Fine-tuning large language models (LLMs) often requires substantial labeled data, which can be expensive or scarce. Synthetic data generation using LLMs has emerged as a powerful approach to create high-quality training and evaluation datasets rapidly and at low cost (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI) (Stanford CRFM). This paper provides a research-focused overview of methods to generate synthetic fine-tuning data with LLMs, aimed at industry professionals. We cover key techniques including prompt engineering (designing effective prompts to guide LLM output), iterative refinement (improving data quality via multi-step generation and feedback loops), and AI feedback loops (leveraging LLM self-evaluation and reinforcement). We also discuss hybrid approaches that combine models, algorithms, and human oversight for optimal results, and the role of human-in-the-loop validation to ensure quality and mitigate bias. We include case studies in instruction tuning (aligning models to follow instructions), domain adaptation (tailoring models to specific domains), low-resource languages (generating data for under-represented languages), and reinforcement learning with human feedback (RLHF). Furthermore, we examine evaluation metrics for synthetic data quality, share best practices for using synthetic data in production, and propose strategies for bias mitigation in generated datasets. Through concrete examples (including JavaScript-based code snippets), pseudocode algorithms, and benchmarks from recent literature, we illustrate the real-world effectiveness of these techniques. The paper concludes with key findings and recommendations for practitioners seeking to safely and effectively use LLM-generated synthetic data in AI systems.
1. Introduction
Training or fine-tuning large language models traditionally requires large, high-quality datasets of task-specific examples. However, obtaining such labeled data via manual annotation is time-consuming, costly, and sometimes infeasible – especially for emerging domains or low-resource languages (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Recent advances in LLMs suggest a compelling alternative: using the models themselves to generate synthetic data that mimics real data distributions (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). In other words, an LLM can be prompted to produce artificial training examples (inputs and outputs) which are then used to fine-tune or evaluate models. This approach can dramatically accelerate dataset creation while maintaining or even enhancing quality and diversity (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI).
Synthetic data generation with LLMs leverages the model’s broad knowledge and language generation ability learned from pretraining. Modern LLMs like GPT-4 can produce text that is often indistinguishable from human-written text in fluency (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). By carefully guiding these models through prompts and feedback, we can obtain datasets that are diverse, comprehensive, and tailored to specific tasks (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). Indeed, synthetic datasets have been used to augment or replace human-labeled data in tasks ranging from question-answering and dialogue to code generation, with notable success ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions).
Two broad paradigms for LLM-driven data generation have emerged (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI):
- Distillation from a stronger model: Use a powerful teacher model to generate examples for fine-tuning a smaller or less capable student model (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). This knowledge distillation via data transfers capabilities downward. For example, OpenAI’s GPT-3.5 can be used to generate instruction-response pairs to train a 7B model, as in Stanford Alpaca (Stanford CRFM) (Stanford CRFM).
- Self-generation (self-improvement): Have the model generate data based on its own outputs, possibly bootstrapping from a small seed set (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). This approach (exemplified by Self-Instruct ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) and Self-Play fine-tuning (SPIN) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models)) uses the model’s current knowledge to improve itself iteratively without requiring an external teacher, though it must be managed carefully to avoid amplifying model biases or errors (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI).
Early results demonstrate the efficacy of synthetic data. Wang et al. (2022) show that a vanilla GPT-3 model instruction-tuned on its own synthetic instructions (the Self-Instruct method) improved by 33% on a test benchmark, reaching performance close to a model trained on expensive human annotations ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). Stanford’s Alpaca model – only 7B parameters – when fine-tuned on 52,000 GPT-generated instruction-following examples, exhibited “very similar performance” to the 175B GPT-3.5 Davinci model on instruction-following tasks (Stanford CRFM), for a data generation cost under $500 (Stanford CRFM). Likewise, Vicuna-13B, trained on user-shared ChatGPT conversations (a form of synthetic data where AI-generated responses are included), achieved about 90% of ChatGPT’s quality as judged by GPT-4 (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org). These cases underscore how LLM-synthesized data can dramatically narrow the capability gap between smaller models and their larger peers (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org) ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions).
Despite these successes, generating high-quality synthetic data requires careful technique. Naively prompting an LLM can yield superficial or biased data that might mislead the fine-tuned model (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Key challenges include: ensuring faithfulness (are the generated outputs correct and relevant?), diversity (do we cover a broad distribution or just repetitive patterns?), and alignment with the intended task (does the data reflect the right format, domain, and difficulty level?) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Additionally, model biases can be reflected and even amplified in synthetic data if not mitigated (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). Thus, a combination of prompt design, iterative generation with feedback, and human oversight is often needed to produce robust datasets.
In this paper, we explore the major methodologies and considerations for LLM-based synthetic data generation:
- Prompt Engineering (§2): How to craft prompts that reliably yield high-quality and varied data.
- Iterative Refinement (§3): Multi-step generation processes and dataset evolution techniques to progressively improve data quality.
- AI Feedback Loops (§4): Using the LLM itself (or another AI) to evaluate and refine outputs via self-critiquing, self-correction, and reinforcement learning signals.
- Hybrid Approaches (§5): Combining techniques – e.g. large-teacher + self-play, or AI + human feedback – to harness their complementary strengths.
- Human-in-the-Loop Validation (§6): Involving human experts to review and curate synthetic data, ensuring reliability and mitigating biases that AI alone might miss.
We then present Case Studies (§7) in four important scenarios: (a) Instruction tuning – aligning models to follow general instructions using synthetic instruction data; (b) Domain adaptation – generating domain-specific data (e.g. legal or medical) to adapt models to specialized contexts; (c) Low-resource languages – using LLMs to create data for languages or dialects with little existing data; and (d) RLHF (Reinforcement Learning with Human Feedback) – a process that, while centered on human preferences, also involves synthetic data generation in the form of model outputs and AI-guided reward models.
We also discuss Evaluation Metrics (§8) for synthetic data quality and downstream impact, including automatic measures (e.g. diversity statistics, model-based evaluation) and human judgment. We provide Best Practices (§9) to guide practitioners in safely and effectively using synthetic data in production – such as balancing synthetic with real data, filtering content, and monitoring for bias. Finally, we address Bias Mitigation (§10) strategies specific to LLM-generated datasets, and conclude with recommendations and future directions (§11).
Throughout, we include concrete examples (with code snippets and algorithms) to illustrate key techniques. All claims and techniques are backed by citations to recent research and industry reports, to maintain rigor and give pointers for further reading. By the end of this paper, a practitioner should understand how to generate synthetic fine-tuning data using LLMs, what pitfalls to avoid, how to evaluate the data, and how to integrate this approach into an AI development pipeline to accelerate progress while upholding quality and fairness.
2. Prompt Engineering for Synthetic Data
Prompt engineering is the art and science of writing inputs that elicit the desired output from an LLM. In the context of synthetic data generation, prompt design is crucial – it determines whether the model produces useful, correct, and varied examples or degenerate outputs. A well-crafted prompt can guide the LLM’s behavior and output format, effectively acting as the “instruction manual” for the synthetic dataset we want to create (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
Key elements of an effective prompt often include (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey): (1) a clear task specification, (2) any conditional constraints or context, and (3) in-context examples or demonstrations. These elements are typically wrapped in natural language form so the model can easily follow them (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). We discuss each in turn:
Task Specification: This part of the prompt defines the role and goal of the model. It may include a role-play instruction (e.g. “You are an expert translator…”) and a description of the task and output format. Providing a short prologue like “Suppose you are a professional data annotator who needs to create question-answer pairs on geography.” gives the model context and often improves performance (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Task specification can also mention the style or tone required, any domain knowledge needed, and clarify what constitutes a correct output. For example, “Output should be a JSON object with fields
question
andanswer
.” Setting the stage in this way helps the model understand what is expected, much like a human given clear guidelines (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Studies show that even a simple instruction like “Act as a {expert role}” can significantly improve the relevance and quality of generated data (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Moreover, if specialized terminology or domain context is needed, the prompt can supply it (e.g. providing a brief glossary or context paragraph), which has been shown to enhance faithfulness in domains like medicine or finance (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).Conditional Constraints: One common challenge is ensuring diversity and coverage in synthetic data (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). If we ask a model to “Generate 100 math problems,” it might produce many similar problems. Conditional prompting addresses this by explicitly specifying certain attributes for each output (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). For instance, one could prompt: “Generate five customer support queries, each about a different product (phone, laptop, router, printer, tablet).” Here, the condition is the product type, ensuring each query is about a distinct topic. In general, a prompt can define a set of condition-value pairs – e.g. a sentiment prompt might include {tone: positive/negative}, or a dialogue prompt might include roles or topics (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). By enumerating different conditions, we can “artificially define” diversity in the output (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Research has found this especially useful: Yu et al. (2023) showed that prompting with fine-grained attributes like topic, length, or style produces far more varied text than a basic prompt, because the number of possible attribute combinations explodes (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Eldan & Li (2023) took an interesting approach by including random keywords that the model must incorporate into each story, forcing creativity and reducing repetition (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). In summary, conditional prompts give better control over the content and diversity of generated data (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). They can also ensure coverage of edge cases – for example, explicitly asking for some inputs that are tricky or rare, like “a question that requires multi-step reasoning”. Care should be taken to choose meaningful conditions relevant to the task at hand (labels, difficulty, style, subtopics, etc.).
In-Context Examples: Few-shot prompting can dramatically improve the quality of LLM outputs for data generation (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). By providing a few demonstration examples in the prompt, we show the model what a correct input-output pair looks like. These demonstrations serve as implicit guidance, helping the model mimic the pattern. For example, a prompt for generating FAQ pairs could be:
Q: How do I reset my password? A: To reset your password, go to the login page and click "Forgot Password"... (answer continues) Q: How can I update my email address? A: You can update your email address in your account settings. First, log in and ... Q: {Generate a new question and answer pair.}
In this prompt, two Q&A examples are given, and the model is asked to continue with a new Q&A. Because the model has seen the pattern twice, it is more likely to produce a well-structured third example following the same format. This leverages the LLM’s strong in-context learning ability (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Even if we have no human-labeled examples, we can use the LLM to generate a few seed examples by itself (perhaps via an initial simpler prompt), then include those as the context for further generation – effectively bootstrapping the process (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This is exactly what the Self-Instruct method does: start with a handful of human-written instruction-output pairs, then iteratively prompt the model to produce more, using previously generated ones as context ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) (Stanford CRFM). One caveat: the quality of in-context examples matters greatly (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Random or low-quality examples may lead to a cascade of poor outputs. Recent work suggests selecting demonstrations that either cover diverse aspects or are highly representative can improve results (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). For instance, Sudalairaj et al. (2024) found that clustering seed examples by different sub-tasks and feeding examples from one cluster at a time yields better long-tail coverage than mixing random examples in the prompt (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Others have suggested using similarity in embedding space to pick consistent examples for demonstration (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey), or even having the model explain each example in the prompt (chain-of-thought) to prime it to produce more logical outputs (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
In practice, effective prompt engineering often requires experimentation. LLM behavior can be sensitive to phrasing and ordering of examples. Tools exist to A/B test prompts quickly to see which yields better outputs (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). For important use cases, iterative prompt tuning (manually or via automated search) may be used. Nonetheless, some general tips include:
- Use clear, concise instructions and avoid ambiguity.
- Provide the desired output format explicitly (e.g. “answer in JSON” or “provide a step-by-step solution followed by the final answer”).
- If outputs are too generic or repetitive, introduce conditional variability or explicitly ask for creative/unique outputs.
- If outputs are incorrect, consider adding an example of a common mistake and its correction to the prompt, signaling the model what not to do.
- Limit the prompt length to remain within the model’s context window, and prefer the most relevant demonstrations if you have many.
Example – Generating Labeled Data via Prompt: Suppose we want to create synthetic training data for a sentiment classifier that labels movie reviews as positive or negative. We can engineer a prompt as follows:
You are a sentiment annotator. Read each movie review and label it as "Positive" or "Negative".
Review: "I absolutely loved the cinematography and the story. The movie was fantastic!"
Label: Positive
Review: "Despite a couple of good scenes, the film was boring and too long."
Label: Negative
Review: "The plot had me on the edge of my seat, and the performances were stellar."
Label:
In this prompt, we gave two demonstrations (one positive, one negative) and then a new review for the model to label. A well-tuned LLM will output “Positive” for the third review, following the pattern. We can automate this in code using an API:
const openai = require('openai'); // assume OpenAI API client is set up
const prompt =
`You are a sentiment annotator. Read each movie review and label it as "Positive" or "Negative".
Review: "I absolutely loved the cinematography and the story. The movie was fantastic!"
Label: Positive
Review: "Despite a couple of good scenes, the film was boring and too long."
Label: Negative
Review: "The plot had me on the edge of my seat, and the performances were stellar."
Label:`;
const response = await openai.createCompletion({
model: "text-davinci-003", // or another LLM
prompt: prompt,
max_tokens: 5, // expecting a single word or short phrase
temperature: 0 // deterministic output for classification
});
console.log("Model output:", response.data.choices[0].text.trim());
By adjusting the prompt and examples, we can generate numerous labeled examples. For instance, we can plug in different review texts and collect the model’s labels to build a synthetic dataset of (review, sentiment) pairs. Care should be taken to review the outputs for any errors (which we address via iterative refinement and validation later).
In summary, prompt engineering is the first critical step in synthetic data generation. A thoughtful prompt can harness an LLM’s capabilities to produce high-quality initial data – setting a strong foundation for further refinement. On the other hand, a poorly constructed prompt might yield low-quality or homogeneous data, which can mislead the fine-tuning process. Therefore, practitioners should invest effort in crafting and testing prompts, possibly iteratively improving them by examining early outputs. In the next section, we discuss how to build on initial outputs through iterative refinement to further enhance the dataset.
3. Iterative Refinement and Data Evolution
Generating a dataset in one shot via a single prompt is seldom optimal for complex tasks. Often, an iterative refinement approach – where data is generated, evaluated or transformed, and then used to prompt the model again – yields better results. This process can be thought of as data evolution, gradually improving the quality and coverage of synthetic data through multiple rounds (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Two scales of refinement exist: sample-wise refinement, which breaks down or improves individual examples step by step, and dataset-wise refinement, which adjusts the generation process across iterations to fill gaps in the overall dataset (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
3.1 Sample-Wise Decomposition and Enhancement
For complex data structures (e.g. a multi-turn dialogue, or a long-form solution), expecting the LLM to produce a perfect sample in one go is unrealistic (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Instead, we can decompose the generation into smaller sub-tasks and guide the model through them sequentially (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This idea is akin to prompting the model with a “plan” or series of steps.
A classic example is dialogue generation. Rather than prompting “Write a customer service conversation between a user and an agent about refunding a product” and hoping for a coherent multi-turn dialogue, we can do this iteratively:
- Prompt the model to produce the first turn (e.g. user’s query).
- Then prompt it to produce the next turn given the previous turn, perhaps by role-playing: “Assistant, reply to the user’s message: [User’s message]”.
- Continue alternating roles. The prompt for each turn includes the context of the conversation so far and an instruction to continue.
Ding et al. (2023) demonstrate this by having the model alternate roles as Assistant and User, generating a full back-and-forth conversation one reply at a time (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This approach reinforces coherence – each turn is explicitly conditioned on the prior dialogue, preventing the model from losing track of context (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). It also allows us to inject corrections or adjustments mid-way if needed (for example, if the assistant’s answer was unsatisfactory, one could regenerate that turn before moving on).
Another use of sample-wise decomposition is for tasks requiring reasoning or intermediate steps. Instead of asking directly for the final answer, we might prompt the model to think step-by-step (this is related to chain-of-thought prompting). For instance, to generate a complex math problem and solution, we can do:
- Step 1: Generate a math problem.
- Step 2: Solve it (perhaps prompting the model with “Show the solution process”).
- Step 3: Format the final Q&A pair.
Even if step 2 yields a reasoning trace that we don’t include in the final dataset, it helps ensure the answer is correct (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Including such intermediate steps explicitly as part of generation can significantly improve the faithfulness of outputs (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). In fact, prompting the model to output a rationale (an explanation or derivation) and then the answer – known as Chain-of-Thought (CoT) prompting – has been shown to reduce errors in complex tasks (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). The rationale can be filtered out later if the training data only requires the final answers, or kept if the task is to train the model to also produce explanations.
Algorithm 1: Sample-wise Iterative Generation (Pseudo-code)
for each desired sample i:
context = initialize_context(task)
output = []
while not complete(sample):
prompt = create_prompt(context, instructions_for_next_step)
next_part = LLM.generate(prompt)
if validate(next_part):
output.append(next_part)
context.update(next_part)
else:
refine_prompt_or_regenerate()
final_sample = assemble(output parts)
dataset.add(final_sample)
Explanation: We iterate to build each sample. The initialize_context
might set up the roles or starting state (e.g., conversation start). On each iteration, we prompt the LLM for the next piece. We include a check validate(next_part)
– if the output part is incoherent or breaks some rule (like the assistant going off-topic), we could refine the prompt or regenerate that part. Once the sample is complete (e.g., conversation reaches an end or the solution is fully derived), we assemble it and add to the dataset.
This approach allows fine-grained control over each example. It is especially useful when generating structured data (like knowledge base triples, JSON records, dialog logs) where maintaining consistency is hard if done in one shot. Additionally, it gives the opportunity to intervene: if at any step the output is unsatisfactory, the process can branch or retry without discarding the entire sample generation.
3.2 Dataset-Wise Evolution and Active Iteration
Beyond refining individual examples, we often want to refine the composition of the dataset as a whole. After an initial round of data generation, some classes or scenarios might be under-represented, or the model might still perform poorly on certain inputs. Dataset-wise iterative refinement involves analyzing the data (or a model trained on it) and then generating new data to address the deficiencies (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
A straightforward approach is an error-driven loop: train a model (even a preliminary one) on the current synthetic data, evaluate it on some validation set or diagnostic tests, and identify where it fails. Then, instruct the LLM to generate more data focusing on those failure modes. Wang et al. (2023b) propose S3 (Synthetic Self-Training) which does exactly this – at each iteration, it finds the categories of data where the model makes the most mistakes, and then generates additional examples for those categories in the next round (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This targets the model’s weak spots, gradually improving overall performance.
Another technique is “generate-then-expand” (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey): start with a broad dataset and then expand it by adding variations or harder examples. Honovich et al. (2023) follow this paradigm to increase dataset diversity – after initial generation, they prompt the LLM to produce variations of existing samples or to cover new sub-categories that were not present initially (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This can be done by taking each generated sample and asking the LLM to slightly perturb it (e.g., change entities, negate the condition, increase complexity). The result is a more diverse set of examples that still resemble realistic data.
A systematic version of expansion is Explore-Instruct by Wan et al. (2023) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). They model the space of possible instructions as a tree: starting from general tasks and branching into more specific ones. The LLM traverses this tree, generating data for each node (task) and expanding into sub-tasks, thereby ensuring both breadth (many different tasks) and depth (increasingly specialized or challenging tasks) in the instruction dataset (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This method was used to enhance domain coverage for domain-specific instruction tuning, resulting in better performance on niche tasks.
The general principle is to establish a feedback loop between the data and a model’s performance:
- Generate an initial dataset (via prompt engineering or sample-wise methods).
- Evaluate a model trained on it – identify gaps, such as poor performance on certain classes or lack of knowledge in certain areas.
- Refine prompts or add conditions for generating new data that specifically targets those gaps.
- Augment the dataset with the new data and potentially remove low-quality or redundant old data.
- Repeat the cycle.
This can be seen as a form of active learning but with the model itself generating new “queries” (data) to learn from, instead of querying an oracle for labels. Importantly, one should include mechanisms to ensure the data quality remains high each round, otherwise the process could drift or amplify errors (more on data curation in §4 and §6).
One notable implementation of iterative refinement without human intervention is the Self-Play Fine-Tuning (SPIN) method by Kieuvongngam et al. (2023). In SPIN, a model is fine-tuned by playing both sides of an interaction with itself, generating new training examples in the process (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models). The model generates prompts and responses, and over iterations, learns to distinguish and improve upon its own responses as if competing with a human. This yielded a 10%+ performance improvement on a benchmark, pushing a model’s score from 58.1 to 63.2 and even rivaling models trained on large human feedback datasets (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models). SPIN effectively evolves the dataset (the self-play transcripts) by continuously making them more challenging, using the model’s progress as the driver.
Case in point – Self-Instruct iterative process: The Self-Instruct framework for instruction tuning (which we’ll detail in case studies) is a prime example of dataset evolution ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). It begins with a small seed of 175 human-written instructions. Then, in each iteration, it:
- Samples some instructions from the current pool.
- Prompts the LLM (GPT-3 in their case) to generate new instructions and their answers, using the sampled ones as examples in the prompt.
- Filters out any low-quality or duplicate instructions from the generation ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions).
- Adds the filtered new instructions into the pool.
By repeating this, they grew the dataset to 52k high-quality instruction-output pairs. Crucially, they included a filtering step (removing malformed or trivial instructions) to maintain quality. The result was an almost annotation-free pipeline to produce instruction-following data, which dramatically improved the instruction generalization of the model ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions).
3.3 Improving Individual Outputs via Iteration
Iterative refinement can also happen at the level of refining a single output. This is typically done after an initial output is generated: the model (or another model) is asked to critique or correct that output, and then a revised output is produced. This blurs into AI feedback loops (next section), but is worth mentioning here as a micro-level iterative strategy.
For example, the Self-Refine method by Madaan et al. (2023) has the model generate an answer to a prompt, then provide feedback on its own answer, and then try again incorporating that feedback ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback) ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback). This process can be repeated multiple times. In experiments across tasks like dialog response and math reasoning, Self-Refine improved output quality substantially – humans preferred the refined outputs 20% more than the originals on average ([[2303.17651] Self-Refine: Iterative Refinement with Self-Feedback](https://arxiv.org/abs/2303.17651#::text=and%20instead%20uses%20a%20single,using%20our%20simple%2C%20standalone%20approach)). What's notable is that this is done without additional training: it's an on-the-fly refinement strategy that uses the model’s inference capability iteratively.
In a synthetic data context, one could use self-refinement to ensure each generated data point is as polished as possible. For instance, generate a trivia question, then have the model check if the question is answerable from the provided context (if not, refine it). Or generate a function documentation, then have the model verify if the function described meets certain criteria, and refine if needed.
We'll dive deeper into such AI feedback loops in the next section. For now, the takeaway is that iterative processes – whether at the dataset scale or the single-sample scale – are powerful tools for enhancing synthetic data. They introduce a notion of continuous improvement: using feedback from intermediate results to guide further generation. This can mimic the way a human might draft, review, and edit content. However, it also raises questions: who or what provides the feedback, and how do we ensure the iteration is actually improving quality and not just overfitting to the model’s own biases? That leads us to the role of AI and human feedback in the loop.
4. AI Feedback Loops: Self-Evaluation and AI-Guided Refinement
One of the intriguing capabilities of advanced LLMs is their ability to evaluate and critique text, including their own outputs. This opens the door to feedback loops where the model not only generates data but also judges and improves it. In such loops, an LLM (or a coalition of LLMs) provides signals akin to what a human reviewer might: identifying errors, scoring quality, suggesting improvements. When these signals are used to refine outputs or as a reward for training, we get a form of AI-based self-improvement.
4.1 Self-Critique and Self-Refinement
As introduced above, Self-Refine is one method where the model iteratively critiques its output and refines it ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback). This is a prime example of an LLM self-evaluation loop. To illustrate, suppose we want to generate a synthetic explanation for a science question:
- Initial generation: Prompt the model: “Q: Why is the sky blue? A: …” and get an initial answer.
- Self-critique: Feed the answer back into the model with a prompt like: “Here is an answer to the question. Critique this answer for correctness and clarity.” The model might respond with, “The answer is partially correct but it lacks mention of Rayleigh scattering and uses some unclear terms.”
- Refinement: Now prompt the model to produce a better answer given that feedback: “Improve the previous answer based on the following critique: [critique].”
This three-step process can notably improve the final output ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback) ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback). Essentially, the model is used in two roles: as an answer generator and as a feedback provider (critic). Since these roles use the same underlying knowledge, the model can catch some of its own mistakes (especially factual omissions or logical inconsistencies). Importantly, this doesn’t require any extra labeled data – the model generates the feedback, making it a self-supervised improvement.
Researchers have found that even a single round of self-refinement significantly boosts output quality ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback). Additional rounds may yield diminishing returns but can be beneficial until the output stabilizes. One must be cautious to avoid the model “talking in circles” or accidentally introducing errors in a later revision (hence it’s good to verify the final result with either a human or another trusted method).
Another example is Anthropic’s Constitutional AI approach, which uses AI feedback to achieve harmlessness without direct human labels (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). In the constitutional AI training process:
- The model is prompted with potentially harmful or tricky queries.
- It generates an initial response.
- Then the model is asked to self-critique that response against a set of provided principles (the “constitution”). For example, “Does the assistant's response follow the principle of not being toxic?”
- The model revises the answer based on its self-critique.
These AI-generated critiques and revisions are then used to fine-tune the model (in a supervised manner first) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). This method essentially produces a synthetic dataset of (prompt, initial answer, critique, improved answer) where the critiques are synthetic labels indicating what was wrong. The outcome was a model that achieved a high degree of harmlessness and helpfulness without any human-labeled toxic/harmless examples – all feedback came from the AI itself following the constitutional rules (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). They termed the reinforcement phase RLAIF (Reinforcement Learning from AI Feedback) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum), since even the reward signal was derived from AI preference judgments (one model judging which of two answers is better).
The success of Constitutional AI is notable: it produced a non-evasive, transparent AI assistant that can explain its refusals, rivaling an RLHF-trained model in many respects (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). This underscores the power of AI feedback loops – models can be made to enforce constraints and evaluate outputs in ways humans would, dramatically reducing the need for expensive human annotation of bad outputs.
Self-critiique prompting is a simple trick practitioners can use even outside of a full training pipeline. For example, if an LLM gives a suspicious answer, one can ask the LLM, “Are you sure about that? Could there be any mistake?” Very often, the LLM will then perform an internal reflection and either correct itself or express more uncertainty (Can LLMs Critique and Iterate on Their Own Outputs? | Eric Jang) (Self-Refine: Iterative Refinement with Self-Feedback - arXiv). This can be leveraged when generating synthetic QA: have the model generate an answer, then explicitly ask it to verify or justify that answer. If the justification fails, you know the answer was likely wrong, and you can discard or regenerate that sample. This approach adds an internal consistency check to synthetic data generation.
4.2 LLM-as-a-Judge and Automated Evaluation
In some setups, one model (or instance) generates data and another model evaluates or ranks those outputs. This is analogous to having a second opinion or using an ensemble. For instance, OpenAI’s InstructGPT work trained a reward model to predict human preferences, but one could similarly train or prompt an LLM to predict preferences as a proxy for a human (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum).
The LLM-as-a-judge concept means using a powerful LLM to evaluate outputs, giving scores or choosing the best output among candidates. This has been used in practice to evaluate open-ended tasks where automated metrics are lacking:
- The Vicuna team used GPT-4 to rank the quality of responses from different chatbots, effectively using GPT-4 as an automated evaluator (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org).
- In the AWS Bedrock example for fine-tuning a QA model, they employed an LLM judge to compare the answers of a fine-tuned model versus a base model, to see which is better (Fine-tune LLMs with synthetic data for context-based Q&A using Amazon Bedrock | AWS Machine Learning Blog). This provided a scalable evaluation instead of relying solely on human testers.
When generating synthetic data, one can use a similar idea to filter or select outputs:
- Generate multiple candidates for a given prompt using an LLM (e.g., sample with different random seeds or temperature).
- Use either the same LLM or a larger one to pick the best candidate or to score each candidate on some criteria (relevance, correctness, etc.).
- Keep the highest-scoring output as the synthetic data instance.
This is a form of best-of-N sampling with AI judging. It leverages the fact that sampling-based generation can produce a range of outputs, some better than others. With an automated judge, we approximate what a human annotator might do (choose the best). Nakano et al. (2021) found that even a simple model-based judge that prefers outputs with certain log-likelihood characteristics can significantly improve quality (this is essentially rejection sampling guided by a model). Using a sophisticated LLM judge could be even more effective, as it can consider semantics, factual accuracy, etc.
However, caution is warranted: an LLM judge may have its own biases and limitations. For instance, it might favor verbose answers or particular styles that are not actually better for the end task. There’s also the risk that if the judge is the same model as the generator, it might not reliably distinguish quality (though prompting it in a judge role can still work to an extent).
A practical compromise is to use a stronger or at least different model as the judge. For example, use GPT-4 to judge outputs generated by a smaller model. Or use a version of the model fine-tuned to act as a classifier for quality. In any case, automated feedback signals help scale the refinement of synthetic data: we can generate a lot, then automatically filter out the junk.
4.3 Reinforcement Learning and Preference Optimization
AI feedback loops can be extended into a full reinforcement learning paradigm, where the model learns to generate better outputs by optimizing an AI-provided reward. This is analogous to RLHF (which we discuss in case studies), but replacing the “H” (human) with an “AI” feedback mechanism – often called RL from AI Feedback (RLAIF) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum).
In the constitutional AI example, after the supervised phase of learning from self-critiques, they performed a reinforcement phase: the model generated two answers to some prompt, a separate model decided which answer was better according to the constitution, and then a reward model was trained on these AI preferences to use in a RL (PPO) update of the policy (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). The result is the model further aligns its outputs to what the AI judge prefers.
One can imagine using a similar loop for synthetic data quality: define a reward function that captures desired properties of the dataset (e.g., correctness, diversity, complexity). Use the model (or another model) to evaluate each generated sample and assign a reward. Then treat the data generation process as a policy to be optimized. However, this is advanced and can be unstable if not carefully managed (much like RLHF requires balancing with KL regularization to not go off-distribution (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models)).
A simpler approach is iterative rejection sampling: generate, get AI feedback, and reject bad samples on the fly. Over time, update your prompt or strategy for generation to favor samples that pass the AI checks. This is more heuristic but often effective.
Example – Filtering with an AI feedback loop: Suppose we want to generate a synthetic knowledge base of facts (triplets like <Country, Capital, City>
). We can prompt an LLM to produce such facts. But we worry about inaccuracies. We could employ a second LLM (or the same with a prompt) to verify each fact by posing it a question, e.g.: “Is [City] the capital of [Country]?” If the verifier LLM says “No” or expresses uncertainty, we discard that sample; if it confidently says “Yes, [City] is the capital of [Country]” (and maybe explains), we keep the sample. This way, we have an automated feedback loop acting as a fact-checker. While not perfect, it might catch blatant errors (for instance, if the generator said "Paris, Capital of Germany", the verifier would likely flag it).
This kind of approach was suggested by Lee et al. (2022) – they used an auxiliary model to extract relevant info and verify factual claims in generated summaries (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). The idea is to reduce the burden on humans by employing an AI “reviewer” before any human or training usage.
In conclusion, AI feedback loops leverage the LLM’s own capabilities (or those of a peer model) to enhance data quality. Techniques like self-critique, chain-of-thought verification, and LLM-as-judge have shown real gains in output reliability and diversity, often matching what additional human oversight would accomplish ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). These loops can operate at generation time (refining each output) or as part of training (providing reward signals or filtering criteria). They are especially useful when human feedback is scarce or expensive – the AI can at least partially fill that role. Of course, combining AI and human feedback is often even more powerful, which brings us to hybrid approaches.
5. Hybrid Approaches: Combining Techniques
No single technique is a silver bullet for all data generation needs. Hybrid approaches aim to combine multiple methods – leveraging the strengths of each – to produce superior results. In practice, successful synthetic data pipelines often blend different LLMs, prompting strategies, and feedback sources (AI and human). We highlight a few notable hybrid strategies:
Teacher–Student + Self-Refinement: One can use a strong teacher model to generate initial data (distillation), then have the student model (or the teacher itself) go through a self-refinement loop on that data. This way, you get the benefit of the teacher’s broad knowledge and the student’s iterative improvement. For example, you might take GPT-4 outputs as a base and then run a GPT-3.5 or domain-specific model to critique or detail them further. The initial teacher ensures a high baseline quality, and the refinement addresses any teacher mistakes or adapts the data closer to the student’s needs.
Prompt + Reinforcement Learning: Prompt engineering provides the model with immediate guidance, while reinforcement learning fine-tunes its longer-term behavior. Anthropic’s Constitutional AI is essentially a hybrid of prompt-based self-critiques (in the supervised phase) and RL optimization (in the reinforcement phase) using AI feedback (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). The result was better than either method alone – the supervised phase teaches the model the desired style (groundwork), and RL further aligns the model’s policy with those preferences across a wide range of scenarios (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum).
Multi-Model Cooperation: Different models can play different roles. One could use a specialized code generation model to create programming challenges and solutions, then use a general model to paraphrase the problem descriptions for variety. Or use a multilingual model to translate some data into a target low-resource language, and another model to back-translate and check for consistency (a bit like dual learning in MT). Each model’s biases might cancel out to some degree, and you can get data that one model alone might not easily produce. The codec approach introduced by Wang & Lee (2024) is a good illustration: they used a strong LLM as an encoder-decoder (CodecLM), meaning it first encodes seed instructions into a structured metadata representation (essentially summarizing the task and skills), and then decodes that into many varied instructions (CodecLM: Aligning language models with tailored synthetic data) (CodecLM: Aligning language models with tailored synthetic data). During decoding, they employed two strategies: Self-Rubrics (the LLM generates evaluation rubrics and improves the instruction) and Contrastive Filtering (comparing the strong LLM’s answer vs a target weaker LLM’s answer to select instructions where the weaker one fails) (CodecLM: Aligning language models with tailored synthetic data) (CodecLM: Aligning language models with tailored synthetic data). This hybrid combines prompt-driven generation, self-critique (rubrics), and performance-based selection. The outcome was state-of-the-art instruction-tuning performance on benchmarks, demonstrating the effectiveness of weaving these techniques together (CodecLM: Aligning language models with tailored synthetic data) (CodecLM: Aligning language models with tailored synthetic data). In effect, CodecLM managed to tailor synthetic data to specific tasks by combining model strengths: the strong model contributed knowledge and evaluation capability, while the target model’s weaknesses guided where more data was needed (CodecLM: Aligning language models with tailored synthetic data).
Synthetic + Real Data Mixing: This is a practical hybrid approach: use synthetic data to cover gaps but still include any real data you have to ground the model in reality. Many successful projects fine-tune on a mixture of human data and synthetic data. For instance, when fine-tuning a chatbot, one might combine some real dialog transcripts with additional AI-generated dialogues. The real data provides a safety check – it can prevent the model from drifting too far into an “AI-sounding” distribution, and ensures important real patterns aren’t lost. Meanwhile, synthetic data boosts the overall volume and diversity. As a best practice, it’s often recommended to maintain some portion of real or human-verified data in the training mix if available (LLM synthetic data: Fine-tuning LLMs with AI-generated data | SuperAnnotate) (LLM synthetic data: Fine-tuning LLMs with AI-generated data | SuperAnnotate). OpenAI’s InstructGPT, for example, used a relatively small set of actual human demonstrations to kickstart the process, then relied on human preference modeling and policy training (which one could consider partly synthetic as it uses model outputs in the loop) ([PDF] Training language models to follow instructions with human feedback). Another example: the AlpacaFarm framework (Taori et al.) uses simulated annotators (LLMs) to generate training data for RLHF research, but they still evaluate with some real human data to ensure alignment with true human preferences (AlpacaFarm: A Simulation Framework for Methods that Learn from ...).
Human-in-the-loop at specific points: A hybrid system might use human expertise sparingly at critical junctures. For instance, let the LLM generate a large pool of data, then have a human quickly review just the most uncertain or potentially problematic cases. Those cases get corrected by humans and fed back into model training (or used to further calibrate the LLM’s judging model). This way, we benefit from scale where the AI is confident and use human judgment where it’s needed most – achieving a balance of efficiency and accuracy. We will talk more about human validation in §6.
The design of a hybrid pipeline should consider the failure modes of each component and aim to cover them with another. For example, if an LLM tends to output biased text, a human or a second model could be tasked explicitly with bias detection and filtering. If a model has gaps in knowledge, an information retrieval module (search engine or database) could be integrated to provide facts for the model to incorporate – effectively a hybrid of LLM generation and knowledge base lookup (a technique often used in question-answering systems to improve factual accuracy). While retrieval-augmented generation (RAG) is more about using external data than generating it, one can conceive of using retrieval as part of synthetic data generation: e.g., retrieve a relevant document and then prompt the LLM to create questions based on that document, yielding a synthetic QA pair that is grounded in a real source. This hybrid of real context + AI generation produces high-quality, contextually correct data (since the answer can be checked against the source) (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI) (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). Indeed, some synthetic data pipelines for evaluation do this: they pair retrieved contexts with LLM-generated questions to create QA test sets for factuality (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI).
In summary, combining techniques is often the key to robust synthetic data generation. Prompt engineering gives initial control, iterative loops enhance quality, AI feedback provides scalable oversight, and human insight or real data anchors the process in reality. Hybrid approaches do come with complexity – orchestrating multiple steps or models requires careful engineering (and sometimes significant compute). But frameworks and libraries are emerging (e.g., DeepEval (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI) (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI), which automates parts of data synthesis, or Meta’s recently proposed pipelines) to assist with this orchestration.
The end goal is to achieve higher quality synthetic data than any single method could provide alone. Google’s CodecLM results, for example, showed that by tailoring data with their hybrid method, they surpassed more naive synthetic data approaches on alignment benchmarks (CodecLM: Aligning language models with tailored synthetic data). Similarly, WizardLM’s combination of Self-Instruct and evolutionary prompting produced instructions that human evaluators preferred over even some human-written ones ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions) ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions). These successes illustrate that hybrids – though more involved – can push performance to new heights.
Next, we consider the role of humans even in these mostly-automated pipelines. No matter how autonomous our data generation, having a human-in-the-loop for validation can be invaluable to catch subtle issues and ensure the synthetic data truly meets the requirements.
6. Human-in-the-Loop Validation
Despite remarkable advances in LLM capabilities, human judgment remains the gold standard for evaluating data quality, correctness, and bias. Human-in-the-loop (HITL) validation refers to involving human experts or annotators at one or more stages of the synthetic data generation pipeline to review, correct, or curate the outputs. The goal is to combine the scalability of AI generation with the reliability of human oversight.
There are several points in a pipeline where human validation can be applied:
- Post-generation review: After the LLM generates data, human annotators can review a sample (or all, if volume permits) of the synthetic examples. They might label any errors, remove flawed examples, or suggest improvements. For instance, if generating a dataset of medical advice, a medical professional could verify that each advice instance is accurate and safe, removing those that are not.
- During iterative loops: In an iterative refinement setup, humans could assess the model’s performance at each iteration and decide which area the next round should focus on (similar to how a scientist would direct experiments). This is like adding a human in the dataset-wise refinement loop to say “The model is still bad at edge case X, generate more of those.” Such expert input can dramatically speed up convergence to a high-quality dataset.
- Final dataset curation: Humans might do a final pass on the fully generated dataset to ensure labeling consistency and fairness. They can also annotate any bias issues or provide meta-labels that might be needed for later bias mitigation.
Why involve humans? Because LLMs can’t yet fully audit themselves. They have inherent biases and blind spots (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). An LLM might not recognize if a synthetic hiring dataset it generated has only male candidates in the examples – a human can spot that and correct it (and then we could prompt the LLM to generate more female candidate examples to balance). LLMs also might not reliably catch subtle logical errors or culturally inappropriate content that a human would flag. As noted in a survey, “LLMs can hardly be self-aware of the bias in their generated data… human knowledge for annotation and verification is vital and irreplaceable.” (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). In short, human eyes are critical for quality assurance.
John et al. (2023a) (ref in survey) describe using human intervention for label refinement: when the model’s generated labels (or outputs) might be wrong due to model hallucination, they simply had humans re-annotate those cases (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). While this introduces some manual effort, it can be limited to only the fraction of data that is problematic, which is far less work than authoring everything from scratch. This is similar to active learning’s idea of only querying humans for the uncertain items.
An effective pattern is “Human in the loop for outlier handling.” Let the LLM generate a lot. Use automatic means to filter obvious good and bad. For the gray area where automatic methods are unsure, have a human review those. This triages the data: AI handles the clear cases, humans handle the tricky cases. The result is a vetted dataset. Additionally, the insights from human corrections can be fed back into the system – e.g., if humans consistently flag a certain type of error, add a rule or additional prompt to fix that in future generations.
Human feedback for model alignment: In reinforcement learning with human feedback (RLHF), humans label preferences which train a reward model, which in turn fine-tunes the model (we’ll detail RLHF in case studies). This is a form of human-in-loop training. Similarly, for synthetic data, we could have humans rank or score synthetic outputs; those scores could train a reward function that then guides the LLM to generate better data (akin to RLAIF but with actual human feedback rather than AI proxy). This is expensive, so it’s usually done on smaller but critical datasets (like a few thousand comparisons) and combined with a lot of unsupervised or AI-supervised data for scale.
Expert involvement to reduce bias: One crucial use of human validation is ensuring the synthetic data does not encode or amplify biases or harmful content. Humans can identify subtle stereotyping or offensive language that an AI filter might miss. For instance, if an LLM inadvertently generates more technical job interview questions for male names than female names, a human reviewer could catch that pattern and mark it. The dataset curators can then correct the imbalance (perhaps by prompting the model to generate more questions for female candidates to compensate). We’ll talk more about bias mitigation in §10, but it’s clear that diversity and fairness audits by humans are an important step before deploying any dataset to training.
Case Study – Human-Assisted Self-Instruct: Although Self-Instruct is largely autonomous, the authors did use a manual filtering step on the final data to remove a small number of problematic instructions (those that were inappropriate or duplicates) ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). This shows a light human touch can help clean the tail of distribution of a large synthetic set.
Another practical consideration: having humans write a small seed set of examples (as done in Alpaca with 175 seed tasks (Stanford CRFM)) can dramatically set the tone for the synthetic data generation. Those human-written seeds essentially encode human priors about what good instructions or outputs look like. The LLM then imitates and expands upon that. So even when the end data is mostly AI-generated, the humans played a key role in guiding it initially.
Crowd-sourcing vs Experts: Depending on the task, human validation could involve domain experts (e.g., doctors for medical data) or crowd-workers for more general tasks. Experts are slower and costlier but ensure correctness in sensitive areas. One might combine them: use crowdworkers to do an initial pass marking obvious issues, then have an expert review anything uncertain or anything related to domain-specific accuracy. This two-tier review is common in data labeling pipelines and can apply here too.
Tooling for human-in-loop: In a production system, you’d likely use an annotation platform that presents the AI-generated data to human reviewers, collects their feedback, and integrates that back. For instance, Amazon Bedrock’s model evaluation workflow allows using human reviewers to rate model outputs and incorporate that feedback (Fine-tune LLMs with synthetic data for context-based Q&A using Amazon Bedrock | AWS Machine Learning Blog) (Fine-tune LLMs with synthetic data for context-based Q&A using Amazon Bedrock | AWS Machine Learning Blog). Such infrastructure can be repurposed for synthetic data verification – treat each AI-generated example as a “model output” to be evaluated. Modern tools even allow you to mix LLM-based eval and human eval seamlessly (like having GPT-4 score outputs and humans spot-check).
To maximize the benefit of human effort, focus humans on what matters most:
- Have guidelines for them on what errors to look for (factual, logical, grammatical, fairness).
- Prioritize reviewing examples that are likely to be wrong or harmful (the noisier slice of data).
- Use smaller review samples to estimate quality – if the synthetic data passes human review in a sample with say 95% accuracy, you might trust the rest more.
In summary, human-in-the-loop validation is about catching what the AI might miss. It provides an extra layer of quality control for synthetic datasets. While it doesn’t scale infinitely, even a small human-curated subset or occasional checks can greatly increase confidence in the data. Ultimately, for high-stakes applications, pure synthetic data without any human oversight is risky – thus involving domain experts or annotators is a prudent step. Think of LLMs as junior collaborators that can generate a lot of drafts, and humans as editors who ensure the final content is up to standards.
With the methodology sections behind us, we now shift to concrete case studies, where these techniques are applied in different scenarios. Each case highlights particular challenges and solutions in synthetic data generation.
7. Case Studies
7.1 Instruction Tuning with Synthetic Data
Instruction tuning refers to fine-tuning LLMs on a dataset of instructions and corresponding responses, so that the model can follow natural language instructions in a general way (CodecLM: Aligning language models with tailored synthetic data). Acquiring a large, diverse set of instruction-response pairs from humans is extremely expensive (e.g., OpenAI’s instruction data came from thousands of crowd-workers and domain experts). Synthetic generation offers a shortcut: use an existing powerful model to generate instruction data, and fine-tune a smaller model on it (Stanford CRFM) (Stanford CRFM).
A landmark work in this area is Self-Instruct (Wang et al., 2022). Self-Instruct bootstrapped an instruction dataset for GPT-3 by leveraging GPT-3 itself ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). The process was:
- Start with a seed set of 175 human-written instructions with reference outputs (covering a few tasks).
- Prompt the LLM with some of these seeds (as in-context examples) and ask it to generate new instructions, along with answers to them ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions).
- Filter out problematic or duplicate ones, add the new ones to the pool, and repeat ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions).
This iterative approach yielded 52,000 high-quality instruction-response pairs (Stanford CRFM) (Stanford CRFM). Notably, the authors reported that the diversity and creativity of instructions greatly increased over iterations, far beyond the initial human examples ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). They then fine-tuned the GPT-3 model on this synthetic dataset. The result was impressive: the instruction-tuned model (GPT-3 Self-Instruct) achieved a 33% absolute improvement on the Super-NaturalInstructions benchmark over the base model ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions), and in a human evaluation on unseen tasks, it outperformed a model of the same size trained on actual human instruction data ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). This suggests that their synthetic data was of very high quality – likely because GPT-3 (175B) is quite knowledgeable and with careful prompting and filtering, its outputs were as useful as crowd-sourced instructions.
Hot on the heels of Self-Instruct, Stanford introduced Alpaca (2023), which has become a well-known case study in democratizing instruction-tuned models. Alpaca is a 7B parameter model (based on Meta’s LLaMA) fine-tuned on a dataset of 52K instruction-following examples that were generated by OpenAI’s text-davinci-003 model (GPT-3.5) (Stanford CRFM) (Stanford CRFM). The Stanford team basically replicated the Self-Instruct idea but using OpenAI’s latest model as the generator and focusing on a smaller target model for efficiency. Amazingly, they reported that Alpaca showed “many behaviors similar to text-davinci-003” (Stanford CRFM) in their evaluations – in other words, a 7B open model began to approach the quality of a 175B proprietary model on instruction following. User studies found Alpaca’s outputs to be often on par with GPT-3.5 for a variety of prompts (Meet Alpaca: The Open Source ChatGPT Made for Less Than $600). Considering the entire dataset cost <$500 in API calls to generate (Stanford CRFM), this was a watershed moment: it implied that with a few hundred dollars and a base model, academics could create ChatGPT-like models. Alpaca did have some limitations (it wasn’t as good at complex reasoning or very specialized instructions, and it had some safety gaps since the synthetic data didn’t include adversarial instructions), but it sparked a wave of projects.
Following Alpaca, numerous Alpaca derivatives emerged:
- Vicuna (2023) took a different route by using real user-shared ChatGPT conversations (from ShareGPT) as training data, producing a 13B model that achieved
90% of ChatGPT quality ([Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org](https://lmsys.org/blog/2023-03-30-vicuna/#::text=We%20introduce%20Vicuna,commercial%20use)). While Vicuna’s data is not purely synthetic (the user prompts are real, though the responses are from ChatGPT, so AI-generated), it demonstrated that incorporating conversational context and longer dialogues can yield even better instruction-following/chat performance (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org). Vicuna outperformed Alpaca by a significant margin, likely because it had richer conversational examples (including multi-turn) and leveraged GPT-4’s evaluation as a guide (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org). - WizardLM (2023) went back to fully synthetic but introduced an evolutionary prompt technique. They used GPT-3.5 to generate relatively simple instructions and then applied an Evol-Instruct algorithm to recursively make those instructions more complex step by step ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions) ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions). For example, a simple instruction “Translate this sentence” could be evolved into “Translate this sentence into French and then summarize it in English.” By doing this, they created tiers of complexity. WizardLM (a LLaMA model fine-tuned on this data) was specifically strong at handling more complex, layered instructions. Human evaluators even preferred WizardLM’s outputs over ChatGPT’s on some highly complex tasks ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions), and GPT-4 eval showed WizardLM reached >90% of ChatGPT’s capability on many skills ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions) ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions). This was a striking result: it suggested that by pushing the envelope of instruction complexity via synthetic means, one could train models that excel in areas where base ChatGPT might not have as much specialized data.
- AlpacaFarm (2023) took a meta-approach: instead of just generating an instruction dataset, they built a simulation framework for RLHF using synthetic data (with models playing the role of human labelers to some extent) (AlpacaFarm: A Simulation Framework for Methods that Learn from ...). While AlpacaFarm is more about studying RLHF algorithms efficiently, it underscores the trend that even processes involving human feedback can be prototyped with AI feedback and synthetic tasks for research purposes.
The combination of these projects has led to an explosion of open instruction-tuned models. The general recipe is: take a good base LM, generate a large synthetic instruction dataset using an API or a stronger model, fine-tune, and then optionally refine via feedback loops (human or AI). This formula has produced models like Dolly (Databricks), OpenAssistant’s models, ChatGLM-Tuning and others, each leveraging some form of synthetic instructions due to the lack of open human instruction data.
One lesson from these efforts is that diversity of instructions is key. Models like Alpaca initially had mostly single-turn instructions. Vicuna added multi-turn chat, which gave it a boost in conversation ability. WizardLM added complexity and multi-step reasoning instructions, boosting that facet. So, depending on what capabilities you want, you should curate your synthetic instruction prompts accordingly. For a well-rounded assistant, you’d want a mix: straightforward tasks, creative tasks, multi-turn interactions, complex compositions, coding instructions, etc. LLMs can generate all of these if prompted well (and perhaps using different specialist models for different types).
Another lesson is filtering and safety: with synthetic instructions, you must be careful not to inadvertently include harmful content. Alpaca’s dataset, for instance, did not have explicit disallowed content instructions (because they didn't prompt for those from the API), so Alpaca wasn’t exposed to them and had some gaps in how to handle them (often just responding rather than refusing). There’s ongoing work in generating synthetic harmful queries and red-teaming data to fine-tune models to refuse or safely handle such requests (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI) (Using LLMs for Synthetic Data Generation: The Definitive Guide - Confident AI). That is another flavor of instruction tuning – aligning models not just to do tasks, but to avoid doing certain tasks (the “harmlessness” instructions, which Constitutional AI tackled by AI feedback).
In summary, instruction tuning via synthetic data has proven extremely effective. It has lowered the barrier to creating custom chatbots or assistants. The combination of high-quality prompt engineering (to generate diverse instructions) and techniques like Evol-Instruct or self-feeding loops has yielded models that in some cases rival those trained on human data ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions). It’s a showcase of using LLMs to improve LLMs.
7.2 Domain Adaptation and Customization
Adapting a general LLM to a specific domain (e.g. legal, medical, finance, or a specific industry) is a common need. However, domain-specific data can be scarce or protected (e.g., medical records have privacy concerns). Synthetic domain data can fill this gap by generating examples that resemble the target domain’s content, allowing the model to fine-tune on those and learn domain-specific terminology or styles.
Example: Legal QA or Document Analysis. Suppose we have a base model and we want it to be good at answering legal questions or parsing legal contracts. We might not have a large QA dataset for law. But we likely have access to a corpus of legal texts (statutes, cases) since those can be public. A strategy:
- Use an LLM to read legal documents and generate Q&A pairs from them. For instance, provide a passage of a law as context and prompt: “Based on the above law, list 3 possible questions someone might ask and provide the answers.”
- The model will generate questions like “What is the penalty for X under this law?” and an answer pulled from the text. This gives you context-linked QA. Yoshikawa et al. (2022) did something similar for the medical domain, generating QA from medical textbooks.
- Fine-tune your model on these QA pairs. Now it has seen many question patterns and answers in legal context, improving its ability to handle real legal queries.
This approach uses retrieval + LLM as a synthetic data generator (a hybrid method we discussed). By grounding generation in real domain content, we ensure factuality and relevance.
Another approach: if the domain has special formats (e.g., financial reports, log files, programming code), you can prompt the LLM to produce synthetic examples of those formats. For coding, one can generate (problem, solution) pairs – in fact, OpenAI’s Codex was partially trained on synthesized code data where they permuted functions and docstrings (though that’s more data augmentation than LLM generation). Google’s Codey/CodeLM work used a similar idea of synthesizing code tasks to fine-tune code models (CodecLM: Aligning language models with tailored synthetic data).
NVIDIA’s NeMo framework guide suggests generating domain-specific utterances for conversational AI when data is lacking (New synthetic data techniques could change the way AI models are ...). For example, for a weather chatbot, use an LLM to simulate dialogues about weather by giving it roles (user asking weather, assistant giving info) – essentially self-play in a domain context.
Medical Domain Case: Let’s consider a low-resource scenario in medicine – say we want a model to answer patient questions about a rare disease. There might be very few real Q&A pairs on that. But we could take whatever medical literature is available on that disease and prompt an LLM with something like: “You are a medical expert. A patient asks: [insert a plausible question about the disease]. Provide a helpful answer based on the above information.” By feeding bits of literature and asking the model to pose and answer a patient question, we create synthetic patient questions with expert answers. This can augment a health advice model’s training.
One interesting case study is the creation of Multi-lingual and Code datasets by synthetic means:
- Meta’s No Language Left Behind project and others often used back-translation or LLMs to generate text in low-resource languages (taking an English sentence and translating it via an LLM into, say, Somali, to create parallel data). We cover low-resource in next sub-section, but it’s also domain adaptation if the domain is “a language domain.”
- OpenAI’s GitHub Copilot and related code models: There’s anecdotal evidence that synthetic data like generating variations of code or using the model to fill in code given docstrings was used to enhance performance ([2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions). Also, the recent StarCoder fine-tuning used synthetic instructional data for coding tasks (since writing a lot of code instructions manually is tough).
Evaluation of domain adaptation: AWS’s Bedrock blog provides a mini-case: fine-tuning an LLM on context-based QA in a specific domain (they don’t specify the domain, but context-based QA implies maybe company documents Q&A) using synthetic data (Fine-tune LLMs with synthetic data for context-based Q&A using Amazon Bedrock | AWS Machine Learning Blog) (Fine-tune LLMs with synthetic data for context-based Q&A using Amazon Bedrock | AWS Machine Learning Blog). They generated Q&As using a teacher model (Claude) and fine-tuned a smaller model. They found via an LLM judge and human eval that the fine-tuned model’s answers were preferred a significant portion of the time over the original model’s answers (Fine-tune LLMs with synthetic data for context-based Q&A using Amazon Bedrock | AWS Machine Learning Blog). This indicates that even with a relatively modest synthetic finetune, a model can become more expert in a domain – answering with more detail or accuracy – than it was originally.
CodecLM (mentioned in Hybrid section) is effectively domain adaptation for instructions. They specifically talk about tailoring data for enterprise applications or personal assistants, where the distribution of instructions might be very different from general public data (CodecLM: Aligning language models with tailored synthetic data). By encoding seed instructions and decoding with self-rubrics and filtering, they aligned LLMs to specific downstream task distributions (CodecLM: Aligning language models with tailored synthetic data) (CodecLM: Aligning language models with tailored synthetic data). For example, tailoring an assistant to handle mostly software engineering questions might involve generating a lot of synthetic instructions about coding, debugging, etc., and ensuring the model sees those.
A caution in domain adaptation: don’t hallucinate facts. If the domain is fact-heavy (law, medicine), purely synthetic data from an LLM not grounded in real sources might contain inaccuracies (because the LLM might approximate or mix up facts). Thus it’s often better to ground the generation or to have a human/domain-expert verify. Another approach is to use the LLM to generate questions only, and then have it retrieve or if possible use a knowledge base to get correct answers, or have the answers written by experts. Generating just questions is easier and less risky, and you can pair them with known answers from a database.
Low-shot to high-shot: Domain adaptation synthetic data can also amplify a small real dataset. If you have 100 actual examples, you can prompt the LLM with each and ask for similar or expanded examples. By doing so, you turn 100 into perhaps 1000 synthetic ones. As long as the LLM doesn’t drift too far, this data augmentation can improve performance. Kaddour et al. (2023) found that even fine-tuning a teacher LLM on a few real examples and then using it to generate more can dramatically improve a small model’s performance ([2310.01119] Synthetic Data Generation in Low-Resource Settings via Fine-Tuning of Large Language Models) ([2310.01119] Synthetic Data Generation in Low-Resource Settings via Fine-Tuning of Large Language Models), sometimes needing only a fraction of the original data. This suggests a workflow: fine-tune a big model on your tiny real dataset (so it specializes a bit), then have it hallucinate a large dataset, then fine-tune your target smaller model on that. They reported strong results in classification and text generation tasks using this method ([2310.01119] Synthetic Data Generation in Low-Resource Settings via Fine-Tuning of Large Language Models).
In practice, many enterprises do domain adaptation by combining retrieval (so the model can look up company-specific info) with slight fine-tuning. Synthetic data can be used to fine-tune the model on the style of interactions or on tasks that involve using retrieved info. For example, generate synthetic dialogues where a user asks something and the assistant provides answers citing a (fake but realistic) document snippet. This teaches the model to properly incorporate retrieved facts. Even though the content is fake, the behavior learned (like citing source, maintaining factual style) transfers to real data usage.
In summary, synthetic data for domain adaptation is a powerful approach to customize LLMs:
- It can create training examples where real data is scarce or sensitive (like generating medical QAs instead of using patient data directly, preserving privacy).
- It can focus a model on domain jargon and context so it becomes fluent there (like legal terms, product names, etc.).
- It should be used with grounding or human checks in high-accuracy domains to avoid introducing misinformation.
Many industry teams report success with domain synthetic augmentation. The key is ensuring the synthetic data is representative of the real tasks. That might mean using real documents or a few real seed examples to guide it. When done right, the fine-tuned model can significantly outperform the base model on domain-specific evaluation.
7.3 Low-Resource Languages and Multilingual Data
LLMs tend to perform poorly in languages that were under-represented in their pretraining data (e.g., many African, South American, Southeast Asian languages). Synthetic data generation can help by producing text in those low-resource languages to fine-tune or adapt models, effectively teaching them the specifics of those languages. This is a form of domain adaptation where the "domain" is a language.
A common method is machine translation-based augmentation:
- If you have a dataset in a high-resource language like English, you can translate it to the low-resource language using an LLM or translation model, creating a parallel corpus. Then fine-tune the model on that translated data (and possibly on a mix with original language data for multilingual ability).
- Or generate new sentences in the low-resource language by prompting an LLM that is known to have some ability in it (many big LLMs do know a bit of dozens of languages from pretraining).
Nguyen et al. (2024) took an innovative prompting approach: they assembled linguistically diverse prompts from many high-resource languages and used them to coax the model into outputting low-resource language text () (). Essentially, by showing examples in other languages, they signaled the model to mimic that pattern in the target low-resource language even without direct training data. They found that this method allowed an English-dominant model to perform translation for 34 low-resource languages at a level comparable to having few-shot examples in those languages () (). This is notable because it didn't require any fine-tuning – it was all prompt-based generation of the outputs. But one could leverage a similar idea to generate a fine-tuning set.
For example, “Democratizing LLMs for Low-Resource Languages” (the paper from which those results come) essentially used synthetic exemplars assembled from other languages to improve performance in target languages () (). They even surpassed supervised prompting in some non-English tasks, showing that carefully crafted prompts can unleash a model’s multilingual ability to generate useful data in languages it hadn’t been explicitly trained on.
In practice, one might do the following to create a QA dataset in a low-resource language:
- Take an existing English QA dataset (e.g., SQuAD).
- Translate the context paragraphs into the target language using an LLM or translation API.
- Ask the LLM to also translate or rewrite the question and answer into the target language.
- Alternatively, have the LLM read the paragraph (now in the target language) and generate a new question in that language and answer it (ensuring the answer is found in the paragraph).
This yields a synthetic QA set in the target language. Fine-tuning a model on this would teach it to understand that language’s syntax and also the way questions are asked.
Another scenario: dialogue or conversational data in low-resource languages. A multilingual LLM could be prompted to have a conversation in Swahili by instructing it in the prompt (maybe even giving it a few example utterances in Swahili). Once it generates dialogues, those can train a chatbot for that language.
One challenge is evaluation – if you create a model for a low-resource language via synthetic data, you need some way to verify it. Often, researchers translate test sets from other languages or have bilingual speakers evaluate outputs.
Oh et al. (2023) in their work on NMT augmentation used GPT-3 to generate additional sentence pairs for machine translation beyond the parallel data. They saw improvements in translation quality for low-resource pairs (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). This is essentially synthetic data to augment machine translation training, which is a very direct example: if you have 10k real sentence pairs, generate another 50k synthetic pairs with an LLM, train the NMT model on both, get better results than using 10k alone.
Pivoting through a high-resource language: Another trick is to generate data in low-resource languages by pivoting through a high-resource one that the model knows well. For example, to get Hindi questions if the model isn't great in Hindi, you could prompt it in English: “Generate a question about Bollywood movies and then give the Hindi translation of that question, and the answer in Hindi.” This uses the model’s English strength to create the content, but then also uses its translation ability to output in the target language. If the model can translate reliably, this yields decent synthetic Hindi QA.
Speech or multimodal: Low-resource can also refer to modalities. For instance, generating synthetic speech transcripts in a dialect to train speech recognition. While we focus on text here, it's worth noting that text LLMs have been used to generate data for speech models (e.g., producing plausible transcriptions with certain noise patterns).
In multilingual synthetic data, diversity of names and cultural context is important. If the model only knows a Western context, its synthetic data for other languages might still skew that way (e.g., asking in Swahili about New York weather rather than local context). One might need to specifically inject local context into prompts or use local knowledge.
One inspiring project: Bloom by BigScience trained a model on 59 languages. While they used real datasets, one could imagine using Bloom itself to generate additional data for languages where only a small corpus existed, to balance the training mix. In fact, their data governance might not allow free generation, but it's a concept.
Results: It’s reported that by fine-tuning with synthetic multilingual data, smaller models have drastically improved in those languages. For example, Meta’s newer models like MPT or LLaMA 2 have better multilingual ability partly because of training on translated data or augmentations. Gilardi et al. (2023) noted that human data is often biased or limited, and synthetic data might actually be less biased in some ways (though that depends on the model) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
Finally, low-resource doesn’t just mean languages – it can mean any scenario with few examples. Synthetic generation is essentially a data amplification strategy that can turn a low-resource task into a higher-resource one artificially. That applies to languages, but also to niche tasks (classify a rare phenomenon, parse a niche file format, etc.).
7.4 Reinforcement Learning with Human Feedback (RLHF)
While RLHF is primarily a fine-tuning approach rather than a data generation technique, it’s closely related and often intertwined with synthetic data generation, because the process involves generating model outputs and learning from human preference data. The “dataset” in RLHF is somewhat synthetic: it consists of model outputs labeled by humans as good or bad, and possibly synthetic prompt variations designed to challenge the model.
InstructGPT (Ouyang et al., 2022) is the canonical example of RLHF for LLMs. The pipeline:
- They first did Supervised Fine-Tuning (SFT) on a small set of human demonstrations (instruction-response pairs). This is not synthetic – it’s real human-written responses.
- They then gathered a dataset of model outputs: They prompted the SFT model with various instructions, collected its outputs (and sometimes outputs from older models too for diversity), and had humans rank pairs of outputs for the same prompt (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). This created a dataset of comparisons – effectively synthetic data where the inputs are prompts and the labels are which output is better.
- They trained a Reward Model (RM) on these human preferences () (). Now the RM can predict a score given a prompt and an output.
- They fine-tuned the policy (the original model) using Proximal Policy Optimization (PPO), a reinforcement learning algorithm, to maximize the RM’s reward (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models) while keeping the model close to the SFT model (using a KL penalty to avoid going off-track) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models).
The result was InstructGPT, which was significantly more aligned and “helpful” than the original GPT-3. A famous outcome was that a 1.3B InstructGPT model was preferred by users over the 175B GPT-3 model in many cases ([PDF] Training language models to follow instructions with human feedback) (). Specifically, the team noted “RLHF is very effective at making models more helpful, more so than a 100x increase in model size.” (). This underscores how fine-tuning with the right data (in this case, human feedback data) can beat raw parameter count for alignment tasks.
Now, where do synthetic data methods come in RLHF?
- The process of generating outputs to be scored is essentially using the model to create a dataset for the reward model. One could incorporate AI feedback here to reduce noise (e.g., filter out nonsensical outputs before showing humans, although that was not done in InstructGPT, they let humans see the unfiltered outputs).
- Some research, like DPO (Direct Preference Optimization) (Rafailov et al., 2023), tries to directly train on the comparison data without RL, which essentially turns the comparisons into a kind of synthetic labeled data for a supervised objective (fitting a Bradley-Terry model) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models). This is tangential, but shows that even RLHF can be reframed as learning from a synthetic dataset of comparisons.
- Many open implementations of RLHF (like trlX, DeepSpeed Chat) rely on synthetic conversations to test their pipelines. For example, they might simulate preference labels using another model (for research, not production).
One can consider human preference data as a special kind of dataset that is model-generated outputs + human labels. It's not fully synthetic because humans are labeling, but the prompts and outputs often come from either real user prompts or some synthetic prompt set. In OpenAI’s case, they used actual user prompts from the API to make sure the distribution was real () (). In academic settings, you might use a proxy (like some collected prompts or generate prompts).
Case study: Anthropic’s HH RLHF model (HarmlessHelpful). They collected human feedback on two axes: helpfulness and harmlessness, by showing model responses and asking if they followed instructions and if they avoided unsafe content. That dataset (Anthropic HH) is effectively a treasure trove of model outputs marked by humans, which one could consider synthetic in the sense that the prompts were sometimes adversarially chosen by humans (kind of synthetic edge cases). They then did RLHF on that. The result was Claude (Anthropic’s assistant) which is known for being polite and refusing unsafe requests.
Reinforcement learning with AI in the loop (RLAIF), as mentioned earlier, is a variant where humans are replaced by AI for the feedback. We saw this in Constitutional AI where they did RL with AI preferences (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). That’s a case where the preference data was entirely synthetic (model’s own judgments). The success of that approach (at least in achieving harmlessness) was notable, though it’s debated if it fully matches RLHF.
Now, RLHF can be seen as orthogonal to synthetic data generation in some sense – it's about refining behavior with human feedback rather than creating new training examples for tasks. However, one can combine them:
- Use synthetic data to warm-start the model (like Instruct tuning) and then apply RLHF to further refine. This is essentially what OpenAI did (they needed the model to be in a reasonable state before RLHF, hence the supervised fine-tune step).
- Use RLHF outputs to further augment a dataset: For example, after RLHF, you have a policy that’s better. You could then sample a bunch of its outputs (with the prompt) and consider those “good” outputs as additional training data for a final supervised finetune if desired. Some pipelines do an additional supervised phase on a filtered set of RLHF outputs for stability.
In open source, projects like OpenAssistant crowdsourced human feedback data (tens of thousands of ranking comparisons) to fine-tune models with RLHF. That data is open – interestingly, one could use it as a dataset to train a model via simple supervised or DPO instead of RL to get similar benefits.
From an industry perspective, RLHF is extremely compute-intensive (because of the RL loop) and human-intensive. If synthetic data generation can achieve similar alignment cheaply, many would prefer to avoid RLHF. Indeed, Stanford’s Alpaca and subsequent models didn’t use RLHF at all, yet they achieved a lot of alignment just from synthetic instructions. However, they likely are weaker at refusal/harmful content because those were not explicitly in the synthetic data (unless you add them). RLHF is very good at shaping those behaviors because you explicitly train on them (humans will downvote any bad or hallucinatory or non-compliant output, and the model learns to avoid them to get reward).
Interestingly, a hybrid emerges: Synthetic RLHF – use a model to play the role of the human and provide feedback. We discussed this under AI feedback (Constitutional AI). Another idea: You could generate a large number of scenario prompts (some regular, some adversarial) and explicitly instruct an LLM to give two different kinds of responses: one helpful and one with some flaw, then label which is better. Essentially simulate the comparison. This could produce a synthetic preference dataset to train a reward model without any human. Would that yield a useful reward? Possibly not as good as human, but maybe helpful for a first round.
Overall, RLHF has proven to be one of the most effective ways to align model outputs with human expectations. It directly optimizes what humans care about, rather than proxies like likelihood. In terms of performance benchmarks, OpenAI noted RLHF greatly improved truthfulness and reduced toxicity compared to pre-RLHF (Training language models to follow instructions with human feedback), with minimal losses on other NLP tasks. Anthropic’s model with RLHF and Constitutional AI is considered very friendly and safe (within the limits of current AI). The “alignment tax” – slight regression on some academic benchmarks due to alignment fine-tuning – was largely mitigated by techniques like mixing in some original data during RLHF (PPO-ptx) () ().
In conclusion for RLHF: while not a pure synthetic dataset generation technique, it produces and relies on derived data (model outputs + human labels). It complements synthetic pretraining/fine-tuning by handling what those can miss – aligning with human preferences on subtle aspects. The case study of InstructGPT and subsequent ChatGPT is a testament that combining these approaches (pretraining → instruct tuning → RLHF) can produce a model that is both highly capable and aligned.
Having covered case studies, we now turn to evaluating synthetic data quality and usage, as well as summarizing best practices and bias mitigation strategies, which apply across these examples.
8. Evaluation Metrics for Synthetic Data Quality
Evaluating the quality of synthetic data is essential to ensure that training on it will be beneficial and not harmful. We can broadly categorize evaluation into direct evaluation of the data itself and indirect evaluation via downstream task performance (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
8.1 Direct Evaluation of Synthetic Data
Direct evaluation treats the synthetic dataset as an object of study. Key aspects to evaluate include:
Faithfulness / Correctness: Does each synthetic example make sense and is it factually or logically correct? For tasks with an objective ground truth (e.g., math problems, knowledge QA), one can attempt to automatically check correctness. For instance, if synthetic data includes arithmetic problems, we can verify the provided answer by recomputing it. For open-ended data (like creative writing or general QA), automatic truth checking is harder, and often human evaluation is needed (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). One method is to sample a subset of the synthetic data and have experts or annotators verify it. If 95% of sampled items are correct, that’s a good sign. If only 60% are correct, the data may need cleaning. As a proxy for human eval, one can use a strong LLM to judge correctness (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). For example, use GPT-4 to fact-check synthetic trivia QAs by asking it if the answer to each question is correct. Tools like OpenAI’s TruthfulQA measure could be applied to outputs to gauge factual accuracy in a broad sense (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Also, as mentioned earlier, an auxiliary model could flag factual errors – e.g., a dedicated classifier that detects hallucinations in summaries (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
Diversity: It’s important that synthetic data is not narrowly repetitive. We can quantify lexical diversity by metrics like vocabulary size, type-token ratio, or distribution of n-grams (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). If the dataset uses 10,000 unique words and has rich n-gram variety, it’s likely diverse. If, however, it repeats the same phrases (like “the quick brown fox” appears very often), that’s a concern. Semantic diversity can be measured via embeddings: e.g., compute embeddings for each example (or each input in the dataset) and look at pairwise similarities (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). If many examples are extremely similar in embedding space, the data might be redundant. Cosine similarity-based measures or clustering can reveal if the dataset has many near-duplicates (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Coverage of conditions: if we used conditional prompting, we should verify each condition value appears roughly as intended (e.g., if we wanted questions about 5 different topics, did we get data for all 5?).
Completeness / Coverage: Does the synthetic data cover the range of scenarios we care about? This is harder to quantify, but one approach is to define some criteria or categories and then check their presence. For example, for an instruction dataset, you might categorize instructions into types (math, writing, coding, etc.) and see if your synthetic set has examples of each. If you have a known distribution or a target test set, you can see if synthetic data distribution matches it (e.g., in terms of topics or difficulty). Tools like BigBench have task diversity – one could evaluate synthetic instruction data on how it performs on BigBench tasks or how a model trained on it does, to gauge coverage.
Fluency and Format: Since LLMs are good at language, fluency is usually high in synthetic data. But one can still measure perplexity of the synthetic data under a base model to ensure it’s not gibberish (low perplexity indicates the text is well-formed in the base model’s eyes). Format correctness (especially if JSON or code) can be checked with parsers. For instance, if the dataset expects JSON outputs, run a JSON parser to see if all outputs are valid JSON. Mismatches can be fixed by refining prompts or post-processing.
Label/Annotation Quality: If the synthetic data includes labels (like classification labels or answers to questions), are those labels correct and consistent? One strategy is to hold out some “control” prompts where you know the answer, generate synthetic answers, and verify they match the known answer. If not, that's an error. Or if generating classification data, perhaps embed a few real labeled examples to see if the model assigns the correct label. If you have multiple models, you could cross-verify (e.g., have another model answer the same question; if both agree, more confidence, if they differ, flag for review).
Direct metrics from literature:
- Yu et al. (2023b) used vocabulary size and n-gram frequency to assess diversity (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
- They also mention using sample similarity (cosine similarity between embeddings of samples) to detect redundancy (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
- For faithfulness, some use BLEU or ROUGE against a reference if available (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). But often references aren’t available for synthetic data unless it's derived from one. If the synthetic data is supposed to mimic an existing test set, one can compute BLEU between synthetic and reference to see how close (but usually you want synthetic data to be different from reference data to add new info).
- Human evaluation: Wang et al. (2022 Self-Instruct) had humans judge a sample of their synthetic instructions for correctness and usefulness ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). They found the synthetic ones were on par with human-written. Doing a small human eval study (like 3-5 judges rating 100 samples on a 1-5 scale for quality) can provide a quality score.
An advanced method: if you suspect some bias or unwanted pattern, you can measure it. E.g., run a sentiment analyzer or a gender mention counter on the synthetic set to see if it skews negative or uses predominantly male pronouns. This is direct data profiling.
8.2 Indirect Evaluation (Downstream Performance)
The ultimate test of synthetic data is how a model trained on it performs on real tasks (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Even if the data looks good by direct metrics, the proof is in the pudding: does it actually improve model performance?
Benchmark Evaluation: This means fine-tuning or training a model on the synthetic data and evaluating on one or more benchmarks for the target task(s) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). For example, if we created a synthetic squad of QA, train a model on it and evaluate on a real QA dataset (like SQuAD or NaturalQuestions) to see if it learned effectively. Yu et al. (2023b) did this and noted that the impact of synthetic data should be measured on multiple axes – not just the task accuracy, but also side effects like truthfulness and reasoning (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). They mention tasks like TruthfulQA to check if the model is more truthful and NIV2 (some comprehensive eval) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Essentially, does training on synthetic data inadvertently make the model more prone to certain errors or does it help across tasks?
One should compare against some baselines:
- A model trained on a real dataset of equivalent size (if available) – though often we resort to synthetic because real is not enough or absent.
- The base model zero-shot or with whatever original training it had.
- Perhaps a model fine-tuned on a much smaller human-labeled set to see if synthetic data can replace X amount of real data.
For instance, Self-Instruct compared their model’s performance to that of GPT-3 tuned on public datasets and found only a small gap remained ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions). Alpaca was compared qualitatively to GPT-3.5. WizardLM was compared to ChatGPT on specific evaluation sets and got ~90% performance on many.
A/B testing with humans: If the purpose is a chat assistant, one can do a side-by-side human preference test. For example, the Vicuna team did a GPT-4 eval and also some human verifications (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org), finding Vicuna’s quality to be high. If you have resources, having human users try the model fine-tuned on synthetic data vs a baseline can give a direct judgment of improvement.
Robustness tests: Evaluate not just on the target test set, but on out-of-distribution cases to ensure the synthetic training didn't overfit to peculiarities. If a model is too tailored to synthetic distribution, it might do poorly on real queries that differ slightly.
Open-ended evaluation: For tasks like open-ended dialogue or creative writing, automatic metrics (BLEU, etc.) are not sufficient. Instead, one might rely on win-rate comparisons (like “model A responses were preferred over model B 70% of time in a blind human eval”) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum) or rating scales. Also, as noted, some use Elo ratings by pairwise battles (as done in Chatbot Arena for Vicuna) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org).
Task-specific metrics: If synthetic data was for a classification, measure accuracy/F1 on a test set. If for text generation, measure BLEU/ROUGE if references exist, or use something like BERTScore or MoverScore to gauge similarity to references.
Model-based eval (GPT-4 as evaluator): As a cheaper proxy to humans, one can use a powerful LLM to evaluate responses or compare models (this is how Vicuna did it) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org). They had GPT-4 assign scores, which correlated with human judgment to an extent. Another known approach is prompting GPT-4 with: “Here is response from Model A and Model B to the user query. Which is better?” and doing that at scale. This falls under indirect, since it evaluates the trained model’s outputs. Xu et al. (2023a) and Sun et al. (2023) used such GPT-4 based frameworks to automate evaluation of model helpfulness (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
We must be careful: an LLM might have biases (preferring verbose answers, etc.), so its judgment isn’t perfect. But it’s quite useful for quick iteration.
Data quality metrics vs performance: It’s interesting to note that sometimes a dataset with slightly more errors but more diversity might outperform a squeaky-clean but small and narrow dataset, in terms of final model performance. So we should optimize for what yields better models, not just better-looking data.
One could also evaluate efficiency: did synthetic data allow achieving X accuracy with fewer training steps or smaller model compared to using less data? For example, show that using 50k synthetic data allowed a 7B model to match a 30B model’s performance without it.
From a real-world effectiveness standpoint:
- Did the use of synthetic data achieve the intended goal? E.g., if the goal was to improve a support chatbot’s ability to answer product questions, measure some KPI on that (like resolution rate or user satisfaction in a pilot deployment).
- Are there any negative side effects? Perhaps the model trained on synthetic data is less calibrated (maybe it is overconfident because it saw mostly confident answers). One should measure things like calibration or propensity to say “I don’t know”. If it’s too low (never says IDK because synthetic data had no uncertain answers), that could be an issue. Some evaluation on truthfulness tests or uncertainty can catch that (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
Summary metrics: We might end up summarizing synthetic data quality with metrics like:
- Average human rating (on a scale) of samples.
- % of samples passing certain automated checks.
- Vocabulary size / diversity indexes.
- Downstream task accuracy (perhaps relative to baseline).
- For bias, one might compute something like KL divergence between synthetic and real data distributions on some attribute.
In literature:
- Wang et al. (2023e in references) used a four-level rating (maybe for outputs quality) and Elo scores for open-ended eval (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
- They mention that general LLM evaluators might lack domain knowledge (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey), meaning if you evaluate a medical answer with GPT-4 (not fine-tuned on medical), it might not catch subtle errors.
Thus, if domain-specific, try to involve domain evaluators (human or a model fine-tuned on domain tasks).
Ultimately, evaluation of synthetic data often comes down to evaluating the models trained on it, as that is what we care about. We should design those evaluations to be as close as possible to the real application of the model.
For instance, if we generate synthetic data to improve a virtual assistant, evaluate the fine-tuned assistant with real user queries and measure success rates or user happiness. If it performs well, the synthetic data is vindicated.
If it doesn’t, analyze whether the issue was coverage (the synthetic data didn’t include something), correctness (it taught some wrong info), or distribution mismatch (maybe the style was off so the model is awkward with real users).
Now that we know how to evaluate, we proceed to recommend best practices for practitioners in using synthetic data, and then discuss bias and fairness.
9. Best Practices for Using Synthetic Data
Drawing from the techniques and case studies discussed, we can outline several best practices and guidelines for effectively using synthetic data in training and fine-tuning LLMs:
9.1 Start Small and Prototype: Before generating a million examples, start with a pilot. Generate a few hundred or a few thousand synthetic samples and fine-tune a model on that. Evaluate to see if it’s improving the desired capability. This quick feedback loop can prevent large wasted efforts on a flawed approach. It also helps refine prompts: if the initial synthetic data isn’t great, adjust the prompt or method and try again.
9.2 Prompt Engineering and Instructions: As covered, invest time in designing prompts that yield the format and content you need. Use clear instructions, include examples, and test the prompt manually. Document the prompt template used for generation (for reproducibility and auditing). If multiple prompt variants are used to cover different sub-tasks, keep track of which portion of data came from which prompt – this can help in debugging and analyzing results (e.g., maybe prompt A yielded better quality data than prompt B).
9.3 Quality over Quantity: While one appeal of synthetic data is unlimited quantity, it’s often better to have 10k high-quality examples than 100k noisy ones. Extremely large synthetic datasets can even hurt if the model overfits quirks in them. Focus on filtering out low-quality outputs (through AI or human means) rather than just scaling up. Many successful projects (Alpaca, etc.) used on the order of tens of thousands of examples, not hundreds of millions. Use volume to get coverage, but do not sacrifice quality. Iterate to improve quality with techniques like self-refinement or manual curation, as opposed to just adding more of the same.
9.4 Data Curation and Filtering: Always perform a cleaning pass on synthetic data. Remove exact duplicates (LLMs can sometimes repeat outputs). Remove any content that is hateful, private, or violates the guidelines for your application. Even if the LLM wasn’t prompted to produce disallowed content, scanning for it is prudent. If generating code or structured data, filter out any unparsable or invalid outputs. If possible, use heuristic metrics like confidence or length to identify outliers (very short or very long outputs that might not fit the spec) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). And as mentioned, use either human review or an auxiliary model to filter obviously incorrect or nonsensical entries before training (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey).
9.5 Balance and Diversity: Ensure the synthetic dataset is well-balanced in whatever dimensions matter:
- If it’s classification, roughly balance classes (unless real-world distribution is important to mirror).
- If it’s multi-lingual, include all target languages.
- If it includes names or demographic content, try to diversify (e.g., don’t have all persons named Alice and Bob; include various genders, ethnic names, etc. to prevent bias).
- For instruction tuning, include a mix of tasks (math, coding, writing, etc.) relevant to your use case so the model doesn’t become too narrow. You can enforce some of this via conditional prompts (as we did with conditional prompting techniques) and by drawing prompt seeds from varied sources.
9.6 Mix Synthetic with Real Data when Possible: If you have any real data for the task or domain, include it in training alongside synthetic data. Real data can anchor the model and provide ground truth signals that purely synthetic data might miss. For example, if you have 1k real customer questions answered by support agents, include them with the 50k AI-generated Q&A. Often a 50/50 or 80/20 mix (synthetic:real) can work, but you might experiment with weighting. Real data might be given slightly higher weight (some pipelines duplicate real data a few times to ensure it’s not drowned out). This way, the model learns from real human style and facts, supplemented by synthetic variety.
9.7 Monitor Training: When fine-tuning on synthetic data, watch the training loss and evaluation metrics closely. Early stopping is important – if the model starts overfitting the synthetic data (like loss keeps dropping but eval performance worsens), stop training. Overfitting on synthetic peculiarities is a risk, since the data may not have the same noise characteristics as real data. Using regularization techniques like dropout or weight decay in fine-tuning can help if you have huge synthetic data.
9.8 Evaluate and Validate (as in §8): Rigorously evaluate the fine-tuned model on real benchmarks or in a sandbox environment. Check not only primary task accuracy but also things like calibration, toxicity, and bias. Sometimes synthetic data can introduce subtle biases – for instance, maybe the LLM that generated it had a bias which now is transferred. If you find issues, consider additional rounds of data generation focusing on those (as in dataset-wise refinement) or add a human-in-loop step to correct them.
9.9 Document Data Generation Process: For transparency and reproducibility, document how the synthetic data was created: the prompt templates, the source of any seed data, which model (and version) was used to generate it, any filtering applied, and basic statistics of the final dataset. This is important for compliance and debugging. For example, if later the model outputs something problematic, you might trace it to a pattern in the training data – documentation helps see where it might have come from. Moreover, if regulations require knowledge of training data lineage (for instance, avoiding copyrighted text), documenting that “all synthetic data was generated by X model, which is known to output only non-copyright or we filtered it” can be useful.
9.10 Legal and Ethical Considerations: Synthetic data can sometimes inadvertently include fragments of the LLM’s training data (since LLMs might regurgitate seen text). Be mindful of potential copyright or privacy issues. If your LLM might output verbatim from its corpus and that corpus had copyrighted text, your synthetic data could unintentionally contain it. Some best practices here:
- Use models that have filtering for such content (OpenAI claims their API has some measures to avoid verbatim training data output).
- Avoid directly prompting for proprietary content (e.g., “Generate a passage from Harry Potter” would obviously yield copyrighted text).
- If there’s any chance sensitive info could appear, run a PII (Personally Identifiable Information) detector on the synthetic data and drop anything that looks like real personal data. Usually, well-formed prompts won’t cause PII to appear, but caution is warranted if using very open-ended generation.
9.11 Continual Improvement: Treat synthetic data generation as an iterative process. After deploying a model fine-tuned on synthetic data, monitor how it performs in production. If users find certain weaknesses, consider generating additional synthetic training data to address those (with or without active human feedback). This can be a loop: model v1 (with synthetic data) -> gather real usage data & feedback -> model v2 (add more synthetic or fine-tune on actual interactions) -> etc. Over time, the model’s performance can be greatly enhanced by this feedback loop between synthetic and real usage.
9.12 Don’t Overlook Safety Testing: If you generate a very powerful instruction-tuned model via synthetic data, it may not have undergone the rigorous safety training that, say, ChatGPT has (like fine-tuning on refusals). You might need to explicitly fine-tune or at least test for safety. Possibly generate synthetic “bad” queries and train the model to refuse them (Constitutional AI style) or apply a separate moderation filter. In best practices, always test your model on adversarial or sensitive prompts to see if the synthetic data training inadvertently made it do something undesirable (like maybe it answers disallowed questions because you never taught it not to).
9.13 Performance Tuning: Synthetic data allows you to generate more of what the model struggles with. Use evaluation results to inform generation. For example, if evaluation shows the model is bad at multi-step math, go generate more multi-step math problems and train on those. This active targeting is a best practice to efficiently use synthetic data where it yields the most gain (instead of generically oversampling things it already does well).
9.14 Size of Data vs. Model Size: A practical guideline from experience: you typically don’t need more than, say, 2-3x the number of examples as the model has parameters, for fine-tuning. E.g., a 7B model probably doesn’t need 100B tokens of synthetic data – it would overfit or not effectively utilize that. Many fine-tunes use on the order of 1e5 to 1e6 tokens of data effectively. Focus on quality and representativeness, not sheer volume.
9.15 Continuous Monitoring: Even after training and deploying, continue to monitor model outputs for anomalies – perhaps set up a system to periodically prompt the model with a set of test queries (some real, some tricky synthetic ones) to ensure it hasn’t drifted or that no new issues have arisen. Synthetic data might cause some biases that only show up under certain conditions – monitoring can catch these early.
In summary, treat synthetic data with the same care as real data in terms of quality control, and leverage the flexibility it offers (you can regenerate or adjust as needed). By following best practices like these, practitioners can maximize the benefit of synthetic data while minimizing the risks of garbage-in, garbage-out.
10. Bias Mitigation in Generated Datasets
Bias in training data can lead to biased or unfair model behavior. Synthetic data is not immune to bias – it can reflect and even amplify biases present in the model that generated it or in the prompts used. Thus, it’s crucial to actively mitigate bias when creating and using synthetic datasets.
Here are strategies for bias mitigation:
10.1 Diverse and Balanced Prompting: As discussed, conditional prompting can ensure representation of various groups or contexts. For example, if generating biographies or dialogues, explicitly include different genders, ethnicities, ages in the prompt scenarios. If left to its own devices, an LLM might default to a “neutral” (often Western male) context due to inherent biases (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). By instructing it to vary attributes (e.g., “Generate two customer complaints, one from a man and one from a woman, about …”), we introduce balance. Similarly, ensure that target labels are balanced for sensitive attributes if the task has any (like not all “angry customer” examples being one gender).
10.2 Bias Checks on Data: After generating synthetic data, perform analysis for biases:
- Check if certain words (e.g., male vs female names, or particular nationalities) appear disproportionately in certain contexts or with certain labels. For example, in a sentiment dataset, are negative reviews more often about products used by women? If yes, that bias came in somehow.
- Use bias detection tools: There are NLP bias evaluation tools (like measuring sentiment bias by demographic, or using word embedding association tests on your dataset).
- If issues are found, regenerate that portion with corrected constraints or use data augmentation to counteract it. For instance, if all doctor-patient conversations you generated have the doctor as male, explicitly regenerate half with female doctors.
Gilardi et al. (2023) pointed out that human data has biases (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey), and while LLMs may also have biases, we have the opportunity in synthetic generation to purposefully counteract them. For example, an LLM might less frequently mention certain minority groups unless prompted; we can prompt it to include them.
10.3 Use Multiple Models or Tools: Sometimes using different LLMs can mitigate bias – e.g., if one model has a known skew, another might have a different skew. Combining outputs or alternating might reduce overall bias. Also, using bias-aware prompting can help; e.g., instruct the LLM: “Ensure the following dataset is gender-balanced and does not perpetuate stereotypes”. Models like GPT-4 do have some understanding of this and might self-regulate outputs to some extent if asked (this is similar to Constitutional AI’s principle-based generation which included fairness principles).
10.4 Human Audit: Have human (or expert) reviewers particularly check for bias in synthetic data. This could be a specific review pass focusing on, say, “is any group represented negatively or excluded?”. Sometimes biases are subtle (e.g., assuming certain occupations for certain genders), and human insight is needed (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). If found, adjust the data accordingly (either remove problematic examples or add contrasting examples to balance).
10.5 Post-training Mitigation: If despite efforts, the model fine-tuned on synthetic data shows bias (e.g., it consistently responds differently to inputs that mention different demographic groups), one can apply mitigation techniques:
- Fine-tune further on a small set of debiasing data (could be synthetic or real) where the correct behavior is demonstrated for those cases.
- Use inference-time techniques like rejection sampling or bias filters (though for LLMs that’s tricky without harming output).
- Or incorporate something like a “bias sentinel” – a separate classifier that checks model outputs for bias and either edits or rejects them. But that’s more in deployment.
10.6 Transparency in Data: Document the demographic and contextual makeup of your synthetic data. If it’s, say, 30% female, 70% male characters, note that. Aim for it to align with either the real-world distribution appropriate for the application or an equitable distribution if that’s the goal. For many general tasks, an equitable approach is adopted (like equal representation) to avoid favoritism.
10.7 Avoid Reinforcing Stereotypes: When prompting, be careful not to inadvertently introduce stereotypes. For instance, if you prompt “Generate an example of a nurse talking to a doctor”, the model might default nurse=female, doctor=male. To avoid that, either specify otherwise or prompt multiple scenarios. Similarly, avoid loaded language in prompts (like asking for a “gossipy conversation” might lead to a certain portrayal).
10.8 Bias in Source Models: Recognize that if the model generating data has bias, it can pass it on. Some biases (like subtle word associations) might slip through unless explicitly countered. Using the latest, more aligned models (like GPT-4 which underwent RLHF) to generate data can help, as they have been tuned to reduce harmful or biased content. They are not perfect, but likely less biased than smaller, raw models.
10.9 Ongoing Bias Evaluation: After the model is trained on synthetic data, incorporate bias tests as part of evaluation (like checking answers to questions that involve different demographic terms to see if the model is consistent and fair). There are standardized tests like BBQ (Bias Benchmark) or others that one can use.
10.10 Ethical Review: If possible, involve a diverse group in reviewing synthetic data and model behavior. They might catch biases that the original developers do not see due to their own perspectives.
Example: Suppose we generate a dataset of tech support dialogues. If not careful, we might inadvertently have all customer reps be male and all customers female (or vice versa) in outputs, or might use certain names predominantly. To mitigate:
- We ensure prompts alternate roles genders.
- We use a list of names from various cultures to sample for characters.
- We check the final data: maybe by counting name usage, to ensure no major skew.
Another angle is label bias: If the synthetic data is for say toxicity classification, the model might associate certain dialects or slang with "toxic" just because of bias in how it was generated or filtered. We should test, for instance, that African American Vernacular English (AAVE) phrases in non-toxic context aren’t mislabeled as toxic. If we had an LLM generate toxic vs non-toxic examples, it might have bias from internet data linking certain vernacular to toxicity. Mitigation might involve explicitly instructing the model to separate profanity from identity, or manually adding non-toxic examples in that vernacular.
Constitutional AI approach to bias: The Anthropic technique included principles like "choose responses that are not disrespectful or discriminatory". When they did self-critiques, the model would flag if an output might be biased or stereotyped and fix it (Anthropic's "Constitutional AI" is very interesting : r/singularity - Reddit) (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). One could adopt a similar approach in data generation: after generating an output, ask the model "Is this response free of any bias or stereotype? If not, revise it." This is like a built-in bias filter with AI. It leverages the model's knowledge of what's appropriate. It might catch overt issues (like derogatory terms) though subtle ones might slip.
Ultimately, bias mitigation is an ongoing process. Synthetic data gives us more control than scraping raw data because we can decide what to include. By proactively designing generation and curation steps with fairness in mind, we can create datasets that lead to more fair models. However, we should always verify and not assume it's unbiased just because we tried – measurement is key.
Many academic works stress transparency and iteration: measure biases, mitigate, measure again. Tools like the Holistic Evaluation of Language Models (HELM) from Stanford provide a framework to evaluate models on various aspects including bias; one can use such frameworks pre- and post-finetuning to see impact.
In summary, treat bias mitigation in synthetic data with the same seriousness as if you were curating a human-collected dataset. The advantage is you have knobs to turn (through prompting and selection) to attempt to correct biases. Use those knobs carefully and validate their effect. This will result in a model that not only performs well but does so equitably and responsibly, which is critical for real-world deployment.
11. Conclusion
Synthetic data generation using LLMs has emerged as a transformative technique for fine-tuning and adapting language models, offering a scalable and flexible alternative to manual data collection. In this paper, we explored the full spectrum of methods – from prompt engineering and iterative refinement to AI feedback loops and hybrid human-AI strategies – that enable the creation of high-quality synthetic datasets. We also delved into case studies demonstrating the efficacy of these methods in practice: instruction-tuned assistants built entirely from AI-generated instructions, domain-specific models tailored with synthetic examples, multilingual systems bootstrapped via translation, and models aligned with human preferences through reinforcement feedback.
Several key findings and takeaways stand out:
Prompt Design is Foundational: How we prompt an LLM largely determines the quality of synthetic data. Effective prompts specify the task clearly, enforce format, and encourage diversity through conditional instructions or examples (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Our examples showed that investing effort in prompt engineering (and using few-shot demonstrations) yields more faithful and useful data, reducing the burden on later filtering.
Iterative and Feedback-Driven Generation Yields Better Data: Rather than one-shot generation, iterative techniques – whether breaking a complex output into steps (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) or evolving a dataset over rounds (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) – produce more coherent and comprehensive datasets. Incorporating feedback loops, especially AI self-critiques ([2303.17651] Self-Refine: Iterative Refinement with Self-Feedback) or preference models (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum), helps catch errors and refine outputs beyond what a single-pass generation can do. The success of methods like Self-Instruct and SPIN highlight the value of letting the model “think” or improve in loops, akin to an editing process ([2212.10560] ACL 2023 Self-Instruct: Aligning Language Models with Self-Generated Instructions) (Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models).
Synthetic Data Can Dramatically Amplify Model Capabilities: Case studies demonstrated that relatively small models fine-tuned on well-crafted synthetic data can reach performance levels close to models orders of magnitude larger. For instance, a 7B Alpaca model replicated many behaviors of OpenAI’s 175B model after fine-tuning on 52K GPT-generated examples (Stanford CRFM), and WizardLM, trained on AI-evolved complex instructions, achieved
90% of ChatGPT’s skill on certain evaluations ([[2304.12244] WizardLM: Empowering Large Language Models to Follow Complex Instructions](https://arxiv.org/abs/2304.12244#::text=evaluation%20results%20of%20the%20high,at%20%2019%20this%20https)). This is a game-changer for the community: it lowers the barrier to entry for developing competitive language models by replacing huge human-labeled corpora with AI-generated ones.Human Expertise Remains Crucial for Validation and Alignment: Despite the power of LLMs to generate data, humans play an indispensable role in steering the process – whether by seeding initial examples, reviewing outputs for quality and bias (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey), or providing the ultimate feedback signals in RLHF. A recurring theme is that a human-in-the-loop at key points (especially final dataset curation and evaluation) greatly improves outcomes, catching issues that automated methods might miss. The combination of AI generation with selective human oversight often yields the best of both worlds: scale and reliability.
Robust Evaluation is Necessary: We emphasized that evaluating synthetic data by both direct inspection and downstream performance is critical. It’s not enough to assume more data is better – one must measure the impact on actual tasks and check for side effects like loss of calibration or biases. Our survey of metrics – from diversity scores (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) to human preference tests () – provides a toolkit for practitioners to assess their synthetic datasets and resulting models. In particular, using strong LLMs as surrogate evaluators (e.g., GPT-4 as a judge) has emerged as a practical way to rapidly iterate, though human evaluation remains the gold standard for fine-grained judgments (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org) (Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality | LMSYS Org).
Bias and Fairness Require Vigilance: Synthetic data is not automatically unbiased – it can mirror the biases of the generating model or prompts. We discussed how careful prompting (ensuring representation) and data balancing are needed, and how one should analyze and mitigate biases in the data and model outputs (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey) (On LLMs-Driven Synthetic Data Generation, Curation, and Evaluation: A Survey). Encouragingly, the synthetic approach also provides tools to fight bias: we can generate counter-stereotypical examples deliberately to balance the model’s training, something much harder to do with organically collected data. By leveraging these tools and including fairness criteria in the feedback loops (like Anthropic’s constitutional principles), we can make models more equitable and safe (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum).
Recommendations: For industry practitioners looking to use synthetic data with LLMs:
- Begin with a clear goal (what capability or domain do you want to improve?) and design your synthetic generation strategy around that (choose appropriate prompts, etc.).
- Use an iterative approach: generate, filter, fine-tune, evaluate, and repeat as needed. Small experiments can validate your approach before you scale up.
- Always include a validation step with human experts, especially for critical applications. Even a day of an expert’s time to review data or model outputs can pay off enormously in catching subtle flaws.
- Keep an eye on evaluation metrics beyond accuracy: user satisfaction, model robustness, and safety are equally important for real-world deployment. Synthetic data should be geared not just to maximize a test score but to improve those holistic criteria.
- Embrace hybrid strategies: Don’t hesitate to use multiple AI models (one to generate, one to critique) and to mix generated data with real data. Our review shows that some of the best results come when techniques are combined synergistically.
- Maintain transparency: document synthetic data provenance and consider releasing the prompts or generated datasets if possible. This aids the community and allows external audits for bias or errors, fostering trust in the models developed.
Future Outlook: The field of LLM-driven synthetic data is evolving rapidly. As models become more capable (e.g., with advanced reasoning like GPT-4 and beyond), their ability to generate truly high-fidelity data will grow, further reducing the gap between synthetic and human-produced datasets. We foresee:
- Automated Dataset Generators (Data-as-code): where one simply specifies properties of the desired dataset (e.g., “100k customer support emails in English and Spanish about electronics, balanced by issue type”) and an AI system constructs it with minimal supervision. Early versions of this concept are emerging in tools and research (CodecLM: Aligning language models with tailored synthetic data) (CodecLM: Aligning language models with tailored synthetic data).
- Fine-Grained Control: Prompt engineering will become more programmatic, perhaps using techniques like prompt programming or chaining where the AI itself writes prompts for another AI. This could handle complex or structured data generation (for example, generating a whole synthetic knowledge graph by iterative querying of an LLM).
- Learning to Generate Data: Meta-learning approaches might train models explicitly to generate training data that maximizes performance of another model (a two-model game). This could optimize synthetic data quality in a more end-to-end way rather than our current manual heuristic design.
- Synthetic Data for RL and Embodied Tasks: While we focused on NLP, similar ideas are extending to robotics and vision (e.g., simulation environments generating scenarios). Cross-modal synthetic data (like pairing generated text with generated images) is another frontier, potentially enabling multimodal models without massive curated datasets.
- Evaluation and Standards: The community will likely develop better standardized evaluations for synthetic data quality. As usage grows, best practices checklists (like the ones we enumerated) might become formalized, and perhaps even regulatory guidance could emerge for AI-generated training data (ensuring it’s properly labeled as synthetic, bias-audited, etc., in high-stakes fields).
In conclusion, using LLMs to generate fine-tuning data is a powerful paradigm that turns the data scarcity problem on its head: we can now create on-demand datasets tailored to our needs. This capability, when used with care and creativity, enables rapid development and alignment of language models to a wide array of tasks and domains. By combining effective prompt engineering, iterative self-improvement, AI and human feedback, and rigorous validation, practitioners can harness synthetic data to build models that are both high-performing and aligned with human values () (Paper: Constitutional AI: Harmlessness from AI Feedback (Anthropic) — AI Alignment Forum). The case studies and techniques detailed in this paper serve as a roadmap for doing so in a responsible and technically rigorous manner.
Large language models thus become not just consumers of data, but co-creators of their own training material – a development that is reshaping how we approach AI training. Embracing this shift will be key to staying at the cutting edge of AI deployment in the industry, enabling AI systems that are more adaptable, more inclusive, and faster to develop than ever before.