Improving Hateful Meme Detection through Retrieval-Guided Contrastive Learning (2024)

Abstract: Hateful memes have emerged as a significant concern on the Internet. Detecting hateful memes requires the system to jointly understand the visual and textual modalities. Our investigation reveals that the embedding space of existing CLIP-based systems lacks sensitivity to subtle differences in memes that are vital for correct hatefulness classification. We propose constructing a hatefulness-aware embedding space through retrieval-guided contrastive training. Our approach achieves state-of-the-art performance on the HatefulMemes dataset with an AUROC of 87.0, outperforming much larger fine-tuned large multimodal models. We demonstrate a retrieval-based hateful memes detection system, which is capable of identifying hatefulness based on data unseen in training. This allows developers to update the hateful memes detection system by simply adding new examples without retraining — a desirable feature for real services in the constantly evolving landscape of hateful memes on the Internet.

## rgcl methodology in each training example {(i i , t i , y i )} n @xmath0, i @xmath1; t i is the caption overlaid on the meme; y @xmath2, 1} is the meme label, where 0 stands for benign, 1 for hateful. we leverage a vision-language (vl) encoder to extract image-text joint representations from the image and the overlaid caption: we encode the training set with our vl encoder to obtain the encoded retrieval vector database g: we index this retrieval database with faiss @xcite to perform training and retrievalbased knn classification. as shown in figure 2 , the vl encoder comprises a frozen clip encoder followed by a trainable multilayer perceptron (mlp). the frozen clip encoder encodes the text and image into embeddings that are then fused into a joint vl embedding before feeding into the mlp. we use hateclipper (kumar and nandakumar, 2022) as our frozen clip encoder. the model architecture is detailed in appendix c. in sec.4.4, we compare different choices of the frozen clip encoder to demonstrate that our approach does not depend on any particular base model. ## rgcl experiments we primarily evaluate the performance of rgcl on the hatefulmemes dataset @xcite and the harmeme dataset @xcite . the harmeme dataset consists of covid-19related harmful memes collected from twitter. in section 4.7, we evaluate three additional datasets to show the generalizability of rgcl beyond hateful meme classification. the dataset statistics are shown in appendix d. to make a fair comparison, we adopt the evaluation metrics used in previous literature @xcite @xcite for hatefulmemes and harmeme: area under the receiver operating characteristic curve (auc) and accuracy (acc). the experiment setup, including the statistical significance tests, and hyperparameter settings are detailed in appendices a and b. ## case analysis we now analyze how rgcl improves relative to baseline systems on confounding memes. ## conclusion we introduce retrieval-guided contrastive learning to enhance any vl encoder in addressing challenges in distinguishing confounding memes. our approach uses novel auxiliary loss with dynamically retrieved examples and significantly improves contextual understanding. achieving an auc score of 87.0% on the hatefulmemes dataset, our system outperforms prior state-of-the-art models. our approach also transfers to different tasks, emphasizing its usefulness across diverse meme domains.