Skip to main content

Synthetic Data Generation (SDG)

Lint Build Release License

e2e-nvidia-t4-x1.yaml on main e2e-nvidia-l4-x1.yaml on main e2e-nvidia-l40s-x4.yml on main

The SDG Framework is a modular, scalable, and efficient solution for creating synthetic data generation workflows in a “no-code” manner. At its core, this framework is designed to simplify data creation for LLMs, allowing users to chain computational units and build powerful pipelines for generating data and processing tasks.

Core Design Principles

The framework is built around the following principles:

  1. Modular Design: Highly composable blocks form the building units of the framework, allowing users to build workflows effortlessly.
  2. No-Code Workflow Creation: Specify workflows using simple YAML configuration files.
  3. Scalability and Performance: Optimized for handling large-scale workflows with millions of records.

Framework Architecture

overview

Blocks: The Fundamental Unit

At the heart of the framework is the Block. Each block is a self-contained computational unit that performs specific tasks, such as:

  • Making LLM calls
  • Performing data transformations
  • Applying filters

Blocks are designed to be:

  • Modular: Reusable across multiple pipelines.
  • Composable: Easily chained together to create workflows.

These blocks are implemented in the src/instructlab/sdg/blocks directory.

Pipelines: Higher-Level Abstraction

Blocks can be chained together to form a Pipeline. Pipelines enable:

  • Linear or recursive chaining of blocks.
  • Execution of complex workflows by chaining multiple pipelines together.

There are four default pipelines shipped in SDG: simple, full, eval and llama. Each pipeline requires specific hardware specifications.

Simple Pipeline

The simple pipeline is designed to be used with quantized Merlinite as the teacher model. It enables basic data generation results on low-end consumer grade hardware, such as laptops and desktops with small or no discrete GPUs.

Full Pipeline

The full pipeline is designed to be used with Mixtral-8x7B-Instruct-v0.1 as the the teacher model, but has also been successfully tested with smaller models such as Mistral-7B-Instruct-v0.2 and even some quantized versions of the two teacher models. This is the preferred data generation pipeline on higher end consumer grade hardware and all enterprise hardware.

Eval Pipeline

The eval pipeline is used to generate MMLU benchmark data that can be used to later evaluate a trained model on your knowledge dataset. It does not generate data for use during model training.

Llama Pipeline

The Llama pipeline is designed for use with the Llama-3.3-70B-Instruct as the teacher model. Currently, our support for Llama pipelines focuses on generating knowledge pipelines, aimed at producing high-quality, context-aware educational content on higher-end consumer hardware and enterprise systems.

Note: Support for Llama-based skills pipelines is still under development and will be rolled out in future releases.


YAML-Based Workflow: The Pipeline Configuration

The Pipeline YAML configuration file is central to defining data generation workflows in the SDG Framework. This configuration file describes how blocks and pipelines are orchestrated to process and generate data efficiently. By leveraging YAML, users can create highly customizable and modular workflows without writing any code.

Pipeline configuration must adhere to our JSON schema to be considered valid.

Key Features of Pipeline Configuration

  1. Modular Design:

    • Pipelines are composed of blocks, which can be chained together.
    • Each block performs a specific task, such as generating, filtering, or transforming data.
  2. Reusability:

    • Blocks and their configurations can be reused across different workflows.
    • YAML makes it easy to tweak or extend workflows without significant changes.
  3. Ease of Configuration:

    • Users can specify block types, configurations, and data processing details in a simple and intuitive manner.

Sample Pipeline Configuration

Here is an example of a Pipeline configuration:

version: "1.0"
blocks:
  - name: gen_questions
    type: LLMBlock
    config:
      config_path: configs/skills/freeform_questions.yaml
      output_cols:
        - question
      batch_kwargs:
        num_samples: 30
    drop_duplicates:
      - question
  - name: filter_questions
    type: FilterByValueBlock
    config:
      filter_column: score
      filter_value: 1.0
      operation: eq
      convert_dtype: float
    drop_columns:
      - evaluation
      - score
      - num_samples
  - name: gen_responses
    type: LLMBlock
    block_config:
      config_path: configs/skills/freeform_responses.yaml
      output_cols:
        - response

Data Flow and Storage

  • Data Representation: Data flow between blocks and pipelines is handled using Hugging Face Datasets, which are based on Arrow tables. This provides:

    • Native parallelization capabilities (e.g., maps, filters).
    • Support for efficient data transformations.
  • Data Checkpoints: Intermediate caches of generated data. Checkpoints allow users to:

    • Resume workflows from the last successful state if interrupted.
    • Improve reliability for long-running workflows.

Installing the SDG library

Clone the library and navigate to the repo:

git clone https://github.com/instructlab/sdg
cd sdg

Install the library:

pip install .

Using the library

You can import SDG into your Python files with the following items:

 from instructlab.sdg.generate_data import generate_data
 from instructlab.sdg.utils import GenerateException

Repository structure

|-- src/instructlab/ (1)
|-- docs/ (2)
|-- scripts/ (3)
|-- tests/ (4)
  1. Contains the SDG code that interacts with InstructLab.
  2. Contains documentation on various SDG methodologies.
  3. Contains some utility scripts, but not part of any supported API.
  4. Contains all the tests for the SDG repository.

Release files for instructlab-sdg 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for instructlab-sdg 0.8.3
File Size Uploaded
instructlab_sdg-0.8.3.tar.gz 3.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for instructlab-sdg 0.8.3
File Interpreter ABI Platform
instructlab_sdg-0.8.3-py3-none-any.whl Python 3 none any Details

Total release size: 3.5 MB

Release files / instructlab_sdg-0.8.3.tar.gz

Download URL instructlab_sdg-0.8.3.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
6c5d038f87f55892450775e3b58e6b9425fad952d1b8244252e094173cdabf0b
BLAKE2b-256 checksum
How to use checksums
0ed76d4523d42935dde1f2db2453615a9a367751816a4ce993f24c5ccaeb8f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.

Transparency log

Release files / instructlab_sdg-0.8.3-py3-none-any.whl

Download URL instructlab_sdg-0.8.3-py3-none-any.whl
Size 107.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0a1df2c8b47a9929e27750ccbe1c908dd5755ac9fbefce2027080df2e13b146
BLAKE2b-256 checksum
How to use checksums
1f3512be45620e704d4c66cc7387b842dd92176a6b4049ffc39ec971c997e8a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page