M ila NLP at S em E val-2022 Task 5: Using Perceiver IO for Detecting Misogynous Memes with Text and Image Modalities (2022)

Abstract: In this paper, we describe the system proposed by the MilaNLP team for the Multimedia Automatic Misogyny Identification (MAMI) challenge. We use Perceiver IO as a multimodal late fusion over unimodal streams to address both sub-tasks A and B. We build unimodal embeddings using Vision Transformer (image) and RoBERTa (text transcript). We enrich the input representation using face and demographic recognition, image captioning, and detection of adult content and web entities. To the best of our knowledge, this work is the first to use Perceiver IO combining text and image modalities. The proposed approach outperforms unimodal and multimodal baselines.

## introduction monitoring and detecting hateful content online is of paramount importance to limit the spread of hate, misconception, and prejudice. content on social media platforms poses several challenges, from fast-paced, large-scale generation requiring automatic solutions, to ever-changing information mediums, like internet memes. misogynous memes are an unfortunately common phenomenon. based on sexist preconceptions, these memes target and degrade women for humor. this intricate nature makes them hard to detect with classical computational models as hate is conveyed by associating known visual concepts with specific textual wording. in the multimedia automatic misogyny identification task @xcite novel systems are required to detect misogynous memes in english. the task is divided into two sub-tasks. sub-task a requires solving the sole misogynous meme identification (i.e., a binary task). sub-task b requires recognizing more specific categories, namely stereotype, shaming, objectification, and violence. figure 1 (top) shows an example from the dataset. we propose a novel architecture where unimodal foot_0 components extract salient information from the meme. we present all information to a late fusion layer that distills it into a latent representation. we use renowned unimodal encoders networks and perceiver io @xcite as the late fusion layer. notably, while jointly learning from all modalities, perceiver io easily extends to multi-task learning. to the best of our knowledge, this work is the first to use perceiver io combining text and image modalities. we hence effectively address, with the same architecture, both sub-tasks a and b. the proposed system outperforms both unimodal and multimodal baselines. the results show that perceiver io is an effective and efficient method to jointly fuse input representations from different modalities in multi-task setups. however, we achieved sub-par performance against other competing solutions. we ranked 25th (13 f1 points worse than the best system) out of 69 competing teams on sub-task a and 15th (4 f1 points worse than the best system) out of 42 competing teams on sub-task b. our system is not specialized in either of the sub-tasks and hence it under-performs against task-engineered solutions. we report a brief error analysis in section 5. we release the code to replicate our experiments at https://github.com/milanlproc/ milanlp-at-mami . ## background in the last years, the task of hate speech detection has attracted considerable attention from the natural language processing and computer vision communities. among the research work in this area, only a limited number of approaches have focused on the problem of misogyny detection, which is a concrete problem in social media platforms. @xcite shows that hate speech detection models do not transfer across different hate speech targets, further demonstrating the need for ad-hoc misogyny detection approaches and datasets. indeed, the corpora made available as part of shared tasks @xcite @xcite enabled a variety of nlp approaches to the problem of automatic misogyny detection on twitter posts @xcite @xcite . the multimedia automatic misogyny identification task focuses on the problem of misogyny detection with the new perspective of multimodality. the most similar research effort in the direction of hateful memes detection is the hateful memes challenge @xcite and the mmhs150k corpus @xcite . on the other hand, multi-modal models that combine image and text are now becoming incredibly popular in natural language processing @xcite @xcite @xcite due to their capabilities to solve zero-shot tasks. 2 in this paper, we focus on the use of perceiver io @xcite to combine the information coming from different sources such as the meme image, the text, and other features. ## system overview following recent work addressing similar tasks @xcite @xcite , we decompose the multimodal learning of hateful memes into two stages. first, we embed with unimodal encoders different input sources. next, we adopt a multimodal late fusion to jointly learn from different modalities. with this setup, we tackle both sub-tasks a and b with no additional data other than the one provided for the task. we build unimodal streams using pretrained, modality-specific encoder networks. each encoder contributes an input representation to the subsequent fusion layer. we then use perceiver io @xcite as a late fusion approach over the concatenation of modality-specific representations. perceiver io produces a structured, multidimensional output. we leverage this ability to jointly learn misogyny and other relevant aspects (e.g., aggressiveness, objectification, etc.) from the input. with that, we effectively solve both subtasks a and b of the challenge using a single model in a multi-task learning setting. the system architecture is shown in figure 2 . to the best of our knowledge, this is the first attempt to use perceiver io as a multimodal late fusion layer for multi-task learning. in the following sections, we further describe what type of unimodal source we considered (section 3.1) and how we adapted perceiver io to multimodal, multi-task learning (section 3.2). ## experimental setup the provided training set counts 10,000 samples. class labels are balanced on misogyny (p 1 = 0.5) but unbalanced on shaming (p 1 = 0.18), stereotype (p 1 = 0.28), objectification (p 1 = 0.22), and violence (p 1 = 0.095). we validated our models and baselines using three-fold cross-validation over the training set. we measure performance with f1 macro on the binary misogyny detection task. for vit, roberta, and distilbert, we use implementations and checkpoints from the transformers library @xcite and huggingface hub. we use monolingual english checkpoints for text models. for perceiver io, we use the lucidrains's pytorch implementation. 6 unimodal encoders for vit, we used the google/vit-base-patch16-224-in21k checkpoint. we used the standard feature processor which entails 1) resizing to a maximum shape of 224x224 and channel normalization. we also augmented the image using color jitter (@xmath0.1), random horizontal flip (@xmath1.5), affine transformations, foot_5 contrast (@xmath2.3) and equalization (@xmath3.3) variations. we discard the cls last token embedding and use the sequence of the remaining 196 tokens as the image representation. for roberta, we used the roberta-base checkpoint and its standard tokenizer padding and truncating up to a maximum of 32 tokens. we performed text augmentation via token removal (@xmath4.15). for distilbert, we used the distilbert-base-uncased checkpoint and its standard tokenizer padding and truncating up to a maximum of 32 tokens. note that this configuration is duplicated for both the text transcript and web entity streams. perceiver io we did not use a perceiver io pretrained checkpoint. we manually fine-tuned the number of latent variables in {64, 128, 256, 512, 1024}, latent dimension in {128, 256, 512, 1024}, and number of selfattention layers in {6, 12}, and settled on the configuration @xcite @xcite . self-attention layers are applied sequentially and do not share weights. we use 5 decoder queries to produce a structured output of shape (5, 2). we project the output using a final linear layer and consider the result as the tasks logits. we also tried to use a different linear projection layer per task but with no measurable improvement in performance. training setup we trained the entire system endto-end, i.e., we jointly optimized all unimodal encoders and perceiver io. following @xcite , we tried to freeze the encoders for an arbitrary number of steps and then unfreeze them, with no significant improvement. we manually tuned the learning rate in the range [10 -5 , 10 -6 ]. we then used 10 -5 with linear decay and 10% of total steps as warmup steps. we set weight decay to 10 -2 . we trained the system for four epochs using focal loss @xcite to account for class imbalance. we set alpha to 0.25 and gamma to 2. ## results the provided test set counts 1,000 samples. target labels are balanced in terms of misogyny but imbalanced for the rest of the categories. unbalancing is slightly more marked than the training set. we report the prior frequency of the positive class as p 1 in in the following, we compare the performance of the proposed system which encodes detected faces (f), web entities (w), the image caption (c), and adult content detection (a). we refer to the system as perceiver io (fcwa). it achieves an overall f1 (macro) score of 69.9% in sub-task a and an f1 (weighted) score of 69.3% in sub-task b. we rank 31th (13 f1 points worse than the best system) on sub-task a and 18th (4 f1 points worse than the best system) on sub-task b. the system outperforms several baselines provided by the task organizers. on sub-task a, we outperform 1) sentence embeddings from a pretrained universal sentence embedding model, 2) an image classifier fine-tuned from a vgg model, and 3) a classifier based on the concatenation of the first two representations plus a single layer neural network. on sub-task b, we outperform 1) a multi-label model based on the concatenation of deep image and text embeddings and ## conclusion we addressed both sub-tasks a and b of the multimedia automatic misogyny identification shared task with a novel perceiver io-based system. we take advantage of pretrained encoders and external services to extract and enrich with salient information the input meme. then, we use perceiver io as a multimodal, multi-task late fusion layer of several unimodal streams. to our knowledge, this is the first time perceiver io has been used to combine text and image modalities. the proposed system outperforms unimodal and multimodal baselines but underperforms against more specialized, task-specific competitor systems. we ranked 25th out of 69 competing teams on subtask a and 15th out of 42 competing teams on subtask b. in future work, we will explore improved input preprocessing (e.g., for the ocr-based text provided), and model ensembling. additional effort should be put into identifying and mitigating unintended bias that may be present in our multimodal misogyny detection model following approaches proposed for text modality @xcite . the development of these multi-modal hate speech classifiers can be useful for the automatic evaluation of large pretrained models @xcite .