logo
ResearchBunny Logo
From online hate speech to offline hate crime: the role of inflammatory language in forecasting violence against migrant and LGBT communities

Sociology

From online hate speech to offline hate crime: the role of inflammatory language in forecasting violence against migrant and LGBT communities

C. A. Calderón, P. S. Holgado, et al.

This study explores how online hate speech can predict offline hate crimes against migrants and the LGBT community in Spain, revealing that toxic language is a crucial indicator. Conducted by a team from University of Salamanca and the National Office for Combating Hate Crimes, the findings highlight the alarming relationship between social media posts and crimes.

00:00
00:00
~3 min • Beginner • English
Introduction
The study investigates whether the emergence and propagation of hate speech on social media can anticipate offline hate crimes, focusing on Spain from 2016 to 2018. Building on the premise that attitudes precede behaviors and that social media captures less-constrained expressions of sensitive attitudes, the authors address shortcomings in prior work that relied on low-frequency crime statistics and single-platform data. Using high-frequency, province-level police reports and multi-platform social media data (X and Facebook), the study evaluates the predictive capacity of inflammatory language (hate, toxicity, sentiment) for hate crimes targeting migrants and LGBT people. The preregistered research frames social media not as a causal driver but as a predictor of offline human behavior. Hypothesis H1: the number of messages with inflammatory language on social media anticipates an increase in offline hate crime.
Literature Review
The literature shows that hate crimes, though longstanding, are underreported and often analyzed with coarse temporal resolution, obscuring dynamics. Temporal patterns in general crime have been linked to seasonality and temperature, but hate crimes are rare events often triggered by specific sociopolitical incidents (e.g., terrorist attacks, Brexit, political campaigns). Online environments respond to such events with spikes in hate speech, and some studies find that online hate can precede offline hate crime, though evidence on temporal ordering is mixed and may depend on event contexts. The vast computational literature on hate speech detection emphasizes automated approaches (e.g., BERT/LLMs), debates definitions (legal vs. disparaging content), and notes biases and ethical concerns. Prior works have often used single sources (commonly X) and single targets, limiting generalizability. Conceptually, social media can function as a predictor of offline behaviors rather than a cause. The authors thus focus on multi-source, multi-target analysis and temporal modeling to assess whether inflammatory language can serve as an indicator for offline hate crimes.
Methodology
Design and data sources: Preregistered study (https://osf.io/bwn93) using primary sources processed at SCAYLE. Hate crime data from the Spanish National Police via the National Office for Combating Hate Crimes (ONDOD) covering Spain except Catalonia and the Basque Country, Jan 2016–Dec 2018. After cleaning: HCDS1 (n=1215 reports, all motivations); HCDS2 specialized subset (n=657), including 376 migrant-victim cases and 281 LGBT-victim cases, with dates of incident and report, main/secondary motivation, province, and NUTS3 codes. Social media data: SMDS1 generic X data: 1000 Spanish tweets/day (2016–2018), total 1,096,000; 12,682 classified as hateful (1.16%) using SocialHaterBERT (Valle-Cano et al., 2023). SMDS2 specialized X and Facebook data: 776,180 records (215,083 original posts) collected via X API (Tweepy) and Facebook CrowdTangle from public groups (>95,000 members), Spanish-language posts produced in Spain. Keyword filters targeted migrants and LGBT topics. Table 1 counts (original | total): X—Migrants 56,969 | 282,338; X—LGBT 99,844 | 259,488; Facebook—Migrants 40,651 | 189,166; Facebook—LGBT 17,619 | 45,188. Measures: Hate crime incidents aggregated by day/week/month (HCDS1) and, for HCDS2, by day/week for racism/xenophobia (migrants) and sexual orientation/gender identity (LGBT). Generic online hate (SMDS1) via SocialHaterBERT. Specific hate (SMDS2) via two ad hoc BERT classifiers (threshold 0.5 to count hateful messages per day/week). Migrants hate classifier trained on PHARM interface Spanish dataset (22,232 balanced messages; train 13,339/val 4,446/test 4,447; BERT 167,357,954 params; LR 3e-5; Adam eps 1e-8; 3 epochs). Test results: loss 0.1575, accuracy 94.63%, F1 ≈0.95. LGBT hate classifier built from double-blind coded corpus (Krippendorff’s alpha 0.726; total 8,836 balanced; train 5,302/val 1,767/test 1,768; same BERT settings). Test results: loss 0.3022, accuracy 90.78%, F1 ≈0.90. Sentiment measured with SentiStrength (Spanish lexicon; positivity/negativity 1–5, 0 neutral). Toxicity measured using Perspective API (six attributes: toxicity, severe toxicity, insult, profanity, identity attack, threat; 0–1), plus an index as their mean. Time series datasets: HCDS1+SMDS1 produced six time series (generic hate crime and generic hate speech) at monthly/weekly/daily scales, in original and smoothed forms. HCDS2+SMDS2 produced eight datasets (2 timely aggregations: daily/weekly; 2 geographies: Spain/Madrid; 2 social data filters: filtered geolocated vs non-filtered national) with 78 variables (means and standard deviations of hate, toxicity attributes, sentiment, counts and proportions). Analysis: Step 1 examined temporal correlations between generic hate speech and generic hate crime (HCDS1+SMDS1). Step 2 modeled specific hate crimes (migrants, LGBT) with VAR, GLMNet (LASSO/elastic net), and XGBTree, forecasting the last four periods (daily or weekly). VAR pipelines included ADF stationarity tests with differencing for training only, AIC-based lag order selection, Johansen cointegration (when applicable), and Granger causality tests (p<0.05) to select predictors. GLMNet and XGBTree used all variables (including SDs), with maximum lag 10, and assessed variable importance. Models were built at national and Madrid levels, with filtered and unfiltered social inputs.
Key Findings
Temporal correlation (generic): Positive correlations between hateful tweets and hate crimes: monthly r=0.467 (p<0.01), weekly r=0.181 (p<0.05), daily r=0.055 (p=0.06). With smoothing/normalization: monthly r=0.552 (p<0.01), weekly r=0.248 (p<0.01), daily r=0.18 (p<0.01). Forecasting (specific): 48 models (16 VAR, 16 GLMNet, 16 XGBTree). Best migrant model: GLMNet, national daily (Model 17), R²=0.64; best LGBT model: XGBTree, national weekly (Model 45), R²=0.53. Overall patterns: weekly aggregation outperformed daily; national models outperformed Madrid; migrant-target models generally outperformed LGBT-target models. VAR models had low R² (e.g., migrants weekly national R²≈0.17–0.19; LGBT weekly national R²≈0.09), but enabled temporal ordering analysis. GLMNet showed strong performance for migrants (e.g., filtered weekly Spain R²=0.32; daily national R²=0.64/0.63) but weaker for LGBT (weekly national R²≈0.25). XGBTree reached R²=0.38 for migrants (weekly national filtered) and R²=0.53 for LGBT (weekly national). Many daily GLMNet/XGBTree runs produced NaN R² due to lack of variance in predictions/observations, indicating daily data’s limitations for rare events. Predictor importance: Toxicity-related features (threats, identity attack, severe toxicity, profanity) consistently outperformed simple hate-speech counts/proportions and sentiment; sentiment had a residual role. Facebook-derived features were often the most influential, outperforming those from X in most best-performing models. Cross-group features sometimes contributed (e.g., migrant-language features predicting LGBT crimes and vice versa). Weekly models often highlighted short lags (L1–L2), suggesting close temporal proximity between online language signals and crime. Temporal order (VAR): In all 16 VAR settings, language features temporally anticipated hate crimes. In 7 models, the relationship was unidirectional (language→crime only). In 9, some recursive effects appeared, but typically only for specific variables. Among top VAR models, two showed unidirectional effects and two showed limited recursion. Overall, evidence favored language preceding crime without establishing causality.
Discussion
Findings address the central question by showing that online inflammatory language can act as a leading indicator for offline hate crimes against migrants and LGBT people. Moderate positive temporal correlations and several predictive models with substantive explained variance (up to 64% for migrants and 53% for LGBT) indicate that social media signals, particularly toxicity-related features and Facebook activity, are informative for short-horizon forecasts. Weekly aggregations, national-level modeling, and migrant-focused targets provided better performance than daily, city-level (Madrid), and LGBT-focused models, reflecting data sparsity and the rarity of hate crimes at fine temporal and geographic granularity. VAR analyses suggest temporal precedence of language over crime, though some bidirectional dynamics exist, potentially driven by external events or media coverage. The study advances the field by integrating multiple platforms (X and Facebook), multiple targets (migrants and LGBT), and multiple linguistic dimensions (specific hate, toxicity attributes, sentiment), using high-frequency police data rather than coarse public aggregates. This multi-source, multi-target approach reveals cross-interactions between group-specific language and crimes, highlighting the utility of machine learning for predictive policing support, early warning systems, and resource allocation. However, the work refrains from causal claims, noting that online and offline dynamics may be jointly influenced by exogenous events. The results support conceptualizing social media as a predictor of offline behavior and underscore practical applications for monitoring, prevention, and counter-speech strategies while acknowledging ethical considerations around digital surveillance and bias.
Conclusion
The paper demonstrates that inflammatory language on social media—especially toxicity-related signals from Facebook—can forecast short-term fluctuations in hate crimes against migrants and LGBT people in Spain. Weekly national models outperform daily and city-level models, and migrant-target predictions generally exceed LGBT-target ones. While causal inferences are not drawn, VAR analyses show that language typically precedes crime. Contributions include: (1) use of high-frequency, granular police records aligned with multi-platform social media data; (2) development of a diverse modeling suite (VAR, GLMNet, XGBTree) for rare-event forecasting; (3) evidence that toxicity measures outperform generic hate and sentiment; (4) practical potential for early-warning and prevention. Future research should incorporate explicit event-tracking and additional contextual covariates (e.g., socioeconomics, migration flows), expand geographic comparisons, address underreporting and real-time data deletion via continuous monitoring, and further debias detection models. Evaluating severity, improving geolocation, and testing intervention strategies (alerts, counter-speech) are also recommended.
Limitations
Key limitations include: (1) underreporting of hate crimes and non-Gaussian, sparse distributions, challenging daily-level modeling; (2) exclusion of high-profile event indicators that likely affect both online language and crime; (3) social media platform moderation/deletions, necessitating real-time capture to avoid data loss; (4) limited geographic scope for comparison (Madrid vs. national), precluding inclusion of local covariates (e.g., unemployment, migration flows, crime rates); (5) no causal identification despite temporal precedence; (6) potential biases in automated classifiers and constraints of keyword filtering and platform coverage; (7) NaN R² in some daily models due to lack of variance, highlighting the difficulty of predicting rare, low-frequency events at fine temporal granularity.
Listen, Learn & Level Up
Over 10,000 hours of research content in 25+ fields, available in 12+ languages.
No more digging through PDFs, just hit play and absorb the world's latest research in your language, on your time.
listen to research audio papers with researchbunny