# distilabel

> Build synthetic-data and AI-feedback pipelines that run on any LLM

- Category: Data & Labeling / Synthetic Data
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/argilla-io/distilabel
- Website: https://distilabel.argilla.io
- Canonical page: https://ai-tldr.dev/tools/distilabel/

## In short

distilabel is a Python framework for generating synthetic data and AI feedback. It sits in the Synthetic Data category of the Data & Labeling tools and is open-source, written in Python and licensed Apache-2.0. To get started: install distilabel.

## Overview

distilabel is a Python framework for generating synthetic data and AI feedback. You write pipelines in code that call large language models to create new examples, label existing ones, and judge their quality, then export the result as a dataset you can use for fine-tuning or evaluation.

It is aimed at engineers and researchers who need to build training and preference datasets without labeling everything by hand. It works for traditional NLP tasks like classification and extraction, as well as generative tasks like instruction following, dialogue, and LLM-as-a-judge scoring.

As a synthetic-data and labeling tool, distilabel sits between your raw inputs and your model training. It uses one unified API across many LLM providers (OpenAI, Anthropic, Mistral, Hugging Face, Ollama, vLLM, and others), so you can swap models without rewriting your pipeline.

## What it does

- Pipeline API that chains steps and tasks such as TextGeneration to produce and process data
- One unified interface to many LLM backends, including OpenAI, Anthropic, Mistral, Cohere, Groq, Ollama, vLLM, and Hugging Face Inference Endpoints
- Built-in tasks for synthetic data generation, labeling, and AI feedback (LLM-as-a-judge)
- Optional extras let you install only the LLM integrations you need (for example, hf-inference-endpoints, openai, vllm)
- Integrates with the Hugging Face datasets ecosystem for loading inputs and pushing results to the Hub
- Designed for scalable pipelines with fault tolerance, based on published research methods

## Getting started

Install distilabel with the LLM integration you want, then define a Pipeline and run it over a dataset. The example below uses Hugging Face Inference Endpoints.

1. Install distilabel

   Requires Python 3.9 or newer. Add an extra in brackets to pull in a specific LLM integration, such as hf-inference-endpoints.

```bash
pip install "distilabel[hf-inference-endpoints]" --upgrade
```

2. Define and run a pipeline

   Wrap your steps in a Pipeline context, attach an LLM to a task like TextGeneration, then call pipeline.run on a dataset and push the result to the Hub.

```python
from datasets import load_dataset

from distilabel.models import InferenceEndpointsLLM
from distilabel.pipeline import Pipeline
from distilabel.steps.tasks import TextGeneration

with Pipeline() as pipeline:
    TextGeneration(
        llm=InferenceEndpointsLLM(
            model_id="meta-llama/Meta-Llama-3.1-8B-Instruct",
            generation_kwargs={"temperature": 0.7, "max_new_tokens": 512},
        ),
    )

if __name__ == "__main__":
    dataset = load_dataset("distilabel-internal-testing/instructions", split="test")
    distiset = pipeline.run(dataset=dataset)
    distiset.push_to_hub(repo_id="distilabel-example")
```

## When to use it

- Generate synthetic instruction or dialogue datasets to fine-tune your own LLM
- Build preference (DPO) datasets by having an LLM judge and rank candidate responses
- Label or filter existing data at scale using AI feedback instead of manual annotation
- Create task-specific evaluation sets that follow methods from recent research papers
