Editor’s introduction
The study assessed unimodal and multimodal machine learning models—specifically Bidirectional Encoder Representations from Transformers (BERT), Visual Geometry Group 16, CLIP, and VisualBERT—on 13,000 social media posts from Facebook, Instagram, and X. Posts were filtered to include race-related and LGBTQ+ community-related content with image attachments, and human annotators labeled them into four categories: negative sentiment, positive sentiment, hate, and antihate. CLIP achieved the highest accuracy in negative sentiment detection at 0.86, while VisualBERT performed best in positive sentiment (0.76) and antihate classification (0.78). The intermediate fusion model showed the most balanced performance across all tasks, particularly in hate speech detection with 0.91 accuracy. The researchers applied synthetic minority oversampling and latent Dirichlet allocation to improve detection of minority classes, especially antihate content. A key limitation noted is that the dataset’s focus on English-language posts may introduce bias, potentially leading to inequitable moderation of non-English content due to limited contextual understanding.
Background
The rapid growth of social media in the early 21st century has fundamentally transformed how people receive and share information. This seismic change in information systems has been leveraged across various industries, ranging from politics, finance, health care, and education [-], allowing investigators to examine how recent technological advancements affect people’s social interactions and understanding of the world [-]. In addition, social media provides outstanding opportunities for collecting far-reaching, information-dense, and vast-scale data, which can be used to measure real-time public opinions and sentiments on a wide range of topics [-]. Most notably, social media–derived sentiment measures overcome numerous limitations of traditional survey approaches in capturing social and cultural trends, providing deeper insights into sensitive topics and social determinants of health, such as race, gender, and sexual orientation. The sense of anonymity provided by web-based spaces emboldens people to express views they may not express during in-person interactions. Collecting, cleaning, and analyzing these data often demands expertise in artificial intelligence (AI), machine learning (ML), data science, or computer science, posing challenges for public health researchers with limited technical backgrounds. This paper outlines a comprehensive framework for collecting, preprocessing, and analyzing multimodal social media data (eg, text and images) to derive public sentiment, providing a generalizable approach for broader social science research.
Researchers are increasingly turning to social media data to advance research on the impact of social and cultural exposures on health outcomes [-]. Historically, measuring cultural norms at the population level has been difficult; however, technological advancements in ML and AI have made it feasible to train and deploy models that can efficiently extract public sentiment measures from large-scale social media datasets. For instance, public health research using social media has demonstrated its utility in capturing temporal changes and geographic differences in population-level attitudes, beliefs, and norms toward marginalized groups. However, extant research has largely focused on harvesting and analyzing the text of social media posts, and many hate detection and sentiment models were designed to classify text-based content that relied heavily on linguistic features to identify abusive language. With recent advances, the social media landscape is rapidly evolving to include novel modalities (eg, images, text, and GIFs).
Visual imagery is a powerful means of communication, capable of conveying social, political, and cultural sentiments. Although most social media platforms use safeguards against hateful content, content moderating algorithms are often less effective in identifying such content in images. There has been a proliferation of harmful content on social media in the form of memes. The term “meme,” originally coined by evolutionary biologist Dawkins to describe a unit of cultural transmission akin to a gene for expressing and spreading ideas, has now become synonymous with web-based content that combines text and images. Recent studies have sought to bridge the gap in social media public sentiment analysis with multimodal hate detection models that combine text and images for improved accuracy. For instance, Das et al aimed to address the limitations of text-focused approaches by incorporating object detection and sentiment analysis to enhance meme classification. Other studies have leveraged vision and language models (eg, Visual Bidirectional Encoder Representations from Transformers [VisualBERTs] and Universal Image-Text Representation) to highlight the critical role of visual meme characteristics in conveying hateful messages, often surpassing the impact of text alone. A study by Habash et al focused on detecting and categorizing misogynous memes into 4 types: stereotypes, shaming, objectification, and violence. The VisualBERT model achieved a F1-score of 0.722. While various studies developed multimodal AI models for sentiment classification, many major breakthroughs emerged from data competitions hosted by social media companies.
Facebook’s parent company, Meta Platforms, Inc, launched the Hateful Memes Challenge, which provided a dataset of memes with “benign confounders” for the expressed intent of challenging unimodal models and advancing multimodal AI approaches. This challenge highlighted the gap between human annotations and ML model performance, with state-of-the-art models achieving only 64.73% accuracy compared to 84.7% for human ratings. This finding emphasizes the complexity of the ML task and highlights significant detection challenges that require significant improvements. In response, the Hate-CLIPper model by Kumar and Nandakumar improved categorization by capturing the interactions between picture and word embeddings using a feature interaction matrix and Contrastive Language-Image Pretraining (CLIP; Open AI) features that better comprehend subtle contextual clues, such as sarcasm. Wu et al developed the TweetEval, CLIP and enhanced cross-attention, cross-mask mechanisms, which leverages transfer learning and a cross-mask mechanism to enhance the integration of visual and textual features and outperforms conventional ensemble approaches by successfully embedding fine-grained features. Building on this work, the ISSUES model uses a pretrained CLIP vision-language model and textual inversion to enhance the semantic capture of memes. It maps images to pseudoword tokens in the CLIP embedding space, creating a comprehensive multimodal representation. The key components of this model include disentangling image and text features and using a multimodal fusion network to achieve state-of-the-art results in the Hateful Memes Challenge and HarMeme datasets. However, researchers have pointed out that findings from these models may not generalize well to other contexts due to the limitations of the Hateful Memes datasets, which do not fully capture the diverse ways in which visual and textual content are represented in other real-world contexts across various social media platforms.
Creating Training Data
To create the training dataset for hatefulness and sentiment classification models, we recruited annotators who were aged ≥18 years; proficient in the English language; and active on social media platforms, such as Facebook, Instagram, or X. Annotators were provided with a codebook containing detailed instructions. The first annotation task determined whether a post referenced a specific race or ethnic group, gender identity, or sexual orientation. If none of these identities were referenced, annotators selected “none” and proceeded to the next post. For posts referencing these groups, annotators identified the overall sentiment expressed by the author of the post (neutral, positive, or negative) and evaluated the post’s hatefulness (neutral, hate, or antihate). Before embarking on annotations, we hosted labeling workshops with annotators to review these guidelines and ascertain that the team had a clear understanding of the task and objectives of the project. We defined hateful content as posts that directly or indirectly engender violence, discrimination, hostility, or prejudice against individuals or groups based on their race, ethnicity, gender identity, and sexual orientation. While these types of expressions appear in various ways, including derogatory language, slurs, stereotypes, threats, insults, or demeaning statements, we directed our annotators to look for content that, intentionally or unintentionally, may perpetuate the marginalization or dehumanization of specific groups and threaten their well-being based on their identity.
Conversely, we defined antihate posts as content that opposes or counteracts hate speech, promoting tolerance, inclusivity, or understanding in support of identity groups. These are posts that acknowledge social, cultural, economic, and political structures that further the marginalization of targeted groups based on their identity, aiming to bring awareness and counter these issues. Finally, we defined content where strong hate speech or antihate sentiment was absent as neutral. These posts may include content that is factual or noninflammatory or content that lacks a clear stance on hate speech related to identity groups.
We hosted several sessions with all annotators and collaboratively worked on >400 example posts. These sessions provided the opportunity for open discussions around specific posts until a consensus on how to annotate was achieved. This enabled the team to explore various and pertinent ways in which the different groups of the study were targeted by hateful, antihateful, or neutral content; ask questions; and achieve a shared understanding and framework for evaluating posts relative to targeted identities. While inherent biases might still have influenced the dataset, our approach minimized subjectivity through a structured dispute resolution process and standardized annotation procedures. In addition, we recognized that hate speech detection is an evolving field, and our dataset contributed to ongoing efforts in refining these classification standards.
For the training dataset, each post was assigned to 2 annotators. For posts where consensus was not reached between the 2 annotators, a third annotator coded posts to reach the final codes. To facilitate the annotation process, we used Label Studio Enterprise (HumanSignal) for researchers, an open-source labeling platform for creating and managing labeling projects. In total, we annotated 13,000 social media posts downloaded from Facebook, Instagram, and Twitter for sentiment and hateful content. After removing posts that did not meet our inclusion criteria, we used the remaining 8521 (65.55%) social media posts to train the models.
Multimodal Models and Fusion Strategy
For multimodal models, we selected 3 advanced models that incorporated different strategies. The first multimodal model, VisualBERT, is designed to process and integrate both text and image information. VisualBERT is pretrained on the Common Objects in Context dataset, a diverse dataset containing 33,000 images paired with captions, released by Microsoft, and widely used in ML model training. VisualBERT has demonstrated state-of-the-art performance on many vision and language tasks, including Visual Question Answering, a dataset with 265,000 images containing open-ended questions. VisualBERT integrates text embeddings from the BERT model and visual embeddings from the Residual Network (ResNet) with 50 layers by applying an early fusion approach. In this method, multiple modalities are merged before applying the feature extraction process. The embeddings are then concatenated into a single sequence for processing in the transformer layers that use self-attention mechanisms to align and integrate information across modalities. This approach allows the model to dynamically evaluate the importance of different input components, capturing joint representations of text and images. The final classification is accomplished using a classifier layer to predict positive sentiment, negative sentiment, hateful speech, and antihateful speech. To prevent overfitting and enhance the model’s generalization capability, a dropout layer was applied during training.
CLIP was the second multimodal model implemented in this study. Because the model was trained on a wide variety of image and text contents, it performs well on many classification benchmarks without optimization. The CLIP model can process mixed data types as inputs using a contrastive approach to evaluate the relationship between them. It extracts embeddings for both image and text through a shared CLIP encoder and maps them into a common latent space. Unlike VisualBERT, CLIP applies a late fusion method, generating image and text embeddings separately and then projecting them into a shared latent space where they are mapped based on similarities. A fully connected layer combines the output logits with topic distributions for classification tasks.
The third model combines ResNet with 101 layers for image processing and fastText for text processing. We applied an intermediate fusion method where features were concatenated before classification. FastText (Meta AI Research laboratory) generates high-quality text embeddings more efficiently than traditional models. Intermediate fusion allowed us to take advantage of both image and text feature representations simultaneously, often resulting in better model performance compared to using a single combined representation. To support further research in this area, we created GitHub repositories to share code and constructed measures.
Principal Findings
The core components of multimodal models are text and image embeddings, which are designed to transform textual and visual data into numerical representations that computers can read and manipulate. These numerical representations capture rich features from the input data, leading to better performance in ML tasks with their capabilities to show semantic meaning between words or pixels. In our multimodal models, text and image embeddings were integrated at certain stages (depending on the fusion strategy), allowing models to leverage multiple data sources for a deeper comprehension of nuanced relationships within data. On the other hand, the experiments on the 2 unimodal models, BERT and VGG-16, helped with analyzing text and image embedding separately. These 2 unimodal models took text-only or image-only data as input and used their built-in embedding features. The comparisons in model performance between multimodal models and unimodal models highlighted the advantages of multimodal embeddings.
The fusion strategy applied in multimodal models also played a critical role in effectively processing data. It decides how information from different data modalities is combined during the modeling process to make a final decision. Many pretrained models have their own default fusion methods, such as VisualBERT using early fusion and CLIP using late fusion. The choice of fusion strategies often significantly impacts the multimodal model performance; therefore, the optimal one can vary and depend on the task needs and data characteristics. This study used the original fusion design for VisualBERT and CLIP.
While social media data can be a powerful lens into society, it is a snapshot that may not be fully representative of the wider population. The data collection includes only publicly available discourse and may not include users with limited web-based presence. Moreover, different platforms have varying user bases. For example, Facebook users skew toward women, whereas X (Twitter) skews toward men. Hence, to account for demographic variance across platforms, we sourced data from 3 platforms rather than 1; however, future studies could further expand their data sources. Consistent with previous literature, our findings highlight the importance of diverse datasets for accurately analyzing harmful memes that reflect complex cultural and social contexts. While previous studies, such as the study by Sharma et al, have noted the limitations of existing datasets, our results demonstrate the value of a novel dataset that includes memes targeting minority groups. This inclusivity has provided new insights into the performance of multimodal models (eg, CLIP and VisualBERT) in handling diverse, nuanced social media content.
Building on the work of Chen and Pan, which highlighted the challenges of detecting nuanced and imbalanced data, we applied advanced data augmentation techniques (eg, SMOTE and LDA) to effectively address class imbalances. These methods significantly enhanced model performance for minority classes, such as antihate content. However, although VisualBERT was widely recognized as one of the most effective models for vision-language tasks, the model exhibited limitations when paired with advanced data augmentation techniques. While the methods improved recall for minority classes, they concurrently diminished precision, revealing trade-offs that merit further investigation. These findings challenge assumptions regarding VisualBERT’s performance and suggest that although augmentation strategies may be beneficial in some contexts, the models may require further refinement to optimize overall performance.
Conclusions
AI models are meant to be fair and neutral, but when the dataset is predominantly concentrated on English-language posts, the model becomes biased. This can result in inequitable content moderation, where non-English posts are either overlooked or excessively flagged due to a lack of contextual understanding. To build a more inclusive and effective dataset, it is essential to expand the dataset by including culturally diverse data. One approach is to curate a dataset with multiple languages, regional dialects, and a mixture of 2 languages (eg, Hinglish), allowing models to better capture real-world communication. Beyond linguistic diversity, ensuring accurate labeling is just as important. Native speakers and local experts can provide nuanced annotations that reflect regional expressions and dialectical differences, improving the model’s ability to detect hate speech accurately while minimizing biases in moderation. Expanding data sources beyond Western platforms is a crucial step in addressing these biases. Many AI models rely on English-centric datasets sourced from platforms such as Twitter, Facebook, and Reddit, leading to an overrepresentation of Western discourse patterns. A more balanced approach would include content from non-Western social media platforms, such as Weibo (China), KakaoTalk or Naver Café (South Korea), and VKontakte (Russia), as well as local news sites and regional forums. These sources provide unique linguistic structures, idiomatic expressions, and cultural references that English-centric models often fail to capture. By integrating data from a variety of platforms, AI systems can better understand multilingual discourse, reducing disparities in content moderation and improving fairness across diverse user bases. By addressing these directions, future work can advance the development of inclusive and impactful solutions, advancing hate speech detection and fostering positive web-based interactions.


