Skip to content

EPFL · EE-559 Deep Learning · spring 2026 · team of 3

UnHateMeme

Spotting a hateful meme is a known problem. Repairing it, while changing the image as little as possible, is not. We built a pipeline that does both, with open-weight models.

Qwen 3.6 / 2.5-VL · Gemma 4 · FLUX.2 · LoRA · Docker

GitHub

The situation

Moderation usually stops at detection: the meme is flagged, or removed. We wanted to go one step further, neutralise the hateful part and keep the rest of the meme. No image from the dataset appears on this page: the originals are hateful, and their licence doesn't allow it.

The system

memeVLMdetects, planseditnot hateful: unchangeddiffusionrewritesrepairedscoredtoxicity,similarity
  • A vision-language model decides whether the meme is hateful, describes what is harmful and plans the edit; a FLUX diffusion model rewrites the image.
  • I fine-tuned the detection (LoRA, a classification head, a weighted loss) and compared prompt variants, with Grad-CAM to see where the model looks.
  • I ran the experiments as a reproducible grid, with repeated runs and GPU batching on the cluster.

Results

Toxicity reduction after the rewrite
  • Gemma 4, no fine-tuning

    84 %
  • Qwen 3.6 + LoRA

    63 %
  • Qwen 3.6, no fine-tuning

    43 %

Mean over repeated runs. EE-559 report, EPFL, 2026.

  • 84 % of hateful memes are judged non-hateful after the rewrite with Gemma 4, with no fine-tuning, against 63 % for the next best (Qwen 3.6 with LoRA).
  • Best detection: AUROC 0.755, F1 0.71, with synthetic few-shot examples.

Means over repeated runs, EE-559 report, EPFL, 2026. These metrics are proxies: none of them says whether the repaired meme keeps its humour, and the report says so.

Try it

An example I drew to show the idea: not a real output, and not from the dataset. The caption stays, only the picture changes, and the joke stops being cruel. Drag to compare.

Everyone came to your party
Everyone came to your party
Drawn by hand to illustrate the pipeline. Not a model output, not from the dataset.

What I learned

LoRA raised recall without making detection better: it moved the decision threshold, not the model's ability to tell memes apart. It also roughly halved visual similarity to the original, because the fine-tuned models wrote more aggressive edits.

Next