Hugging Face Synthetic Data Generator

Hugging Face has launched the Synthetic Data Generator, a no-code application designed to let users create custom datasets using Large Language Models (LLMs) via natural language prompts. This tool simplifies the process of generating artificial information that mimics real-world data, enabling users to overcome data limitations by expanding or enhancing existing datasets without writing code.

Core Functionality and Pipeline

The Synthetic Data Generator converts a user's custom prompt into a usable dataset through a synthetic data pipeline. This process is powered by the distilabel framework and the free Hugging Face text-generation API.

Supported Dataset Tasks

The tool currently supports two primary types of data generation:

  • Text Classification: This process involves two LLM-driven steps: generating diverse texts and then assigning labels to those texts. An example of this is the argilla/synthetic-text-classification-news dataset, which categorizes synthetic news articles into eight classes.
  • Chat Datasets: These datasets are used for supervised fine-tuning (SFT), allowing LLMs to interact via chat interfaces. An example is the argilla/synthetic-sft-customer-support-single-turn dataset, designed for customer support scenarios.

Using the free Hugging Face API, the tool typically generates approximately 50 samples per minute for text classification and 20 samples per minute for chat datasets.

The Three-Step Generation Process

The application guides users through a streamlined workflow to move from a prompt to a finished dataset:

  1. Describe Your Dataset: Users provide a detailed description of the goal and the type of assistant they want, including example use cases.
  2. Configure and Refine: The tool generates a sample dataset based on the description. Users can then adjust the system prompt and task-specific settings, iterating by saving and regenerating the sample until the results are satisfactory.
  3. Generate and Push: Users define the dataset name, organization, the number of samples to generate, and the "temperature" (which controls the creativity of the generation). The final output is saved directly to Argilla and the Hugging Face Hub.

Review, Curation, and Model Training

To ensure data quality, the generator integrates directly with Argilla, a collaboration tool for AI engineers and domain experts. This integration allows users to explore and evaluate synthetic datasets using semantic search and composable filters. Once curated, the dataset can be exported back to the Hugging Face Hub for model training.

For the training phase, Hugging Face suggests using AutoTrain, a no-code tool for creating AI models. Users can select the task (e.g., Text Classification), provide the dataset source, and train a model on Hugging Face CPU hardware.

Advanced Customization and Deployment

For technical users, the Synthetic Data Generator offers several advanced options to scale and customize the pipeline:

Performance and Accuracy Tuning

By duplicating the tool as a private Space and modifying environment variables, users can:

  • Change Models: Switch from the default meta-llama/Llama-3.1-8B-Instruct to other models, such as meta-llama/Llama-3.1-70B-Instruct or OpenAI models (e.g., gpt-4o by setting the BASE_URL to https://api.openai.com/v1/).
  • Increase Throughput: Adjust the BATCH_SIZE (default is 5) to a higher value to increase samples generated per minute, depending on API provider limits.
  • Private Integration: Connect to a private Argilla instance by configuring ARGILLA_URL and ARGILLA_API_KEY.

Local Deployment and Open Source

The tool is released under an Apache 2 license and is available on GitHub. It can be installed as a Python package via pip install synthetic-dataset-generator for local modification and adaptation.

Future Roadmap

Hugging Face is actively working on adding new capabilities to the Synthetic Data Generator, including:

  • Retrieval Augmented Generation (RAG) support.
  • Custom evaluations using "LLMs as a Judge".

Sources