africlassifier: CPU-First Multi-Task Foundation Classifier for African Speech & Text

africlassifier is an omnimodal zero-shot foundation model that classifies speech audio or text in any African language across 6 core NLP dimensions:

  1. Domain / Topic (Agriculture, Healthcare, Governance/Politics, Business/Finance, Education, Religion, Culture/Sports, Climate, Legal/Justice, Technology, Customer Support)
  2. Sentiment (Positive, Negative, Neutral)
  3. Emotion (Joy, Sadness, Anger, Fear, Surprise, Hope, Frustration, Neutral)
  4. Intent Detection (Greeting, Inquiry, Complaint, Billing/Payment, Tech Support, Booking, Refund/Cancellation, Farewell)
  5. Safety & Content Moderation (Hate Speech & Violence Detection vs Safe/Peaceful)
  6. Language Identification (100+ African languages + English + French)

Trained using High-Rank LoRA ($r=64, \alpha=128$) on the Hopper H200 GPU over 796,481 sentence-level multimodal pairs, aligning African speech audio directly with full, natural English sentences (CLIP representation principle).


Model Release Artifacts in this Repository

Artifact File / Path Size Description
Full Merged 16-bit model.safetensors ~1.4 GB Standalone merged bfloat16 weights. Works out of the box with sentence-transformers and transformers.
Quantized GGUF (Q8_0) gguf/africlassifier-q8_0.gguf ~290 MB 8-bit quantized weights for edge, mobile, and llama.cpp deployment.
Multimodal Projector gguf/africlassifier-mmproj-bf16.gguf ~937 MB Multimodal audio projector for GGUF runtime.
Multi-Task Index taxonomies_index.pt ~436 KB Precomputed sentence-anchor embeddings for sub-15ms CPU multi-task scoring.
LoRA Adapters lora_adapters/ ~99 MB Lightweight LoRA adapter checkpoint for base unsloth/embeddinggemma-2.
Benchmark Suite benchmark_results.json ~45 KB Detailed 16-language out-of-domain evaluation results.

Benchmark Results (16 African Languages)

Evaluated on 80 non-religious African speech clips and native texts across 16 African languages sampled from Google WaxalNLP and Google FLEURS, with gold labels independently annotated by Google Gemini 2.5 Flash:

Modality / Task Metric Score Key Takeaways
Audio Language ID Top-1 Accuracy 47.5% 16-way classification from raw audio without ASR
Audio Language ID Top-3 Accuracy 60.0% Correct language within Top-3 candidates
Audio Domain / Topic Top-3 Accuracy 56.2% Broad domain alignment across 11 classes
Audio Sentiment Accuracy 28.8% Zero-shot speech sentiment
Text Sentiment Accuracy 53.8% Native African text sentiment
Text Domain / Topic Top-1 Accuracy 21.2% 11 semantic domain classes
Text Domain / Topic Top-3 Accuracy 38.8% Native African text
Text Emotion Accuracy 26.2% 8 emotion classes
Safety / Violence Moderation Threat / Hostility Recall 100.0% (8/8) Correctly caught all violent/warfare/killing statements
Safety / Content Moderation Balanced Overall 68.8% (11/16) Hate speech & violence vs peaceful expressions
Customer Support Intent Cancellation / Refund 100.0% (4/4) Across Twi, Yoruba, Swahili, Hausa
Customer Support Intent Farewell 100.0% (4/4) Across Twi, Yoruba, Swahili, Hausa
Customer Support Intent Inquiry 75.0% (3/4) Information seeking
Customer Support Intent Top-2 Accuracy 67.9% (19/28) High-recall chatbot intent routing

Evaluated Languages

  • West Africa: Akan (Twi/Fante), Southern Dagaare, Ewe, Dagbani, Ikposo, Yoruba, Hausa
  • East Africa: Swahili, Amharic, Oromo, Wolaytta, Luganda, Acholi
  • Central Africa: Lingala
  • Southern Africa: Shona, Zulu

Quickstart

1. Using Standard sentence-transformers (Text Embeddings)

from sentence_transformers import SentenceTransformer

# Load standalone 16-bit model directly from Hugging Face
model = SentenceTransformer("AfriSpeech/africlassifier")

sentences = [
    "Mema wo akye, me pɛ sɛ me nya nkyerɛkyerɛmu fa adwuma no ho.",  # Twi
    "Mo fẹ fagilee adehun mi ki ẹ si da owo mi pada.",                 # Yoruba
    "Ninataka kusitisha huduma hii naomba kurudishiwa pesa.",         # Swahili
]

embeddings = model.encode(sentences, normalize_embeddings=True)
print("Embeddings shape:", embeddings.shape)

2. Using africlassifier Python Package (Speech Audio & Text Multi-Task Classification)

pip install git+https://github.com/AfriSpeech/africlassifier.git
from africlassifier import AfriClassifier

# Load CPU-first classifier (sub-15ms classification latency)
classifier = AfriClassifier.load(
    model_path="AfriSpeech/africlassifier",
    taxonomy_index_path="taxonomies_index.pt",
    device="cpu",  # or "cuda"
)

# Classify raw speech audio:
result = classifier.predict("speech.flac", top_k=3)
print(result.to_json(indent=2))

# Classify African text:
result = classifier.predict("Mo service no yɛ bɔne dodo, me pɛ me sika", top_k=3)
print(result.intent.top_1)   # cancellation_refund
print(result.safety.top_1)   # non_hate_speech

Community Feedback & Contributions Welcome

More feedback, suggestions, and contributions are warmly welcome!

  • Taxonomy Refinement: If you have domain-specific taxonomy needs (e.g., public health, civic engagement, agricultural extension), feel free to propose new sentence anchors.
  • Language Coverage: Help expand anchors for additional African languages and regional dialects.
  • GitHub: https://github.com/AfriSpeech/africlassifier
Downloads last month
-
Safetensors
Model size
0.7B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support