Downloads · 30 days
293
12% of all-time downloads
ele-sage/distilbert-base-uncased-name-splitter
distilbert-base-uncased-name-splitter is a machine learning model from ele-sage. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This is a token classification model fine-tuned from distilbert-base-uncased to parse and split full human names into their first name and last name components.
Downloads · 30 days
293
12% of all-time downloads
All-time downloads
2.4K
Public
Parameters
66.4M
265 MB on disk
Likes
5
Public
Click a slice to open those files.
.safetensors265 MB · 100%
From the Hugging Face model README
This is a token classification model fine-tuned from distilbert-base-uncased to parse and split full human names into their first name and last name components.
The model is trained to recognize multi-word first names (e.g., "Mary Anne") and multi-word last names (e.g., "van der Sar"). It is also robust to the order of names, having been trained on three formats:
FirstName LastNameLastName, FirstNameLastName FirstNameIt identifies tokens with the following labels: B-FNAME (Beginning of a First Name), I-FNAME (Inside a First Name), B-LNAME (Beginning of a Last Name), I-LNAME (Inside a Last Name), and O (Outside, for tokens like commas).
distilbert-for-token-classificationdistilbert/distilbert-base-uncasedThis model is intended to be used for Named Entity Recognition (NER), specifically for parsing full name strings into structured FirstName and LastName components. It can be used directly with the ner (or token-classification) pipeline in the 🤗 Transformers library.
from transformers import pipeline
# Use the 'ner' pipeline with an aggregation strategy to automatically group B-I tags
name_parser = pipeline("ner", model="ele-sage/distilbert-base-uncased-name-splitter", aggregation_strategy="simple")
# Example 1: Standard Order
name_parser("Alonso Sarmiento Martinez")
# Expected Output:
# [{'entity_group': 'FNAME', 'score': ..., 'word': 'Alonso'},
# {'entity_group': 'LNAME', 'score': ..., 'word': 'Sarmiento Martinez'}]
# Example 2: Swapped Order with Comma
name_parser("Wolf, Michel Konstantin")
# Expected Output:
# [{'entity_group': 'LNAME', 'score': ..., 'word': 'Wolf'},
# {'entity_group': 'FNAME', 'score': ..., 'word': 'Michel Konstantin'}]
This model is highly specialized. It should not be used for:
ele-sage/distilbert-base-uncased-name-classifier model should be used first.Use the code below to get started with the model.
from transformers import pipeline
# Load the pipeline
# aggregation_strategy="simple" is recommended to automatically group multi-word names
name_parser = pipeline(
"ner",
model="ele-sage/distilbert-base-uncased-name-splitter",
aggregation_strategy="simple"
)
# --- Examples ---
names = [
"Michel Konstantin Wolf",
"Bunting Roon, Doralie",
"Sarmiento Martinez Alonso" # Ambiguous case without comma
]
for name in names:
parsed_name = name_parser(name)
print(f"Input: '{name}'")
print(f" -> Parsed: {parsed_name}\n")
The model was trained on a custom-curated dataset derived from two primary sources:
The dataset was curated and processed through a multi-stage pipeline before training:
AI-Powered Cleaning: The raw person name CSV (3.4M rows) was first processed by the ele-sage/distilbert-base-uncased-name-classifier model. Any entry that the classifier identified as a "Company" or had low confidence of being a "Person" was discarded. This step removed a significant amount of non-name noise (e.g., "The Bahais of Prince George", "Saskatchewan Intl Freight").
Rule-Based Filtering: The AI-cleaned data was further filtered to:
Data Augmentation: The final, cleaned dataset was augmented to create three different name formats to improve robustness:
FirstName LastName order.LastName, FirstName format, with a comma token tagged as O.LastName FirstName format (without a comma).The final dataset was then shuffled to ensure all formats were present in each training batch.
Trainerbf16 mixed precisionper_device_train_batch_size)2e-51000 stepsThe model's performance is evaluated using standard token classification metrics, with F1-Score being the primary metric. F1 is chosen over Accuracy because it provides a balanced measure of Precision and Recall, which is crucial for imbalanced NER tasks where the "haystack" of non-entity tokens is much larger than the "needles" (the name tokens).
The final model was selected based on the highest F1-score achieved on the validation set during training.
| Metric | Value |
|---|---|
| eval_f1 | 0.957 |
| eval_precision | 0.957 |
| eval_recall | 0.957 |
| eval_accuracy | 0.962 |
| eval_loss | 0.106 |
This result was achieved at Step 20,000 of the training run, after which performance on the validation set began to plateau.