OnDeviceTraining is a lightweight C/CMake framework for inference and on-device training (backpropagation) of deep neural networks across two execution contexts:
- MCU targets (resource-constrained embedded systems)
- PC/host builds (fast iteration, debugging, reference behavior)
Framework for Inference and Training of Deep Neural Networks on MCU + PC
Most TinyML stacks are built for inference-only. OnDeviceTraining targets the harder regime:
- local personalization / adaptation
- continual learning on streaming sensor data
- tiny fine-tuning loops under strict RAM/Flash/compute budgets
The project aims to provide a research-friendly but engineering-minded codebase for:
- training algorithms and memory/computation trade-offs
- portability across MCUs
- host-side debugging and reference behavior (“ground truth” runs)
The repository is currently structured as a CMake-based C project and includes:
src/— core sourcestest/unit/— unit testsexamples/— end-to-end training demos (PyTorch reference + C twin + parity checks) — seeexamples/README.mddocs/— feature matrix, continual-learning guide, contributor conventionspython/— the Python packagepython/odt/(the remat budget plannerpython/odt/planner/; the other subpackages are not started yet) andpython/tests/(its tests and those of the example tooling)cmake/— build helpersCMakePresets.json— reproducible CMake configurationspyproject.toml/uv.lock— Python dependencies, managed with uvdevenv.*— a pinned developer environment (optional, depending on your setup).github/workflows/ci.yml— the CI pipelineCONTRIBUTING.md— repository map, build/test, and contribution workflow- MIT license
What the framework supports today (layers, optimizers, quantization, serialization, …) is
tracked in docs/FEATURES.md — that file is the source of truth for current
capabilities. Expect this project to evolve quickly.
- Portability-first: keep the training core independent of heavy runtimes and OS assumptions.
- MCU realism: optimize for peak RAM, temporary buffers, and predictable memory behavior.
- Host equivalence: run the same model code on PC for debugging/profiling and cross-checking.
- Incremental complexity: start minimal, then add optimizers, quantization, and memory knobs without breaking the baseline.