DataGen: Unified Synthetic Dataset Generation via Large Language Models

Yue Huang, Siyuan Wu, Chujie Gao, Dongping Chen, Qihui Zhang, Yao Wan, Tianyi Zhou, Chaowei Xiao, Jianfeng Gao, Lichao Sun, Xiangliang Zhang

TL;DR

DataGen is a unified framework that leverages Large Language Models (LLMs) to generate high-quality, diverse, and truthful synthetic datasets. By integrating innovative modules like attribute-guided generation, code-based mathematical verification, and RAG-based factual validation, it moves beyond simple data "shuffling" to create entirely new, controllable data that improves model performance and enables more robust benchmarking.

What Problem Does This Paper Address?

As LLMs grow more powerful, our hunger for high-quality training and evaluation data has become insatiable. Human-generated data is prohibitively expensive and slow to produce. While synthetic data seems like the obvious solution, current methods face a "quality ceiling."

Existing frameworks often suffer from three main issues:

  1. Lack of Generalization: Many methods simply modify or shuffle existing data items rather than creating truly novel scenarios.
  2. Low Diversity: LLMs have a tendency to repeat themselves or stay within a narrow "semantic lane" when asked to generate multiple examples.
  3. The Truthfulness Gap: LLMs hallucinate. If a synthetic dataset contains incorrect labels or factual errors, it can actively degrade the performance of any model trained on it.
Comparison of DataGen with existing synthetic data generation frameworks.

The authors of DataGen set out to build a "unified" pipeline that handles any text dataset type while enforcing strict controls on diversity and accuracy, overcoming the limitations of prior work.

Methods

DataGen operates as a multi-stage pipeline that transforms a base dataset and a set of user constraints into a high-quality synthetic corpus. Its "secret sauce" lies in three specific areas:

The detailed DataGen pipeline, showcasing generation hints, internal evaluation, and post-processing.
  • Diversity via Attributes and Group Checking: To prevent the model from outputting the same "type" of data repeatedly, DataGen uses Attribute-Guided Generation. It asks the LLM to extract or assign specific attributes (e.g., "topic: economics," "difficulty: high") to guide the creative process. Afterward, a Group Checking module uses text embeddings to calculate similarity between items, filtering out duplicates or near-duplicates.
  • Accuracy via Internal Evaluation: DataGen doesn't just take the LLM's first answer as gospel. For math problems, it employs Code-Based Mathematical Assessment, where the LLM writes and executes Python code to verify the correct answer. For factual data, it uses Retrieval-Augmented Generation (RAG) to cross-reference generated statements against Wikipedia.
  • Controllability: Users can input specific constraints (e.g., "ensure the question is in Spanish" or "must contain five options"). The framework uses a self-reflection loop where the LLM evaluates its own output against these constraints and "self-enhances" the data if it falls short.

Datasets

The authors evaluated DataGen across four representative benchmark datasets to test its generative prowess:

  • GSM8K: Grade school math word problems.
  • MMLU: Massive Multitask Language Understanding (general knowledge).
  • TruthfulQA: Testing factual accuracy and common misconceptions.
  • HellaSwag: Commonsense reasoning.

For the Data Augmentation experiments, they expanded to 10 datasets, including MetaTool (agent abilities), MultiNLI (natural language inference), and BBH (Big-Bench Hard).

Key Insights and Ideas

  • Knowledge Richness over Modification: Unlike previous frameworks that mostly paraphrase existing questions, DataGen introduces significant "new" knowledge. The authors found an average entity overlap of only 3.83% between DataGen's output and the original datasets, compared to over 45% in prior work.
  • The "Code-as-Verifier" Paradigm: One of the most effective ways to fix LLM math errors is to stop asking the LLM to do the math and start asking it to write the code that does the math. This boosted label accuracy from 44% to 92% in their tests.
  • Fighting Benchmark Leakage: Because DataGen can generate an infinite stream of new questions that follow the distribution of a benchmark (like MMLU) without being copies of it, it provides a powerful tool for "dynamic evaluation"—testing models on data they couldn't have possibly seen during training.

Key Results

  • Human-Level Quality: In human evaluations, over 80% of the data items enhanced by DataGen’s self-reflection module were rated as superior to the raw LLM outputs.
  • Effective Augmentation: Fine-tuning models (like Llama-3-8B and Mistral-7B) on DataGen-augmented data led to performance gains across all ten tested domains. For example, on the MT-Bench, a Llama-3 model fine-tuned on DataGen data outperformed the version trained on the original Alpaca dataset.
  • Cost Efficiency: The total cost to generate, verify, and enhance one data item is approximately $0.20. While higher than "naive" generation, it remains orders of magnitude cheaper than human annotation.

Limitations and Future Work

Despite its success, the authors acknowledge several hurdles:

  • Knowledge-Intensive Limits: While DataGen helps, it doesn't magically solve the problem of teaching models entirely new facts during fine-tuning. Gains on datasets like TruthfulQA were more modest than on reasoning-heavy tasks.
  • Instruction Following: Even state-of-the-art models like GPT-4 occasionally struggle with complex, nested dataset descriptions, leading to "question errors."
  • Future Directions: The authors suggest expanding DataGen to multimodal data (images/video) and exploring "weak-to-strong" self-alignment, where a model uses DataGen to generate data specifically designed to improve its own weaknesses.

Summary updated

BibTeX
@inproceedings{huang2025datagen,
  author = {Yue Huang and Siyuan Wu and Chujie Gao and Dongping Chen and Qihui Zhang and Yao Wan and Tianyi Zhou and Chaowei Xiao and Jianfeng Gao and Lichao Sun and Xiangliang Zhang},
  title = {{DataGen: Unified Synthetic Dataset Generation via Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=F5R0lG74Tu},
}
Figure