Hello everyone, again. I am here to present the minor update for MiniML Engine, v1.1.2.
With this new version, MiniML Engine introduces a hyper-optimized On-Device Transfer Learning engine. Now, your microcontroller can learn and recalibrate its weights in real-time using a static Stochastic Gradient Descent (SGD), all while maintaining a predictable and minuscule dynamic memory (SRAM) footprint.
How does this work under the hood?
Implementing a traditional backpropagation engine (Autograd) on "Bare Metal" hardware would destroy the SRAM memory in milliseconds. MiniML solves this bottleneck with a Distributed Intelligence architecture:
- 🚦 The Memory Traffic Light (ROM vs. SRAM): By activating
on_device_learning=True, the transpiler isolates the topology. The deep feature extraction layers (Convolutions, Residual Blocks) are "frozen" and sent directly to the Flash memory (PROGMEM) as immutable functions. Simultaneously, the matrices of the finalLinearlayer (the classifier) are diverted to the volatile memory (SRAM), becoming the only adaptable variables. - ⚡ Pre-Compiled Gradient Calculation: The microcontroller does not calculate complex derivatives on the fly. The Python exporter reads your original loss function (
MSELossorCrossEntropyLoss) and hardcodes the exact algebraic simplification into the C++ code. The weight update is reduced to purified arithmetic that costs just a couple of clock cycles. - 🧠 Zero-Copy Latent Vector: To backpropagate the error, the SGD algorithm needs to remember the network state before the final prediction. Instead of cloning entire arrays in RAM (which would cause a Stack Overflow), the engine injects a single 32-bit pointer that captures the memory address of the latent tensor. Physical learning cost: 4 bytes of RAM.
Unlocked Use Cases:
This feature transforms your boards into reactive and biomimetic systems. It is the fundamental piece for Hot Sensor Calibration: imagine a smart thermometer or a vibration sensor that, after being installed on a specific industrial machine, uses the first hours of readings to self-adjust its last layer to the exact tolerances of that motor, compensating for local electrical noise and sensor degradation.
Technical note: Due to the migration of the final layer to SRAM, this feature is geared towards pushing the limits of 32-bit architectures (ESP32, STM32, Cortex-M4), keeping the traditional lightweight read-only memory model intact for the 8-bit AVR family.
Buenas a todos nuevamente. Aquí vengo a presentarles la pequeña actualización de MiniML Engine, la v1.1.2.
Con esta nueva versión, MiniML Engine introduce un motor de Transfer Learning en el Dispositivo hiper-optimizado. Ahora, tu microcontrolador puede aprender y re-calibrar sus pesos en tiempo real utilizando un Descenso de Gradiente Estocástico (SGD) estático, todo mientras mantiene un uso de memoria dinámica (SRAM) predecible y minúsculo.
¿Cómo funciona esto bajo el capó?
Implementar un motor de retropropagación (Autograd) tradicional en hardware "Bare Metal" destruiría la memoria SRAM en milisegundos. MiniML resuelve este cuello de botella con una arquitectura de Inteligencia Distribuida:
- 🚦 El Semáforo de Memoria (ROM vs. SRAM): Al activar
on_device_learning=True, el transpilador aísla la topología. Las capas profundas de extracción de características (Convoluciones, Bloques Residuales) se "congelan" y se envían directamente a la memoria Flash (PROGMEM) como funciones inmutables. Simultáneamente, las matrices de la última capaLinear(el clasificador) se desvían hacia la memoria volátil (SRAM), convirtiéndose en las únicas variables adaptables. - ⚡ Cálculo de Gradientes Pre-Compilado: El microcontrolador no calcula derivadas complejas al vuelo. El exportador de Python lee tu función de pérdida original (
MSELossoCrossEntropyLoss) y quema (hardcodea) la simplificación algebraica exacta en el código C++. La actualización de los pesos se reduce a una aritmética purificada que cuesta apenas un par de ciclos de reloj. - 🧠 Zero-Copy Latent Vector: Para retropropagar el error, el algoritmo SGD necesita recordar el estado de la red antes de la predicción final. En lugar de clonar arreglos enteros en la RAM (lo que causaría un Stack Overflow), el motor inyecta un único puntero de 32-bits que captura la dirección de memoria del tensor latente. Costo físico del aprendizaje: 4 bytes de RAM.
Casos de Uso Desbloqueados:
Esta funcionalidad transforma tus placas en sistemas reactivos y biomiméticos. Es la pieza fundamental para la Calibración de Sensores en Caliente: imagina un termómetro inteligente o un sensor de vibración que, tras ser instalado en una máquina industrial específica, utiliza las primeras horas de lectura para auto-ajustar su última capa a las tolerancias exactas de ese motor, compensando el ruido eléctrico local y la degradación del sensor.
Nota técnica: Debido a la migración de la capa final a la SRAM, esta característica está orientada a empujar los límites de arquitecturas de 32-bits (ESP32, STM32, Cortex-M4), manteniendo el modelo ligero tradicional de memoria de solo lectura intacto para la familia AVR de 8-bits.