Files
TinyTorch/modules/19_benchmarking/ABOUT.md
T
Vijay Janapa Reddi a2e4586f18 Update documentation after module reordering
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
2025-11-10 19:37:41 -05:00

4.0 KiB
Raw Blame History

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
Profiling
All optimization techniques
Competition (Capstone)
Implement MLPerf-inspired benchmarking frameworks
Design fair comparison protocols across different hardware
Apply statistical significance testing to performance claims
Build normalized metrics for hardware-independent comparison
Generate comprehensive performance reports with visualizations

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:

  1. Implement MLPerf-inspired benchmarking frameworks with standardized scenarios
  2. Design fair comparison protocols accounting for hardware differences
  3. Apply statistical significance testing to validate performance claims
  4. Build normalized metrics (speedup, compression ratio, efficiency scores)
  5. 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

  1. Reproducibility: Fixed random seeds, documented environment
  2. Fairness: Same workload, measured on same hardware
  3. Realism: Representative tasks (ResNet, BERT, etc.)
  4. 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

  1. Hardware Normalization: How do you compare optimizations across M1 Mac vs Intel vs AMD? What metrics are fair?

  2. Statistical Power: You measure 5% speedup with p=0.06. Is this significant? How many runs do you need?

  3. 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.