maartenvs commited on
Commit
b0851dd
·
verified ·
1 Parent(s): cfb03d2

Upload 8 files

Browse files
README.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: gliner
6
+ datasets:
7
+ - nvidia/Nemotron-PII
8
+ pipeline_tag: token-classification
9
+ tags:
10
+ - PII
11
+ - PHI
12
+ - GLiNER
13
+ - information extraction
14
+ - encoder
15
+ - entity recognition
16
+ - privacy
17
+ ---
18
+
19
+ # GLiNER-PII: Fine-Tuned Model for PII/PHI Detection
20
+
21
+ The GLiNER-PII is a fine-tuned successor to the Gretel GLiNER PII models. Built on the GLiNER bi-large base (`knowledgator/gliner-bi-large-v1.0`), it detects and classifies a broad range of Personally Identifiable Information (PII) and Protected Health Information (PHI) in **English text**. The model works with both structured and unstructured text and is non-generative, producing span-level entity annotations with confidence scores across 55+ categories.
22
+
23
+ This model is intended for privacy-preserving NLP workflows such as de-identification, redaction, and compliance checks in healthcare, finance, legal, and enterprise data pipelines.
24
+
25
+ For more information about the base GLiNER model, including its architecture and general capabilities, please refer to the [GLiNER Model Card](https://huggingface.co/knowledgator/gliner-bi-large-v1.0).
26
+
27
+ ## Training Data
28
+
29
+ The model was fine-tuned on the `nvidia/Nemotron-PII` dataset, a synthetic, persona-grounded dataset containing 100,000 records across 50+ industries with span-level annotations for 55+ PII/PHI categories. The dataset was generated with NVIDIA NeMo Data Designer using synthetic personas grounded in U.S. Census data to ensure demographic realism and contextual consistency.
30
+
31
+ **Dataset Details:**
32
+ - **Size:** 100,000 records (50k train / 50k test)
33
+ - **Domains:** 50+ industries (healthcare, finance, cybersecurity, etc.)
34
+ - **Entity Types:** 55+ PII/PHI categories
35
+ - **Locale Coverage:** US and international formats
36
+ - **Content Types:** Both structured (forms, invoices) and unstructured (emails, notes) documents
37
+
38
+ For detailed statistics on the dataset, visit the [dataset documentation on Hugging Face](https://huggingface.co/datasets/nvidia/Nemotron-PII).
39
+
40
+ ## Use Cases
41
+
42
+ The GLiNER-PII supports detection and redaction of sensitive information across regulated and enterprise scenarios:
43
+
44
+ - **Healthcare**: Redact PHI in clinical notes, reports, and medical documents
45
+ - **Finance**: Identify account numbers, SSNs, and transaction details in banking and insurance documents
46
+ - **Legal**: Protect client information in contracts, filings, and discovery materials
47
+ - **Enterprise Data Governance**: Scan documents, emails, and data stores for sensitive information
48
+ - **Data Privacy Compliance**: Support GDPR, HIPAA, and CCPA workflows across varied document types
49
+ - **Cybersecurity**: Detect sensitive data in logs, security reports, and incident records
50
+ - **Content Moderation**: Flag personal information in user-generated content
51
+
52
+ Note: performance varies by domain, format, and threshold, so validation and human review are recommended for high-stakes deployments.
53
+
54
+ ## Installation & Usage
55
+
56
+ Ensure you have Python installed. Then, install or update the `gliner` package:
57
+
58
+ ```python
59
+ import json
60
+ from gliner import GLiNER
61
+
62
+ # Load the fine-tuned GLiNER model
63
+ model = GLiNER.from_pretrained("nvidia/gliner-pii")
64
+
65
+ # Sample text containing PII/PHI entities
66
+ text = """
67
+
68
+ """
69
+
70
+ # Define the labels for PII/PHI entities
71
+ labels = [
72
+ "certificate_license_number",
73
+ "first_name",
74
+ "date_of_birth",
75
+ "ssn",
76
+ "medical_record_number",
77
+ "password",
78
+ "unique_id",
79
+ "phone_number",
80
+ "national_id",
81
+ "swift_bic",
82
+ "company_name",
83
+ "country",
84
+ "license_plate",
85
+ "tax_id",
86
+ "employee_id",
87
+ "pin" ,
88
+ "state",
89
+ "email",
90
+ "date_time",
91
+ "api_key",
92
+ "biometric_identifier",
93
+ "credit_debit_card",
94
+ "coordinate",
95
+ "device_identifier",
96
+ "city",
97
+ "postcode",
98
+ "bank_routing_number",
99
+ "vehicle_identifier",
100
+ "health_plan_beneficiary_number",
101
+ "url",
102
+ "ipv4",
103
+ "last_name",
104
+ "cvv" ,
105
+ "customer_id",
106
+ "date",
107
+ "user_name",
108
+ "street_address",
109
+ "ipv6",
110
+ "account_number",
111
+ "time",
112
+ "age",
113
+ "fax_number",
114
+ "county",
115
+ "gender",
116
+ "sexuality",
117
+ "political_view",
118
+ "race_ethnicity",
119
+ "religious_belief",
120
+ "language",
121
+ "blood_type",
122
+ "mac_address",
123
+ "http_cookie",
124
+ "employment_status",
125
+ "education_level",
126
+ "occupation"
127
+ ]
128
+
129
+ # Predict entities with a confidence threshold of 0.7
130
+ entities = model.predict_entities(text, labels, threshold=0.3)
131
+
132
+ # Display the detected entities
133
+ print(json.dumps(entities, indent=2))
134
+ ```
added_tokens.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "<<ENT>>": 128002,
3
+ "<<SEP>>": 128003,
4
+ "[FLERT]": 128001,
5
+ "[MASK]": 128000
6
+ }
gliner_config.json ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "class_token_index": 128002,
3
+ "dropout": 0.4,
4
+ "embed_ent_token": true,
5
+ "encoder_config": {
6
+ "_name_or_path": "microsoft/deberta-v3-large",
7
+ "add_cross_attention": false,
8
+ "architectures": null,
9
+ "attention_probs_dropout_prob": 0.1,
10
+ "bad_words_ids": null,
11
+ "begin_suppress_tokens": null,
12
+ "bos_token_id": null,
13
+ "chunk_size_feed_forward": 0,
14
+ "cross_attention_hidden_size": null,
15
+ "decoder_start_token_id": null,
16
+ "diversity_penalty": 0.0,
17
+ "do_sample": false,
18
+ "early_stopping": false,
19
+ "encoder_no_repeat_ngram_size": 0,
20
+ "eos_token_id": null,
21
+ "exponential_decay_length_penalty": null,
22
+ "finetuning_task": null,
23
+ "forced_bos_token_id": null,
24
+ "forced_eos_token_id": null,
25
+ "hidden_act": "gelu",
26
+ "hidden_dropout_prob": 0.1,
27
+ "hidden_size": 1024,
28
+ "id2label": {
29
+ "0": "LABEL_0",
30
+ "1": "LABEL_1"
31
+ },
32
+ "initializer_range": 0.02,
33
+ "intermediate_size": 4096,
34
+ "is_decoder": false,
35
+ "is_encoder_decoder": false,
36
+ "label2id": {
37
+ "LABEL_0": 0,
38
+ "LABEL_1": 1
39
+ },
40
+ "layer_norm_eps": 1e-07,
41
+ "length_penalty": 1.0,
42
+ "max_length": 20,
43
+ "max_position_embeddings": 512,
44
+ "max_relative_positions": -1,
45
+ "min_length": 0,
46
+ "model_type": "deberta-v2",
47
+ "no_repeat_ngram_size": 0,
48
+ "norm_rel_ebd": "layer_norm",
49
+ "num_attention_heads": 16,
50
+ "num_beam_groups": 1,
51
+ "num_beams": 1,
52
+ "num_hidden_layers": 24,
53
+ "num_return_sequences": 1,
54
+ "output_attentions": false,
55
+ "output_hidden_states": false,
56
+ "output_scores": false,
57
+ "pad_token_id": 0,
58
+ "pooler_dropout": 0,
59
+ "pooler_hidden_act": "gelu",
60
+ "pooler_hidden_size": 1024,
61
+ "pos_att_type": [
62
+ "p2c",
63
+ "c2p"
64
+ ],
65
+ "position_biased_input": false,
66
+ "position_buckets": 256,
67
+ "prefix": null,
68
+ "problem_type": null,
69
+ "pruned_heads": {},
70
+ "relative_attention": true,
71
+ "remove_invalid_values": false,
72
+ "repetition_penalty": 1.0,
73
+ "return_dict": true,
74
+ "return_dict_in_generate": false,
75
+ "sep_token_id": null,
76
+ "share_att_key": true,
77
+ "suppress_tokens": null,
78
+ "task_specific_params": null,
79
+ "temperature": 1.0,
80
+ "tf_legacy_loss": false,
81
+ "tie_encoder_decoder": false,
82
+ "tie_word_embeddings": true,
83
+ "tokenizer_class": null,
84
+ "top_k": 50,
85
+ "top_p": 1.0,
86
+ "torch_dtype": null,
87
+ "torchscript": false,
88
+ "type_vocab_size": 0,
89
+ "typical_p": 1.0,
90
+ "use_bfloat16": false,
91
+ "vocab_size": 128004
92
+ },
93
+ "ent_token": "<<ENT>>",
94
+ "eval_every": 5000,
95
+ "fine_tune": true,
96
+ "fuse_layers": false,
97
+ "has_rnn": true,
98
+ "hidden_size": 512,
99
+ "labels_encoder": null,
100
+ "labels_encoder_config": null,
101
+ "lr_encoder": "1e-5",
102
+ "lr_others": "5e-5",
103
+ "max_len": 384,
104
+ "max_neg_type_ratio": 1,
105
+ "max_types": 25,
106
+ "max_width": 12,
107
+ "model_name": "microsoft/deberta-v3-large",
108
+ "model_type": "gliner",
109
+ "name": "correct",
110
+ "num_post_fusion_layers": 1,
111
+ "num_steps": 30000,
112
+ "post_fusion_schema": "",
113
+ "random_drop": true,
114
+ "sep_token": "<<SEP>>",
115
+ "shuffle_types": true,
116
+ "size_sup": -1,
117
+ "span_mode": "markerV0",
118
+ "subtoken_pooling": "first",
119
+ "train_batch_size": 8,
120
+ "transformers_version": "4.45.2",
121
+ "vocab_size": 128004,
122
+ "warmup_ratio": 3000,
123
+ "words_splitter_type": "whitespace"
124
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4dfd0dcbd718acc86dca65fa99f1097d2796c8d7a681e1bc42f40f946c03802
3
+ size 1782000995
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "[CLS]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "[SEP]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "[MASK]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "[PAD]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "[SEP]",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "[UNK]",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[CLS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[SEP]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128000": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128001": {
44
+ "content": "[FLERT]",
45
+ "lstrip": false,
46
+ "normalized": true,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": false
50
+ },
51
+ "128002": {
52
+ "content": "<<ENT>>",
53
+ "lstrip": false,
54
+ "normalized": true,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": false
58
+ },
59
+ "128003": {
60
+ "content": "<<SEP>>",
61
+ "lstrip": false,
62
+ "normalized": true,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": false
66
+ }
67
+ },
68
+ "bos_token": "[CLS]",
69
+ "clean_up_tokenization_spaces": false,
70
+ "cls_token": "[CLS]",
71
+ "do_lower_case": false,
72
+ "eos_token": "[SEP]",
73
+ "mask_token": "[MASK]",
74
+ "max_length": null,
75
+ "model_max_length": 1000000000000000019884624838656,
76
+ "pad_to_multiple_of": null,
77
+ "pad_token": "[PAD]",
78
+ "pad_token_type_id": 0,
79
+ "padding_side": "right",
80
+ "sep_token": "[SEP]",
81
+ "sp_model_kwargs": {},
82
+ "split_by_punct": false,
83
+ "tokenizer_class": "DebertaV2Tokenizer",
84
+ "unk_token": "[UNK]",
85
+ "vocab_type": "spm"
86
+ }