Implementation of Lightweight Machine Learning Models for Real-time Text Classification on Resource-Constrained Devices

Main Article Content

Marwah Zaid Mohammed Al-Helali
Naveen Palanichamy
K. Revathi

Abstract

This paper addresses the growing need for implementing intelligent Natural Language Processing (NLP) systems on low-power, memory-limited devices such as Raspberry Pi, mobile phones, and IoT edge hardware. As edge computing and smart devices proliferate, there is an urgent need for more advanced NLP technology that does not require constant cloud access and is efficient in computing and provides results in real time. While deep learning and cloud-based models typically offer high text-classification accuracy and have demonstrated exceptional performance across a range of NLP tasks, they are often too resource-intensive for real-time deployment in constrained environments. To overcome these limitations, we explore a set of lightweight machine learning (ML) models—Multinomial Naive Bayes, Logistic Regression, and Decision Tree—to perform sentiment classification on a subset of the Amazon Reviews Polarity dataset. Following thorough data preprocessing and Term Frequency-Inverse Document Frequency (TF-IDF) vectorization, two optimization techniques are employed: feature selection via Chi-Squared tests and simulated post-training quantization. Our experimental results show that resource consumption can be substantially reduced, with minimal accuracy loss, thereby demonstrating feasibility for edge-based text analytics and offline functionality. We provide a detailed comparative analysis that highlights how classical ML models remain viable in scenarios where modern deep learning architectures cannot be efficiently deployed.

Article Details

How to Cite
Al-Helali, M. Z. M., Palanichamy, N., & Revathi, K. (2025). Implementation of Lightweight Machine Learning Models for Real-time Text Classification on Resource-Constrained Devices. Journal of Informatics and Web Engineering, 4(3), 126–139. https://doi.org/10.33093/jiwe.2025.4.3.7
Section
Regular issue

References

M.G.S. Murshed, C. Murphy, D. Hou, N. Khan, G. Ananthanarayanan, and F. Hussain, “Machine Learning at the Network Edge: A Survey,” ACM Comput Surv, vol. 54, no. 8, pp. 1–37, Nov. 2022, doi: 10.1145/3469029.

D. Mishra, A. Trotta, E. Traversi, M. Di Felice, and E. Natalizio, “Cooperative Cellular UAV-to-Everything (C-U2X) communication based on 5G sidelink for UAV swarms,” Comput Commun, vol. 192, pp. 173–184, Aug. 2022, doi: 10.1016/j.comcom.2022.06.001.

Y. Chen, “Convolutional Neural Network for Sentence Classification,” 2015. Accessed: Mar. 03, 2025. [Online]. Available: https://dspacemainprd01.lib.uwaterloo.ca/server/api/core/bitstreams/2ef42d4c-aba3-4adb-bd99-2ceb6099553b/content

M. Rastegari, V. Ordonez, J. Redmon, and A. Farhadi, “XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks,” in Computer Vision -- ECCV 2016, Springer International Publishing, 2016, pp. 525–542, doi: 10.1007/978-3-319-46493-0_32.

X. Zhang, J. Zhao, and Y. LeCun, “Character-level Convolutional Networks for Text Classification,” in Advances in Neural Information Processing Systems, vol. 28, C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett, Eds., Curran Associates, Inc., 2015, pp. 649–657.

F. Bonomi, R. Milito, J. Zhu, and S. Addepalli, “Fog computing and its role in the internet of things,” in Proceedings of the first edition of the MCC workshop on Mobile cloud computing, New York, NY, USA: ACM, pp. 13–16, Aug. 2012, doi: 10.1145/2342509.2342513.

Y. Cheng, D. Wang, P. Zhou, and T. Zhang, “A Survey of Model Compression and Acceleration for Deep Neural Networks,” CoRR, 2017, Accessed: Mar. 03, 2025. [Online]. Available: http://arxiv.org/abs/1710.09282.

T.T. Khoei and N. Kaabouch, “Machine Learning: Models, Challenges, and Research Directions,” Future Internet, vol. 15, no. 10, pp. 332, Oct. 2023, doi: 10.3390/fi15100332.

E. Yvinec, “Efficient Neural Networks: Post Training Pruning and Quantization,” Sorbonne Université, 2023. Accessed: Jun. 03, 2025. [Online]. Available: https://theses.hal.science/tel-04496138

R.I. Mukhamediev et al., “Review of Artificial Intelligence and Machine Learning Technologies: Classification, Restrictions, Opportunities and Challenges,” Mathematics, vol. 10, no. 15, p. 2552, Jul. 2022, doi: 10.3390/math10152552.

