--- language: - en - es - fr - de - it - pt - sv - nl - pl - ru - bn - hi - fa - zh - uk license: mit tags: - ner - named-entity-recognition - token-classification - universal-ner - unified-ner - mdeberta-v3 - mdeberta - deberta - lora - multilingual - fine-grained-ner - cross-lingual - information-extraction - nlp - sequence-labeling - bio-tagging - entity-extraction - text-mining - deep-learning - transformer - wikiann - multinerd - multiconer - multiconer-2023 base_model: microsoft/mdeberta-v3-base library_name: transformers datasets: - unimelb-nlp/wikiann - MultiCoNER/multiconer_v2 - Babelscape/multinerd pipeline_tag: token-classification widget: - text: "Barack Obama visited the United Nations headquarters in New York City." example_title: "English Example" - text: "Albert Einstein entwickelte die Relativitätstheorie in Bern und Zürich." example_title: "German Example" - text: "Emmanuel Macron est le président de la République française à Paris." example_title: "French Example" - text: "El delantero Lionel Messi marcó tres goles en el estadio Camp Nou de Barcelona." example_title: "Spanish Example" - text: "Юрий Гагарин совершил первый космический полёт на корабле Восток-1." example_title: "Russian Example" - text: "जी-20 शिखर सम्मेलन का आयोजन नई दिल्ली के भारत मंडपम में किया गया।" example_title: "Hindi Example" --- # Unified Multilingual NER (mDeBERTa-v3-base) This model is a fine-grained **Multilingual Named Entity Recognition (NER)** model fine-tuned on **1.53+ million sentences** across three major benchmark suites: * [**WikiANN**](https://huggingface.co/datasets/unimelb-nlp/wikiann) * [**MultiCoNER 2023 (v2)**](https://huggingface.co/datasets/MultiCoNER/multiconer_v2) * [**MultiNERD**](https://huggingface.co/datasets/Babelscape/multinerd) Built on top of [`microsoft/mdeberta-v3-base`](https://huggingface.co/microsoft/mdeberta-v3-base), it supports **47 fine-grained entity categories** (95 BIO logit tags) across **12+ languages**. Developed by [**Rishabh Kumar**](https://www.linkedin.com/in/rishabh-kumar-922072195/). --- ## 1. Model Description & Architecture - **Base Model**: [`microsoft/mdeberta-v3-base`](https://huggingface.co/microsoft/mdeberta-v3-base) (278M parameters, 12 Transformer layers, 768 hidden size, 250k vocabulary) - **Fine-Tuning Method**: LoRA (Low-Rank Adaptation, r=64, α=64, target modules: `query_proj`, `key_proj`, `value_proj`, `intermediate.dense`, `output.dense`) merged into standalone base weights. - **Precision**: FP16 (`torch.float16`, ~530 MB footprint) - **Task**: Multilingual Token Classification / Named Entity Recognition - **Languages Supported (15)**: English (`en`), Spanish (`es`), French (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), Swedish (`sv`), Dutch (`nl`), Polish (`pl`), Russian (`ru`), Farsi (`fa`), Bengali (`bn`), Hindi (`hi`), Ukrainian (`uk`), Chinese (`zh`), and multilingual mixed text. --- ## 2. Dataset Links & Entity Taxonomy The model combines the taxonomy of **three major Hugging Face NER datasets** into a single unified classification head (47 × 2 + 1 = **95 BIO output logits**): ### A. [WikiANN](https://huggingface.co/datasets/unimelb-nlp/wikiann) (3 Core Broad Categories) * **Languages Included (7)**: German (`de`), English (`en`), Spanish (`es`), French (`fr`), Italian (`it`), Portuguese (`pt`), Swedish (`sv`) * **Entity Classes**: `PER` (Person), `LOC` (Location), `ORG` (Organization) ### B. [MultiNERD](https://huggingface.co/datasets/Babelscape/multinerd) (15 Multi-Domain Categories) * **Languages Included (10)**: German (`de`), English (`en`), Spanish (`es`), French (`fr`), Italian (`it`), Dutch (`nl`), Polish (`pl`), Portuguese (`pt`), Russian (`ru`), Chinese (`zh`) * **Standard**: `PER`, `LOC`, `ORG`, `TIME` * **Specialized Domains**: * `ANIM` (Animal species, breeds, fauna) * `PLANT` (Plants, trees, botanical species, fungi) * `FOOD` (Food, dishes, beverages, culinary items) * `DIS` (Diseases, disorders, medical conditions) * `CEL` (Celestial bodies, stars, planets, galaxies) * `EVE` (Historical, sports, cultural events) * `INST` (Public institutions, international bodies) * `MEDIA` (Newspapers, networks, press outlets) * `MYTH` (Mythological entities, deities, folklore) * `VEHI` (Vehicles, ships, aircraft, spacecraft) * `BIO` (Biological compounds, genes, proteins) ### C. [MultiCoNER 2023 (v2)](https://huggingface.co/datasets/MultiCoNER/multiconer_v2) (33 Fine-Grained Categories) * **Languages Included (13)**: Bangla (`BN`), German (`DE`), English (`EN`), Spanish (`ES`), Farsi (`FA`), French (`FR`), Hindi (`HI`), Italian (`IT`), Portuguese (`PT`), Swedish (`SV`), Ukrainian (`UK`), Chinese (`ZH`), and Multilingual Mixed (`MULTI`) * **Person Subtypes**: `Artist`, `Athlete`, `Cleric`, `Politician`, `Scientist`, `SportsManager`, `OtherPER` * **Organization Subtypes**: `AerospaceManufacturer`, `CarManufacturer`, `MusicalGRP`, `PrivateCorp`, `PublicCorp`, `SportsGRP` * **Location Subtypes**: `Facility`, `HumanSettlement`, `Station`, `OtherLOC` * **Products & Creative Works**: `ArtWork`, `MusicalWork`, `VisualWork`, `WrittenWork`, `Software`, `Clothing`, `Drink`, `Food`, `OtherPROD` * **Medical & Healthcare**: `AnatomicalStructure`, `Disease`, `MedicalProcedure`, `Medication/Vaccine`, `Symptom` ### D. Complete Unified 47 Entity Category List ```text 1. ANIM 13. Disease 25. Medication/Vaccine 37. Scientist 2. AerospaceManufacturer 14. Drink 26. MusicalGRP 38. Software 3. AnatomicalStructure 15. EVE 27. MusicalWork 39. SportsGRP 4. ArtWork 16. FOOD 28. ORG 40. SportsManager 5. Artist 17. Facility 29. OtherLOC 41. Station 6. Athlete 18. Food 30. OtherPER 42. Symptom 7. BIO 19. HumanSettlement 31. OtherPROD 43. TIME 8. CEL 20. INST 32. PER 44. VEHI 9. CarManufacturer 21. Cleric 33. PLANT 45. Vehicle 10. Cleric 22. MEDIA 34. Politician 46. VisualWork 11. Clothing 23. MYTH 35. PrivateCorp 47. WrittenWork 12. DIS 24. MedicalProcedure 36. PublicCorp ``` --- ## 3. Training Results & Metrics The model was fine-tuned for **5 epochs** (~28.3 hours across 1.53M training sentences) using AdamW (`lr=2e-5`, linear scheduler, effective batch size 16). ### Final Validation Evaluation (Epoch 5 / 5) | Metric | Score | | :--- | :---: | | **Validation Entity F1** | **0.7693** | | **Validation Precision** | **0.8449** | | **Validation Recall** | **0.7061** | | **Validation Accuracy** | **0.9587** | | **Validation Loss** | **0.0276** | ### Per-Epoch Progression * **Epoch 1**: F1 = 0.7183 | Precision = 0.8016 | Recall = 0.6506 | Loss = 0.0372 * **Epoch 2**: F1 = 0.7322 | Precision = 0.8151 | Recall = 0.6645 | Loss = 0.0317 * **Epoch 3**: F1 = 0.7544 | Precision = 0.8346 | Recall = 0.6883 | Loss = 0.0293 * **Epoch 4**: F1 = 0.7669 | Precision = 0.8460 | Recall = 0.7013 | Loss = 0.0281 * **Epoch 5**: F1 = 0.7693 | Precision = 0.8449 | Recall = 0.7061 | Loss = 0.0276 --- ### Overall Language Benchmarks (15 Languages, Sample-Weighted Aggregate) To evaluate cross-lingual generalization across diverse datasets, the table below aggregates performance per language weighted by sentence support across all test splits: | Language | Total Test Sentences | Precision | Recall | **Entity-Span F1** | Token Accuracy | Source Benchmarks Included | | :--- | :---: | :---: | :---: | :---: | :---: | :--- | | 🇷🇺 **Russian (RU)** | 8,338 | 82.11% | 71.70% | **`76.56%`** | 96.31% | MultiNERD | | 🇳🇱 **Dutch (NL)** | 17,181 | 83.13% | 66.41% | **`73.84%`** | 96.47% | MultiNERD | | 🇵🇱 **Polish (PL)** | 19,555 | 80.46% | 63.69% | **`71.10%`** | 95.10% | MultiNERD | | 🇩🇪 **German (DE)** | 45,907 | 70.64% | 67.17% | **`68.72%`** | 93.13% | WikiANN + MultiNERD + MultiCoNER 2023 | | 🇮🇹 **Italian (IT)** | 276,098 | 66.20% | 65.93% | **`66.00%`** | 92.20% | WikiANN + MultiNERD + MultiCoNER 2023 | | 🇸🇪 **Swedish (SV)** | 241,190 | 64.97% | 63.46% | **`64.21%`** | 91.68% | WikiANN + MultiCoNER 2023 | | 🇫🇷 **French (FR)** | 277,481 | 61.47% | 60.23% | **`60.83%`** | 91.01% | WikiANN + MultiNERD + MultiCoNER 2023 | | 🇺🇦 **Ukrainian (UK)** | 238,296 | 61.23% | 59.94% | **`60.58%`** | 92.32% | MultiCoNER 2023 | | 🇪🇸 **Spanish (ES)** | 274,299 | 60.23% | 60.98% | **`60.55%`** | 91.86% | WikiANN + MultiNERD + MultiCoNER 2023 | | 🇵🇹 **Portuguese (PT)** | 257,305 | 60.23% | 59.93% | **`60.02%`** | 91.59% | WikiANN + MultiNERD + MultiCoNER 2023 | | 🇬🇧 **English (EN)** | 276,434 | 58.13% | 59.35% | **`58.72%`** | 90.70% | WikiANN + MultiNERD + MultiCoNER 2023 | | 🇮🇳 **Hindi (HI)** | 18,399 | 53.08% | 55.75% | **`54.38%`** | 93.12% | MultiCoNER 2023 | | 🇧🇩 **Bangla (BN)** | 19,859 | 50.29% | 52.75% | **`51.49%`** | 90.79% | MultiCoNER 2023 | | 🇮🇷 **Farsi (FA)** | 219,168 | 52.86% | 46.06% | **`49.23%`** | 90.72% | MultiCoNER 2023 | | 🇨🇳 **Chinese (ZH)** | 39,842 | 36.69% | 36.51% | **`36.11%`** | 84.05% | MultiNERD + MultiCoNER 2023 | > **Note on Evaluated Splits & Benchmarks:** > * **3-Benchmark Languages (DE, EN, ES, FR, IT, PT)** appear in all three datasets (WikiANN + MultiNERD + MultiCoNER 2023). Their scores represent joint generalizability across coarse Wikipedia text, domain-specific corpora, and noisy query contexts. > * **2-Benchmark Languages (SV, ZH)** appear across two datasets (SV: WikiANN + MultiCoNER; ZH: MultiNERD + MultiCoNER). > * **1-Benchmark Languages (RU, NL, PL, UK, HI, BN, FA)** are evaluated on their respective source benchmark splits (RU, NL, PL from MultiNERD; UK, HI, BN, FA from MultiCoNER 2023). --- ### Dataset-Specific Test Benchmarks (32-Suite) Evaluation across **WikiANN**, **MultiNERD** (10 languages + full), and **MultiCoNER 2023** (13 languages + full): | Dataset | Subset / Lang | Sentences | Precision | Recall | **F1 Score** | Accuracy | | :--- | :--- | :---: | :---: | :---: | :---: | :---: | | **`combined`** | **`combined`** | **536,661** | **0.6639** | **0.6298** | **`0.6464`** | **0.9313** | | **`multinerd`** | 🔹 **`multinerd_full`** | **167,993** | **0.8906** | **0.7298** | **`0.8022`** | **0.9646** | | `multinerd` | 🇬🇧 `EN-English` | 16,454 | 0.9097 | 0.8103 | **`0.8571`** | 0.9771 | | `multinerd` | 🇩🇪 `DE-German` | 15,762 | 0.9025 | 0.7874 | **`0.8410`** | 0.9761 | | `multinerd` | 🇷🇺 `RU-Russian` | 8,338 | 0.8211 | 0.7170 | **`0.7656`** | 0.9631 | | `multinerd` | 🇳🇱 `NL-Dutch` | 17,181 | 0.8313 | 0.6641 | **`0.7384`** | 0.9647 | | `multinerd` | 🇫🇷 `FR-French` | 17,695 | 0.7738 | 0.6725 | **`0.7196`** | 0.9668 | | `multinerd` | 🇵🇱 `PL-Polish` | 19,555 | 0.8046 | 0.6369 | **`0.7110`** | 0.9510 | | `multinerd` | 🇪🇸 `ES-Spanish` | 17,399 | 0.7893 | 0.6374 | **`0.7053`** | 0.9653 | | `multinerd` | 🇵🇹 `PT-Portuguese` | 17,815 | 0.7471 | 0.6083 | **`0.6706`** | 0.9585 | | `multinerd` | 🇮🇹 `IT-Italian` | 18,217 | 0.7424 | 0.5844 | **`0.6540`** | 0.9619 | | `multinerd` | 🇨🇳 `ZH-Chinese` | 19,577 | 0.3193 | 0.2353 | **`0.2709`** | 0.8184 | | **`wikiann`** | 🔹 **`wikiann_full`** | **70,000** | **0.6214** | **0.6199** | **`0.6202`** | **0.8099** | | `wikiann` | `sv` (Swedish) | 10,000 | 0.7174 | 0.6662 | **`0.6909`** | 0.8843 | | `wikiann` | `de` (German) | 10,000 | 0.6874 | 0.6352 | **`0.6603`** | 0.8938 | | `wikiann` | `it` (Italian) | 10,000 | 0.6506 | 0.6459 | **`0.6482`** | 0.8362 | | `wikiann` | `es` (Spanish) | 10,000 | 0.6076 | 0.6560 | **`0.6309`** | 0.7726 | | `wikiann` | `fr` (French) | 10,000 | 0.6017 | 0.6080 | **`0.6049`** | 0.7581 | | `wikiann` | `pt` (Portuguese) | 10,000 | 0.5613 | 0.5976 | **`0.5789`** | 0.7517 | | `wikiann` | `en` (English) | 10,000 | 0.5238 | 0.5304 | **`0.5271`** | 0.7729 | | **`multiconer2023`** | 🔹 **`multiconer2023_full`** | **1,991,359** | **0.5957** | **0.5923** | **`0.5937`** | **0.9160** | | `multiconer2023` | `IT-Italian` | 247,881 | 0.6566 | 0.6654 | **`0.6609`** | 0.9225 | | `multiconer2023` | `SV-Swedish` | 231,190 | 0.6468 | 0.6332 | **`0.6400`** | 0.9182 | | `multiconer2023` | `UK-Ukrainian` | 238,296 | 0.6123 | 0.5994 | **`0.6058`** | 0.9232 | | `multiconer2023` | `FR-French` | 249,786 | 0.6039 | 0.5971 | **`0.6005`** | 0.9122 | | `multiconer2023` | `ES-Spanish` | 246,900 | 0.5889 | 0.6060 | **`0.5974`** | 0.9212 | | `multiconer2023` | `PT-Portuguese` | 229,490 | 0.5928 | 0.5987 | **`0.5957`** | 0.9197 | | `multiconer2023` | `MULTI-Multilingual` | 358,668 | 0.5787 | 0.5840 | **`0.5813`** | 0.9118 | | `multiconer2023` | `DE-German` | 20,145 | 0.5625 | 0.5993 | **`0.5803`** | 0.9148 | | `multiconer2023` | `EN-English` | 249,980 | 0.5620 | 0.5818 | **`0.5718`** | 0.9078 | | `multiconer2023` | `HI-Hindi` | 18,399 | 0.5308 | 0.5575 | **`0.5438`** | 0.9312 | | `multiconer2023` | `BN-Bangla` | 19,859 | 0.5029 | 0.5275 | **`0.5149`** | 0.9079 | | `multiconer2023` | `FA-Farsi` | 219,168 | 0.5286 | 0.4606 | **`0.4923`** | 0.9072 | | `multiconer2023` | `ZH-Chinese` | 20,265 | 0.4129 | 0.4904 | **`0.4483`** | 0.8619 | --- ## 4. Inference Mechanism & Softmax Logit Decoding (95 Logit Classes) During inference, for any input text, our fine-tuned model (`microsoft/mdeberta-v3-base` with merged LoRA parameters) passes subword token representations through its 12 Transformer layers to output a **95-dimensional logit vector** per token. PyTorch applies a **softmax function** across all 95 output tags to compute normalized probability confidence scores: ``` P(tag_k | token_i) = exp(z_k) / Σ exp(z_j) for k ∈ {1, 2, ..., 95} ``` - **Hard Argmax (Default Token Classification)**: Selects the single highest-probability tag (argmax). - **Soft Confidence Distribution**: For ambiguous entity tokens (e.g. *"Harvard"*), the model distributes probability across related candidate classes (`B-INST`: **72.4%**, `B-ORG`: **21.1%**, `B-Facility`: **5.3%**), capturing semantic cross-taxonomy relationships. --- ## 5. Intended Use & Out-of-Scope Use ### Intended Use - **Information extraction** from multilingual text (news articles, Wikipedia, social media, web content) - **Downstream NLP pipelines** requiring structured entity extraction across multiple languages - **Research** in cross-lingual transfer learning, fine-grained NER, and multilingual NLP - **Knowledge graph construction** from unstructured multilingual text ### Out-of-Scope Use - **Domain-specific NER** (e.g., legal, financial, or clinical NER) — may require additional fine-tuning on domain data - **Languages not listed** in the supported 15-language set — the model was not trained on those languages --- ## 6. How to Use ### Quick Inference via Hugging Face Pipeline ```python from transformers import pipeline ner_pipeline = pipeline( "token-classification", model="Rishabh157/unified-multilingual-ner-mdeberta", aggregation_strategy="simple" ) text = "Barack Obama visited the United Nations headquarters in New York City." entities = ner_pipeline(text) for entity in entities: print(f"{entity['word']:<25} | {entity['entity_group']:<15} | Score: {entity['score']:.4f}") ``` ### PyTorch & Transformers Direct Usage ```python import torch from transformers import AutoTokenizer, AutoModelForTokenClassification model_name = "Rishabh157/unified-multilingual-ner-mdeberta" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForTokenClassification.from_pretrained(model_name) text = "Emmanuel Macron est le président de la République française à Paris." inputs = tokenizer(text, return_tensors="pt") with torch.no_grad(): outputs = model(**inputs) predictions = torch.argmax(outputs.logits, dim=2) tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0]) labels = [model.config.id2label[p.item()] for p in predictions[0]] for token, label in zip(tokens, labels): if label != "O": print(f"{token:<20} -> {label}") ``` --- ## 7. Known Considerations & Future Improvements - **European Languages Lead Performance**: The model achieves highest F1 scores on European languages (English, German, Dutch, Russian — F1 `0.76`–`0.86` on MultiNERD) due to richer training data availability. - **East Asian & South Asian Languages**: Chinese (`ZH`), Farsi (`FA`), Bangla (`BN`), and Hindi (`HI`) show room for improvement and can benefit from additional fine-tuning on language-specific corpora. - **Unified Taxonomy Design**: The model unifies 47 entity types from three separate datasets into a single classification head. Some categories across datasets are semantically related (e.g., `Food` from MultiCoNER and `FOOD` from MultiNERD) and are treated as distinct classes to preserve dataset fidelity. - **Continual Improvement**: Performance on lower-resource languages can be improved by fine-tuning further on domain-specific or language-specific NER datasets. --- ## 8. Citation If you use this model, dataset pipeline, or findings in your research, please cite: ```bibtex @misc{kumar2026multilingualner, author = {Rishabh Kumar}, title = {Unified Fine-Grained Multilingual NER with mDeBERTa-v3}, year = {2026}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/Rishabh157/unified-multilingual-ner-mdeberta}} } ```