Preprint
Large Language Models

Filtro de SPAM basado en aprendizaje profundo

Danna Lesley Cruz Reyes, Juan Camilo Camargo Prieto, Andres David Leon Hernandez, Felipe Algarra
December 2, 2025Comunicaciones en Estadística

0

Citations

0

Influential Citations

Comunicaciones en Estadística

Venue

2025

Year

Abstract

La clasificación de correos electrónicos como spam o no spam es un problema clásico en el procesamiento de lenguaje natural. En este trabajo se implementan dos enfoques de aprendizaje profundo para abordar esta tarea: un modelo basado en BERT y una red neuronal recurrente LSTM. Se comparan sus rendimientos en términos de precisión, recall, F1 score y eficiencia computacional. Ambos modelos se entrenaron y evaluaron sobre el Enron Email Corpus, alcanzando una exactitud global del 97% y un F1 score equilibrado para ham y spam. El modelo BERT presenta una leve mejora en métricas de robustez, aunque implica mayores tiempos de entrenamiento e inferencia; por su parte, LSTM sigue siendo una solución efectiva cuando se diseña y entrena adecuadamente con un consumo de recursos sensiblemente menor. Estos hallazgos evidencian que, según los requisitos de latencia y capacidad de cómputo, es posible optar por un enfoque transformer de alto rendimiento o una implementación recurrente más ligera.

Analysis

Why This Paper Matters

Spam email classification remains a critical task for cybersecurity and user productivity. While deep learning has been applied extensively, this paper directly compares two dominant paradigms—transformer-based (BERT) and recurrent (LSTM) architectures—on a standard benchmark. The findings are immediately actionable for practitioners: they quantify the trade-off between marginal accuracy gains and computational cost. In production environments where latency and hardware budgets are constrained, knowing that LSTM can achieve 97% accuracy with far fewer resources is valuable.

Technical Contributions

The paper's main technical contributions include:

  • A clean, reproducible comparison of BERT and LSTM on the Enron Email Corpus, a widely used dataset.
  • Evaluation using precision, recall, F1 score, and computational efficiency metrics, providing a holistic view of model performance.
  • Demonstration that both models achieve high accuracy (97%) and balanced F1 scores, indicating that neither class (ham or spam) is neglected.
  • Quantification of the resource gap: BERT requires longer training and inference times, while LSTM is more efficient.

Results

Both models reached 97% overall accuracy on the Enron dataset. BERT exhibited slightly better robustness, likely due to its attention mechanism capturing long-range dependencies in email text. However, LSTM's performance was nearly equivalent, with the key advantage of lower computational overhead. The F1 scores were balanced for both ham and spam, suggesting no significant class imbalance issues. These results align with the broader literature where transformers often edge out recurrent models but at a higher cost.

Significance

This study reinforces the practical insight that simpler architectures can still be highly effective for well-defined NLP tasks like spam detection. It provides a clear decision framework: choose BERT when maximum accuracy and robustness are critical and resources allow; choose LSTM when latency, power, or cost constraints dominate. The work also highlights that the Enron dataset remains a relevant benchmark, and future research could extend comparisons to newer models like DistilBERT or lightweight transformers.