A Performance-efficiency Analysis of Transformer Models for Code-mixed Hausa Sentiment Data
Discuss this preprint
Start a discussion What are Sciety discussions?Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
The deployment of large language models (LLMs) in African contexts offers significant opportunities for societal innovation, but is often hindered by their substantial computational requirements. This challenge is particularly acute for code-mixed Hausa sentiment analysis, where the state-of-the-art (SOTA) model achieves high accuracy at a significant cost in model size and inference speed. This paper addresses this performance-efficiency trade-off by presenting the first comprehensive benchmark of the SOTA model against a suite of smaller, more efficient alternatives, including specialized African-centric and generalist models. Using the established NaijaSenti benchmark, our experiments reveal that a compact, specialized model (castorini/afriberta small) retains over 82% of the SOTA’s F1-score (0.761 vs. 0.928) while being 2.25 times faster at inference. Furthermore, our results demonstrate that specialized pre-training is a critical factor, as the small African-centric model significantly outperforms its generalist counterpart. We conclude that castorini/afriberta small represents the optimal ”sweet spot” for practical deployment, and we recommend it for applications where a balance between high performance and computational efficiency is required. Our findings provide a data-driven guide for practitioners building scalable NLP solutions in the African context.