UncleanCode commited on
Commit
471eb55
·
verified ·
1 Parent(s): 424aef9

Restyle model card: Modular logo, diagram, structured sections

Browse files
.gitattributes CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  models/labse-ig-ha-yo/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  models/labse-ig-ha-yo/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ images/native_bird_diagram.jpg filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -19,112 +19,123 @@ tags:
19
  base_model: sentence-transformers/LaBSE
20
  ---
21
 
22
- # Native-Bird
23
-
24
- **Native-Bird** is a 768-dimensional multilingual sentence-embedding model fine-tuned from **LaBSE** for cross-lingual retrieval involving **Igbo, Hausa, Yoruba, and English**.
25
-
26
- Its primary use case is **native-language query → English document retrieval**. A user can describe what they are looking for in Igbo while the indexed document is written in English, and Native-Bird maps both into the same embedding space for semantic search.
27
-
28
- ## What it is designed to do
29
-
30
- Example:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  > **Igbo query:** “Neuklọs ahụ bụ ahụ ihe abụọ mejupụtara ya - neutrọn na protọn.”
33
  >
34
  > **English document:** “The nucleus consists of two particles - neutrons and protons.”
35
 
36
- The model should assign a high cosine similarity to the matching English text even though the languages differ.
37
-
38
- ## Model details
39
-
40
- - **Model name:** Native-Bird
41
- - **Architecture:** SentenceTransformer based on LaBSE
42
- - **Embedding dimension:** 768
43
- - **Maximum sequence length used during training:** 128 tokens
44
- - **Similarity:** cosine similarity
45
- - **Base model:** sentence-transformers/LaBSE
46
- - **Training objective:** Cached Multiple Negatives Ranking Loss (CachedMNRL)
47
- - **Languages:** Igbo, Hausa, Yoruba, English
48
- - **Training examples:** 76,150 paired examples
49
- - **Epochs:** 4
50
- - **Per-device batch size:** 256
51
- - **Learning rate:** 2e-5
52
- - **Warmup:** 10%
53
- - **Scheduler:** cosine
54
- - **Training precision:** BF16
55
- - **Negative sampling:** in-batch negatives with NO_DUPLICATES; CachedMNRL mini-batch size 128
56
-
57
- ## Evaluation
58
-
59
- The retrieval evaluation uses an English corpus of **1,004 sentences** and **204 queries per language**. For each query, the correct English sentence is known. We report Recall@1, Recall@10, and Mean Reciprocal Rank (MRR).
60
-
61
- ### Fine-tuned Native-Bird
62
 
63
- | Language | Query condition | R@1 | R@10 | MRR |
64
- |---|---|---:|---:|---:|
65
- | Igbo | Clean | 1.0000 | 1.0000 | 1.0000 |
66
- | Igbo | ASR-style noise | 1.0000 | 1.0000 | 1.0000 |
67
- | Hausa | Clean | 1.0000 | 1.0000 | 1.0000 |
68
- | Hausa | ASR-style noise | 1.0000 | 1.0000 | 1.0000 |
69
- | Yoruba | Clean | 0.9804 | 1.0000 | 0.9902 |
70
- | Yoruba | ASR-style noise | 0.9804 | 1.0000 | 0.9867 |
71
 
72
- ### Before fine-tuning: LaBSE baseline
73
 
74
- | Language | Query condition | R@1 | R@10 | MRR |
75
- |---|---|---:|---:|---:|
76
- | Igbo | Clean | 1.0000 | 1.0000 | 1.0000 |
77
- | Igbo | ASR-style noise | 0.9853 | 0.9951 | 0.9888 |
78
- | Hausa | Clean | 1.0000 | 1.0000 | 1.0000 |
79
- | Hausa | ASR-style noise | 0.9951 | 1.0000 | 0.9975 |
80
- | Yoruba | Clean | 0.9804 | 1.0000 | 0.9871 |
81
- | Yoruba | ASR-style noise | 0.9559 | 0.9951 | 0.9683 |
82
 
83
- ### Interpretation
84
 
85
- Native-Bird is **strong on the benchmark it was trained and evaluated against**, particularly for Igbo and Hausa. Fine-tuning improved noisy-query retrieval for Igbo and Hausa and slightly improved Yoruba.
 
 
 
 
 
 
 
 
86
 