S. Salmani Pour Avval, N.D. Eskue, R.M. Groves, and V. Yaghoubi, “Systematic review on neural architecture search,” Artif Intell Rev, vol. 58, no. 3, p. 73, Jan. 2025, doi: 10.1007/s10462-024-11058-w.

Y. Zheng, Z. Wei, and J. Liu, “Decoupled Graph Neural Networks for Large Dynamic Graphs,” arXiv preprint, May 2023, [Online]. Available: https://arxiv.org/pdf/2305.08273

T. Alonso et al., “Elastic-DF: Scaling Performance of DNN Inference in FPGA Clouds through Automatic Partitioning,” ACM Trans Reconfigurable Technol Syst, vol. 15, no. 2, pp. 1–34, Jun. 2022, doi: 10.1145/3470567.

E. Cambria, D. Das, S. Bandyopadhyay, and A. Feraco, “Affective Computing and Sentiment Analysis,” In A practical guide to sentiment analysis, pp. 1–10, 2017, doi: 10.1007/978-3-319-55394-8_1.

W. Jiang et al., “Challenges and practices of deep learning model reengineering: A case study on computer vision,” Empir Softw Eng, vol. 29, no. 6, p. 142, Nov. 2024, doi: 10.1007/s10664-024-10521-0.

“Post-training quantization,” TensorFlow. Accessed: Apr. 01, 2025. [Online]. Available: https://www.tensorflow.org/model_optimization/guide/quantization/post_training

“Quantize ONNX models.” Accessed: Apr. 01, 2025. [Online]. Available:

https://onnxruntime.ai/docs/performance/model-optimizations/quantization.html

T. Ahmed Khan, R. Sadiq, Z. Shahid, M.M. Alam, and M.M. Su’ud, “Sentiment Analysis using Support Vector Machine and Random Forest,” Journal of Informatics and Web Engineering, vol. 3, no. 1, pp. 67–75, Feb. 2024, doi: 10.33093/jiwe.2024.3.1.5.

M.A. Daniel, S.-C. Chong, L.-Y. Chong, and K.-K. Wee, “Optimising Phishing Detection: A Comparative Analysis of Machine Learning Methods with Feature Selection,” Journal of Informatics and Web Engineering, vol. 4, no. 1, pp. 200–212, Feb. 2025, doi: 10.33093/jiwe.2025.4.1.15.

X. Cheng, “A Comprehensive Study of Feature Selection Techniques in Machine Learning Models,” Insights in Computer, Signals and Systems, vol. 1, no. 1, pp. 65–78, Nov. 2024, doi: 10.70088/xpf2b276.

P.V. Dantas, W. Sabino da Silva, L.C. Cordeiro, and C.B. Carvalho, “A comprehensive review of model compression techniques in machine learning,” Applied Intelligence, vol. 54, no. 22, pp. 11804–11844, Nov. 2024, doi: 10.1007/s10489-024-05747-w.

B. Hawks, J. Duarte, N. J. Fraser, A. Pappalardo, N. Tran, and Y. Umuroglu, “Ps and Qs: Quantization-Aware Pruning for Efficient Low Latency Neural Network Inference,” Front Artif Intell, vol. 4, Jul. 2021, doi: 10.3389/frai.2021.676564.

B. Kim, “Dimensionality and data size reduction using singular value decomposition,” Issues in Information Systems, vol. 25, no. 3, pp. 231–237, 2024, doi: 10.48009/3_iis_2024_118.

S. Palaniappan, R. Logeswaran, S. Khanam, and Y. Zhang, “Machine Learning Model for Predicting Net Environmental Effects,” Journal of Informatics and Web Engineering, vol. 4, no. 1, pp. 243–253, Feb. 2025, doi: 10.33093/jiwe.2025.4.1.18.

M. Zulqarnain, R. Ghazali, Y.M.M. Hassim, and M. Rehan, “A comparative review on deep learning models for text classification,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 19, no. 1, p. 325, Jul. 2020, doi: 10.11591/ijeecs.v19.i1.pp325-335.

M. Zulqarnain, R. Ghazali, Y.M.M. Hassim, and M. Rehan, “A comparative review on deep learning models for text classification,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 19, no. 1, p. 325, Jul. 2020, doi: 10.11591/ijeecs.v19.i1.pp325-335.

J. Devlin, M.-W. Chang, K. Lee, K.T. Google, and A.I. Language, “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding,” 2019. [Online]. Available: https://github.com/tensorflow/tensor2tensor