|
| 1 | +# F0.2: CIFAR-10 Cross-Stack Validation Implementation |
| 2 | + |
| 3 | +**Status:** Ready to implement |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +F0.2 validates GF16 format against competing formats (FP16, BF16) using CIFAR-10 dataset instead of MNIST. This provides scientific credibility beyond synthetic MNIST benchmarks. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +``` |
| 12 | +Dataset: CIFAR-10 (10k images, 32x32x3 RGB, 10 classes) |
| 13 | +Model: Small CNN — Conv(3→16)→ReLU→Pool → Conv(16→32)→ReLU→Pool → FC(1152→128) → FC(128→10) |
| 14 | +Formats compared: GF16, FP16, BF16 |
| 15 | +Output: results/cifar10_metrics.json |
| 16 | +``` |
| 17 | + |
| 18 | +### Architecture Details |
| 19 | + |
| 20 | +- **Input:** 32×32×3 = 3072 features (RGB images) |
| 21 | +- **Conv1:** 3 channels → 16 filters, 3×3 kernel, stride=1, padding=1 |
| 22 | +- **Pool1:** 2×2 max pooling, stride=2 → output 16×16×16 = 4096 |
| 23 | +- **Conv2:** 16 channels → 32 filters, 3×3 kernel, stride=1, padding=1 |
| 24 | +- **Pool2:** 2×2 max pooling, stride=2 → output 8×8×32 = 2048 |
| 25 | +- **FC1:** 2048 → 128 dense layer |
| 26 | +- **FC2:** 128 → 10 output layer (softmax) |
| 27 | + |
| 28 | +### Baseline Expected Accuracy |
| 29 | + |
| 30 | +Small CNN without data augmentation on CIFAR-10: **~70-75%** |
| 31 | + |
| 32 | +## Implementation Notes |
| 33 | + |
| 34 | +### 1. Build System Integration |
| 35 | +The Zig build system uses explicit `b.step()` calls. The `bench_cifar10` executable needs proper registration in build.zig. |
| 36 | + |
| 37 | +**Current issue:** build.zig expects steps like `const bench_XXX_step = b.step("...", "...")` pattern. We're using a simpler approach. |
| 38 | + |
| 39 | +### 2. Model Weights |
| 40 | +CIFAR-10 requires a trained small CNN for CIFAR-10. Options: |
| 41 | +- Train from scratch in PyTorch (small CNN architecture as above) |
| 42 | +- Export weights in binary format (compatible with F0.2 loader) |
| 43 | +- Use cross-entropy loss, Adam optimizer, 50-100 epochs |
| 44 | + |
| 45 | +### 3. CIFAR-10 Dataset |
| 46 | +The loader at `src/cifar10_loader.zig` downloads from: |
| 47 | +`https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz` |
| 48 | + |
| 49 | +This is 10k images (32x32x3 RGB), requires downloading (~160MB). |
| 50 | + |
| 51 | +## Phase 2 Summary (Complete) |
| 52 | + |
| 53 | +- Competitive analysis documents copied to docs/research |
| 54 | +- arXiv + GitHub research completed (30+ papers, multiple repos analyzed) |
| 55 | +- Issue #497 updated with findings |
| 56 | + |
| 57 | +**Next Phase:** 3. Experimental Directions (academic paper, hardware bridge, optimizer suite) |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +**Document Status:** Created implementation plan for F0.2. |
0 commit comments