Update README.md
Browse files
README.md
CHANGED
|
@@ -18,8 +18,6 @@ tags:
|
|
| 18 |
- mwirelabs
|
| 19 |
- token-efficiency
|
| 20 |
license: cc-by-4.0
|
| 21 |
-
datasets:
|
| 22 |
-
- MWirelabs/NE-BERT-Raw-Corpus
|
| 23 |
pipeline_tag: fill-mask
|
| 24 |
model-index:
|
| 25 |
- name: NE-BERT
|
|
@@ -54,7 +52,29 @@ Built on the **ModernBERT** architecture, it supports a context length of **$102
|
|
| 54 |
|
| 55 |
---
|
| 56 |
|
| 57 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
We evaluated NE-BERT against industry-standard multilingual models (mBERT, XLM-R, IndicBERT) on a final, complex, held-out test set to ensure reproducibility and rigor.
|
| 60 |
|
|
@@ -62,7 +82,9 @@ We evaluated NE-BERT against industry-standard multilingual models (mBERT, XLM-R
|
|
| 62 |
|
| 63 |
Perplexity measures the model's fluency and understanding of text (lower is better). This comparison proves NE-BERT's superior language modeling across the board, particularly in low-resource settings.
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
|
| 67 |
| Language | **NE-BERT** | mBERT | IndicBERT | Verdict |
|
| 68 |
| :--- | :--- | :--- | :--- | :--- |
|
|
@@ -73,67 +95,27 @@ Perplexity measures the model's fluency and understanding of text (lower is bett
|
|
| 73 |
| Mizo ($\text{lus}$) | **3.09** | 3.13 | 6.45 | **Best Specialized Model** |
|
| 74 |
| **Garo** ($\text{grt}$) | **3.80** | 3.32 | 8.64 | **Crushes IndicBERT** |
|
| 75 |
|
| 76 |
-
*Note: While XLM-R shows low PPL scores (which is often due to its highly fragmenting tokenizer), **NE-BERT** is the clear **Regional SOTA** winner against the most relevant competitors (mBERT and IndicBERT), proving its linguistic advantage.*
|
| 77 |
-
|
| 78 |
### 2. Efficiency: Token Fertility (Inference Speed)
|
| 79 |
|
| 80 |
Token Fertility (Tokens per Word) is the key metric for inference speed and memory footprint (lower is better). NE-BERT's custom Unigram tokenizer delivers massive efficiency gains.
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
| :--- | :--- | :--- | :--- | :--- |
|
| 86 |
-
| **Assamese** ($\text{asm}$) | **1.46** | 4.20 | 2.75 | 2.69 |
|
| 87 |
-
| **Meitei** ($\text{mni}$) | **2.12** | 4.22 | 3.77 | 2.50 |
|
| 88 |
-
| **Garo** ($\text{grt}$) | **2.12** | 3.62 | 3.34 | 3.95 |
|
| 89 |
-
| **Pnar** ($\text{pbv}$) | **1.43** | 1.74 | 1.64 | 1.93 |
|
| 90 |
|
| 91 |
*Result: NE-BERT is **$2\text{x}$ to $3\text{x}$ more token-efficient** on major languages than mBERT and XLM-R, translating directly to **faster inference** and **lower VRAM consumption** in production.*
|
| 92 |
|
| 93 |
---
|
| 94 |
|
| 95 |
-
##
|
| 96 |
-
|
| 97 |
-
The model was trained on a custom corpus curated by **MWirelabs**, containing $\approx 8.3$ Million sentences.
|
| 98 |
-
|
| 99 |
-
| Language | HF Tag | Script | Corpus Size | Training Strategy |
|
| 100 |
-
| :--- | :--- | :--- | :--- | :--- |
|
| 101 |
-
| **Assamese** | `asm-Beng` | Bengali-Assamese | $\approx 1\text{M}$ Sentences | Native |
|
| 102 |
-
| **Meitei (Manipuri)** | `mni-Beng` | Bengali-Assamese | $\approx 1.3\text{M}$ Sentences | Native |
|
| 103 |
-
| **Khasi** | `kha-Latn` | Roman | $\approx 1\text{M}$ Sentences | Native |
|
| 104 |
-
| **Mizo** | `lus-Latn` | Roman | $\approx 1\text{M}$ Sentences | Native |
|
| 105 |
-
| **Nyishi** | `njz-Latn` | Roman | $\approx 55\text{k}$ Sentences | **Oversampled** ($20\text{x}$) |
|
| 106 |
-
| **Garo** | `grt-Latn` | Roman | $\approx 10\text{k}$ Sentences | **Oversampled** ($20\text{x}$) |
|
| 107 |
-
| **Pnar** | `pbv-Latn` | Roman | $\approx 1\text{k}$ Sentences | **Oversampled** ($100\text{x}$) |
|
| 108 |
-
| **Kokborok** | `trp-Latn` | Roman | $\approx 2.5\text{k}$ Sentences | **Oversampled** ($100\text{x}$) |
|
| 109 |
-
| **Anchor Languages** | `eng-Latn`/`hin-Deva` | Roman/Devanagari | $\approx 660\text{k}$ Sentences | Downsampled |
|
| 110 |
-
|
| 111 |
-
### Note on Data Strategy
|
| 112 |
-
To prevent overfitting on the heavily upsampled micro-languages, we utilized **Dynamic Masking** during training. This forced the model to learn semantic relationships rather than memorizing token sequences across epochs.
|
| 113 |
-
|
| 114 |
-
## Quick Use
|
| 115 |
-
|
| 116 |
-
You can use NE-BERT directly with the Hugging Face `pipeline`.
|
| 117 |
-
**Note:** NE-BERT uses `<mask>` (XML style) instead of `[MASK]`.
|
| 118 |
-
|
| 119 |
-
```python
|
| 120 |
-
from transformers import pipeline
|
| 121 |
-
|
| 122 |
-
# 1. Load Model
|
| 123 |
-
unmasker = pipeline("fill-mask", model="MWirelabs/ne-bert", tokenizer="MWirelabs/ne-bert")
|
| 124 |
-
|
| 125 |
-
# 2. Test Example (Khasi)
|
| 126 |
-
# Input: "I go to [mask]" (Market/School/Home)
|
| 127 |
-
sentence = "Nga leit sha <mask>."
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
# iew: 6.9% (Market)
|
| 137 |
|
| 138 |
## Technical Specifications
|
| 139 |
|
|
|
|
| 18 |
- mwirelabs
|
| 19 |
- token-efficiency
|
| 20 |
license: cc-by-4.0
|
|
|
|
|
|
|
| 21 |
pipeline_tag: fill-mask
|
| 22 |
model-index:
|
| 23 |
- name: NE-BERT
|
|
|
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
+
## 💾 Training Data & Strategy
|
| 56 |
+
|
| 57 |
+
NE-BERT was trained on a meticulously curated corpus using a **Smart-Weighted Sampling** strategy to ensure the low-resource languages were not drowned out by anchor languages.
|
| 58 |
+
|
| 59 |
+
<div align="center">
|
| 60 |
+
<img src="https://huggingface.co/MWirelabs/ne-bert/resolve/main/ne_bert_data_dist.png" alt="Data Distribution Pie Chart" width="600"/>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
| Language | HF Tag | Script | Corpus Size | Training Strategy |
|
| 64 |
+
| :--- | :--- | :--- | :--- | :--- |
|
| 65 |
+
| **Assamese** | `asm-Beng` | Bengali-Assamese | $\approx 1\text{M}$ Sentences | Native |
|
| 66 |
+
| **Meitei (Manipuri)** | `mni-Beng` | Bengali-Assamese | $\approx 1.3\text{M}$ Sentences | Native |
|
| 67 |
+
| **Khasi** | `kha-Latn` | Roman | $\approx 1\text{M}$ Sentences | Native |
|
| 68 |
+
| **Mizo** | `lus-Latn` | Roman | $\approx 1\text{M}$ Sentences | Native |
|
| 69 |
+
| **Nyishi** | `njz-Latn` | Roman | $\approx 55\text{k}$ Sentences | **Oversampled** ($20\text{x}$) |
|
| 70 |
+
| **Garo** | `grt-Latn` | Roman | $\approx 10\text{k}$ Sentences | **Oversampled** ($20\text{x}$) |
|
| 71 |
+
| **Pnar** | `pbv-Latn` | Roman | $\approx 1\text{k}$ Sentences | **Oversampled** ($100\text{x}$) |
|
| 72 |
+
| **Kokborok** | `trp-Latn` | Roman | $\approx 2.5\text{k}$ Sentences | **Oversampled** ($100\text{x}$) |
|
| 73 |
+
| **Anchor Languages** | `eng-Latn`/`hin-Deva` | Roman/Devanagari | $\approx 660\text{k}$ Sentences | Downsampled |
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## 📈 Evaluation and Benchmarks: Regional SOTA
|
| 78 |
|
| 79 |
We evaluated NE-BERT against industry-standard multilingual models (mBERT, XLM-R, IndicBERT) on a final, complex, held-out test set to ensure reproducibility and rigor.
|
| 80 |
|
|
|
|
| 82 |
|
| 83 |
Perplexity measures the model's fluency and understanding of text (lower is better). This comparison proves NE-BERT's superior language modeling across the board, particularly in low-resource settings.
|
| 84 |
|
| 85 |
+
<div align="center">
|
| 86 |
+
<img src="https://huggingface.co/MWirelabs/ne-bert/resolve/main/ppl_benchmark_chart.png" alt="Perplexity Benchmark Chart" width="800"/>
|
| 87 |
+
</div>
|
| 88 |
|
| 89 |
| Language | **NE-BERT** | mBERT | IndicBERT | Verdict |
|
| 90 |
| :--- | :--- | :--- | :--- | :--- |
|
|
|
|
| 95 |
| Mizo ($\text{lus}$) | **3.09** | 3.13 | 6.45 | **Best Specialized Model** |
|
| 96 |
| **Garo** ($\text{grt}$) | **3.80** | 3.32 | 8.64 | **Crushes IndicBERT** |
|
| 97 |
|
|
|
|
|
|
|
| 98 |
### 2. Efficiency: Token Fertility (Inference Speed)
|
| 99 |
|
| 100 |
Token Fertility (Tokens per Word) is the key metric for inference speed and memory footprint (lower is better). NE-BERT's custom Unigram tokenizer delivers massive efficiency gains.
|
| 101 |
|
| 102 |
+
<div align="center">
|
| 103 |
+
<img src="https://huggingface.co/MWirelabs/ne-bert/resolve/main/fertility_benchmark_chart.png" alt="Token Fertility Benchmark Chart" width="600"/>
|
| 104 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
*Result: NE-BERT is **$2\text{x}$ to $3\text{x}$ more token-efficient** on major languages than mBERT and XLM-R, translating directly to **faster inference** and **lower VRAM consumption** in production.*
|
| 107 |
|
| 108 |
---
|
| 109 |
|
| 110 |
+
## Training Performance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
<div align="center">
|
| 113 |
+
<img src="https://huggingface.co/MWirelabs/ne-bert/resolve/main/ne_bert_loss_chart.png" alt="Training Convergence Chart" width="800"/>
|
| 114 |
+
</div>
|
| 115 |
|
| 116 |
+
* **Final Training Loss:** 1.62
|
| 117 |
+
* **Final Validation Loss:** 1.64
|
| 118 |
+
* **Convergence:** The model achieved optimal convergence where validation loss tracked closely with training loss, indicating robust generalization despite the small dataset size of rare languages.
|
|
|
|
| 119 |
|
| 120 |
## Technical Specifications
|
| 121 |
|