Align before Attend: Aligning Visual and Textual Features for Multimodal Hateful Content Detection (2024)

Abstract: Multimodal hateful content detection is a challenging task that requires complex reasoning across visual and textual modalities. Therefore, creating a meaningful multimodal representation that effectively captures the interplay between visual and textual features through intermediate fusion is critical. Conventional fusion techniques are unable to attend to the modality-specific features effectively. Moreover, most studies exclusively concentrated on English and overlooked other low-resource languages. This paper proposes a context-aware attention framework for multimodal hateful content detection and assesses it for both English and non-English languages. The proposed approach incorporates an attention layer to meaningfully align the visual and textual features. This alignment enables selective focus on modality-specific features before fusing them. We evaluate the proposed approach on two benchmark hateful meme datasets, viz. MUTE (Bengali code-mixed) and MultiOFF (English). Evaluation results demonstrate our proposed approach’s effectiveness with F1-scores of 69.7% and 70.3% for the MUTE and MultiOFF datasets. The scores show approximately 2.5% and 3.2% performance improvement over the state-of-the-art systems on these datasets. Our implementation is available at https://github.com/eftekhar-hossain/Bengali-Hateful-Memes.

## introduction recently, online platforms are witnessing an emerging trend of propagating hateful and offensive content. while most research in this area has focused on detecting hate speech from text-based content (waseem and hovy, 2016; schmidt and wiegand, * denotes equal contribution figure 1 : example of hateful memes. in isolation, neither the image nor the caption may appear hateful, but when combined, they can convey a hateful message. 2017), offensive multimodal content is also propagated, such as memes. memes are images or screenshots with short texts embedded in them. their sarcastic nature made them an increasingly popular tool for spreading hate and targeting individuals or communities based on various factors such as gender, race, ethnicity, religion, physical appearance, and sexual orientation @xcite . the proliferation of such content poses a significant threat to communal harmony and social stability and has therefore become an area of active research interest @xcite . multimodal hateful content detection requires a holistic understanding of visual and textual information. when considered separately, the image and caption components in figure 1 (a) may seem innocuous. the image portrays two women-one wearing a hijab and the other without and the caption states, "abnormal and normal". however, as a meme, this composition can be seen as derogatory towards the woman wearing the hijab by labeling her as abnormal. similarly, the meme in figure 1(b ) insults the marriage of two south indian celebrities by indicating their age gap in the text. thus, focusing only on the image or the text is inadequate for complete understanding. sometimes without the background information of the people and events used in a meme, it is difficult to interpret the meaning because the captions are short, fragmented, and sarcastic. studies have demonstrated that off-theshelf multimodal systems, which are typically effective in performing various visual-linguistic tasks, encounter difficulties when it comes to detecting hateful memes @xcite . furthermore, the current state-of-the-art systems @xcite for detecting hateful memes face limitations when applied to resource-constrained languages. this is primarily because several key components within their architectures are not accessible or well-supported in other languages. these challenges underscore the need for language-specific adaptations to address hateful meme detection in a broader linguistic context effectively. to address this knowledge gap, we present a solution for detecting multimodal hateful memes. the approach leverages an attention-based contextaware fusion framework to create coherent multimodal representations. we hypothesize that by aligning visual and textual features before fusion, the network can better capture essential cues for accurate classification. the key challenge lies in effectively incorporating modality information to enable the network to focus on crucial features. previous methods @xcite used background context and additional captions while performing the fusion. in contrast, our approach introduces an attention layer to align modalities which simultaneously facilitates the extraction of contextual representations from both visual and textual modalities. moreover, without adding external knowledge, the model's learning capability is augmented when the aligned representations are combined with modality-specific (i.e., visual, textual) features. to evaluate our approach, we conducted experiments on two benchmark datasets in different languages: mute @xcite and multioff @xcite . the evaluation results and ablation study demonstrate the effectiveness of our solution over baseline and state-of-the-art methods. the major contributions of this paper are three-fold: (i) develop an attention framework that effectively attends the contributing features of visual and textual modalities to detect multimodal hateful memes (section 3.1); (ii) conduct an extensive evaluation on two different benchmark datasets on real-world memes to demonstrate the effectiveness of the proposed solution (section 4.3, 4.5); and (iii) perform ablation studies in different settings to examine the impact of bert-base embeddings in detecting hateful memes while also investigate the model's quantitative and qualitative errors to understand its limitations (section 4.4, 4.4). ## related work hateful content detection: over the past few years, offensive/hate speech detection has received a significant amount of attention from researchers. some works focused on developing new corpus for different languages @xcite while others studied to develop novel methods @xcite . however, most of the studies focused on hateful content detection from textual data and overlooked the multimodal aspects of the user-generated data. one such multimodal data is a meme, which combines both images and text. with the flourishing of internet memes and because of their detrimental impact on society, online hateful meme classification got a considerable amount of traction from the research community @xcite lately. @xcite and @xcite introduced hateful memes dataset in english. besides developing datasets in english, few works attempted to introduce hateful memes datasets for low-resource languages such as bengali @xcite . multimodal fusion: over the years, various techniques have been applied to detect multimodal hateful memes. conventional fusion @xcite by concatenating the modality-specific information is the most commonly used method for learning multimodal representation. some works employed bilinear pooling @xcite while others fine-tuned transformers @xcite based architectures such as vilbert, mmbt, and visual-bert. besides, some works attempted to use disentangled learning @xcite and incorporate image captioning @xcite to improve the hateful memes detection performance. recently, @xcite applied prompting techniques for hateful meme detection in english. to the best of our knowledge, no one has attempted to align the visual and textual features for hateful meme detection. nonetheless, feature alignment is key in creating a successful multimodal representation @xcite . this work aims to address this research gap by introducing an alignment technique for hateful meme detection. overall our work differs from the existing studies in several significant ways: (i) rather than using additional context with conventional (i.e., early, late) fusion for multimodal representation, we align the visual and textual features using attention before fusing them, (ii) existing models are primarily designed for english and challenging to adapt for languages like bengali. this work presents a model that uses alignment and can be adapted for any language by swapping out language-specific components, and (iii) evaluation is performed on real-world meme dataset (mute, multioff) rather than the synthetic memes as in @xcite . ## method memes comprise two modalities (i.e., visual and textual); logically, one modality's content can outweigh another's content during prediction. besides, not all the information from both modalities has an equal effect on determining whether a meme is hateful. we propose a context-aware fusion framework that selectively focuses on modalityspecific information to model this complex relationship. the proposed network takes multimodal input and feeds the visual information to a cnn and textual information to an rnn for feature extraction. then we calculate alignment weights over the visual and textual features through the attention layer. the objective is to capture the contributing features with higher weights by emphasizing both modalities. subsequently, these alignment weights are utilized to create multimodal contextual representation. finally, the resulting contextual and modality-specific representations are combined and passed to the softmax layer for classification. we denote our proposed architecture as multimodal context aware -skip connected fusion (mca-scf) framework. an overall architecture of the framework is presented in figure 2 . to ensure the robustness of the architecture, we experiment with three other variants of the proposed mca-scf framework: a) vision guided contextual fusion (vgcf) framework; b) text guided contextual fusion (tgcf) framework; and c) multimodal contextual fusion (mcf) framework. the architecture of these variants differs in context vector computation and information fusion. in vgcf, we compute contextual information concerning the visual information and fuse it with the textual features. on the other hand, in tgcf, the contextual information is computed with respect to textual features and integrated with the visual features. in contrast, we compute the context for both modalities and then combine them in mcf. the rest of the components for all the architectures remain the same. the details of the variants vgcf, tgcf, mcf can be found in appendix a. ## experiments and results in this section, we first describe the datasets and the evaluation settings. we discuss the baselines and their results in comparison with the proposed method. moreover, we conduct an ablation study to show how replacing components of the mca-scf framework affects the performance. subsequently, an error analysis will be provided to understand the model's error. furthermore, we perform a crossdomain analysis to see how the proposed framework performs irrespective of language variation in a zero-shot setting (appendix c). ## conclusion this paper presents mca-scf, a multimodal framework that aligns visual and textual features using attention to create a coherent contextual representation. the model aims to improve hateful content detection performance by leveraging contextual and modality-specific representations. we evaluate the model on two publicly available datasets i.e., mute and multioff. our extensive experiments demonstrate that mca-scf outperforms the state-of-the-art systems on these datasets. furthermore, we conducted experiments with different variants of the model and performed an ablation study to ensure the system's robustness. the ablation study reveals that general word embeddings are more suitable than contextualized embedding for multimodal hateful meme detection. finally, the cross-domain analysis illustrates the model's generalization capability in zero-shot settings.