Files
TinyTorch/examples
Vijay Janapa Reddi 2f23f757e7 MAJOR: Implement beautiful module progression through strategic reordering
This commit implements the pedagogically optimal "inevitable discovery" module progression based on expert validation and educational design principles.

## Module Reordering Summary

**Previous Order (Problems)**:
- 05_losses → 06_autograd → 07_dataloader → 08_optimizers → 09_spatial → 10_training
- Issues: Autograd before optimizers, DataLoader before training, scattered dependencies

**New Order (Beautiful Progression)**:
- 05_losses → 06_optimizers → 07_autograd → 08_training → 09_spatial → 10_dataloader
- Benefits: Each module creates inevitable need for the next

## Pedagogical Flow Achieved

**05_losses** → "Need systematic weight updates" → **06_optimizers**
**06_optimizers** → "Need automatic gradients" → **07_autograd**
**07_autograd** → "Need systematic training" → **08_training**
**08_training** → "MLPs hit limits on images" → **09_spatial**
**09_spatial** → "Training is too slow" → **10_dataloader**

## Technical Changes

### Module Directory Renaming
- `06_autograd` → `07_autograd`
- `07_dataloader` → `10_dataloader`
- `08_optimizers` → `06_optimizers`
- `10_training` → `08_training`
- `09_spatial` → `09_spatial` (no change)

### System Integration Updates
- **MODULE_TO_CHECKPOINT mapping**: Updated in tito/commands/export.py
- **Test directories**: Renamed module_XX directories to match new numbers
- **Documentation**: Updated all references in MD files and agent configurations
- **CLI integration**: Updated next-steps suggestions for proper flow

### Agent Configuration Updates
- **Quality Assurance**: Updated module audit status with new numbers
- **Module Developer**: Updated work tracking with new sequence
- **Documentation**: Updated MASTER_PLAN_OF_RECORD.md with beautiful progression

## Educational Benefits

1. **Inevitable Discovery**: Each module naturally leads to the next
2. **Cognitive Load**: Concepts introduced exactly when needed
3. **Motivation**: Students understand WHY each tool is necessary
4. **Synthesis**: Everything flows toward complete ML systems understanding
5. **Professional Alignment**: Matches real ML engineering workflows

## Quality Assurance

-  All CLI commands still function
-  Checkpoint system mappings updated
-  Documentation consistency maintained
-  Test directory structure aligned
-  Agent configurations synchronized

**Impact**: This reordering transforms TinyTorch from a collection of modules into a coherent educational journey where each step naturally motivates the next, creating optimal conditions for deep learning systems understanding.
2025-09-24 15:56:47 -04:00
..

TinyTorch Examples: A Journey Through AI History

These examples tell the story of neural networks through historical breakthroughs. Each example represents a pivotal moment in AI history, and you'll build the same architectures that changed the field.

The Historical Journey

1957: The Perceptron - Where It All Began

perceptron_1957/rosenblatt_perceptron.py (Run after Module 4)

  • Frank Rosenblatt's first trainable neural network
  • Could learn linearly separable patterns
  • Sparked dreams of artificial intelligence
  • You'll build: Single-layer network for linear classification

1969: The XOR Problem - The First AI Winter

xor_1969/minsky_xor_problem.py (Run after Module 6)

  • Minsky & Papert proved perceptrons can't solve XOR
  • Led to decade-long "AI Winter" (1969-1980s)
  • Solution required hidden layers + nonlinearity + backpropagation
  • You'll build: Multi-layer perceptron that solves XOR

1998: LeNet - The Convolution Revolution

lenet_1998/train_mlp.py (Run after Module 9)

  • Yann LeCun's convolutional neural network
  • First practical system for reading handwritten digits
  • Deployed in banks for check processing
  • You'll build: Network for MNIST digit recognition

2012: AlexNet - The Deep Learning Explosion

alexnet_2012/train_cnn.py (Run after Module 10)

  • Alex Krizhevsky's ImageNet breakthrough
  • Proved deep networks could surpass traditional CV
  • Triggered the modern deep learning boom
  • You'll build: Deep CNN for CIFAR-10 classification

2018: GPT - The Transformer Era

gpt_2018/simple_tinygpt.py (Run after Module 14)

  • OpenAI's transformer architecture
  • Self-attention revolutionized NLP
  • Foundation for ChatGPT and modern AI
  • You'll build: Character-level language model

Running the Examples

Each example shows which modules are required:

# After Module 4: Can build architectures
python examples/perceptron_1957/rosenblatt_perceptron.py

# After Module 6: Can train with gradients  
python examples/xor_1969/minsky_xor_problem.py

# After Module 9: Can use convolutions
python examples/lenet_1998/train_mlp.py

# After Module 10: Full training pipeline
python examples/alexnet_2012/train_cnn.py

# After Module 14: Transformers work!
python examples/gpt_2018/simple_tinygpt.py

The Learning Flow

  1. Build modules → Core engine development
  2. Pass unit tests → Verify your implementation
  3. Complete moduletito module complete XX_modulename
  4. Pass integration tests → Automatic validation with other modules
  5. Unlock capability → New historical example available!
  6. Run example → See what you've enabled!

📚 See CAPABILITIES.md for the complete progression system

PyTorch-Style Code

All examples follow modern PyTorch conventions:

class HistoricNetwork:
    def __init__(self):
        # Define layers
        self.fc1 = Dense(input_size, hidden_size)
        self.activation = ReLU()
        self.fc2 = Dense(hidden_size, output_size)
    
    def forward(self, x):
        # Forward pass
        x = self.fc1(x)
        x = self.activation(x)
        x = self.fc2(x)
        return x

What You're Building

You're not just learning ML - you're rebuilding the breakthroughs that created modern AI:

  • 1957: Linear models that could learn
  • 1969: Multi-layer networks for complex patterns
  • 1998: Convolutional networks for vision
  • 2012: Deep networks that changed everything
  • 2018: Attention mechanisms powering ChatGPT

Each example runs on YOUR implementation. When GPT works, it's because YOU built every component from scratch!