Optimizing the Deployment of Tiny Transformers on Low-Power MCUs
Not on the map. Why?
Abstract (arXiv)
Transformer networks are rapidly becoming SotA in many fields, such as NLP and CV. Similarly to CNN, there is a strong push for deploying Transformer models at the extreme edge, ultimately fitting the tiny power budget and memory footprint of MCUs. However, the early approaches in this direction are mostly ad-hoc, platform, and model-specific. This work aims to enable and optimize the flexible, multi-platform deployment of encoder Tiny Transformers on commercial MCUs. We propose a complete framework to perform end-to-end deployment of Transformer models onto single and multi-core MCUs. Our framework provides an optimized library of kernels to maximize data reuse and avoid unnecessary data marshaling operations into the crucial attention block. A novel MHSA inference schedule, named Fused-Weight Self-Attention, is introduced, fusing the linear projection weights offline to further reduce the number of operations and parameters. Furthermore, to mitigate the memory peak reached by the computation of the attention map, we present a Depth-First Tiling scheme for MHSA. We evaluate our framework on three different MCU classes exploiting ARM and RISC-V ISA, namely the STM32H7, the STM32L4, and GAP9 (RV32IMC-XpulpV2). We reach an average of 4.79x and 2.0x lower latency compared to SotA libraries CMSIS-NN (ARM) and PULP-NN (RISC-V), respectively. Moreover, we show that our MHSA depth-first tiling scheme reduces the memory peak by up to 6.19x, while the fused-weight attention can reduce the runtime by 1.53x, and number of parameters by 25%. We report significant improvements across several Tiny Transformers: for instance, when executing a transformer block for the task of radar-based hand-gesture recognition on GAP9, we achieve a latency of 0.14ms and energy consumption of 4.92 micro-joules, 2.32x lower than the SotA PULP-NN library on the same platform.
Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 35 of its 46 references that are in the map. First posted on arXiv 3 Apr 2024.
Builds on
35 of 46 references.
References · 35
- 2017Attention Is All You Needcited by 60,361
- 2015Deep Residual Learning for Image Recognitioncited by 52,096
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2022Hierarchical Text-Conditional Image Generation with CLIP Latentscited by 6,585
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2017MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applicationscited by 3,845
- 2016Gaussian Error Linear Units (GELUs)cited by 3,502
- 2015SSD: Single Shot MultiBox Detectorcited by 3,130
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
23 more
- 2015Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Codingcited by 2,329
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2020Rethinking Attention with Performerscited by 1,601
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,346
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
- 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 717
- 2022Efficiently Scaling Transformer Inferencecited by 539
- 2021A Survey of Transformerscited by 401
- 2020MCUNet: Tiny Deep Learning on IoT Devicescited by 273
- 2018Online normalizer calculation for softmaxcited by 162
- 2018CMSIS-NN: Efficient Neural Network Kernels for Arm Cortex-M CPUscited by 121
- 2020Data Movement Is All You Need: A Case Study on Optimizing Transformerscited by 108
- 2022The Devil in Linear Transformercited by 98
- 2020Benchmarking TinyML Systems: Challenges and Directioncited by 91
- 2019Trained Quantization Thresholds for Accurate and Efficient Fixed-Point Inference of Deep Neural Networkscited by 90
- 2020DORY: Automatic End-to-End Deployment of Real-World DNNs on Low-Cost IoT MCUscited by 58
- 2022Hydra Attention: Efficient Attention with Many Headscited by 55
- 2019PULP-NN: Accelerating Quantized Neural Networks on Parallel Ultra-Low-Power RISC-V Processorscited by 35
- 2020VecQ: Minimal Loss DNN Model Compression With Vectorized Weight Quantizationcited by 15
- 2022DeFiNES: Enabling Fast Exploration of the Depth-first Scheduling Space for DNN Accelerators through Analytical Modelingcited by 12
- 2020Automatic Kernel Generation for Volta Tensor Corescited by 8
- 2024A Tiny Transformer for Low-Power Arrhythmia Classification on Microcontrollerscited by 6
Built on by
Citing papers per year: 2024: 2; 2025: 3; 2026: 3.
8 papers.
- 2025From Tiny Machine Learning to Tiny Deep Learning: A Surveycited by 5
- 2025Automating Versatile Time-Series Analysis with Tiny Transformers on Embedded FPGAscited by 4
- 2024Transformer-Based Fault-Tolerant Control for Fixed-Wing UAVs Using Knowledge Distillation and In-Context Adaptationcited by 3
- 2025Ariel-ML: Computing Parallelization with Embedded Rust for Neural Networks on Heterogeneous Multi-core Microcontrollerscited by 1
- 2024Future-Proofing Mobile Networks: A Digital Twin Approach to Multi-Signal Managementcited by 0
- 2026Towards Real-Time ECG and EMG Modeling on μNPUscited by 0
- 2026MR2-ByteTrack: CNN and Transformer-based Video Object Detection for AI-augmented Embedded Vision Sensor Nodescited by 0
- 2026QTrans: A Quantum Transformer for Sentiment Classificationcited by 0
- 2026QTrans: A Quantum Transformer for Sentiment Classification10 Sep 2026
- 2026MR2-ByteTrack: CNN and Transformer-based Video Object Detection for AI-augmented Embedded Vision Sensor Nodes14 May 2026
- 2026Towards Real-Time ECG and EMG Modeling on μNPUs20 Apr 2026
- 2025Ariel-ML: Computing Parallelization with Embedded Rust for Neural Networks on Heterogeneous Multi-core Microcontrollers10 Dec 2025
- 2025From Tiny Machine Learning to Tiny Deep Learning: A Survey21 Jun 2025
- 2025Automating Versatile Time-Series Analysis with Tiny Transformers on Embedded FPGAs23 May 2025
- 2024Transformer-Based Fault-Tolerant Control for Fixed-Wing UAVs Using Knowledge Distillation and In-Context Adaptation5 Nov 2024
- 2024Future-Proofing Mobile Networks: A Digital Twin Approach to Multi-Signal Management22 Jul 2024