Synthetic Data and Data Augmentation
Why Synthetic Data? Real data is limited, expensive, and may have privacy concerns. Synthetic data enables training at scale.
Data Augmentation
Image Augmentation
from torchvision import transforms
augment = transforms.Compose([
transforms.RandomHorizontalFlip(),
transforms.RandomRotation(15),
transforms.ColorJitter(brightness=0.2, contrast=0.2),
transforms.RandomResizedCrop(224, scale=(0.8, 1.0)),
])
Text Augmentation
def text_augment(text):
augmentations = [
synonym_replacement,
random_insertion,
random_swap,
random_deletion,
back_translation,
]
return random.choice(augmentations)(text)
LLM-Generated Augmentation
def llm_augment(text):
return llm.generate(f"""
Paraphrase this text while preserving the meaning:
{text}
Paraphrase:
""")
Synthetic Data Generation
Tabular Data
from sdv.single_table import GaussianCopulaSynthesizer
synthesizer = GaussianCopulaSynthesizer(metadata)
synthesizer.fit(real_data)
synthetic_data = synthesizer.sample(1000)
Image Generation
# Use diffusion models to generate training images
synthetic_images = diffusion_model.generate(
prompts=["a car on a highway", "a red sports car"],
num_images_per_prompt=100
)
Instruction Data
def generate_instruction_data(domain, n):
return llm.generate(f"""
Generate {n} diverse instruction-response pairs for {domain}.
Format as JSON: [{{"instruction": "...", "response": "..."}}]
""")
Quality Considerations
| Aspect | Method |
|---|---|
| Diversity | Measure distribution coverage |
| Realism | Human evaluation, discriminators |
| Privacy | Differential privacy, membership inference |
| Utility | Downstream task performance |
Use Cases
| Domain | Application |
|---|---|
| Healthcare | Replace sensitive patient data |
| Finance | Fraud detection training |
| Autonomous driving | Edge case scenarios |
| NLP | Low-resource languages |
Best Practices
- Validate synthetic data quality with real data holdout
- Mix synthetic with real when possible
- Use domain randomization for sim-to-real
- Monitor for distribution shift
synthetic datadata augmentationgen
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.