Running models on microcontrollers with kilobytes of memory: the tensor arena, supported operators and memory limits.
Advanced11 min read
Educational draft content that needs expert review before it is used as an academic reference. Specifications, versions and licences change; check the official source. No experimental result is shown here unless it was actually run.
Learning objectives
Explain the tensor arena
Estimate whether a model fits a microcontroller’s memory
List the steps to deploy on an MCU
Microcontrollers (MCUs) typically have hundreds of kilobytes of SRAM, a little flash and no full operating system. Frameworks such as TensorFlow Lite for Microcontrollers (LiteRT for Microcontrollers) avoid dynamic allocation: they reserve a static array, the tensor arena, to hold intermediate activations.
The arena size is set by the peak concurrent activation use, not the sum of all layers, so it can change with the architecture. Weights are embedded as a constant array in flash, and only the operators the model needs are linked (the op resolver) to keep the binary small.
Practical rules: quantize to int8, pick a small architecture, and measure memory and time on the real hardware rather than estimating. Libraries such as CMSIS-NN speed up kernels on Arm Cortex-M processors.
Terminology (with Arabic equivalents)
Microcontroller (MCU)
متحكم دقيق
SRAM
ذاكرة وصول عشوائي ساكنة
Flash
ذاكرة فلاش
Tensor arena
منطقة الموتّرات
Op resolver
محلّل المشغّلات
Cortex-M
معالجات Arm كورتكس-إم
Worked example
An int8 model with 20 thousand parameters occupies about 20 KB of flash (one byte per parameter), but working memory is determined by its intermediate activations. If the largest activation is 32 KB, reserve an arena no smaller than it with a margin, then verify on the device. (Illustrative figures.)
TensorFlow Lite for Microcontrollers documentationNot verified
Image and audio processing in the experiments runs inside your browser. Your images and audio are never uploaded and conversations are not stored. Privacy
Assistant Professor of Artificial Intelligence and Deep Learning
University of Al-Qadisiyah
About
Researcher and academic specialising in artificial intelligence (AI), deep learning, computer vision and natural language processing (NLP). The “Deep Learning in Arabic” project aims to enrich Arabic scientific and technical content with sound, free references and software for researchers and learners across the Arab world.
Edge AI Assistant
I am the Edge AI Assistant. Ask about a concept, technology, board or project and I will answer from the lab content with links.
Edge AI Assistant
Local Database Mode
Answers from the lab knowledge base only, without sending your question to any external party. Conversations are not stored.
Smart assistant
Answers from the site’s content
The assistant can make mistakes, so check the attached sources.
Welcome! I am Dr. Alaa Taima, and this is my smart assistant on “Deep Learning in Arabic”. Ask it about any term or topic in artificial intelligence, and it will answer from the site's content with links to the sources.
DL Bot
Your smart assistant · Connecting…
Enter to send · Shift + Enter for a new line · The assistant can make mistakes, so check the sources.