Skip to content

Datafast

Generate high-quality and diverse synthetic data with LLMs.

Datafast is a Python library for generating synthetic datasets with LLMs.

You assemble building blocks for data operations into a custom pipeline that generates a synthetic dataset matching your project's needs. It works with open-weight and proprietary models.

Start with seeds or the dimensions your dataset must cover. Connect LLMs and data processing steps for filtering, transformations, and annotations, then run the pipeline. Save the dataset locally or push it to the Hugging Face Hub.

Intended Use Cases

  • Get initial evaluation text data instead of starting your LLM project blind.
  • Increase diversity and coverage of another dataset by generating additional data.
  • Experiment and test quickly LLM-based applications, and before shipping to production.
  • Make your own datasets to fine-tune and evaluate LLMs and agents.
  • Model distillation

🌟 Star this repo if you find this useful!

Example Pipeline

The simple pipeline below combines seeds topics and difficulty levels to generate questions and answers, written to a JSONL file.

from datafast import LLMStep, Seed, Sink, openai

pipeline = (
    # Create two columns combining topic x level (the 'seeds')
    Seed.product(
        Seed.values("topic", ["photosynthesis", "plate tectonics", "virus"]),
        Seed.values("level", ["beginner", "advanced"]),
    )
    # Use seeds in LLM prompt to generate structured outputs of Q&As.
    >> LLMStep(
        prompt="Write one {level} exam question about {topic}, with its answer. "
               "Return JSON with fields question and answer.",
        input_columns=["topic", "level"],
        output_columns=["question", "answer"],
        parse_mode="json",
        model=openai(),
    )
    # Save locally to a file
    >> Sink.jsonl("questions.jsonl")
)

# Run the pipeline
pipeline.run()

Why pipelines

AI projects all need something special in their datasets. Whether this is for training, fine tuning, evaluation, or just to test the application coverage in realistic conditions. So we need something highly flexible and modular: Like assembling LEGOs, datafast provides building blocks so you can build your synthetic data pipeline that matches your needs.

Where to start?

Coming soon

  • An llms.txt so you can ask questions about of docs to your favorite AI.
  • A datafast SKILL so your coding agent can build the pipeline the right way under your supervision.
  • Integration with llama.cpp, vLLM