87
- The scores do **not** prove that Native-Bird will retrieve arbitrary long English documents from arbitrary Igbo descriptions with the same accuracy. The current evaluation is sentence-level. Real document search should therefore split documents into passages/chunks before embedding.
88
 
89
- ## Direct Igbo → English retrieval checks
90
 
91
- The trained model was directly run against the English evaluation corpus. Examples:
 
 
 
92
 
93
- **Igbo:** “Mgbanwe n'ọdịdị na-agbakwunye ọdịdị kejenetiki ọhụrụ, ma nhọpụta na-ewepụ ya n'ogwu ọdịdị nke a kọwapụtara.”
94
 
95
- → **Top English result:** “Mutation adds new genetic variation, and selection removes it from the pool of expressed variation.”
96
 
97
- Cosine similarity: **0.7079**
98
 
99
- **Igbo:** “Neuklọs ahụ bụ ahụ ihe abụọ mejupụtara ya - neutrọn na protọn.”
100
 
101
- → **Top English result:** “The nucleus consists of two particles - neutrons and protons.”
 
 
 
 
 
 
 
102
 
103
- Cosine similarity: **0.7049**
104
 
105
- **Igbo:** “Enwere ọtụtụ ihe mere ha ji kara web prọgzi mma: ha na-agbanwe ụzọ trafik ịntanetị niile, ọ bụghị naanị http.”
106
 
107
- → **Top English result:** “They are superior to web proxies for several reasons: They re-route all Internet traffic, not only http.”
108
 
109
- Cosine similarity: **0.6774**
 
 
 
 
110
 
111
- These are direct demonstrations of the intended behavior: the query is Igbo while the retrieved target is English.
112
 
113
- ## Installation
114
-
115
- ~~~bash
116
  pip install -U sentence-transformers torch
117
- ~~~
118
-
119
- ## Basic usage
120
 
121
- ~~~python
122
  from sentence_transformers import SentenceTransformer
123
 
124
  model = SentenceTransformer("Modularcomputing/Native-Bird")
125
 
126
  query = "Neuklọs ahụ bụ ahụ ihe abụọ mejupụtara ya - neutrọn na protọn."
