---
title: "Homograph Attacks on Maghreb Sentiment Analyzers (2024)"
description: "It proposes, as future work, an input layer that detects suspicious Unicode characters and restores them before classification. 4 references."
authors: ["Fatima Zahra Qachfar", "Rakesh M. Verma"]
year: 2024
venue: "arXiv:2402.03171"
source: "https://arxiv.org/abs/2402.03171"
doi: "10.48550/arxiv.2402.03171"
arxiv: "2402.03171"
licence: "CC BY-NC-SA 4.0 (arXiv)"
licence_url: "http://creativecommons.org/licenses/by-nc-sa/4.0/"
summary_licence: "Elamur Cosmic License"
canonical: "https://research.elamur.ai/free/en/papers/qachfar-2024-homograph-attacks-maghreb-sentiment-analyzers/"
---
[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/qachfar-2024-homograph-attacks-maghreb-sentiment-analyzers/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/page/7/) / Homograph Attacks on Maghreb Sentiment Analyzers

# Homograph Attacks on Maghreb Sentiment Analyzers

**Authors:** Fatima Zahra Qachfar and [Rakesh M. Verma](https://md.research.elamur.ai/free/en/authors/rakesh-verma/) · **Year:** 2024 · **Venue:** arXiv:2402.03171 · **Licence:** [CC BY-NC-SA 4.0 (arXiv)](http://creativecommons.org/licenses/by-nc-sa/4.0/)

**Links:** [Publisher's page](https://arxiv.org/abs/2402.03171) · [PDF](https://arxiv.org/pdf/2402.03171) · [DOI 10.48550/arxiv.2402.03171](https://doi.org/10.48550/arxiv.2402.03171) · [arXiv 2402.03171](https://arxiv.org/abs/2402.03171) · [OpenAlex](https://openalex.org/W4391622618)

**Citations:** 0 citations (OpenAlex, 2026-10-14)

## Summary
The paper tests how fragile fine-tuned sentiment classifiers for North-African (Maghreb) Arabic dialects are when input text contains Unicode look-alike characters. Maghreb dialects are low-resource. They are often written in Latin script ("Arabizi") and mix languages, so many inputs contain Latin letters that can be swapped for visually identical but differently encoded characters.

The authors fine-tuned four dialect-aware BERT models on five sentiment datasets: MDMD, its Latin-only subset MDMD[DAL], TUNIZI, TSAC and AlgD. Training data stayed clean. At test time, 90% of the Latin characters in each example were replaced with homographs.

Every configuration lost performance. The worst case was TunBERT on TUNIZI, where F1 fell from 0.95 to 0.33, a 65.3% drop. Datasets written entirely in Arabizi suffered most, because every sample was affected. Even the mildest case, a mixed-script corpus, lost about a quarter of its F1.

The work argues that models consuming raw, unfiltered text are easy to sabotage. It proposes, as future work, an input layer that detects suspicious Unicode characters and restores them before classification.

## Key points
- **Models:** DarijaBERT-mix, DarijaBERT-arabizi, TunBERT and DziriBERT, each fine-tuned for 3 epochs with learning rate 2e-5.
- **Data split:** each dataset was divided 80/10/10 for train, validation and test. TUNIZI and TSAC were also merged under a shared label2id mapping.
- **Dataset sizes:**
  - MDMD: 42,000 examples, 3 classes.
  - MDMD[DAL]: 18,184 examples.
  - TUNIZI: 3,000 examples, binary and balanced.
  - TSAC: 11,871 examples.
  - AlgD: 11,760 examples.
  - Texts are short, roughly 5 to 19 tokens on average.
- **F1 before → after attack:**
  - TunBERT/TUNIZI: 0.95 → 0.33 (−65.3%).
  - DarijaBERT-arabizi/MDMD[DAL]: 0.75 → 0.30 (−60%).
  - TunBERT/TUNIZI+TSAC: 0.78 → 0.51 (−34.6%).
  - DziriBERT/AlgD: 0.86 → 0.57 (−33.7%).
  - DarijaBERT-mix/MDMD: 0.77 → 0.58 (−24.7%).
- **ChatGPT 3.5 test:** given a homograph-perturbed prompt, it failed to answer meaningfully and asked the user to rephrase.

## Interesting ideas
- Keep training data clean and perturb only the test set. Any accuracy gap then measures robustness alone, with no adaptation to the noise mixed in.
- Defend by reversing the attack at the input: find characters that only look like Latin letters and map them back to canonical forms before any model sees the text.
- Read the damage against the share of input the attack can reach. All-Latin corpora collapsed while mixed-script ones degraded less, so exposure explains much of the variation.
- When pooling datasets with different label conventions, first build one shared label-to-id mapping so the labels stay consistent.

## For Mova

How these ideas could serve Mova, our small open language model — its files, stages and tests:

- **I1** (learn): Add homograph-perturbed copies of the school tests and parser test sets as negative controls. A drop in scores would reveal hidden dependence on exact byte forms.
- **I2** (tokens): Put a confusable-character normalizer in front of the crate en tokenizer. Log each substitution so the repair stays traceable in the explanation chain.
- **I3** (learn): When evaluating robustness, report scores by the fraction of tokens perturbed. This separates genuine model weakness from simple exposure.
- **I4** (tree): Apply the same discipline when merging treebanks or converting UD dialects. Fix a single canonical relation and feature inventory before combining, so silent label clashes cannot corrupt training.

*Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.*

## Institutions

- [University of Houston](https://md.research.elamur.ai/free/en/universities/university-of-houston/) — University, Houston, United States · 7 works · 1,105 citations

📚 Shelves (2): [🖥️ Computer Science](https://md.research.elamur.ai/free/en/shelves/computer-science/) · 9,086 works · [🤖 Artificial Intelligence](https://md.research.elamur.ai/free/en/shelves/computer-science/artificial-intelligence/) · 8,889 works

🧭 Topics (2): [😊 Sentiment & emotion](https://md.research.elamur.ai/free/en/topics/sentiment-emotion/) · 608 works · [Semitic languages](https://md.research.elamur.ai/free/en/topics/semitic-languages/) · 1,484 works

## Cite

Cite as: Fatima Zahra Qachfar and Rakesh M. Verma. 2024. Homograph Attacks on Maghreb Sentiment Analyzers. arXiv:2402.03171.

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@misc{qachfar2024homograph,
  title = {{Homograph Attacks on Maghreb Sentiment Analyzers}},
  author = {Fatima Zahra Qachfar and Rakesh M. Verma},
  year = {2024},
  doi = {10.48550/arxiv.2402.03171},
  eprint = {2402.03171},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2402.03171}
}
```

- [← previous HeSum: a Novel Dataset for Abstractive Text Summarization in Hebrew](https://md.research.elamur.ai/free/en/papers/mondshine-2024-hesum-novel-dataset-abstractive-text/)
- [next → Human Temporal Inferences Go Beyond Aspectual Class](https://md.research.elamur.ai/free/en/papers/prus-2024-human-temporal-inferences-go-beyond/)
- [↑ back to papers of 2024](https://md.research.elamur.ai/free/en/papers/2024/page/7/)

## References

4 references, 1 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

1. Chayma Fourati, Abir Messaoudi, and Hatem Haddad. [Tunizi: a tunisian arabizi sentiment analysis dataset](https://md.research.elamur.ai/free/en/papers/fourati-2020-tunizi-tunisian-arabizi-sentiment-analysis/). In AfricaNLP Workshop, Putting Africa on the NLP Map. ICLR 2020, volume arXiv:3091079, 2020. [↗](https://doi.org/10.48550/arxiv.2004.14303)
2. Ahmed Cherif Mazari and Abdelhamid Djeffal. Sentiment analysis of algerian dialect using machine learning and deep learning with word2vec. Informatica, 46(6), 2022. [↗](https://doi.org/10.31449/inf.v46i6.3340)
3. Salima Medhaffar, Fethi Bougares, Yannick Estève, and Lamia Hadrich-Belguith. Sentiment analysis of Tunisian dialects: Linguistic ressources and experiments. In Proceedings of the Third Arabic Natural Language Processing Workshop, pages 55–61. Association for Computational Linguistics, April 2017. [find](https://scholar.google.com/scholar?q=Salima+Medhaffar%2C+Fethi+Bougares%2C+Yannick+Est%C3%A8ve%2C+and+Lamia+Hadrich%2DBelguith%2E+Sentiment+analysis+of+Tunisian+dialects%3A+Linguistic+ressources+and+experiments%2E+In+Proceedings+of+the+Third+Arabic+Natural)
4. Otman Moussaoui, Yacine El Younoussi, and Chaimae Azroumahli. Supervised classification of languages used by moroccans in social networks. International Journal of Computer Engineering and Data Science (IJCEDS), 2(4):1–10, 2022. [find](https://scholar.google.com/scholar?q=Otman+Moussaoui%2C+Yacine+El+Younoussi%2C+and+Chaimae+Azroumahli%2E+Supervised+classification+of+languages+used+by+moroccans+in+social+networks%2E+International+Journal+of+Computer+Engineering+and+Data+Scienc)

*Updated 24 October 2026*
