Neural Sequence Modelling for Spam Classification via Bidirectional LSTM and Hierarchical Neural Networks: A Deep Learning Approach

Yakin Ginson, E. Bijolin Edwin, V. Ebenezer, Stewart Kirubakaran S, M. Roshni Thanka, M. Manicka Raja · 2025

Spam messages are a major problem in digital communication. They are a breach of privacy, facilitate financial fraud and result in unnecessary clutter in one’s inbox. Most traditional methods for spam filtering are based on the older machine learning approaches. Such approaches rely on hand-crafted features which are inadequate to detect novel and progressively complex varieties of spam. As the spam messages become more sophisticated and sophisticated, we clearly require better detection algorithms. It must be able to detect small details in the text and understand the context of the messages in order to identify and filter out the spam effectively.In this paper a deep learning architecture for accurate classification of spam using Long Short-Term Memory (LSTM) and Bidirectional LSTM (BiLSTM) networks is introduced. The proposed method tokenizes, uses embedding layers and sequence modeling to effectively analyze SMS texts in order to distinguish between spam and non spam contents. A publicly available dataset of 5,574 SMS messages was used in this study, which included 4,827 non-spam messages and 747 spam messages. To this end, the dataset was first preprocessed through text normalization, stop word removal, and padding to ensure that the input sequences were of consistent length. In order to prevent overfitting, the model was trained with an optimum learning rate, an appropriate sample size, and dropout regularization procedures. The best performing model was the BiLSTM model which was able to process sequences in both directions and achieved an accuracy of 97.3%, precision of 95.6%, recall of 96.1% and an F1-score of 95.8%. The high recall score indicates that the model is able to correctly identify spam without many false negatives which is a critical component of an effective spam detection system. The study compares the accuracy of Bidirectional Long Short-Term Memory networks with usual classifiers such as SVM, Naïve Bayes, and Random Forest. The former technique shows better performance than traditional models in correctly identifying sequential links within text messages. Although the results are promising, there are still major issues to be addressed, such as dealing with skewed datasets and improving processing efficiency. Attention mechanisms to better understand context and respond to the new spam methods. This paper demonstrates show deep learning can be applied to develop a more reliable and automated spam detection thereby enhancing security and privacy.

Read the paper · More papers on PaperTik