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:
- Modular Design: Highly composable blocks form the building units of the framework, allowing users to build workflows effortlessly.
- No-Code Workflow Creation: Specify workflows using simple YAML configuration files.
- Scalability and Performance: Optimized for handling large-scale workflows with millions of records.
Framework Architecture
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
-
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.
-
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.
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sdg_hub-0.1.0a2.tar.gz.
File metadata
- Download URL: sdg_hub-0.1.0a2.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a022f06fc504b01401cbb90474506e4c7cd5b2f529de644b995a3697c8ef11bc
|
|
| MD5 |
b2d1247366e50477dff488327660778e
|
|
| BLAKE2b-256 |
882103afd3edc0c46130b3858cfb8ca51751d8ef6bb4edf478f82f1f439d65b5
|
Provenance
The following attestation bundles were made for sdg_hub-0.1.0a2.tar.gz:
Publisher:
pypi.yaml on Red-Hat-AI-Innovation-Team/sdg_hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdg_hub-0.1.0a2.tar.gz -
Subject digest:
a022f06fc504b01401cbb90474506e4c7cd5b2f529de644b995a3697c8ef11bc - Sigstore transparency entry: 197495216
- Sigstore integration time:
-
Permalink:
Red-Hat-AI-Innovation-Team/sdg_hub@d5dd779314fe4e721315503b53811aca8c0ad7d1 -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/Red-Hat-AI-Innovation-Team
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@d5dd779314fe4e721315503b53811aca8c0ad7d1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sdg_hub-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: sdg_hub-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 105.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d6c8cf1a1c5a579448466cc6634bcd45a8c2b0d2c753da81300468914a06657
|
|
| MD5 |
591e7636b17e28269bbbbd2c14b70afd
|
|
| BLAKE2b-256 |
a282f55b831ade9e10c2ed895617832030e9118049271027dbaeb9d3580f80a1
|
Provenance
The following attestation bundles were made for sdg_hub-0.1.0a2-py3-none-any.whl:
Publisher:
pypi.yaml on Red-Hat-AI-Innovation-Team/sdg_hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdg_hub-0.1.0a2-py3-none-any.whl -
Subject digest:
8d6c8cf1a1c5a579448466cc6634bcd45a8c2b0d2c753da81300468914a06657 - Sigstore transparency entry: 197495220
- Sigstore integration time:
-
Permalink:
Red-Hat-AI-Innovation-Team/sdg_hub@d5dd779314fe4e721315503b53811aca8c0ad7d1 -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/Red-Hat-AI-Innovation-Team
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@d5dd779314fe4e721315503b53811aca8c0ad7d1 -
Trigger Event:
release
-
Statement type: