A CLIP-based siamese approach for meme classification

Javier Huertas-Tato, Christos Koutlis, Symeon Papadopoulos, David Camacho, Ioannis KompatsiarisarXiv 2024 · arXiv

TL;DR

SimCLIP introduces a compact, lightweight architecture for meme classification by treating a pre-trained CLIP model as a Siamese network. By leveraging simple, parameter-free vector operations—specifically absolute difference and Hadamard product—to capture cross-modal interactions, it achieves state-of-the-art and even super-human performance across multiple benchmarks without relying on heavy ensembles or external knowledge bases.

What Problem Does This Paper Address?

Memes are a staple of internet culture, but moderating or analyzing them automatically is an absolute nightmare for machine learning models. Because memes are inherently multimodal and contextual, analyzing the text or image in isolation rarely works. A harmless image paired with a specific line of text can suddenly become a vehicle for hate speech, irony, or misogyny.

Current state-of-the-art approaches try to solve this by stacking complex external detectors (e.g., face, ethnicity, or entity recognizers) or building massive ensembles. While effective for specific datasets, these methods are computationally expensive, prone to over-specialization, and fail to generalize across different tasks—for instance, a model tuned to detect political propaganda will struggle with humor or sarcasm classification.

Methods

The authors propose SimCLIP, a self-contained architecture that exploits the fact that CLIP already projects text and images into a shared vision-language space.

The pipeline works as follows:

  1. Preprocessing: Text is extracted from the meme image using an Optical Character Recognition (OCR) algorithm.
  2. Encoding: The image and text are passed through frozen or partially-thawed CLIP encoders to generate base embeddings ($E_{IMG}$ and $E_{TXT}$).
  3. Siamese Projection: Shallow feed-forward networks (FFNs) project these embeddings into a custom feature space, followed by L2 normalization.
  4. Cross-Modal Fusion: Instead of simply concatenating the vectors, SimCLIP applies classic Siamese operators to explicitly capture interactions: $$E = [E_{TXT}, E_{IMG}, |E_{TXT} - E_{IMG}|, E_{TXT} \cdot E_{IMG}]$$
  5. The absolute difference ($|E_{TXT} - E_{IMG}|$) highlights contradictions or disagreements between the text and image (crucial for irony and sarcasm).
  6. The Hadamard product ($E_{TXT} \cdot E_{IMG}$) amplifies similarities and agreements.
  7. Classification: Feed-forward classification heads process this combined representation to output the final predictions.
Figure 2: Visualization of SimCLIP architecture. The input image is first processed by an OCR algorithm to extract the text. Image and text are CLIP-encoded and projected using a simple Siamese feed-forward network. Projections are concatenated (⊕) with the absolute difference and Hadamard product to finally be processed by a feed-forward classification head. In multitask settings, losses are summed across heads. In multilabel settings the binary cross-entropy loss is considered, while in multiclass settings we use the categorical cross-entropy loss.

Datasets

The model was rigorously evaluated across 6 distinct datasets covering 7 tasks:

  • Memotion7k: A dataset for sentiment analysis, humor, sarcasm, and offensiveness intensity.
  • FBHM (Facebook Hateful Memes): The standard benchmark for hate speech detection in image macros.
  • Harm-C & Harm-P: Harmful content detection focused on COVID-19 and US Politics, respectively.
  • MultiOFF: A small dataset dedicated to offensiveness detection.
  • Propaganda memes: A highly challenging multi-label dataset for political propaganda.

Key Insights and Ideas

  • CLIP as a Siamese Network: Because CLIP maps both modalities to a shared embedding space, we can treat its dual branches as a Siamese network. This allows geometric operations (like distance or element-wise products) to carry actual semantic meaning across text and vision.
  • Parameter-Free Interaction: Computing the absolute difference and Hadamard product allows the model to instantly capture cross-modal alignment and contradictions without adding a single trainable parameter to the fusion layer. This is vital for small meme datasets (often <10k samples) where large fusion networks would easily overfit.
  • The Danger of Over-Specialization: The authors demonstrate that relying on external knowledge graphs or demographic detectors hurts overall generalization. SimCLIP’s minimalist, purely visual-textual approach proves that a unified, lightweight model can handle both humor and hate speech effectively.

Key Results

  • Super-Human Performance: On the Harm-P (US Politics) dataset, SimCLIP achieved an 80.01% F1-score, significantly outperforming human baselines (70.35%) and beating the previous best model, MOMENTA (66.66%).
  • State-of-the-Art: On Memotion7k (Task 3), SimCLIP set a new SOTA with a 36.79% F1-score, representing a 7.25% relative improvement over MemeFier.
  • Efficiency: SimCLIP achieves these results with a fraction of the computational overhead of its competitors, training in just 10 minutes to 2 hours on a single commodity GPU (NVIDIA RTX 3090 ti).

Limitations and Future Work

  • Curated vs. "In-the-Wild" Memes: Existing datasets are heavily curated and relatively small. The authors express skepticism about how well any current model (including SimCLIP) generalizes to real-world, fast-evolving internet memes.
  • Label Noise: Meme interpretation is highly subjective, leading to weak annotator agreement and noisy training labels.
  • Future Directions: The authors suggest exploring domain adaptation via large-scale meme pre-training (hundreds of thousands of pairs) and integrating noise-resistant loss functions to handle subjective labeling.

Summary updated

Abstract

Memes are an increasingly prevalent element of online discourse in social networks, especially among young audiences. They carry ideas and messages that range from humorous to hateful, and are widely consumed. Their potentially high impact requires adequate means of control to moderate their use in large scale. In this work, we propose SimCLIP a deep learning-based architecture for cross-modal understanding of memes, leveraging a pre-trained CLIP encoder to produce context-aware embeddings and a Siamese fusion technique to capture the interactions between text and image. We perform an extensive experimentation on seven meme classification tasks across six datasets. We establish a new state of the art in Memotion7k with a 7.25% relative F1-score improvement, and achieve super-human performance on Harm-P with 13.73% F1-Score improvement. Our approach demonstrates the potential for compact meme classification models, enabling accurate and efficient meme monitoring. We share our code at https://github.com/jahuerta92/meme-classification-simclip
BibTeX
@misc{huertastato2024clip,
  author = {Javier Huertas-Tato and Christos Koutlis and Symeon Papadopoulos and David Camacho and Ioannis Kompatsiaris},
  title = {{A CLIP-based siamese approach for meme classification}},
  year = {2024},
  eprint = {2409.05772},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.05772},
}

Loading related content...

Figure