All module references updated to reflect new ordering: - Module 15: Quantization (was 16) - Module 16: Compression (was 17) - Module 17: Memoization (was 15) Updated by module-developer and website-manager agents: - Module ABOUT files with correct numbers and prerequisites - Cross-references and "What's Next" chains - Website navigation (_toc.yml) and content - Learning path progression in LEARNING_PATH.md - Profile milestone completion message (Module 17) Pedagogical flow now: Profile → Quantize → Prune → Cache → Accelerate
4.0 KiB
title, description, difficulty, time_estimate, prerequisites, next_steps, learning_objectives
| title | description | difficulty | time_estimate | prerequisites | next_steps | learning_objectives | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Benchmarking - Fair Performance Comparison | MLPerf-style benchmarking with statistical rigor and standardized metrics | 3 | 5-6 hours |
|
|
|
19. Benchmarking
⚡ OPTIMIZATION TIER | Difficulty: ⭐⭐⭐ (3/4) | Time: 5-6 hours
Overview
Build rigorous benchmarking systems following MLPerf principles. This module implements fair comparison protocols, statistical testing, and normalized metrics for evaluating all the optimizations you've built in the Optimization Tier.
Learning Objectives
By completing this module, you will be able to:
- Implement MLPerf-inspired benchmarking frameworks with standardized scenarios
- Design fair comparison protocols accounting for hardware differences
- Apply statistical significance testing to validate performance claims
- Build normalized metrics (speedup, compression ratio, efficiency scores)
- Generate comprehensive reports with visualizations and actionable insights
Why This Matters
Production Context
Benchmarking drives ML systems decisions:
- MLPerf standardizes ML benchmarking; companies compete on leaderboards
- Google TPU teams use rigorous benchmarking to justify hardware investments
- Meta PyTorch benchmarks every optimization before merging to production
- OpenAI benchmarks training efficiency to optimize $millions in compute costs
Historical Context
- Pre-2018: Ad-hoc benchmarking; inconsistent metrics; hard to compare
- MLPerf Launch (2018): Standardized benchmarks; reproducible results
- 2019-2021: MLPerf Training and Inference; industry adoption
- 2021+: MLPerf Tiny, Mobile; benchmarking for edge deployment
Without rigorous benchmarking, optimization claims are meaningless.
Implementation Guide
Core Components
MLPerf Principles
- Reproducibility: Fixed random seeds, documented environment
- Fairness: Same workload, measured on same hardware
- Realism: Representative tasks (ResNet, BERT, etc.)
- Transparency: Open-source code and results
Normalized Metrics
- Speedup: baseline_time / optimized_time
- Compression Ratio: baseline_size / compressed_size
- Accuracy Delta: optimized_accuracy - baseline_accuracy
- Efficiency Score: (speedup × compression) / (1 + accuracy_loss)
Statistical Rigor
- Multiple runs (typically 10+)
- Confidence intervals
- Significance testing (t-test, Mann-Whitney)
- Report variance, not just mean
Testing
tito export 19_benchmarking
tito test 19_benchmarking
Where This Code Lives
tinytorch/
├── benchmarking/
│ └── benchmark.py
└── __init__.py
Systems Thinking Questions
-
Hardware Normalization: How do you compare optimizations across M1 Mac vs Intel vs AMD? What metrics are fair?
-
Statistical Power: You measure 5% speedup with p=0.06. Is this significant? How many runs do you need?
-
Benchmark Selection: MLPerf uses ResNet-50. Does this represent all workloads? What about transformers, GANs, RL?
Real-World Connections
MLPerf: Industry-standard benchmarking consortium SPEC: Hardware benchmarking standards TensorFlow/PyTorch: Continuous benchmarking in CI/CD
What's Next?
In Module 20: TinyMLPerf Competition (Capstone), you'll apply everything:
- Use all Optimization Tier techniques
- Compete on a standardized benchmark
- Submit results to a leaderboard
- Demonstrate complete ML systems skills
This is your capstone—show what you've learned!
Ready to benchmark rigorously? Open modules/19_benchmarking/benchmarking_dev.py and start implementing.