TLDR: This research paper compares traditional machine learning models (SVM, Logistic Regression, Naïve Bayes) and transformer models (XLM-RoBERTa, RoBERTa-Dynabench) for hope speech detection in English social media texts. While traditional models performed well, transformer models, particularly RoBERTa-Dynabench, achieved higher precision and recall, demonstrating a better ability to capture complex semantic patterns of hope. The study suggests transformers and LLMs could excel even with smaller datasets.
In the evolving landscape of natural language processing (NLP), identifying “hope speech” on social media platforms has emerged as a crucial task. This involves recognizing motivational expressions that convey agency and goal-directed behavior, distinct from mere optimism or positive feelings. A recent study delves into this area, evaluating the effectiveness of both traditional machine learning models and advanced transformer architectures for detecting hope speech in English social media texts.
The research, titled “Hope Speech Detection in Social Media English Corpora: Performance of Traditional and Transformer Models,” was conducted by Luis Ramos, Hiram Calvo, and Olga Kolesnikova from the Instituto Politécnico Nacional, Centro de Investigación en Computación, Mexico City. Their work addresses the growing need to understand and potentially leverage hopeful expressions to enhance user well-being in online communities.
Understanding Hope Speech Detection
Hope speech is defined as the perceived capability to formulate methods to achieve set targets and self-motivate through agentic thought to act on such methods. It’s a nuanced emotion that goes beyond simple positivity, offering insights into individuals’ goals and expectations. The study highlights that accurately identifying hope speech can guide timely actions to support users on social media.
Methodology at a Glance
The researchers employed a comprehensive methodology, starting with a carefully curated dataset of English social media texts, pre-split into training, development, and test sets. This dataset, sourced from the PolyHope-M shared task at RANLP 2025, ensured a balanced representation of “Hope” and “Not Hope” classes.
A critical initial step involved extensive data cleaning. This phase standardized text by converting to lowercase, performing word lemmatization, and removing emojis, URLs, numbers, special characters, and stop words. Libraries like Spacy and NLTK were instrumental in this process, preparing the text for more effective analysis.
For traditional machine learning models, feature engineering played a vital role. Text representations were created using TF-IDF (Term Frequency-Inverse Document Frequency) and CountVectorizer from the scikit-learn library. The best performance was observed with N-grams of words, specifically using an ngram range of (1,8) and an ‘analyzer’ set to ‘word’.
Models Explored
The study evaluated a range of models:
- Traditional Machine Learning Models: These included Logistic Regression, Naïve Bayes, and Support Vector Machines (SVM) with both linear and RBF (Radial Basis Function) kernels. These models were deployed with default parameters using the scikit-learn library.
- Transformer Models: Two pre-trained transformer encoders were fine-tuned for the task: XLM-RoBERTa (specifically, papluca/xlm-roberta-base-language-detection) and RoBERTa-Dynabench (facebook/roberta-hate-speech-dynabench-r4-target). These models were trained for five epochs with a batch size of 16, utilizing automatic best-model selection based on the macro-F1 score.
Key Findings and Performance
On the development set, traditional models showed competitive performance. A linear-kernel SVM and logistic regression both achieved a macro-F1 score of 0.78, while SVM with an RBF kernel reached 0.77, and Naïve Bayes scored 0.75.
However, transformer models generally delivered superior results. On the test set, the RoBERTa-Dynabench model emerged as the top performer. It achieved a weighted precision of 0.82, weighted recall of 0.80, weighted F1 of 0.79, macro-precision of 0.82, macro-recall of 0.80, macro-F1 of 0.79, and an overall accuracy of 0.80. This performance surpassed both the traditional SVM (which scored 0.79 across all metrics) and the XLM-RoBERTa model (also at 0.79).
Also Read:
- Beyond Size: Small Language Models Prove Competitive for Requirements Classification
- Bridging Language and Structure: A Look at Large Language Models and Text-Attributed Graphs
Conclusion and Future Implications
The study concludes that while well-configured traditional machine learning models remain effective and agile, transformer architectures demonstrate a greater ability to capture the subtle semantics inherent in hope expressions. This leads to enhanced precision and recall in hope speech detection. The findings suggest that larger transformers and advanced Large Language Models (LLMs) could potentially achieve even better performance, especially when working with smaller datasets.
For a deeper dive into the methodology and results, you can access the full research paper here.


