Implementation and Performance Analysis of a Transformer Architecture on Resource-Constrained Microcontrollers
Authors
Department of Mechatronics, Ege University, Türkiye (Turkey)
Article Information
DOI: 10.51244/IJRSI.2026.1311000101
Subject Category: Embedded Systems
Volume/Issue: 13/11 | Page No: 1272-1282
Publication Timeline
Submitted: 2026-11-14
Accepted: 2026-11-19
Published: 2026-12-02
Abstract
In this study, the feasibility of implementing an encoder-only Transformer architecture on microcontrollers with limited memory and processing capacity was experimentally investigated using different quantization methods. Human activity recognition based on accelerometer and gyroscope sensor data was employed as a case study.
For the classification task, a Transformer model was trained on a computer and deployed on an Xtensa LX6-based ESP32 microcontroller using different quantization approaches. These included 8-bit weight quantization and integer-based multiply-accumulate operations with 32-bit accumulation. The quantized implementations were compared with a 32-bit floating-point reference implementation in terms of classification accuracy, inference time, program memory usage, and static RAM usage.
Experimental results showed that classification accuracy remained approximately 86% after quantization, while program memory usage decreased by approximately 7%, with no reduction in static RAM usage. Although one integer-based implementation reduced inference time by 31.1% on the computer, all quantized implementations increased inference time by 8.2% to 97.6% on the ESP32. These findings indicate that quantization can reduce the storage requirements of Transformer models, but its effect on computational performance depends on the target hardware and the implementation of arithmetic operations.
Keywords
Embedded Transformer, resource-constrained microcontrollers, human activity recognition, model quantization, embedded inference
Downloads
References
1. Anguita, D., Ghio, A., Oneto, L., Parra, X., & Reyes-Ortiz, J. L. (2013). A public domain dataset for human activity recognition using smartphones. Proceedings of the European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning (ESANN), 437–442. https://hdl.handle.net/2117/20897 [Google Scholar] [Crossref]
2. Burrello, A., Scherer, M., Zanghieri, M., Conti, F., & Benini, L. (2021). A microcontroller is all you need: Enabling transformer execution on low-power IoT endnodes. 2021 IEEE International Conference on Omni-Layer Intelligent Systems (COINS), 84–89. https://doi.org/10.1109/COINS51742.2021.9524173 [Google Scholar] [Crossref]
3. Contoli, C., & Lattanzi, E. (2023). A study on the application of TensorFlow compression techniques to human activity recognition. IEEE Access, 11, 48046–48058. https://doi.org/10.1109/ACCESS.2023.3276438 [Google Scholar] [Crossref]
4. Daghero, F., Burrello, A., Xie, C., Castellano, M., Gandolfi, L., Calimera, A., Macii, E., Poncino, M., & Pagliari, D. J. (2022). Human activity recognition on microcontrollers with quantized and adaptive deep neural networks. ACM Transactions on Embedded Computing Systems, 21(4), 1–28. https://doi.org/10.1145/3542819 [Google Scholar] [Crossref]
5. Ek, S., Portet, F., & Lalanda, P. (2023). Transformer-based models to deal with heterogeneous environments in human activity recognition. Personal and Ubiquitous Computing, 27, 2267–2280. https://doi.org/10.1007/s00779-023-01776-3 [Google Scholar] [Crossref]
6. Jacob, B., Kligys, S., Chen, B., Zhu, M., Tang, M., Howard, A., Adam, H., & Kalenichenko, D. (2018). Quantization and training of neural networks for efficient integer-arithmetic-only inference. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2704–2713. https://doi.org/10.1109/CVPR.2018.00286 [Google Scholar] [Crossref]
7. Jung, V. J. B., Burrello, A., Scherer, M., Conti, F., & Benini, L. (2025). Optimizing the deployment of tiny transformers on low-power MCUs. IEEE Transactions on Computers, 74(2), 526–541. https://doi.org/10.1109/TC.2024.3500360 [Google Scholar] [Crossref]
8. Khanday, A. R., Kumar, R., Gulzar, Y., & Alkanan, M. (2026). Edgeefficient human activity recognition using a quantized patchbased transformer. Scientific Reports. https://doi.org/10.1038/s41598-026-62744-4 [Google Scholar] [Crossref]
9. Kim, S., Gholami, A., Yao, Z., Mahoney, M. W., & Keutzer, K. (2021). I-BERT: Integer-only BERT quantization. Proceedings of the 38th International Conference on Machine Learning, 139, 5506–5518. https://proceedings.mlr.press/v139/kim21d.html [Google Scholar] [Crossref]
10. Leite, C. S., Mauranen, H., Zhanabatyrova, A., & Xiao, Y. (2024). Transformer-based approaches for sensor-based human activity recognition: Opportunities and challenges. arXiv. https://doi.org/10.48550/arXiv.2410.13605 [Google Scholar] [Crossref]
11. Martínez, H., Catalán, S., Castelló, A., & Quintana-Ortí, E. S. (2025). Characterization of quantized inference with transformer encoders on low power CPUs. The International Journal of High Performance Computing Applications, 39(6), 803–821. https://doi.org/10.1177/10943420251355115 [Google Scholar] [Crossref]
12. Pazmiño-Ortiz, L., Cuenca-Sánchez, A., & Maldonado-Soliz, I. (2026). Tiny transformers for TinyML: A systematic review of deployment readiness, trustworthiness, and benchmarking. Future Internet, 18(11), 589. https://doi.org/10.3390/fi18110589 [Google Scholar] [Crossref]
13. Pyo, J., & Shin, D. (2025). An integer-only quantized transformer with LayerNorm removal and linear attention for efficient MCU deployment in TinyML applications. 2025 International Technical Conference on Circuits/Systems, Computers, and Communications (ITC-CSCC). https://doi.org/10.1109/ITC-CSCC66376.2025.11137617 [Google Scholar] [Crossref]
14. Reyes-Ortiz, J., Anguita, D., Ghio, A., Oneto, L., & Parra, X. (2013). Human activity recognition using smartphones [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C54S4K [Google Scholar] [Crossref]
15. Shavit, Y., & Klein, I. (2021). Boosting inertial-based human activity recognition with transformers. IEEE Access, 9, 53540–53547. https://doi.org/10.1109/ACCESS.2021.3070646 [Google Scholar] [Crossref]
16. Varaldi, A., Genta, C., Manzone, A., & Vacca, M. (2026). STORM: Hardware-aware tiny transformer co-design for low-power inertial human activity recognition. Electronics, 15(9), 1924. https://doi.org/10.3390/electronics15091924 [Google Scholar] [Crossref]
17. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention is all you need. Advances in Neural Information Processing Systems, 30. https://proceedings.neurips.cc/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html [Google Scholar] [Crossref]
18. Yang, J., Liao, J., Lei, F., Liu, M., Long, L., Chen, J., Wan, H., Yu, B., & Zhao, W. (2026). TinyFormer: Efficient sparse transformer design and deployment on tiny devices. IEEE Transactions on Circuits and Systems I: Regular Papers, 73(5), 3350–3362. https://doi.org/10.1109/TCSI.2025.3638448 [Google Scholar] [Crossref]
19. Ye, N., Zhang, L., Cheng, D., Bu, C., Sun, S., Wu, H., & Song, A. (2024). Dynamic instance-aware layer-bit-select network on human activity recognition using wearable sensors. Engineering Applications of Artificial Intelligence, 137, 109260. https://doi.org/10.1016/j.engappai.2024.109260 [Google Scholar] [Crossref]