Idea 2: On-Device Continual Learning with Compressed Replay on ESP32-S3
Overview
Build the first continual learning framework that performs gradient-based weight updates directly on the ESP32-S3. The system learns new environments (e.g., acoustic scenes) without catastrophic forgetting, using PSRAM for a compressed replay buffer and memory-efficient regularization.
Research Gap
- 100% of deployed TinyML on ESP32 uses static models trained offline
- Federated learning on ESP32 only aggregates pre-trained models, not true online updates
- On-device learning is considered impossible on MCUs due to memory constraints
- Existing continual learning methods require GPU-level memory (full gradient history, large replay buffers)
Key Innovation
First demonstration of gradient-based updates on ESP32-class hardware. Derive memory-optimal backpropagation using diagonal Fisher information and compressed latent replay buffers in PSRAM.
Hardware Requirements
| Component | Specification | Purpose |
|---|---|---|
| Main MCU | ESP32-S3-DevKitC with PSRAM | 8 MB external SPI RAM for replay buffer |
| Sensor | I2S MEMS microphone (e.g., INMP441) | Audio input for scene classification |
| Storage | SD card or SPI flash | Logging training metrics and model checkpoints |
| Power | USB or battery + INA219 | Profiling energy per update |
Technical Approach
Phase 1: Baseline Static Model
- Train a small CNN/RNN on initial dataset (e.g., ESC-10, Google Speech Commands)
- Quantize to INT8 using post-training quantization
- Establish baseline accuracy on initial task
Phase 2: Memory-Efficient Replay Buffer
- Store quantized latent representations (not raw audio) in PSRAM
- Buffer size: ~100-500 samples, each ~64-256 bytes
- Use reservoir sampling or ring buffer for online population
- Compress further using vector quantization or PCA
Phase 3: Elastic Weight Consolidation (EWC) on MCU
- During initial training, compute diagonal Fisher information F_i for each weight
- Store F_i in flash (one scalar per weight, ~10-50 KB total)
- During online learning, loss = task_loss + lambda * sum(F_i * (w_i - w_i^*)
- Use fixed-point arithmetic for all operations
Phase 4: Gradient Computation
- Implement mini-batch SGD with batch size 1-4
- Compute gradients using finite differences or backprop
- Store only weight deltas, not full gradients
- Update frequency: every 1-10 seconds (not per-sample)
Phase 5: Evaluation Protocol
- Task sequence: Home → Office → Street → Cafe → Back to Home
- Measure: accuracy on each task after each update, backward transfer, forward transfer
- Compare against: naive fine-tuning (catastrophic forgetting), no-update baseline, cloud retraining
Expected Results
- <5% accuracy drop on old tasks after learning 5 new tasks
- Each update completes in <2 seconds on ESP32-S3
- Memory overhead: <100 KB for Fisher info + <200 KB for replay buffer
- Energy per update: <10 mJ
Target Venues
- Nature Machine Intelligence
- IEEE Transactions on Neural Networks and Learning Systems (TNNLS)
- NeurIPS/ICML TinyML workshop → journal extension
- ACM IMWUT
Related Work to Cite
- Kirkpatrick et al., “Overcoming catastrophic forgetting in neural networks” (PNAS 2017)
- Progressive Neural Networks, Learning without Forgetting
- TinyOL, Tiny-Transfer-Learning (on-device learning frameworks)
- OML, ANML (meta-learning for continual learning)
- ESP32 PSRAM technical reference
Risk Mitigation
| Risk | Mitigation |
|---|---|
| PSRAM too slow for gradients | Use SRAM for active computation; PSRAM only for buffer storage |
| Floating-point too slow | Use fixed-point (Q15/Q7) throughout; no float32 |
| Catastrophic forgetting still occurs | Combine EWC with replay; use smaller learning rate |
| Update latency too high | Process updates only during idle periods; use interrupt-driven scheduling |
Timeline (Approximate)
- Weeks 1-2: Static baseline model training and quantization
- Weeks 3-4: EWC implementation in C/Arduino
- Weeks 5-6: Replay buffer design and PSRAM integration
- Weeks 7-8: Full continual learning pipeline
- Weeks 9-10: Multi-task evaluation and paper writing