Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Hate and Offensive Text Detection with Small Language Models
Luleå University of Technology, Department of Computer Science, Electrical and Space Engineering.
2026 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesis
Abstract [en]

Identifying Hate and Offensive (HOF) content is a genuine challenge for online platforms and communities working to keep their digital spaces safe. Individuals, communities, and online platforms need automated tools to detect and mitigate such content. This work examines open-weight Small Language Models (SLMs) that run locally and preserve privacy and sovereignty without relying on cloud APIs. We systematically evaluate 109 open-weight SLMs on the HASOC 2019 and HASOC 2020 datasets and fine-tune 8 SLMs. We investigate the prompting strategy (zero-shot vs. few-shot), individual vs. majority-voting ensemble performance, the impact of characteristics such as parameter count, family, and dense vs. Mixture-of-Experts architectures, and QLoRA fine-tuning. Around 30 SLMs perform well out of the box. The few-shot prompting and ensembles offer little benefit over a single strong zero-shot model, and fine-tuning can significantly help weaker models. The fine-tuned phi4-14b achieves macro-F1 0.8196 on HASOC 2019. Also, the fine-tuned smollm2-1.7b and a differently fine-tuned phi4-14b both reach macro-F1 0.9196 on HASOC 2020, ranking at the top of all results, exceeding the best previously reported scores in literature. Overall, open-weight SLMs are a viable option for local, privacy-preserving HOF detection.

Place, publisher, year, edition, pages
2026. , p. 84
Keywords [en]
Hate and Offensive Text, Generative AI, Small Language Model, Fine-Tuning, Natural Language Processing
National Category
Artificial Intelligence Computer Sciences Natural Language Processing Science and Technology Studies
Identifiers
URN: urn:nbn:se:ltu:diva-120109OAI: oai:DiVA.org:ltu-120109DiVA, id: diva2:2109512
Educational program
Master Programme in Applied Aritficial Intelligence
Examiners
Available from: 2026-10-12 Created: 2026-10-09 Last updated: 2026-10-12Bibliographically approved

Open Access in DiVA

No full text in DiVA

By organisation
Department of Computer Science, Electrical and Space Engineering
Artificial IntelligenceComputer SciencesNatural Language ProcessingScience and Technology Studies

Search outside of DiVA

GoogleGoogle Scholar

urn-nbn

Altmetric score

urn-nbn
Total: 45 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf