# Synthetic Data Kit

> Generate and curate synthetic QA and reasoning data to fine-tune LLMs

- Category: Data & Labeling / Synthetic Data
- Language: Python
- Repository: https://github.com/meta-llama/synthetic-data-kit
- Canonical page: https://ai-tldr.dev/tools/synthetic-data-kit/

## In short

Synthetic Data Kit is a command-line tool from Meta for building synthetic datasets to fine-tune large language models. It takes your existing files, uses an LLM to generate question-answer pairs and reasoning examples, filters them for quality, and saves the result in formats that common fine-tuning workflows expect. It sits in the Synthetic Data category of the Data & Labeling tools and is open-source, written in Python.

## Overview

Synthetic Data Kit is a command-line tool from Meta for building synthetic datasets to fine-tune large language models. It takes your existing files, uses an LLM to generate question-answer pairs and reasoning examples, filters them for quality, and saves the result in formats that common fine-tuning workflows expect.

It is aimed at developers and ML engineers who already have fine-tuning tooling but lack data shaped the right way. Most datasets are not structured as user/assistant threads, and this kit handles that conversion so you can move straight to training.

Within the synthetic data and labeling space, it covers the data-prep step end to end through a small set of CLI commands: ingest, create, curate, and save-as. You point it at a local vLLM server or an external API endpoint to do the generation.

## What it does

- Four-command pipeline: ingest, create, curate, and save-as cover the full data-prep flow
- Ingests multiple file types including PDF, HTML, DOCX, PPTX, and TXT
- Generates QA pairs, Chain-of-Thought reasoning examples, or summary formats
- Curates examples using an LLM as a judge with a configurable quality threshold
- Saves to fine-tuning formats such as Alpaca and OpenAI-style chat, including HF datasets
- Works with a local vLLM server or any external API endpoint, configured via YAML or CLI flags

## Getting started

Install the package, point it at an LLM backend, then run the four-stage pipeline on your files.

1. Install from PyPI

   Create an environment and install the package. You can also clone the repo and run pip install -e . from source.

```bash
conda create -n synthetic-data python=3.10
conda activate synthetic-data
pip install synthetic-data-kit
```

2. Start an LLM backend

   The tool needs an LLM to generate data. To run locally, start a vLLM server (a Hugging Face token is required to pull the model).

```bash
vllm serve meta-llama/Llama-3.3-70B-Instruct --port 8000
```

3. Run the pipeline

   Ingest a document, create QA pairs, curate by quality, then save in a fine-tuning format. Use system-check first to confirm the backend is reachable.

```bash
synthetic-data-kit system-check
synthetic-data-kit ingest docs/report.pdf
synthetic-data-kit create data/parsed/report.lance --type qa
synthetic-data-kit curate data/generated/report_qa_pairs.json
synthetic-data-kit save-as data/curated/report_cleaned.json --format alpaca --storage hf
```

## When to use it

- Turn a folder of PDFs or research papers into QA pairs for fine-tuning a domain-specific model
- Generate Chain-of-Thought reasoning traces to add task-specific reasoning to a Llama model
- Convert unstructured documents into Alpaca or OpenAI-style training data your fine-tuning workflow can read
- Use an LLM as a judge to filter a generated dataset down to high-quality examples
