Skip to main content

Synthetic Data Generation

Project description

Synthetic Data Generation for LLMs

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/sdg_hub/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.

SDG Workflow: Full Workflow Automation

Pipelines are further orchestrated into SDG Workflows, enabling seamless end-to-end processing. When invoking sdg_hub.generate, it triggers a pipeline/ or multiple pipelines that processes data through all the configured blocks.


YAML-Based Workflow: The Flow

The YAML configuration file, known as the Flow, is central to defining data generation workflows in the SDG Framework. A Flow 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.

Key Features of a Flow

  1. Modular Design:

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

    • Blocks and configurations defined in a Flow 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 Flow

Here is an example of a Flow configuration:

- block_type: LLMBlock
  block_config:
    block_name: gen_questions
    config_path: configs/skills/freeform_questions.yaml
    model_id: mistralai/Mixtral-8x7B-Instruct-v0.1
    output_cols:
      - question
    batch_kwargs:
      num_samples: 30
  drop_duplicates:
    - question
- block_type: FilterByValueBlock
  block_config:
    block_name: filter_questions
    filter_column: score
    filter_value: 1.0
    operation: operator.eq
    convert_dtype: float
    batch_kwargs:
      num_procs: 8
  drop_columns:
    - evaluation
    - score
    - num_samples
- block_type: LLMBlock
  block_config:
    block_name: gen_responses
    config_path: configs/skills/freeform_responses.yaml
    model_id: mistralai/Mixtral-8x7B-Instruct-v0.1
    output_cols:
      - response

Dataflow and Storage

  • Data Representation: Dataflow 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.

Examples

For sample use cases and implementation examples, please refer to the examples directory. This directory contains various examples demonstrating different workflows and use cases of the SDG Framework.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sdg_hub-0.1.0a3.tar.gz (4.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sdg_hub-0.1.0a3-py3-none-any.whl (97.8 kB view details)

Uploaded Python 3

File details

Details for the file sdg_hub-0.1.0a3.tar.gz.

File metadata

  • Download URL: sdg_hub-0.1.0a3.tar.gz
  • Upload date:
  • Size: 4.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sdg_hub-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 0e1cc3a2fed7d1efc0099f7b68bd619bf9d3720f6c977ca51f888a90222bfdd9
MD5 643b87102359ab85eeba200c8b912d21
BLAKE2b-256 b1b460a003ff894b1dacfdcc9c1d2e1245ae153ddfb398ac277538fa58fc1c19

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdg_hub-0.1.0a3.tar.gz:

Publisher: pypi.yaml on Red-Hat-AI-Innovation-Team/sdg_hub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sdg_hub-0.1.0a3-py3-none-any.whl.

File metadata

  • Download URL: sdg_hub-0.1.0a3-py3-none-any.whl
  • Upload date:
  • Size: 97.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sdg_hub-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 65cc9acc5f802084235fa81069c6916561a5659d1f41d3f84934e41d3ba0998b
MD5 d8da5a9eb2f8e9d6a989bc1eafe555ef
BLAKE2b-256 bb59a641dd786786de69c8298c71adbc1c57c7603943978402fa912dc0f8bdeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdg_hub-0.1.0a3-py3-none-any.whl:

Publisher: pypi.yaml on Red-Hat-AI-Innovation-Team/sdg_hub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page