[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,65 +2,228 @@
|
||||
id: wiki-2026-0508-synthetic-data
|
||||
title: Synthetic Data
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-SYDA-001]
|
||||
aliases: [Synthetic Data Generation, Synthetic Dataset, 합성 데이터, Artificial Data]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.96
|
||||
tags: [auto-reinforced, synthetic-data, data-generation, privacy, simulation, data-augmentation, training-data]
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [synthetic-data, data-generation, llm, gan, diffusion, privacy]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: pytorch
|
||||
---
|
||||
|
||||
# [[Synthetic-Data|Synthetic-Data]]
|
||||
# Synthetic Data
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "데이터의 연금술: 현실의 데이터를 수집하기 힘들거나 개인정보 문제가 있을 때, AI가 수학적 법칙과 통계를 활용해 '진짜 같은 가짜 데이터'를 스스로 만들어내어 지능 학습의 한계를 돌파하는 혁신적인 원료."
|
||||
## 매 한 줄
|
||||
> **"매 synthetic data 는 real data 의 statistical surrogate — privacy preserve + scale 의 unlock"**. 매 2026 LLM training 의 절반 이상 synthetic (Phi-4, Llama 4, Claude). 매 GAN→Diffusion→LLM-generated 의 evolution 의 끝. 매 validation gap 의 핵심 risk — 매 model collapse 의 prevent 의 첫 priority.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
합성 데이터(Synthetic-Data)는 실제 사건에 의해 생성된 것이 아니라 알고리즘이나 시뮬레이션에 의해 인위적으로 생성된 데이터입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **가치**:
|
||||
* **Privacy Preservation**: 실제 개인정보 없이도 그와 유사한 통계적 특성을 가진 데이터로 학습 가능. ([[Sustainability|Sustainability]]와 연결)
|
||||
* **Unlimited Scale**: 현실 데이터 수집의 물리적 한계를 넘어 수조 개의 데이터를 순식간에 생성. ([[Scalability|Scalability]]와 연결)
|
||||
* **Edge Case Generation**: 현실에서 드물게 일어나는 위험 상황 데이터를 인위적으로 만들어 강인한 AI 학습. (Risk-[[Management|Management]]와 연결)
|
||||
2. **왜 중요한가?**:
|
||||
* 현대 AI는 데이터 고갈 위기(Data wall)에 직면해 있으며, 합성 데이터는 '지능이 지능을 키우는' 선순환 구조를 만드는 유일한 돌파구이기 때문임.
|
||||
### 매 generation methods (2026)
|
||||
- **LLM-augmented**: Self-Instruct, Evol-Instruct, magpie, persona-based generation. 매 dominant.
|
||||
- **Diffusion (image/video)**: SDXL, FLUX, Sora-style. 매 image 의 standard.
|
||||
- **GAN**: tabular (CTGAN), face (StyleGAN3) 의 niche only — 매 retire 진행.
|
||||
- **Simulation**: Unreal/Unity, NVIDIA Omniverse — 매 robotics·AV 의 sim-to-real.
|
||||
- **Rule/template**: Faker-style, structured format (JSON, SQL) — 매 reliable baseline.
|
||||
- **Distillation**: teacher LLM → student dataset. 매 Phi-series approach.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 가짜 데이터 학습이 성능을 떨어뜨린다고 여겼으나, 현대 정책은 고품질 합성 데이터 정책(Synthetic data quality)만 잘 관리하면 오히려 실제 데이터보다 더 깨끗하고 학습 효율 정책이 좋은 결과를 낸다는 것을 증명함(RL Update).
|
||||
- **정책 변화(RL Update)**: 이제는 단순 생성 정책을 넘어, AI 모델이 스스로 데이터를 만들고(Self-generation) 스스로 검증 및 필터링 정책을 수행하는 '자율 지식 확장 정책'이 주류가 됨.
|
||||
### 매 use cases
|
||||
- **LLM training**: instruction tuning, RLHF, code (Magicoder), math (MetaMathQA).
|
||||
- **Privacy**: medical record (Synthea), financial (DPSDA differential privacy).
|
||||
- **Robotics**: sim-to-real domain randomization, AV (Waymo Carcraft).
|
||||
- **Edge cases**: rare disease, fraud — 매 real data 의 부족 area.
|
||||
- **Augmentation**: minority class oversampling, MixUp.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Sustainability|Sustainability]], [[Scalability|Scalability]], [[Risk-Management|Risk-Management]], Deep Learning (DL), Simulation
|
||||
- **Modern Tech/Tools**: GANs (Generative Adversarial Networks), Diffusion models, NVIDIA Omniverse.
|
||||
---
|
||||
### 매 validation (critical)
|
||||
- **Fidelity**: marginal/joint distribution match (KS test, MMD, FID, KID).
|
||||
- **Utility**: TSTR (Train Synthetic Test Real) — downstream metric.
|
||||
- **Privacy**: membership inference, NN distance (DCR), k-anonymity check.
|
||||
- **Diversity**: coverage, mode collapse detection.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 model collapse
|
||||
- **Definition**: synthetic-on-synthetic training 의 distribution narrow.
|
||||
- **Mitigation**: real data anchor (Shumailov 2024 — 1% real / 99% synthetic 의 collapse 의 stop).
|
||||
- **Provenance**: C2PA / watermark 의 future synthetic detection.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### 매 응용
|
||||
1. **LLM instruction**: Self-Instruct + critic filter → 100k high-quality pairs.
|
||||
2. **Tabular**: CTGAN / TVAE → DP-protected medical record.
|
||||
3. **AV sim**: Carla / NVIDIA DRIVE Sim — millions of edge case km.
|
||||
4. **Image augmentation**: SDXL controlnet → balanced classification dataset.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
### 1. LLM Self-Instruct (2026 magpie style)
|
||||
```python
|
||||
from anthropic import Anthropic
|
||||
import json
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
client = Anthropic()
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
def magpie_generate(seed_topics, n_per_topic=20):
|
||||
"""Magpie: prompt LLM with empty user → it generates instruction itself."""
|
||||
pairs = []
|
||||
for topic in seed_topics:
|
||||
for _ in range(n_per_topic):
|
||||
# First call: model invents user prompt
|
||||
user_msg = client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
max_tokens=200,
|
||||
messages=[{"role": "user", "content": f"Topic: {topic}\n\nGenerate one user question about this topic:"}],
|
||||
).content[0].text
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
# Second call: model answers it
|
||||
answer = client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
max_tokens=800,
|
||||
messages=[{"role": "user", "content": user_msg}],
|
||||
).content[0].text
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
pairs.append({"prompt": user_msg, "completion": answer})
|
||||
return pairs
|
||||
```
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
### 2. Evol-Instruct (depth/breadth evolution)
|
||||
```python
|
||||
EVOLVE_PROMPT = """Rewrite the following instruction to make it more complex
|
||||
(add constraints, deeper reasoning, edge cases). Output only the new instruction.
|
||||
|
||||
Original: {seed}
|
||||
Evolved:"""
|
||||
|
||||
def evol(seed: str, rounds: int = 3):
|
||||
cur = seed
|
||||
for _ in range(rounds):
|
||||
cur = llm(EVOLVE_PROMPT.format(seed=cur))
|
||||
return cur
|
||||
```
|
||||
|
||||
### 3. Critic filter (rejection sampling)
|
||||
```python
|
||||
JUDGE = """Rate this instruction-response pair 1-5 on:
|
||||
- correctness, helpfulness, no hallucination.
|
||||
Output JSON {"score": int, "reason": str}.
|
||||
|
||||
Q: {q}
|
||||
A: {a}"""
|
||||
|
||||
def filter_pairs(pairs, threshold=4):
|
||||
keep = []
|
||||
for p in pairs:
|
||||
verdict = json.loads(llm(JUDGE.format(q=p["prompt"], a=p["completion"])))
|
||||
if verdict["score"] >= threshold:
|
||||
keep.append(p)
|
||||
return keep
|
||||
```
|
||||
|
||||
### 4. CTGAN tabular synthesis
|
||||
```python
|
||||
from sdv.single_table import CTGANSynthesizer
|
||||
from sdv.metadata import SingleTableMetadata
|
||||
import pandas as pd
|
||||
|
||||
real = pd.read_csv("medical.csv")
|
||||
meta = SingleTableMetadata()
|
||||
meta.detect_from_dataframe(real)
|
||||
|
||||
syn = CTGANSynthesizer(meta, epochs=300, batch_size=500)
|
||||
syn.fit(real)
|
||||
fake = syn.sample(num_rows=10000)
|
||||
|
||||
# Quality check
|
||||
from sdv.evaluation.single_table import evaluate_quality
|
||||
report = evaluate_quality(real, fake, meta)
|
||||
print(report.get_score())
|
||||
```
|
||||
|
||||
### 5. Diffusion-based image synth (FLUX)
|
||||
```python
|
||||
import torch
|
||||
from diffusers import FluxPipeline
|
||||
|
||||
pipe = FluxPipeline.from_pretrained(
|
||||
"black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16
|
||||
).to("cuda")
|
||||
|
||||
prompts = [f"medical X-ray of {cond}, clear, anonymized" for cond in conditions]
|
||||
images = pipe(prompts, num_inference_steps=20, guidance_scale=3.5).images
|
||||
```
|
||||
|
||||
### 6. TSTR validation
|
||||
```python
|
||||
from sklearn.ensemble import GradientBoostingClassifier
|
||||
from sklearn.metrics import roc_auc_score
|
||||
|
||||
# Train on synthetic
|
||||
clf = GradientBoostingClassifier()
|
||||
clf.fit(syn_X, syn_y)
|
||||
|
||||
# Test on real held-out
|
||||
auc = roc_auc_score(real_y_test, clf.predict_proba(real_X_test)[:, 1])
|
||||
print(f"TSTR AUC: {auc:.3f}") # close to TRTR baseline → high utility
|
||||
```
|
||||
|
||||
### 7. Membership inference attack (privacy check)
|
||||
```python
|
||||
import numpy as np
|
||||
from sklearn.neighbors import NearestNeighbors
|
||||
|
||||
def dcr_score(real, synthetic):
|
||||
"""Distance to Closest Record — high = better privacy."""
|
||||
nn = NearestNeighbors(n_neighbors=1).fit(real)
|
||||
dists, _ = nn.kneighbors(synthetic)
|
||||
return np.mean(dists)
|
||||
```
|
||||
|
||||
### 8. Real-data anchor (collapse prevention)
|
||||
```python
|
||||
def safe_mix(synthetic, real, real_ratio=0.1):
|
||||
"""Shumailov 2024: small real anchor prevents collapse."""
|
||||
n_real = int(len(synthetic) * real_ratio / (1 - real_ratio))
|
||||
real_sample = real.sample(n=min(n_real, len(real)))
|
||||
return pd.concat([synthetic, real_sample]).sample(frac=1)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| LLM instruction tuning | Magpie + Evol + critic filter |
|
||||
| Tabular privacy | CTGAN + DP-SGD + DCR check |
|
||||
| Image augment | FLUX/SDXL + controlnet |
|
||||
| Robotics | Sim (Omniverse) + domain randomization |
|
||||
| Fast structured | Faker / template |
|
||||
|
||||
**기본값**: LLM-generated + critic filter + real anchor (≥5%).
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Data-Generation]] · [[Machine-Learning-Data]]
|
||||
- 변형: [[Self-Instruct]] · [[Evol-Instruct]] · [[CTGAN]]
|
||||
- 응용: [[LLM-Training]] · [[Privacy-Preserving-ML]] · [[Sim-to-Real]]
|
||||
- Adjacent: [[Differential-Privacy]] · [[Model-Collapse]] · [[Data-Augmentation]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: instruction generation (Self-Instruct), critic judging, edge case ideation.
|
||||
**언제 X**: privacy-sensitive numeric synth (LLM 의 number 의 hallucinate — CTGAN/DP method 사용).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Real data anchor 없 synthetic-only training**: 매 model collapse — distribution narrow.
|
||||
- **Validation skip**: 매 unsafe deploy. TSTR / FID / DCR 의 minimum 3 metric.
|
||||
- **Privacy claim without DP**: 매 pure synthetic ≠ private — membership inference 의 leak.
|
||||
- **Single-method generation**: 매 mode-collapse risk. ensemble / diversity check.
|
||||
- **Watermark / provenance 무시**: 매 future detection 의 impossible — C2PA 의 attach.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Shumailov "AI models collapse" Nature 2024, Magpie paper 2024, Microsoft Phi-4 tech report 2025, NIST SP 800-188).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — synthetic data canonical (LLM-generated + GAN + diffusion + collapse) |
|
||||
|
||||
Reference in New Issue
Block a user