127
-
128
  documents = [
129
  "The nucleus consists of two particles - neutrons and protons.",
130
  "The liver is an organ responsible for many metabolic functions.",
@@ -133,100 +144,49 @@ documents = [
133
 
134
  q = model.encode(query, normalize_embeddings=True)
135
  d = model.encode(documents, normalize_embeddings=True)
136
-
137
  scores = d @ q
138
 
139
  for i in scores.argsort()[::-1]:
140
- print(float(scores[i]), documents[i])
141
- ~~~
142
 
143
  The matching English sentence should rank first.
144
 
145
- ## Testing the model
146
-
147
- A minimal test is:
148
-
149
- 1. Load Native-Bird.
150
- 2. Encode an Igbo query.
151
- 3. Encode several English candidate documents.
152
- 4. Compute cosine similarity.
153
- 5. Sort candidates by similarity.
154
- 6. Check whether the semantically matching English document is ranked first.
155
-
156
- For a real search system, replace the small list with a vector database or FAISS index.
157
-
158
- ## Searching a real English document collection
159
 
160
- Do **not** embed a multi-page document as one vector. Split each document into passages, normally around 100–300 words with overlap, and store each passage embedding together with its parent document ID.
161
 
162
- At query time:
163
-
164
- 1. Encode the user's Igbo query with Native-Bird.
165
- 2. Search the English passage vectors using cosine similarity or an ANN index such as FAISS.
166
- 3. Return the highest-scoring passages.
167
- 4. Group or rerank passages by their parent document.
168
-
169
- Conceptually:
170
-
171
- ~~~text
172
- Igbo query
173
- ↓
174
- Native-Bird encoder
175
- ↓
176
- 768-dimensional query vector
177
- ↓ cosine similarity
178
  English passage index
179
- ↓
180
- Top-k English passages
181
- ↓
182
- Parent documents
183
- ~~~
184
-
185
- This is the architecture needed for the intended “describe it in Igbo, find the English document” product.
186
-
187
- ## Important limitation
188
-
189
- Native-Bird is an **embedding/retrieval model**, not a translator and not a generative language model. It does not generate an English answer. It represents text as vectors so that semantically related text can be found across languages.
190
-
191
- The current model uses a 128-token training sequence length and was evaluated on sentence-level retrieval. For long documents, chunking is therefore important.
192
-
193
- A production deployment should be evaluated on the actual target domain. Nigerian government documents, university material, medical documents, legal documents, and technical documentation can have vocabulary and writing styles that differ substantially from the current benchmark.
194
-
195
- ## Evaluation methodology
196
-
197
- The evaluation script embeds the 1,004-item English corpus, embeds each language's 204 queries, computes cosine similarities, and measures the rank of the known matching English sentence.
198
-
199
- Two query variants are evaluated:
200
-
201
- - **clean:** original native-language query
202
- - **ASR-style noise:** Unicode diacritics removed, lowercased, punctuation stripped, and whitespace normalized
203
-
204
- The benchmark is useful for measuring cross-lingual retrieval and robustness to transcription-style normalization, but should not be interpreted as a universal real-world retrieval score.
205
-
206
- ## Intended applications
207
-
208
- - Igbo → English semantic document search
209
- - Hausa → English semantic document search
210
- - Yoruba → English semantic document search
211
- - Multilingual educational search
212
- - Native-language interfaces for English knowledge bases
213
- - Cross-lingual RAG retrieval
214
- - Search over Nigerian institutional documents
215
-
216
- ## Training provenance
217
-
218
- Native-Bird was fine-tuned from LaBSE using paired native-language/English retrieval data prepared for this project. Training used 76,150 pairs and a contrastive retrieval objective.
219
 
220
- The final training run completed successfully for four epochs, saved the model, and produced the evaluation results reported above.
221
 
222
- ## Model status
223
 
224
- **Status: research / early release.**
 
 
 
225
 
226
- The core cross-lingual retrieval capability is demonstrated. The next meaningful validation step is a human-annotated benchmark of real Nigerian documents and real Igbo/Hausa/Yoruba information needs, especially for multi-paragraph documents.
227
 
228
- ## Citation
 
 
 
 
 
 
 
 
229
 
230
- If you use Native-Bird in research or a project, please reference the model as:
231
 
232
- **Native-Bird: Cross-lingual Native-Language Embeddings for English Document Retrieval.**
 
19
  base_model: sentence-transformers/LaBSE
20
  ---
21
 
22
+ <div align="center">
23
+ <img src="images/modular_logo.jpg" width="38%" alt="Modular" />
24
+ </div>
25
+ <hr>
26
+ <div align="center" style="line-height: 1;">
27
+ <a href="https://huggingface.co/Modularcomputing" target="_blank"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Modular-ffc107?color=ffc107&logoColor=white"/></a>
28
+ <a href="https://huggingface.co/Modularcomputing/Native-Bird2" target="_blank"><img alt="Native-Bird2" src="https://img.shields.io/badge/Multimodal-Native--Bird2-536af5?color=536af5&logoColor=white"/></a>
29
+ <a href="https://github.com/Dox45" target="_blank"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-Dox45-181717?logo=github&logoColor=white"/></a>
30
+ <br>
31
+ <img alt="Languages" src="https://img.shields.io/badge/Languages-Igbo%20%7C%20Hausa%20%7C%20Yoruba%20%7C%20English-1f6feb"/>
32
+ <img alt="Embedding dim" src="https://img.shields.io/badge/Embedding-768--d-2ea44f"/>
33
+ <img alt="Base" src="https://img.shields.io/badge/Base-LaBSE-6f42c1"/>
34
+ </div>
35
+
36
+ <p align="center">
37
+ <img src="images/native_bird_diagram.jpg" width="100%" alt="Native-Bird: an Igbo query and English documents in one shared semantic vector space" />
38
+ </p>
39
+
40
+ ## Table of Contents
41
+
42
+ 1. [Introduction](#1-introduction)
43
+ 2. [Model Summary](#2-model-summary)
44
+ 3. [Model Downloads](#3-model-downloads)
45
+ 4. [Evaluation Results](#4-evaluation-results)
46
+ 5. [Quick Start](#5-quick-start)
47
+ 6. [Searching Real Document Collections](#6-searching-real-document-collections)
48
+ 7. [Limitations](#7-limitations)
49
+ 8. [Citation](#8-citation)
50
+ 9. [Contact](#9-contact)
51
+
52
+ ## 1. Introduction
53
+
54
+ **Native-Bird** is a 768-dimensional multilingual sentence-embedding model fine-tuned from **LaBSE** for cross-lingual retrieval across **Igbo, Hausa, Yoruba and English**.
55
+
56
+ Its primary use case is **native-language query → English document retrieval**: a user describes what they are looking for in Igbo, Hausa or Yoruba, the indexed documents are written in English, and Native-Bird maps both into the same embedding space for semantic search.
57
 
58
  > **Igbo query:** “Neuklọs ahụ bụ ahụ ihe abụọ mejupụtara ya - neutrọn na protọn.”
59
  >
60
  > **English document:** “The nucleus consists of two particles - neutrons and protons.”
61
 
62
+ Native-Bird is the text backbone of [**Native-Bird2**](https://huggingface.co/Modularcomputing/Native-Bird2), which extends the same space to images.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ ## 2. Model Summary
 
 
 
 
 
 
 
65
 
66
+ **Architecture**
67
 
68
+ | | |
69
+ |---|---|
70
+ | Architecture | SentenceTransformer (LaBSE encoder → pooling → dense → normalize) |
71
+ | Base model | [`sentence-transformers/LaBSE`](https://huggingface.co/sentence-transformers/LaBSE) |
72
+ | Embedding dimension | 768 |
73
+ | Max sequence length (training) | 128 tokens |
74
+ | Similarity | Cosine |
75
+ | Languages | Igbo (`ig`), Hausa (`ha`), Yoruba (`yo`), English (`en`) |
76
 
77
+ **Training**
78
 
79
+ | | |
80
+ |---|---|
81
+ | Objective | Cached Multiple Negatives Ranking Loss (CachedMNRL) |
82
+ | Training pairs | 76,150 native-language ↔ English pairs |
83
+ | Epochs | 4 |
84
+ | Per-device batch size | 256 (CachedMNRL mini-batch 128) |
85
+ | Learning rate / schedule | 2e-5, cosine, 10% warmup |
86
+ | Negatives | In-batch, NO_DUPLICATES sampling |
87
+ | Precision | BF16 |
88
 
89
+ ## 3. Model Downloads
90
 
91
+ <div align="center">
92
 
93
+ | **Model** | **Modality** | **Embedding dim** | **Download** |
94
+ | :---: | :---: | :---: | :---: |
95
+ | Native-Bird | Text (ig / ha / yo / en) | 768 | [🤗 Hugging Face](https://huggingface.co/Modularcomputing/Native-Bird) |
96
+ | Native-Bird2 | Text + Image | 512 | [🤗 Hugging Face](https://huggingface.co/Modularcomputing/Native-Bird2) |
97
 
98
+ </div>
99
 
100
+ ## 4. Evaluation Results
101
 
102
+ Cross-lingual retrieval against an English corpus of **1,004 sentences**, with **204 queries per language**. Each query has one known matching English sentence. Two query variants are tested: **clean** (original text) and **ASR-style noise** (diacritics removed, lowercased, punctuation stripped, whitespace normalized).
103
 
104
+ <div align="center">
105
 
106
+ | **Language** | **Query** | **LaBSE R@1** | **Native-Bird R@1** | **LaBSE MRR** | **Native-Bird MRR** |
107
+ | :--- | :--- | :---: | :---: | :---: | :---: |
108
+ | Igbo | Clean | 1.0000 | **1.0000** | 1.0000 | **1.0000** |
109
+ | Igbo | ASR-style noise | 0.9853 | **1.0000** | 0.9888 | **1.0000** |
110
+ | Hausa | Clean | 1.0000 | **1.0000** | 1.0000 | **1.0000** |
111
+ | Hausa | ASR-style noise | 0.9951 | **1.0000** | 0.9975 | **1.0000** |
112
+ | Yoruba | Clean | 0.9804 | **0.9804** | 0.9871 | **0.9902** |
113
+ | Yoruba | ASR-style noise | 0.9559 | **0.9804** | 0.9683 | **0.9867** |
114
 
115
+ </div>
116
 
117
+ Native-Bird reaches R@10 = 1.0000 in every setting (LaBSE: 0.9951 on noisy Igbo and Yoruba). Fine-tuning mainly improves **robustness to transcription-style noise**, which matters for voice and keyboard input without diacritics.
118
 
119
+ **Direct Igbo → English retrieval examples**
120
 
121
+ | Igbo query | Top English result | Cosine |
122
+ | :--- | :--- | :---: |
123
+ | Mgbanwe n'ọdịdị na-agbakwunye ọdịdị kejenetiki ọhụrụ, ma nhọpụta na-ewepụ ya n'ogwu ọdịdị nke a kọwapụtara. | Mutation adds new genetic variation, and selection removes it from the pool of expressed variation. | 0.7079 |
124
+ | Neuklọs ahụ bụ ahụ ihe abụọ mejupụtara ya - neutrọn na protọn. | The nucleus consists of two particles - neutrons and protons. | 0.7049 |
125
+ | Enwere ọtụtụ ihe mere ha ji kara web prọgzi mma: ha na-agbanwe ụzọ trafik ịntanetị niile, ọ bụghị naanị http. | They are superior to web proxies for several reasons: They re-route all Internet traffic, not only http. | 0.6774 |
126
 
127
+ ## 5. Quick Start
128
 
129
+ ```bash
 
 
130
  pip install -U sentence-transformers torch
131
+ ```
 
 
132
 
133
+ ```python
134
  from sentence_transformers import SentenceTransformer
135
 
136
  model = SentenceTransformer("Modularcomputing/Native-Bird")
137
 
138
  query = "Neuklọs ahụ bụ ahụ ihe abụọ mejupụtara ya - neutrọn na protọn."
 
139
  documents = [
140
  "The nucleus consists of two particles - neutrons and protons.",
141
  "The liver is an organ responsible for many metabolic functions.",
 
144
 
145
  q = model.encode(query, normalize_embeddings=True)
146
  d = model.encode(documents, normalize_embeddings=True)
 
147
  scores = d @ q
148
 
149
  for i in scores.argsort()[::-1]:
150
+ print(f"{scores[i]:.4f} {documents[i]}")
151
+ ```
152
 
153
  The matching English sentence should rank first.
154
 
155
+ ## 6. Searching Real Document Collections
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
+ Do **not** embed a multi-page document as one vector. Split each document into passages of roughly 100–300 words with overlap, and store each passage embedding with its parent document ID.
158
 
159
+ ```text
160
+ Igbo / Hausa / Yoruba query
161
+ ↓ Native-Bird encoder
162
+ 768-d query vector
163
+ ↓ cosine similarity (FAISS / vector DB)
 
 
 
 
 
 
 
 
 
 
 
164
  English passage index
165
+ ↓
166
+ Top-k passages → grouped by parent document
167
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
+ **Intended applications:** native-language search over English knowledge bases, cross-lingual RAG retrieval, multilingual educational search, and search over Nigerian institutional documents.
170
 
171
+ ## 7. Limitations
172
 
173
+ - **Embedding model, not a translator or generator.** It represents text as vectors; it does not produce English answers.
174
+ - **Sentence-level evaluation.** Trained at 128 tokens and evaluated on sentences, so long documents need chunking. Scores do not guarantee the same accuracy on arbitrary long documents.
175
+ - **Domain shift.** Government, legal, medical and technical text can differ substantially from the benchmark; evaluate on your target domain before production use.
176
+ - **Status: research / early release.** The next validation step is a human-annotated benchmark of real Nigerian documents and real Igbo, Hausa and Yoruba information needs.
177
 
178
+ ## 8. Citation
179
 
180
+ ```bibtex
181
+ @misc{nativebird2026,
182
+ title = {Native-Bird: Cross-lingual Native-Language Embeddings for English Document Retrieval},
183
+ author = {Akuegbo, Chima Emmanuel},
184
+ year = {2026},
185
+ publisher = {Modular},
186
+ howpublished = {\url{https://huggingface.co/Modularcomputing/Native-Bird}}
187
+ }
188
+ ```
189
 
190
+ ## 9. Contact
191
 
192
+ Questions, issues or collaboration: open a discussion on the [Community tab](https://huggingface.co/Modularcomputing/Native-Bird/discussions).
images/modular_logo.jpg ADDED
images/native_bird_diagram.jpg ADDED

Git LFS Details

  • SHA256: 7b3be41466c6258d33ae157610b33f72d33b988f8e50e44cd802f507e72ba62b
  • Pointer size: 131 Bytes
  • Size of remote file: 650 kB