5300: Synthetic Data & Advanced Training¶
Module Overview¶
This module covers advanced training techniques including synthetic data generation, knowledge distillation, distributed training, and federated learning. You'll learn to train and deploy models at scale with limited resources.
Why This Matters:
- Real data is expensive, private, or scarce
- Synthetic data can augment or replace training data
- Distributed training enables large-scale model training
- Federated learning allows privacy-preserving model improvement
Learning Objectives¶
After completing this module, you will be able to:
- Knowledge Distillation: Train smaller models using larger teacher models
- Distributed Training: Configure multi-GPU and multi-node training
- Federated Learning: Implement privacy-preserving distributed training
- Synthetic Data: Generate training data from teacher model outputs
- Self-Instruct & Collapse: Grow instruction pools from seeds and price the recursion's collapse tax
- Advanced Optimization: Apply state-of-the-art training techniques
Module Contents¶
5301: Knowledge Distillation¶
Teacher-Student Training Paradigm
- Distillation theory and objectives
- Temperature-scaled softmax
- Different distillation targets (logits, hidden states, attention)
- Multi-teacher distillation
- Evaluation of distilled models
Experiments:
- Implement knowledge distillation
- Train student model from teacher
- Compare distillation strategies
- Measure size vs quality tradeoffs
5302: Distributed Training¶
Orchestrating Distributed Training Runs
- Distributed training strategies overview
- K3s cluster training
- Fine-tuning workflows
- Orchestration with Ray
- Monitoring, logging, and performance optimization
Experiments:
- Set up DDP training
- Implement FSDP for large models
- Optimize communication overhead
- Handle training failures
5303: Federated Learning¶
Privacy-Preserving Distributed Training
- Federated learning fundamentals
- Federated averaging (FedAvg)
- The non-IID reality of client data
- Privacy: what FedAvg does and does not give you
- Federated LLM fine-tuning and orchestration with Flower
Experiments:
- Implement federated averaging
- Simulate federated training
- Apply differential privacy
- Analyze convergence
5304: Self-Instruct and Model Collapse¶
Growing Instruction Data Without Losing the Distribution
- The self-instruct bootstrap: seed tasks, pool sampling, and the 0.7 similarity keep rule
- Model collapse: fitting your own output is an absorbing process, tails first
- The ten-percent real-data anchor and what its budget line flattens
- Downstream evaluation: train on the mix, measure on a gold holdout
- The campaign ledger: $1,603 to generate against $524,450 to write
Experiments:
- Run the four-round bootstrap and read the filter-rejection curve
- Walk the recursion and count the type extinction
- Price the anchor against the collapse tax
Prerequisites¶
Before starting this module, ensure you have:
- Module 2100: Calculus for Deep Learning (optimization)
- Module 2200: Deep Learning Frameworks (PyTorch proficiency)
- Module 2400: LLM Pretraining (distributed training basics)
- Module 4100: Low-Bit Quantization (for model compression)
- Access to multiple GPUs or compute cluster
Review: PREREQUISITES.md for detailed requirements.
Assessment¶
Quiz¶
- Format: 20 multiple-choice questions
- Passing Score: 80% (16/20)
- Topics: Distillation, distributed orchestration, federated learning
- Location: 5300: Synthetic Data & Advanced Training - Quiz
Practice Exercises¶
- Format: Advanced training projects
- Duration: 5 hours
- Topics:
- Implement knowledge distillation
- Set up distributed training
- Build federated learning system
- Generate synthetic training data
- Location: 5300: Synthetic Data Generation - Practice
Related Modules¶
This module connects to:
- 2400: LLM Pretraining (large-scale training)
- 4100: Low-Bit Quantization (model compression)
- 5200: LLM Alignment (synthetic preference data)
- 6100: Vector Embeddings (embedding distillation)
Time Commitment¶
| Activity | Time |
|---|---|
| 5301: Knowledge Distillation | 4 hours |
| 5302: Distributed Training | 4 hours |
| 5303: Federated Learning | 4 hours |
| 5304: Self-Instruct and Model Collapse | 4 hours |
| Quiz | 30 minutes |
| Practice | 5 hours |
| Total | 21.5 hours |
Resources¶
Essential Libraries:
- PyTorch DDP / FSDP
- DeepSpeed / Megatron
- Flower (federated learning)
- Hugging Face Accelerate
Essential Papers:
- "Distilling the Knowledge in a Neural Network"
- "DeepSpeed: System Optimizations for Training"
- "Communication-Efficient Learning of Deep Networks"
Knowledge Distillation Comparison¶
| Method | Student Size | Quality | Training Time |
|---|---|---|---|
| Training from Scratch | Any | 100% | High |
| Logit Distillation | 50% | 95-98% | Medium |
| Hidden State Distillation | 50% | 96-99% | High |
| Multi-Target Distillation | 30% | 92-96% | High |
| Quantization + Distillation | 25% | 90-94% | Medium |
Distributed Training Strategies¶
| Strategy | Memory Efficiency | Communication | Best For |
|---|---|---|---|
| Data Parallel (DDP) | Low | Medium | Small models |
| ZeRO-1 | Medium | Low | Large models |
| ZeRO-2 | High | Medium | Very large models |
| ZeRO-3 (FSDP) | Very High | High | Huge models |
| Tensor Parallel | High | Low | Model parallelism |
Federated Learning Challenges¶
| Challenge | Description | Solutions |
|---|---|---|
| Communication | Network bottlenecks | Compression, partial updates |
| Heterogeneity | Different data distributions | Personalization, robust aggregation |
| Privacy | Data access restrictions | Differential privacy, secure aggregation |
| Scalability | Many clients | Client selection, asynchronous updates |
Synthetic Data Quality Metrics¶
| Metric | Description | Good Range |
|---|---|---|
| Diversity | Unique examples | >90% unique |
| Coverage | Concept coverage | Matches real data |
| Accuracy | Factual correctness | >95% |
| Format Consistency | Structure adherence | >98% |
Tips for Success¶
- Start simple: Basic distillation before complex methods
- Profile communication: Distributed training is often I/O bound
- Validate synthetic data: Always check quality before use
- Monitor convergence: Federated learning can be unstable
- Use existing tools: Don't rebuild distributed training frameworks
Common Pitfalls¶
- Temperature too low: Distillation loses teacher knowledge
- Student too small: Cannot capture teacher's knowledge
- Ignoring communication: Network overhead kills performance
- Poor synthetic data: Garbage in, garbage out
- Federating naively: Standard averaging fails with heterogeneous data
Model Compression Pipeline¶
Original Model (7B)
↓
Pruning (removing weights)
↓
Quantization (4-bit)
↓
Knowledge Distillation
↓
Distilled Model (1B, 90%+ quality)
Synthetic Data Generation Pipeline¶
- Define Schema: What data do you need?
- Generate Examples: Use teacher LLM
- Validate Quality: Check accuracy and diversity
- Filter: Remove low-quality examples
- Balance: Ensure class balance
- Train: Use synthetic + real data mix
When to Use Each Technique¶
| Scenario | Recommended Approach |
|---|---|
| Deploy on mobile | Quantization + Distillation |
| Limited labeled data | Synthetic data generation |
| Privacy constraints | Federated learning |
| Very large models | Distributed training + FSDP |
| Rapid iteration | Smaller student models |
Next Module: 6100: Vector Embeddings
Previous Module: 5200: Alignment
Questions? Review the PREREQUISITES.md or check Phase 5 documentation.