NameBERT: Scaling Name-Based Nationality Classification with LLM-Augmented Open Academic Data
Organizations: Northeastern University, United States
Abstract
Inferring nationality from personal names is a critical capability for equity and bias monitoring, personalization, and a valuable tool in biomedical and sociological research. However, existing name-based nationality classifiers are typically trained on relatively small or source-specific labeled datasets, which can introduce coverage gaps and limit performance for underrepresented countries. While large language models (LLMs) demonstrate strong zero-shot performance for name-based nationality prediction, their computational cost and latency make them impractical for real-time, large-scale deployment. In this work, we created a large-scale name-nationality dataset from the Open Academic Graph (OAG) and introduce a framework that leverages LLMs as dataset enrichers rather than inference engines. We augment low-resource countries with LLM-generated names and evaluate on real and synthetic-tail test sets. We find that augmentation produces large gains when evaluation includes synthetic tail names and still offers a modest lift on tail-country metrics otherwise. Overall, NameBERT models achieve significantly higher accuracy than state-of-the-art baselines across both in- and out-of-domain tasks, while remaining efficient for large-scale inference compared to LLMs.
Figures & tables
| Model | Class | Accuracy | Weighted-F1 | Macro-F1 |
| LLM (GPT-4o) | 99 | |||
| LLM (Claude-3.5) | 99 | |||
| LLM (GPT-5) | 99 | 0.586 | 0.574 | 0.521 |
| LLM (GPT-5) | 39 | |||
| LLM (GPT-5) | 12 |
| Model | Classes | Accuracy | Weighted-F1 | Macro-F1 |
| EthnicSeer | 12 | 0.677 | 0.670 | 0.548 |
| NameBERT oag | 12 | 0.808 | 0.820 | 0.741 |
| NameBERT aug | 12 | 0.806 | 0.819 | 0.742 |
| NamePrism | 39 | 0.589 | 0.603 | 0.383 |
| NameBERT oag | 39 | 0.787 | 0.785 | 0.604 |
| NameBERT aug | 39 | 0.788 | 0.785 | 0.607 |
| test_filter | test_filter_aug | ||||||
| Model | Classes | Acc | W-F1 | M-F1 | Acc | W-F1 | M-F1 |
| EthnicSeer | 12 | 0.648 | 0.647 | 0.568 | 0.709 | 0.709 | 0.589 |
| NameBERT oag | 12 | 0.824 | 0.840 | 0.796 | 0.735 | 0.772 | 0.746 |
| NameBERT aug | 12 | 0.821 | 0.839 | 0.796 | 0.849 | 0.873 | 0.820 |
| NamePrism | 39 | 0.590 | 0.590 | 0.491 | 0.483 | 0.484 | 0.487 |
| NameBERT oag | 39 | 0.802 | 0.800 | 0.712 | 0.698 | 0.685 | 0.633 |
| Split | Model | Acc | M-F1 | Head Acc | Head M-F1 | Tail Acc | Tail M-F1 |
| test_filter | NameBERT oag | 0.651 | 0.416 | 0.699 | 0.336 | 0.482 | 0.199 |
| test_filter | NameBERT aug | 0.653 | 0.442 | 0.695 | 0.308 | 0.505 | 0.232 |
| test_filter_aug | NameBERT oag | 0.467 | 0.350 | 0.699 | 0.336 | 0.282 | 0.158 |
| test_filter_aug | NameBERT aug | 0.742 | 0.570 | 0.705 | 0.312 | 0.773 | 0.345 |
| 12 Classes | 39 Classes | 99 Classes | |||||||
| Model | Acc | W-F1 | M-F1 | Acc | W-F1 | M-F1 | Acc | W-F1 | M-F1 |
| EthnicSeer | 0.748 | 0.760 | 0.622 | – | – | – | – | – | – |
| NamePrism | – | – | – | 0.609 | 0.647 | 0.113 | – | – | – |
| Name2Nat | – | – | – | – | – | – | 0.958 ∗ | 0.971 ∗ | 0.582 ∗ |
| NameBERT oag | 0.807 | 0.831 | 0.734 | 0.783 | 0.792 | 0.503 | 0.552 | 0.540 | 0.338 |
| NameBERT aug | 0.799 | 0.826 | 0.730 | 0.777 | 0.789 | 0.465 | 0.544 | 0.539 | 0.300 |
| Model | Acc | M-F1 | Head Acc | Head M-F1 | Tail Acc | Tail M-F1 |
| NameBERT oag | 0.552 | 0.338 | 0.570 | 0.210 | 0.414 | 0.166 |
| NameBERT aug | 0.544 | 0.300 | 0.559 | 0.177 | 0.429 | 0.167 |
| 12 Classes | 39 Classes | 99 Classes | |||||||
| Model | Acc | W-F1 | M-F1 | Acc | W-F1 | M-F1 | Acc | W-F1 | M-F1 |
| EthnicSeer | 0.763 | 0.778 | 0.628 | – | – | – | – | – | – |
| NamePrism | – | – | – | 0.680 | 0.670 | 0.617 | – | – | – |
| Name2Nat | – | – | – | – | – | – | 0.238 | 0.186 | 0.177 |
| NameBERT oag | 0.785 | 0.812 | 0.722 | 0.722 | 0.712 | 0.641 | 0.402 | 0.352 | 0.352 |
| Model | Type | Batch | Throughput (names/s) | Latency (ms/name) | $/1M names |
| Sonnet 4.5 | LLM API | 1,000 | 4.3 | 234.6 | 282 |
| Gemini 3 | LLM API | 1,000 | 4.8 | 208.7 | 824 |
| GPT-5 | LLM API | 1,000 | 3.7 | 268.4 | 469 |
| NameBERT | Local GPU | 1,000 | 1,831 | 0.5 |