Token Classification
Transformers
Safetensors
Yoruba
English
xlm-roberta
code-switching
yoruba
efficient-ai
african-nlp
language-identification
lid
Eval Results (legacy)
Instructions to use LyngualLabs/yoruba-en-ner-model-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LyngualLabs/yoruba-en-ner-model-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="LyngualLabs/yoruba-en-ner-model-small")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("LyngualLabs/yoruba-en-ner-model-small") model = AutoModelForTokenClassification.from_pretrained("LyngualLabs/yoruba-en-ner-model-small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 4,051 Bytes
0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b 4d1688f f87ed4b 0f97873 f87ed4b 0f97873 f87ed4b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | ---
library_name: transformers
language:
- yo
- en
license: mit
base_model: Davlan/afro-xlmr-mini
tags:
- code-switching
- yoruba
- efficient-ai
- african-nlp
- language-identification
- lid
metrics:
- precision
- recall
- f1
- accuracy
model-index:
- name: yoruba-english-lid-mini
results:
- task:
type: token-classification
name: Language Identification
dataset:
name: Yoruba-English Code-Switched Dataset
type: custom
metrics:
- type: f1
value: 0.9905
name: Overall F1
- type: precision
value: 0.9900
name: Overall Precision
- type: recall
value: 0.9910
name: Overall Recall
---
# Yoruba-English Code-Switching Language Identification (LID) - Mini
This model is a highly efficient, fine-tuned version of [Davlan/afro-xlmr-mini](https://huggingface.co/Davlan/afro-xlmr-mini) designed for token-level Language Identification (LID) in Yoruba-English code-switched text.
## Research Highlights
- **High Accuracy, Low Footprint:** Achieved an **Overall F1-score of 99.05%**, matching the performance of "Large" models (550M parameters) while using a significantly smaller architecture (approx. 17M parameters).
- **Efficiency:** Optimized for deployment in resource-constrained environments or high-throughput real-time applications.
- **African Language Focus:** Built upon the AfroXLM-R-Mini base, leveraging pre-training specifically tailored for African linguistic structures.
## Performance Evaluation (Test Set)
The following results were obtained on the held-out test set (~80k tokens):
| Language | Precision | Recall | F1-Score | Support |
| :--- | :--- | :--- | :--- | :--- |
| **Overall** | **0.990** | **0.991** | **0.991** | **80,085** |
| English | 0.994 | 0.995 | 0.994 | 63,016 |
| Yoruba | 0.976 | 0.978 | 0.977 | 17,069 |
### Evaluation Metrics
- **Overall Accuracy:** 99.56%
- **Evaluation Loss:** 0.0947
## Model Comparison (Ablation Study)
In our research, we compared this "Mini" architecture against a "Large" baseline to evaluate the trade-off between size and accuracy:
| Model | Parameters | Overall F1 | Speed (Samples/sec) |
| :--- | :--- | :--- | :--- |
| AfroXLM-R Large | 550M | 99.07% | ~300 |
| **AfroXLM-R Mini** | **17M** | **99.05%** | **1712** |
## Training Procedure
### Training Narrative
The model was trained for 5 epochs on an A100 GPU. We utilized a large global batch size (256) and mixed-precision training (BF16) to ensure stable and fast convergence. Unlike larger models that may overfit rapidly on LID tasks, the Mini architecture showed a healthy learning curve with validation loss steadily decreasing throughout the process.
### Hyperparameters
- **Learning Rate:** 3e-05
- **Global Batch Size:** 256
- **Optimizer:** AdamW (Fused)
- **LR Scheduler:** Cosine Decay
- **Warmup Ratio:** 0.1
### Training Logs
| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-----:|:----:|:---------------:|
| No log | 1.0 | 313 | 0.2852 |
| 0.4325 | 2.0 | 626 | 0.1622 |
| 0.4325 | 3.0 | 939 | 0.1153 |
| 0.1482 | 4.0 | 1252 | 0.1000 |
| 0.1039 | 5.0 | 1565 | 0.0977 |
## Usage
```python
from transformers import pipeline
# Load the model directly from the Hub
lid_model = pipeline("token-classification", model="Professor/yoruba-en-ner-model-small")
text = "Ẹ jẹ́ kí á lọ si cinema to watch the latest movie."
results = lid_model(text)
for entity in results:
print(f"Token: {entity['word']}, Language: {entity['entity']}")
```
## Intended Uses & Limitations
This model is intended for researchers and developers working on bilingual text processing for Nigerian English and Yoruba. While highly accurate, users should note that performance may vary on text with non-standard orthography or code-switching involving third languages (e.g., Nigerian Pidgin).
## Citation
If you use this model in your research, please cite the original AfroXLM-R paper and this specific fine-tuned release. |