CoolFace
Modelpublic

kalyan-ks/ettin-32m-nemotron-pii

sourceHugging Facemitupdated 4mo agoView on Hugging Face
1likes163downloads
Model Card

ettin-32m-nemotron-pii model

Light Weight PII Detection Model | Open Source | 32M Parameters | 95.73 F1 Score | Blog Post

Overview

Ettin-32m-nemotron-pii is based on the ettin-encoder-32M model and fine-tuned over the Nemotron PII dataset. This model can detect 50+ PII entities in both structured and unstructured texts across various domains like healthcare, finance, legal, cybersecurity etc. With just 32M parameters, the model achieves a strong F1-score of 95.73.

Key Features

  • —Achieves strong F1-score of 95.73 with just 32M parameters.
  • —Outperforms popular LLMs like DeepSeek-V4-Flash (84.89) and GPT-4o-Mini (78.69).
  • —Detects 50+ PII entities in both structured and unstructured texts.
  • —Handles text in various domains like healthcare, finance, legal etc.

Supported PII Entity Types

This model can detect the following 55 PII entity types

<details> <summary> PII entity types with description </summary>

EntityDescription
account_numberAccount Number
ageAge
api_keyAPI Key
bankroutingnumberBank Routing Number
biometric_identifierBiometric Identifier
blood_typeBlood Type
certificatelicensenumberCertificate or License Number
cityCity
company_nameCompany Name
coordinateGeographic Coordinate
countryCountry
countyCounty
creditdebitcardCredit or Debit Card Number
customer_idCustomer ID
cvvCard Verification Value (CVV)
dateDate
dateofbirthDate of Birth
date_timeDate and Time
device_identifierDevice Identifier
education_levelEducation Level
emailEmail Address
employee_idEmployee ID
employment_statusEmployment Status
fax_numberFax Number
first_nameFirst Name
genderGender
healthplanbeneficiary_numberHealth Plan Beneficiary Number
http_cookieHTTP Cookie
ipv4IPv4 Address
ipv6IPv6 Address
languageLanguage
last_nameLast Name
license_plateVehicle License Plate
mac_addressMAC Address
medicalrecordnumberMedical Record Number
national_idNational Identification Number
occupationOccupation
passwordPassword
phone_numberPhone Number
pinPersonal Identification Number (PIN)
political_viewPolitical View
postcodePostcode / Zip Code
race_ethnicityRace or Ethnicity
religious_beliefReligious Belief
sexualitySexuality / Sexual Orientation
ssnSocial Security Number
stateState
street_addressStreet Address
swift_bicSWIFT / BIC Code
tax_idTax Identification Number
timeTime
unique_idUnique Identifier
urlURL / Web Address
user_nameUsername
vehicle_identifierVehicle Identification Number (VIN)

</details>

Usage

python

# First install Hugging Face transformers library
!pip install transformers

# Initialize and run the PII detection pipeline to extract PII entities
from transformers import pipeline

## Initialize the PII detection pipeline
ner = pipeline("ner", model="kalyan-ks/ettin-32m-nemotron-pii", aggregation_strategy="simple")

input_text = "Kalyan KS is from India. His email id is kalyan.ks@yahoo.com"

## Run the PII detection to extract PII entities
pii_entities = ner(input_text)

## Process the extracted PII entities 
def format_pii_entities(entities, original_text):
    if not entities:
        return []

    merged_entities = []

    entities = sorted(entities, key=lambda x: x['start'])

    current_entity = {
        'start': entities[0]['start'],
        'end': entities[0]['end'],
        'label': entities[0]['entity_group'],
        'text': entities[0]['word']
    }

    for next_ent in entities[1:]:
        is_same_label = next_ent['entity_group'] == current_entity['label']
        is_adjacent = next_ent['start'] <= current_entity['end'] + 1

        if is_same_label and is_adjacent:
            current_entity['end'] = max(current_entity['end'], next_ent['end'])
            current_entity['text'] = original_text[current_entity['start']:current_entity['end']]
        else:
            merged_entities.append(clean_entity(current_entity))
            current_entity = {
                'start': next_ent['start'],
                'end': next_ent['end'],
                'label': next_ent['entity_group'],
                'text': next_ent['word']
            }

    merged_entities.append(clean_entity(current_entity))
    return merged_entities

def clean_entity(ent):

    raw_text = ent['text']
    stripped_text = raw_text.strip()
    leading_spaces = len(raw_text) - len(raw_text.lstrip())

    return {
        'start': ent['start'] + leading_spaces,
        'end': ent['start'] + leading_spaces + len(stripped_text),
        'text': stripped_text,
        'label': ent['label']
    }

# Display the extracted PII entities
formatted_entities = format_pii_entities(pii_entities, input_text)
print(formatted_entities)

# Output
[{'start': 0, 'end': 9, 'text': 'Kalyan KS', 'label': 'first_name'}, {'start': 18, 'end': 23, 'text': 'India', 'label': 'country'}, {'start': 41, 'end': 60, 'text': 'kalyan.ks@yahoo.com', 'label': 'email'}]

Evaluation

This model is evaluated on a 10k sample test set from Neomotron PII dataset and achieved the following results

MetricScore
F195.73
Precision95.96
Recall95.49
Accuracy99.17

Top Performing PII Entity Types

EntityPrecisionRecallF1
mac_address0.99651.00000.9982
biometric_identifier0.99570.99780.9967
dateofbirth0.99370.99760.9956
email0.99370.99400.9939
api_key0.99210.99490.9935
coordinate0.99100.99550.9932
vehicle_identifier0.98630.99810.9922
medicalrecordnumber0.99600.98810.9921
employee_id0.99090.99150.9912
creditdebitcard0.99350.98700.9902

Challenging PII Entity Types

EntityPrecisionRecallF1
occupation0.71100.51150.5949
time0.86140.77840.8178
political_view0.83480.88420.8588
age0.82200.91840.8676
state0.89410.85700.8751
national_id0.86710.89990.8832
company_name0.88600.88600.8860
fax_number0.90700.87420.8903
race_ethnicity0.86110.92990.8942
education_level0.92320.88740.9049

Limitations

  • —Language: This model works well only for English language texts.
  • —Challenging PII Entity Types: Some of the entity types like occupation has low F1 score.

Citation

bibtex
@misc{ettin-32m-pii-2026,
  title = {ettin-32m-nemotron-pii-2026: PII Detection Model},
  author = {Kalyan KS},
  year = {2026},
  publisher = {Hugging Face},
  url = {https://huggingface.co/kalyan-ks/ettin-32m-nemotron-pii}
}