Abstract
Ethnic hate speech is a form of intersectional violence that affects Indigenous groups in México. Despite the severity of this social phenomenon, there is a lack of computational resources, specifically labeled datasets, to enable the development of automated tools for its detection. This paper presents a methodology for calculating benchmarks of the EthnoHate dataset, designed for the classification of ethnic hate speech in México, and focuses on establishing baselines using machine learning algorithms. Moreover, different levels of linguistic representation are evaluated. The results reveal that hate in the dataset is predominantly explicit, with a strong lexical component, enabling models such as BoW, and TF-IDF to achieve an F1-macro competitive. However, semantic techniques like BERT with a contextual classifier achieves the best overall performance in F1-macro, demonstrating that there is a significant proportion of implicit cases that require deep semantic understanding. Analysis of algorithms reveals that ethnic hate speech in México manifests through a recurring vocabulary with complex combinations, and that, while lexical approaches are highly effective, contextual models are necessary to capture the subtlety and diversity of hate expressions. This work establishes the feasibility of the task, validates the quality of the EthnoHate dataset, and lays the groundwork for future research employing more complex architectures.
1. Introduction
Hate speech refers to any type of communication, whether oral, written, or behavioral, that attacks or uses pejorative or discriminatory language toward a person or group [1]. The most common reasons why people are victims of discrimination include the following: identity and belonging—gender, age, ethnicity, gender identity, sexual preference, spiritual or religious beliefs (or lack thereof), and place of origin; social and personal status—socioeconomic status, level of education, and presence of disabilities; communication and expression—language and/or accent, cultural clothing, and political ideology, among many others [1,2,3].
Hate speech is commonly spread through social media, a mass communication medium that facilitates its dissemination. Although most hate messages are textual, images and sounds are also used. Therefore, to address this problem from a computer science perspective, text classification is the most effective method for automated detection [4]. It is not just about text, but rather an amplification system, where users do not use explicit hate speech, but rather encode it through humor or irony to normalize extreme ideas.
Hate speech has serious negative consequences of affecting people, promoting misinformation, and degrading online dialogue. This sheer volume of digital data prevents effective human review, as manually processing and classifying large amounts of text data is slow and difficult. Furthermore, the accuracy of manual text categorization can easily be affected by human factors such as fatigue and competence [4]. Because of this, it is essential to advance research into automated techniques for its detection [5]. That is the reason Natural Language Processing (NLP) is a fundamental tool for mitigating hate speech, as it allows for the analysis of textual linguistic features.
In the state of the art, there have been various efforts to address this problem. NLP has seen a notable increase in academic interest in hate speech detection, ranging from the implementation of traditional machine learning to deep learning. This is reflected in a significant increase in research in this area, with developments allowing social media platforms to identify and block hateful messages before they are published, thereby reducing the risk of harassment [1,6].
Advances in this area have had a significant impact in various fields, leading to the creation of datasets of social media real posts in different regions of the world, mainly in English. These are particularly focused on detecting hate speech against women [7,8,9], the LGBT community [10,11], and religious communities such as those of Islam, Christianity, and Judaism [12]; in relation to nationality and racism, there is also work published on the detection of hate speech against immigrants [7].
Hate speech and discrimination are closely related terms. In México, the origins of discrimination can be traced back mainly to the Spanish conquest and the colonial caste system, which established social structures based on ethnic origin and skin color to maintain control and justify inequality. These prejudices have been perpetuated over time and continue to this day [13].
According to the CONAPRED (Consejo Nacional para Prevenir la Discriminación), “Not every act of discrimination is caused by hate speech; however, all hate speech has a discriminatory basis” [14]. Ethnic discrimination is also commonly known as racial discrimination or racism, especially in the international area. However, there are no races within the human species. This idea is based on the false premise that human beings can be classified racially, establishing a hierarchy where certain races are considered superior, and therefore, others are seen as morally and intellectually deficient [15]. Ethnic hate speech constitutes a specific form of violence, as it is directed against individuals or groups that are distinguished by their cultural characteristics, traditions, ethnicity, clothing, and skin color, among other factors [16].
This is intersectional violence with other types of violence such as aporophobia or classism, where—according to the special report on discriminatory narratives issued by [14] CONAPRED—the main victims are those living in poverty, who face not only a shortage of economic resources but also marginalization by society and a lack of access to education and job opportunities. Although CONAPRED receives complaints from various motives, it has documented cases related to ethnic origin that demonstrate hate speech put into practice in the form of discrimination. This is reinforced by data obtained in the most recent National Survey on Discrimination (https://www.inegi.org.mx/app/saladeprensa/noticia/8172 (accessed on 15 February 2026)), where indigenous groups have seen an increase in discrimination. The percentage of indigenous people who reported having suffered an act of discrimination rose from 25% in 2017 to 28% in 2022, making them one of the most vulnerable groups.
However, despite the fact that ethnic hate speech represents a serious and recurring problem within the Mexican social context, there is a lack of labeled datasets that capture the linguistic diversity and contextual particularities of hate speech in the country. This promotes the development of text classification tools, meaning that the severity of the social phenomenon is not supported by the necessary computational resources. Therefore, in this article, we present an effort to address this problem with the creation of the EthnoHate dataset, the purpose of which is to classify ethnic hate speech in México. Specifically, in this work, we focus on the calculation of benchmarks through machine learning algorithms. The importance of this work lies in the fact that it establishes the feasibility and difficulty of addressing this problem and validates the dataset in relation to the labeling performed and the classes established. In addition, it lays the foundation for comparing performance between classification algorithms.
The rest of the paper is structured as follows: The Section 2 reviews the background of hate detection, with emphasis on how benchmarks have been calculated across other datasets. The Section 3 describes the construction of the EthnoHate dataset, its class distribution, the division into training, development, and testing phases, as well as the textual representations and the set of classification algorithms selected to establish the benchmarks. The Section 4 presents the performance of each configuration, including a comparative analysis. Finally, the Section 5 synthesizes the findings, thus validating the quality of the EthnoHate dataset and establishing a solid foundation for future work with more complex architectures.
2. State of the Art
Recently, hate speech detection has gained significant relevance in the field of NLP, reflecting the scientific community’s growing interest in social and ethical issues. This boom is directly related to the international commitment to curb extremism and violence on the internet. It is essential to address hate speech, as it stems from intolerance and prejudice and has the potential to trigger acts or even structured policies of violence and discrimination [17]. Hate speech is addressed computationally as a classification problem through NLP, particularly machine learning, which consists of assigning predefined categories to texts, facilitating the management of large volumes of unstructured text data [18].
Automatic detection of hate speech has become a priority for ensuring safe digital spaces. However, the effectiveness of these systems depends critically on the availability of annotated datasets and the definition of robust benchmarks that allow the progress of new algorithms. The effectiveness of text classification models depends on feature selection and engineering, since the quality of the input data conditions the learning of the algorithm. By using units such as words or semantic structures, both accuracy and interpretation capacity can be optimized. Hate speech detection is mainly based on textual feature engineering, using techniques such as TF-IDF and n-grams to represent textual features [19]. However, the landscape has changed with the advent of architectures such as BERT (Bidirectional Encoder Representations from Transformers) [20]. These deep learning models have redefined industry standards by processing bidirectional relationships and long-distance contexts, thus capturing the semantic complexity of text more efficiently [18].
Hate speech becomes especially difficult to distinguish when it involves regional expressions or language used against vulnerable groups, where nuance is crucial. Therefore, in this section, we will review some key initiatives that have laid the methodological groundwork for establishing benchmarks or baselines for classifying violent content across various social contexts.
As a basis for the study of digital violence, the MEX-A3T dataset [21] allows for the detection of aggression in tweets in the Mexican Spanish language. Its relevance lies in the fact that it serves as a starting point for combating complex problems such as hate and harassment, through the analysis of social media posts on topics such as politics, sexism, homophobia, and discrimination. To establish a point of comparison, two traditional baselines were developed: a Bag of Words (BoW) model and another based on character trigrams. In both schemes, preprocessing was applied, consisting of the removal of stop words and special characters from the entire vocabulary of the corpus. The final classification was carried out using a Support Vector Machine (SVM) with a linear kernel.
HOMO-MEX [11] is a model designed to detect LGBTQ+phobic content written in Mexican Spanish. This project is crucial because it addresses the duality between aggressive and subtle expressions. Its benchmarks were established by comparing traditional algorithms, such as Naive Bayes (NB), SVM, Logistic Regression (LR) and Random Forest (RF), with cutting-edge models based on BERT. Technically, HOMO-MEX validated that combining frequency features (BoW and TF-IDF) with contextual language models is the most robust strategy for classifying discrimination on social media. On the other hand, In HOMO-LAT, a pretrained BERT database for Spanish was implemented and fitted to the training dataset using the HuggingFace Transformers library [10].
On the other hand, EXIST is a shared task on identifying sexism in social media. EXIST seeks to address sexism in a broad sense, from explicit misogyny to other subtle expressions that imply implicit sexist behaviors. To evaluate the performance of the different approaches proposed for this problem, in its 2021 and 2022 editions [8,9], they proposed two different baselines to establish the expected performance of the runs. First, they calculated a benchmark based on an SVM, with input from features extracted with TF-IDF, generated from text BoW. A second benchmark is based on a model that labels each record according to the majority class.
In the field of political and religious hate speech, the third edition of the shared task on detecting hateful content in Italian tweets [12] stands out. In this work, benchmarks were calculated using SVMs trained with BoW representations, employing the XPoliticalHate and HaSpeeDe2 datasets. This approach reaffirms the use of traditional models and lexical representations as a solid basis for benchmarking in hate detection tasks.
Meanwhile, the HatEval shared task was presented [7], focused on the detection of hate speech against immigrants and women, where two benchmarks were calculated: the first is based on the majority class and a representation based on TF-IDF with the SVM classifier.
Table 1 summarizes state-of-the-art approaches to hate speech detection. As observed, this trend is reflected in the predominance of traditional techniques, with the SVMs as the most frequently used algorithm and the quintessential reference model due to its ability to generalize in high-dimensional vector spaces. Naive Bayes and Random Forests are also used, complementing the analysis of digital violence phenomena documented in recent literature. Some studies have established morphological benchmarks, such as MEX-A3T, which established textual representation using character trigrams.
Table 1.
Summary of datasets.
According to the literature review, there is a strong consensus on the representation and classification methods used to calculate reference models, highlighting that TF-IDF and n-gram-based representations have demonstrated consistent performance in capturing the lexicon of sentiment, polarity, and other linguistic features essential for identifying hate speech. In particular, representations such as BoW and TF-IDF remain relevant for detecting offensive language, although their scope is limited to the lexical level, as they rely exclusively on term frequency and fail to capture complex semantic relationships between words.
Therefore, current research suggests a necessary transition toward integrating advanced linguistic models such as BERT and BETO. This evolution allows us to move beyond the identification of isolated words to understand the semantics and context behind online violence, facilitating the critical distinction between aggressive colloquial language and hate speech intended to offend or marginalize.
Despite advances in Natural Language Processing, a significant gap persists in the state of the art regarding the specific detection of ethnic hate speech in the Mexican context. Current efforts in Mexican Spanish have primarily focused on detecting generic aggression using MEX-A3T or forms of violence directed at the LGBT+ community using HOMO-MEX. International databases such as HatEval address hatred toward immigrants and women, while resources like HaSpeeDe3 focus on political and religious hate in other languages. However, there is no specialized corpus analyzing ethnic discrimination against Indigenous peoples in México, an absence that is especially important considering the increased discrimination this group has experienced. This lack represents a crucial opportunity to develop models that, beyond detecting sexism or generic aggression, can decode the historical, cultural, and linguistic nuances of ethnic hate directed at Indigenous communities. Consequently, this paper systematically establishes and presents the initial performance parameters for the EthnoHate dataset; the benchmarks of this dataset are essential not only to validate the new corpus, but also to evaluate the performance of future models and contribute to making visible a topic that is little explored in the literature, thus strengthening research in cultural and linguistic contexts.
3. Proposed Methodology
Hate speech is difficult to identify. Its complex and multifaceted nature presents significant challenges for both human annotators and automated systems. In this context, EthnoHate dataset is presented, wich is composed of tweets specifically collected and annotated for the detection of hate speech directed at Indigenous communities in México. It addresses the need for specialized datasets that allow for the training and evaluation of models capable of learning in this domain. The main objective of the methodology is to establish initial benchmarks for the dataset, which will serve as a reference point for future research. To this end, traditional and modern text representation techniques, as well as widely used classifiers for similar tasks, were employed.
3.1. Data
The instances were collected through a manual search on social network X, using words directed at a specific person or group through terms referring to the 68 indigenous communities of México, the words indio, india, and indigena, as well as their ethnonyms. As a result of the data-collection process, a set of 18,685 publications was obtained. However, after data curation, the resulting number of posts was 17,000. Subsequently, a pre-processing phase was carried out aimed at cleaning and anonymizing the information, in which the usernames of both the sender and the recipient were replaced by a generic label. This procedure made it possible to protect the identity of users and standardize the text for subsequent analysis.
With the participation of experts in social anthropology and indigenous law, the collected publications were analyzed and labeled through guidelines that establish criteria for annotating each post. Subsequently, an annotation team was formed, consisting of eight people selected based on their familiarity with social media, use, and the sociocultural context in which the analyzed interactions take place. Before beginning the labeling process, the annotators were given clear and detailed information about the general objectives of the research, the purpose of the dataset, and the importance of accurate annotation for the development of reliable hate speech detection models.
In order to ensure the consistency and quality of the annotation process, a preliminary annotation training phase was carried out. During this stage, several meetings were held in which the classification categories were presented and explained in detail, along with their formal definitions and inclusion and exclusion criteria. Representative examples of each category were also analysed, and borderline or ambiguous cases were discussed, allowing annotators to compare interpretations, resolve doubts, and harmonize the criteria.
These examples lie on the borderline between hate speech against the Indigenous community and hate speech against another population (or between hate speech and non-discriminatory criticism) for the following reasons:
- “indio” Dijo el Europeo color cartón mojado.
This example represents sarcasm. No other population is explicitly attacked, but the use of “European” as a contrast could imply a reverse criticism (a stereotype of the racist European).
- No mnches! A la India Maria se le respeta, porque siempre portó con orgullo la vestimenta de indígena Mazahua, en cambio la p1nch3 zopilota, solo parece que va a una fiesta de disfraces. Un saludo a todos los indígenas, con mucho cariño.
The main attack is against a non-Indigenous woman (“Zopilota”), who is accused of cultural appropriation and ridiculing Indigenous clothing. The insult is violent (“p1nch3 zopilota”), but it is not directed at her ethnic identity, but rather at her behavior.
- Qué increíble ver a una cocinera tradicional cuicateca representando nuestra cultura en este nuevo libro. Oaxaca siempre poniendo el nombre de México en alto con su gastronomía, aunque siendo sinceros me parece Hay chefs con estudios de verdad que sí ponen el nombre de México en alto, no esto, esta es comida taan ordinaria y comun.
It is not explicit hate speech, but it approaches a microaggression or systemic contempt for Indigenous culture. The ambiguity lies in whether it is a legitimate opinion about the quality of the food or a derogatory judgment based on ethnicity/class.
This iterative process of discussion and consensus was essential to reduce the subjectivity inherent in the task and minimize variability among annotators.
Once the annotation training stage was complete and a common agreement had been reached on the annotation guidelines, the dataset was labeled using the Human Signal® platform. This tool facilitated the systematic assignment of labels and the monitoring of annotation progress. Each post was classified into one of three defined categories: hate, no hate, and unrelated hate. The hate class includes explicit or implicit expressions that promote discrimination, contempt, or violence towards indigenous communities; the no hate class covers posts that, although related to these communities, do not contain offensive content; meanwhile, the unrelated hate class corresponds to messages with hate unrelated to the population study.
To ensure the reliability and consistency of the manual labeling of the EthnoHate corpus, Fleiss’s Kappa coefficient was used, a statistical metric designed to assess the degree of agreement among multiple annotators [22]. The coefficient ranges from −1 to 1, where 1 represents perfect agreement and 0 indicates that the observed agreement is equivalent to that expected by chance. In this study, the Fleiss’s Kappa value obtained was 0.9, indicating a substantial level of agreement among the annotators. Furthermore, it validates the consistency of the labeling criteria applied to the categories of ethnic hatred, no hate, and unrelated hate. This high reliability is crucial to ensuring that the subsequently established benchmarks reflect genuine linguistic patterns and not the particular biases of an individual annotator. This annotation scheme made it possible to construct a structured and coherent dataset, suitable for use in automatic classification tasks and for establishing reliable benchmarks in the detection of hate speech towards indigenous communities in México.
Regarding the representativeness of the labels, an imbalance is observed: the predominant category is no hate, followed by hate, while unrelated hate is the least-represented class (as illustrated in Figure 1). The dataset was split as follows: 70% of the instances were allocated to model training, 10% were reserved for hyperparameter tuning (development), and 20% were reserved for the final evaluation (test). This partitioning was performed randomly, maintaining the class distribution.
Figure 1.
Distribution of classes in the EthnoHate dataset.
A significant limitation of the methodological design is that, despite identifying a significant imbalance in the distribution of classes within the dataset (53% for no hate, 43% for ethnic hate speech, and only 4% for unrelated hate), no strategies to mitigate this imbalance were implemented. This decision was based on preserving the natural distribution of the phenomenon in the collected data. However, it is recognized that this imbalance impacts model performance differently for each class: (a) the majority class (no hate) will tend to obtain the highest metrics; (b) the ethnic hate speech class, despite having considerable representation (43%), may be affected by overlap with no hate; and (c) the minority class (unrelated hate, 4%) has a high probability of obtaining low sensitivity (recall) and accuracy values, generating false negatives (undetected hate speech) and false positives (confusion with other classes).
3.2. Text Representation
This section details the various text representation techniques used in the classification task. The selection of these representations sought to cover aspects of different language levels:
- Morphological
- –
- Probability of ASCII characters: This is based on obtaining the relative frequency of each character by normalizing its individual content by the total length of the text. The final product is a 256-dimensional vector, where each entry reflects the probability of occurrence of a specific character [23,24].
- Lexical
- –
- BoW: In this technique, the representation is based exclusively on word frequency, without considering syntactic organization.
- –
- TF-IDF: Calculates a score for each word that reflects how informative it is to a particular text, taking into account it is frequency across the corpus.
- Semantic
- –
- BERT: Contextual integration is an approach to attribute extraction that interprets the meaning of a word by considering it is environment in a bidirectional way, that is, by examining both the terms that precede it and those that follow it [20].
- –
- D2V: Allows textual content to be represented in a continuous vector space, enabling the encoding of deep semantics and contextual environment. This capability facilitates the recognition of complex patterns and relational links between various documents in the dataset [25].
We considered the aforementioned representations to compare their performance. At the morphological level, we could identify whether users are employing word distortions (e.g., 1nd14) or spelling alterations. At the lexical level, we could identify whether hate speech relies on specific vocabulary. Finally, by implementing semantic representations, we could capture the context of irony or sarcasm.
Furthermore, implementing these benchmarks allows to identify annotation biases. If a lexical benchmark performs exceptionally well, it could mean that human annotators relied primarily on the presence of certain words for tagging, rather than on context. Calculating benchmarks with these representations is not just a methodological procedure, but a diagnostic tool. In the case of ethnic hatred, where language is constantly evolving to evade censorship. Understanding the contribution of each linguistic level (morphological, lexical, and semantic) in this task is vital to building more robust systems.
For each classifier (SVM, LR, NB, RF, KNN, DT, MLP), feature vectors were generated from each representation technique. For example, a given text is converted into (i) a 256-dimensional vector with the probability of ASCII characters, (ii) a word frequency vector with BoW, (iii) a TF-IDF vector of the same space, and (iv) a 768-dimensional vector with BERT. Each of these vectors is fed separately into each classifier. The BERT SC classifier, however, directly uses BERT’s own internal representations, fine-tuning the entire model.
3.3. Modeling Text Classification
Regarding text classification, we considered traditional and modern approaches, which are based on the state of the art.
- SVM: As the reference algorithm, it is based on its robustness and its inherent ability to handle high-dimensional feature spaces, such as those generated by TF-IDF or BoW representations.
- LR: This is considered a standard for benchmark calculation due to its computational efficiency (fast training) and its ability to generate probabilities, which facilitates the interpretation of model confidence.
- NB: This algorithm is based on Bayes’ theorem, which addresses the probability theory. It allows the use of subjective information and combines it with empirical information to estimate the probability of events. In any text classification task, it is used as a standard to establish a benchmark for proposed models.
- Random Forest (RF): This is used as a benchmark classifier for hate speech detection. First, text documents are represented by vectorized features (e.g., TF-IDF), and multiple decision trees are trained on random subsets of data and features. Finally, the predictions are obtained through majority voting, providing a robust baseline for performance comparison.
- KNN: We included KNN as a baseline to assess whether vector-space similarity between posts is an effective predictor of hate speech. That is, it seeks semantically or lexically similar texts that share a label, enabling the diagnosis of corpus homogeneity.
- Decision Tree (DT): This approach helps determine whether hate speech can be characterized by straightforward rules, thereby gauging the complexity of the hate speech classification.
- Multilayer Perceptron (MLP): We include this as a baseline to assess whether including nonlinearities in the model improves performance compared to linear classifiers, serving as an intermediate point between classical approaches and more complex deep learning models.
- BERT SC: The contextualized representations produced by the BERT encoder (Section 3.2) were fed into a linear classification head for the Sequence Classification (SC) task.
To ensure transparency and facilitate the replication of this study, both the text representation techniques and the evaluated algorithms are available in the following repository [24]: https://gitlab.com/JohnRojas/NLPClassKit (accessed on 10 February 2026).
We implemented a classification pipeline for detecting ethnic hate speech (see Figure 2). The methodology combines an architecture that compares traditional models (SVM, RF, MLP) with representations such as ASCII, BoW, TF-IDF, and BERT. The evaluation is based on metrics of accuracy, recall, and F1-score.
Figure 2.
Diagram of the proposed methodology.
3.4. Evaluation Metrics
To evaluate model performance, the following metrics were used: precision, recall, and F1-score. Particular consideration was given to the macro average. The macro average calculates the metric independently for each class and then averages the results, giving equal weight to all classes regardless of their frequency in the dataset. This choice is particularly relevant in this study, as the minority class unrelated hate has the same evaluative importance as the majority class no hate, thus allowing for a fairer and more rigorous assessment of model performance in the face of the natural imbalance in the data.
The following formulas explain the metrics, where is true positives, is false positives, and is false negatives.
Precision: This is the metric that calculates the fraction of true positives out of the total number of items classified as positive.
Recall: The recall indicates, of all the cases that are positive in reality, how many of them were accurately labeled as positive by the model.
F1-score: The F1-score combines precision and recall through the harmonic mean, offering a measure that seeks a balance between these two metrics.
4. Experimental Results
This section presents and analyzes the results obtained in the evaluation of different classification algorithms for detecting ethnic hate speech, examining the performance of various textual representations: morphological (ASCII character probability), lexical (TF-IDF, BoW), and semantic (BERT, D2V) in capturing linguistic nuances. To establish a robust comparative overview, a diverse set of classification algorithms was employed, from traditional approaches to modern.
Benchmarks
To ensure the robustness and generalizability of our findings, we selected eight machine learning algorithms (SVM, LR, NB, RF, KNN, DT, MLP, and BERT SC). This diverse set of models enables a comprehensive evaluation of performance metrics across different learning approaches. In addition, we considered five text representations (ASCII, TF-IDF, BoW, BERT, and D2V), enabling comparisons among classical, distributed, and contextualized approaches within the benchmark. In addition, these models and representations have been widely adopted as baselines in previous hate speech detection studies [7,8,9,11,21], supporting fair and interpretable evaluation. Accordingly, we evaluated multiple combinations of text representations and classification models.
The experimental setup used in this study is documented in Table 2, which details the hyperparameters for both text representations and classification algorithms. Regarding text representations, the D2V embeddings were generated using 100-dimensional vectors, a context window of 5, and 5 training epochs, empirically chosen to capture semantic relationships between words and documents. TF-IDF vectors were constructed using the 100 most frequent unigrams and bigrams at the document level. In addition, multilingual BERT (bert-base-multilingual-cased) was employed to obtain contextual embeddings of size 256 using [CLS] pooling. For the ASCII-based representation, the vector length was fixed at 256, as described in Section 3.2. Finally, the BoW representation yielded a high-dimensional feature space (57,198) derived from the vocabulary of the training set.
Table 2.
Parameters of each text representation and machine learning classifier.
The hyperparameters of the classification models were selected to ensure a balanced comparison across both traditional machine learning and deep learning approaches. For transformer-based classification, the BERT model was fine-tuned with a maximum sequence length of 128 tokens, a learning rate of , and 5 training epochs, following common practices in text classification. For traditional classifiers, standard yet effective configurations were adopted. Naive Bayes employed the complement variant (ComplementNB), which is particularly suitable for imbalanced text data. The SVM used a Radial Basis Function (RBF) kernel to capture nonlinear decision boundaries, while KNN was configured with , favoring local neighborhood decisions. Ensemble and tree-based methods included RF with 200 estimators and DT using the Gini impurity criterion for node splitting. The LR was trained for up to 10,000 iterations to ensure convergence. Finally, an MLP with 5 hidden layers, 1160 neurons, and ReLU activation was trained for 50 epochs, enabling the model to capture complex nonlinear relationships in the data.
Table 3 reports the mean performance (±standard deviation) over 10-fold cross-validation for all evaluated models previously described in Table 2. In addition to these models, a baseline was included using the majority class (One-R) to provide a reference point for comparison. As expected, the One-R baseline obtains the lowest F1-score (0.2276). Moreover, the ASCII + MLP model performs similarly to the One-R baseline, indicating that character-based representations capture fewer linguistic patterns of ethnic hate speech.
Table 3.
Obtained results of each model (mean ± standard deviation).
The results show a wide variability in performance, with F1-scores ranging from 0.2276 to 0.6158. The benchmark based on the majority class (One-R) performed poorly, as it is an extremely simple classification method that selects the most predictive class. This benchmark serves as the basis for this research. Its low performance confirms that the classifiers are learning genuine patterns, while (ASCII + MLP) improves on the classification of One-R, purely morphological character-based information is insufficient to capture hate speech.
On the other hand, there is a group of configurations based on lexical representations, including TF-IDF + DT, TF-IDF + RF, and BoW + NB; these perform very similarly, since the simple frequency-based models are expressed using specific vocabulary, while BERT + SC exhibits the best performance, achieving an F1 value of 0.6158.
To assess whether the performance differences between the models are statistically significant, the non-parametric Friedman test was applied to the 10-fold cross-validation results. According to this test, a Friedman statistic of was obtained. With a -value = (), the differences between all models are significant. Pairwise comparisons showed that the SC + BERT model significantly outperformed all other classifiers. Table 4 shows the pairwise comparisons based on Wilcoxon (BoW + NB (1); D2V + KNN (2); D2V + LR (3); ASCII + MLP (4); BERT + SVM (5); TF-IDF + DT (6); TF-IDF + RF (7); BERT + SC (8)) signed-rank test [26].
Table 4.
Pairwise comparisons.
Figure 3 shows the degree of significance of BERT + SC over the other models by means of (*). Moreover, the BERT+SC model ranks first, significantly outperforming SVM+BERT with an average difference of 0.09 points in F1. On the other hand, the models with traditional representations (BoW + NB, TF-IDF + RF, TF-IDF + DT) show intermediate and consistent performance, with average values between 0.49 and 0.54. D2V embeddings combined with linear (LR) and distance-based (KNN) classifiers performed worse. Finally, MLP + ASCII was significantly worse (mean = 0.20), probably due to the inability of the ASCII representation to capture relevant semantic information.
Figure 3.
Statistical significance between models.
Finally, Figure 4 shows a comparison between the precision and recall measures, with recall on the Y-axis and precision on the X-axis. The dashed diagonal line represents a balance between both metrics: points below the line indicate higher precision than recall, whereas points above it indicate the opposite. Although BERT + SC and BoW + NB achieve the best F1-score, they show an imbalance between precision and recall, suggesting difficulties in capturing hate speech nuances without incurring false negatives. This behavior may be related to the linguistic characteristics of the dataset, where hate speech is often expressed implicitly through sarcasm, ambiguity, or context-dependent language (see examples of Section 3.1), making it harder to detect.
Figure 4.
Comparison between precision and recall of generated models.
In contrast, the combinations BERT + SVM, TF-IDF + DT, TF-IDF + RF, D2V + LR, and D2V + KNN are located close to the diagonal line, indicating a balance between precision and recall. Despite their F1-scores being lower than BERT + SC, these models do not favor one type of error over another, suggesting more stable and neutral behavior. On the other hand, although ASCII + MLP and One-R have the lowest performance, their balance indicates that they tend to classify more instances as positive, increasing recall at the expense of precision. This may be influenced by the limited representational capacity of these approaches to capture the lexical and semantic variability of hate speech.
Overall, these results indicate that no single model is universally optimal, highlighting the inherent complexity of ethnic hate speech detection, which is shaped by linguistic variability, implicit expressions, and contextual dependencies. This suggests that selecting a model should depend on the specific application requirements, particularly the importance of balancing precision and recall.
5. Conclusions
The rise in discrimination against Indigenous groups in México and the persistence of discriminatory structures with colonial roots underscore. The urgent need to develop technological tools that contribute to the detection and mitigation of ethnic hate speech. This work represents an important first step by providing the following:
- A Spanish computational resource designed to represent and analyze the distinctive characteristics of ethnic hate speech within the Mexican context.
- Robust benchmarks that establish the performance of classifiers and allow quantifying the added value of more complex models.
- An analysis of the dataset that reveals a predominantly explicit character, but with important contextual nuances.
- The benchmarks were established using a set of classification algorithms combined with textual representations at different linguistic levels.
The obtained results demonstrate that classifying ethnic hate is achievable using computational techniques. All evaluated models significantly outperform the dummy classifier One-R (F1 = 0.2276). This validates the quality of the labeling and confirms that the established classes (“No Hate”, “Hate”, “Unrelated Hate”) exhibit distinctive linguistic patterns that the algorithms can learn. The algorithms’ performance indicates that a substantial portion of the hate is manifested through recurring offensive vocabulary and direct insults. This reflects that, in the Mexican digital context, users frequently resort to explicit terms to express ethnic discrimination. However, BERT’s performance suggests that is required a deep contextual understanding. These examples likely include hate, sarcasm, irony, or implicit cultural references that purely lexical models cannot capture.
While BERT obtained the best performance (see Table 3), it is important to evaluate Spanish versions of the model to address the imbalance between recall and precision. Although multilingual transformer models have been implemented, it is essential to explore architectures tailored to Spanish, since the linguistic and cultural nuances of ethnic hate in México may be better represented by these approaches. Thus, we propose evaluating pretrained models such as BERTín, RoBERTa, and BETO, and comparing their performance against their multilingual versions.
The statistical significance test demonstrated that BERT + SC outperforms the other models evaluated in the task of detecting ethnic hate speech in the Mexican context -value = . This level of significance provides statistical evidence supporting the claim that incorporating deep contextual representations substantially improves discrimination capabilities compared to purely lexical or less complex approaches.
On the other hand, even though the evaluation does not consider accuracy and is based on robust metrics such as precision, recall, and F1-score; the unrelated hate minority class (4%) continues to pose a significant challenge. To address this limitation, the following lines of future work are proposed:
- Advanced sampling techniques: Explore synthetic oversampling strategies such as SMOTE (Synthetic Minority Over-sampling Technique), as well as intelligent undersampling methods that preserve the original data distribution.
- Generation of synthetic data with generative models: Employ variants of autoencoders (VAE), conditional Generative Adversarial Networks (GANs), or Large Language Models (LLMs) to generate artificial examples of the Unrelated Hate class under human supervision, ensuring the semantic consistency of hate content unrelated to ethnicity.
- Evaluation using learning curves by class: Perform a systematic analysis of the model’s performance based on the training sample size to determine the saturation point of each class and establish minimum thresholds of required data.
We also propose implementing fine-grained labeling in EnthoHate to identify the motives behind hate speech, such as clothing style, accent, skin tone, and other factors, as well as their intersection with other forms of violence. This would not only allow the classification of hate’s presence but also its characterization. This more granular and socially informed approach will not only improve the technical performance of the models but also help generate more useful tools for social researchers, human rights organizations, and government entities dedicated to preventing discrimination in México.
Finally, we seek to extend the models performance analysis using a more number of executions, in order to strengthen the validity of the Wilcoxon signed-rank test. This would allow for the assessment of the stability of statistically significant differences.
Author Contributions
Conceptualization and methodology, V.N.-M., Y.L. and J.R.-S.; software, validation, formal analysis and writing—original draft preparation, V.N.-M., J.R.-S. and M.T.Z.; investigation and data curation, V.N.-M.; writing—review, editing and supervision, Y.L., R.A.G.-H. and Á.H.-C. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Informed Consent Statement
Informed consent was obtained from all participants regarding the study labeling. Written informed consent was obtained from all participants for the publication of this article.
Data Availability Statement
The dataset presented in this article is not readily available because the data are part of an ongoing study. Requests to access the dataset should be directed to veronica.nerimendoz@gmail.com.
Acknowledgments
We thank Ángel Baron García, for their technical assistance and dedication. We also thank Tania Iliana Santiago and David Eduardo Silva Carmona for their support in the development of labeling guidelines. During the preparation of this manuscript, the authors used [Gemini 3 Flash Image] for the purpose of generating Figure 2. The authors have reviewed and edited the result and assume full responsibility for the content of this publication.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Rawat, A.; Kumar, S.; Samant, S.S. Hate speech detection in social media: Techniques, recent trends, and future challenges. Wiley Interdiscip. Rev. Comput. Stat. 2024, 16, e1648. [Google Scholar] [CrossRef] [Scilit]
- González Gómez, J. La etnofobia en México y sus implicaciones en la educación superior. Univ. Habana 2024, 300, e8784. [Google Scholar]
- Ullah, F.; Zamir, M.; Arif, M.; Ahmad, M.; Felipe-Riveron, E.; Gelbukh, A. Fida@ dravidianlangtech 2024: A novel approach to hate speech detection using distilbert-base-multilingual-cased. In Proceedings of the Fourth Workshop on Speech, Vision, and Language Technologies for Dravidian Languages; Association for Computational Linguistics: Stroudsburg, PA, USA, 2024; pp. 85–90. [Google Scholar]
- Mullah, N.S.; Zainon, W.M.N.W. Advances in Machine Learning Algorithms for Hate Speech Detection in Social Media: A Review. IEEE Access 2021, 9, 88364–88376. [Google Scholar] [CrossRef] [Scilit]
- Gandhi, A.; Ahir, P.; Adhvaryu, K.; Shah, P.; Lohiya, R.; Cambria, E.; Poria, S.; Hussain, A. Hate speech detection: A comprehensive review of recent works. Expert Syst. 2024, 41, e13562. [Google Scholar] [CrossRef] [Scilit]
- Zamir, M.T.; Tash, S.; Ahani, Z.; Gelbukh, A.; Sidorov, G. Lidoma@DravidianLangTech 2024: Identifying Hate Speech in Telugu Code-Mixed: A BERT Multilingual. In Proceedings of the Fourth Workshop on Speech, Vision, and Language Technologies for Dravidian Languages; Association for Computational Linguistics: Stroudsburg, PA, USA, 2024; pp. 101–106. [Google Scholar]
- Basile, V.; Bosco, C.; Fersini, E.; Nozza, D.; Patti, V.; Rangel, F.; Rosso, P.; Sanguinetti, M. SemEval-2019 Task 5: Multilingual Detection of Hate Speech Against Immigrants and Women in Twitter. In NAACL HLT 2019—International Workshop on Semantic Evaluation, SemEval 2019, Proceedings of the 13th Workshop; Association for Computational Linguistics: Stroudsburg, PA, USA, 2019; pp. 54–63. [Google Scholar] [CrossRef] [Scilit]
- Rodríguez-Sánchez, F.; Carrillo-De-Albornoz, J.; Plaza, L.; Gonzalo, J.; Rosso, P.; Comet, M.; Donoso, T. Overview of EXIST 2021: SEXism Identification in Social NeTworks. Proces. Leng. Nat. 2021, 67, 195–207. [Google Scholar]
- Rodríguez-Sánchez, F.; Carrillo-De-Albornoz, J.; Plaza, L.; Mendieta-Aragón, A.; Marco-Remón, G.; Makeienko, M.; Plaza, M.; Gonzalo, J.; Spina, D.; Rosso, P. Overview of EXIST 2022: SEXism Identification in Social NeTworks. Proces. Leng. Nat. 2022, 69, 229–240. [Google Scholar]
- Bel-Enguix, G.; Gómez-Adorno, H.; Ojeda-Trueba, S.; Sierra, G.; Barco, J.; Lee-Romero, E.; Dunstan, J.; Manrique, R. Overview of HOMO-LAT at IberLEF 2025: Human-Centric Polarity Detection in Online Messages Oriented to the Latin American-Speaking LGBTQ+ PopulaTion. Proces. Leng. Nat. 2025, 75, 413–424. [Google Scholar]
- Vásquez, J.; Andersen, S.T.; Bel-Enguix, G.; Ojeda-Trueba, S.L.; Gómez-Adorno, H. HOMO-MEX: A Mexican Spanish Annotated Corpus for LGBT+phobia Detection on Twitter. In Proceedings of the Annual Meeting of the Association for Computational Linguistics; Association for Computational Linguistics: Stroudsburg, PA, USA, 2023; pp. 202–214. [Google Scholar]
- Lai, M.; Celli, F.; Ramponi, A.; Tonelli, S.; Bosco, C.; Patti, V. HaSpeeDe3 at EVALITA 2023: Overview of the Political and Religious Hate Speech Detection Task. In CEUR Workshop Proceedings; CEUR-WS: Bonn, Germany, 2023. [Google Scholar]
- Neri-Mendoza, V.; Ledeneva, Y.; Rojas-Simón, J.; Santos-Bobadilla, Y.A.; García-Hernández, R.A. Pilot Test of Ethnic Hate Speech Detection in Mexico. In Mexican International Conference on Artificial Intelligence; Springer: Cham, Switzerland, 2026; pp. 168–176. [Google Scholar] [CrossRef] [Scilit]
- Consejo Nacional para Prevenir la Discriminación (CONAPRED). Informe Especial 01/2024 Sobre Narrativas Discriminatorias. CONAPRED: Mexico City, Mexico, 2024. Available online: https://www.conapred.gob.mx/wp-content/uploads/2024/09/Inform-Especial-NArrativas-Discriminatorias-04.09.2024.rev_.juridico-ok.pdf (accessed on 15 February 2026).
- Mato, D. Violencia verbal y otras prácticas de discriminación étnico-racial hacia estudiantes indígenas y afrodescendientes en universidades de América Latina. Rev. Latinoam. Estud. Educ. 2025, 55, 197–234. [Google Scholar] [CrossRef] [Scilit]
- Escalante, Y. Derechos de los Pueblos Indígenas y Discriminación Étnica o Racial; Consejo Nacional para Prevenir la Discriminación: Mexico City, Mexico, 2009; Available online: https://teams.microsoft.com/l/message/19:3e7c9f3d-60fb-45ad-9fff-6ec53fe194d6_8c1b6d40-148c-490c-8457-0083e8490793@unq.gbl.spaces/1780280191939?context=%7B%22contextType%22%3A%22chat%22%7D (accessed on 15 February 2026).
- Poletto, F.; Basile, V.; Sanguinetti, M.; Bosco, C.; Patti, V. Resources and benchmark corpora for hate speech detection: A systematic review. Lang. Resour. Eval. 2021, 55, 477–523. [Google Scholar] [CrossRef] [Scilit]
- Allam, H.; Makubvure, L.; Gyamfi, B.; Graham, K.N.; Akinwolere, K. Text Classification: How Machine Learning Is Revolutionizing Text Categorization. Information 2025, 16, 130. [Google Scholar] [CrossRef] [Scilit]
- Mao, J.; Shi, H.; Li, X. Research on multimodal hate speech detection based on self-attention mechanism feature fusion. J. Supercomput. 2025, 81, 28. [Google Scholar] [CrossRef] [Scilit]
- Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers); Association for Computational Linguistics: Minneapolis, MN, USA, 2019; pp. 4171–4186. [Google Scholar]
- Aragón, M.E.; Álvarez-Carmona, M.; Montes-Y-Gómez, M.; Escalante, H.J.; Villaseñor-Pineda, L.; Moctezuma, D. Overview of MEX-A3T at IberLEF 2019: Authorship and Aggressiveness Analysis in Mexican Spanish Tweets. CEUR Workshop Proc. 2019, 2421, 478–494. [Google Scholar]
- Fleiss, J.L.; Cohen, J. The equivalence of weighted kappa and the intraclass correlation coefficient as measures of reliability. Educ. Psychol. Meas. 1973, 33, 613–619. [Google Scholar] [CrossRef] [Scilit]
- Rojas-Simón, J.; Ledeneva, Y.; García-Hernández, R.A. Classification of human and machine-generated texts using lexical features and supervised/unsupervised machine learning algorithms. In Mexican Conference on Pattern Recognition; Springer: Cham, Switzerland, 2024; pp. 331–341. [Google Scholar]
- Rojas-Simón, J.; Ledeneva, Y.; García-Hernández, R.A. A Dimensionality Reduction Approach for Text Vectorization in Detecting Human and Machine-generated Texts. Comput. Sist. 2024, 28, 1919–1929. [Google Scholar] [CrossRef] [Scilit]
- Le, Q.; Mikolov, T. Distributed representations of sentences and documents. In Proceedings of the 31st International Conference on International Conference on Machine Learning—Volume 32 (ICML′14); Proceedings of Machine Learning Research: Cambridge, MA, USA, 2014. [Google Scholar]
- Wilcoxon, F. Individual comparisons by ranking methods. Biom. Bull. 1945, 1, 80–83. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.



