sairaamv1 commited on
Commit
3e83577
·
verified ·
1 Parent(s): af32ea4

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -27,21 +27,21 @@ and wrong predictions have overlapping confidence distributions, so no cutoff cl
27
 
28
  ## Benchmarks
29
 
30
- - End-to-end accuracy (gate right, and type right if PII): **89.98%** (4423 held-out examples)
31
- - PII gate: accuracy **98.96%**, precision 99.10%, recall 99.52%, F1 99.31%
32
- - Type accuracy given true PII: **87.61%** (3326 PII rows)
33
- - CPU inference latency: **1.71 ms/example** (single thread, batch size 1)
34
- - Best epoch: 95, validation end-to-end accuracy 90.69%
35
 
36
  Lowest-accuracy categories on the test set (PII rows only):
37
 
38
  | Category | Accuracy |
39
  |---|---|
40
- | Identity Data | 72.2% |
41
- | Health & Biometric Data | 76.9% |
42
- | Device & Technology Data | 77.1% |
43
- | Investment & Trading Data | 77.3% |
44
- | Authentication Data | 78.0% |
45
 
46
  ## Out-of-distribution benchmark
47
 
@@ -57,8 +57,8 @@ HubSpot, GitHub, DMV) added only after the training data below was finalized, an
57
  not-PII** batch (24 rows) of system/infra field names (AWS, Kafka,
58
  Datadog, Segment) added the same way, to get an uncontaminated read on the gate.
59
 
60
- **Combined: 87.6%** (83.6% /
61
- 89.1% / **92.3%** /
62
  **100.0%** on the four sources). Take the first two
63
  with a grain of salt — some of their miss-words ended up in this model's training vocabulary, so
64
  part of that score is memorization. **The two fresh sources are the honest numbers**: real
 
27
 
28
  ## Benchmarks
29
 
30
+ - End-to-end accuracy (gate right, and type right if PII): **93.90%** (4440 held-out examples)
31
+ - PII gate: accuracy **99.10%**, precision 99.20%, recall 99.61%, F1 99.40%
32
+ - Type accuracy given true PII: **92.70%** (3343 PII rows)
33
+ - CPU inference latency: **2.12 ms/example** (single thread, batch size 1)
34
+ - Best epoch: 90, validation end-to-end accuracy 94.27%
35
 
36
  Lowest-accuracy categories on the test set (PII rows only):
37
 
38
  | Category | Accuracy |
39
  |---|---|
40
+ | Health & Biometric Data | 38.5% |
41
+ | Transaction Data | 87.7% |
42
+ | Authentication Data | 88.1% |
43
+ | Cookies & Tracking | 88.5% |
44
+ | Communication & Behavioral Data | 88.5% |
45
 
46
  ## Out-of-distribution benchmark
47
 
 
57
  not-PII** batch (24 rows) of system/infra field names (AWS, Kafka,
58
  Datadog, Segment) added the same way, to get an uncontaminated read on the gate.
59
 
60
+ **Combined: 91.3%** (84.4% /
61
+ 100.0% / **96.2%** /
62
  **100.0%** on the four sources). Take the first two
63
  with a grain of salt — some of their miss-words ended up in this model's training vocabulary, so
64
  part of that score is memorization. **The two fresh sources are the honest numbers**: real
__pycache__/modeling_dual_head.cpython-314.pyc CHANGED
Binary files a/__pycache__/modeling_dual_head.cpython-314.pyc and b/__pycache__/modeling_dual_head.cpython-314.pyc differ
 
config.json CHANGED
@@ -53,224 +53,226 @@
53
  "37": "Check-in Data",
54
  "38": "Children Information",
55
  "39": "Churn Prediction Data",
56
- "40": "Claim History",
57
- "41": "Collateral Information",
58
- "42": "Communication Records",
59
- "43": "Consent Records",
60
- "44": "Content Creation Data",
61
- "45": "Continuing Education",
62
- "46": "Cookie ID",
63
- "47": "Courses Completed",
64
- "48": "Coverage Details",
65
- "49": "Credit History",
66
- "50": "Credit Limit",
67
- "51": "Credit Score (CIBIL)",
68
- "52": "Credit Score (Equifax)",
69
- "53": "Credit Score (Experian)",
70
- "54": "Credit Utilization Ratio",
71
- "55": "Criminal History",
72
- "56": "Customer Lifetime Value",
73
- "57": "Customer Support Interactions",
74
- "58": "Date of Birth",
75
- "59": "Default Records",
76
- "60": "Degree Certificate",
77
- "61": "Degree Number",
78
- "62": "Delivery Address",
79
- "63": "Delivery History",
80
- "64": "Delivery Instructions",
81
- "65": "Delivery Preferences",
82
- "66": "Delivery Time Slots",
83
- "67": "Device Brand",
84
- "68": "Device ID",
85
- "69": "Device Model",
86
- "70": "Device-bound Credentials",
87
- "71": "Dietary Preferences",
88
- "72": "Digital Signature",
89
- "73": "Digital Wallet ID",
90
- "74": "Disability Severity / Level",
91
- "75": "Disability Status",
92
- "76": "Disability Type",
93
- "77": "Discount Usage",
94
- "78": "Dividend History",
95
- "79": "Download History",
96
- "80": "Drinking Habits",
97
- "81": "Driver\u2019s License Number",
98
- "82": "EPF Number",
99
- "83": "Email Address",
100
- "84": "Emergency Contact Details",
101
- "85": "Employee ID",
102
- "86": "Employer Name",
103
- "87": "Employment Contract",
104
- "88": "Employment History",
105
- "89": "Ethnic Origin",
106
- "90": "Expense Categories",
107
- "91": "Failed Delivery Attempts",
108
- "92": "Family Information",
109
- "93": "Feedback & Reviews",
110
- "94": "Financial Goals",
111
- "95": "First Name",
112
- "96": "Fraud Alerts",
113
- "97": "Functional Cookies",
114
- "98": "GST Number",
115
- "99": "Game Progress",
116
- "100": "Gaming Device Information",
117
- "101": "Gaming Preferences",
118
- "102": "Gender",
119
- "103": "Genetic Data",
120
- "104": "Graduation Years",
121
- "105": "Graphical Password Data",
122
- "106": "Group Memberships",
123
- "107": "Guarantor Details",
124
- "108": "HSC Document",
125
- "109": "Health Insurance Details",
126
- "110": "Health Records",
127
- "111": "Horoscope Data",
128
- "112": "IBAN",
129
- "113": "IFSC Code",
130
- "114": "IP Address",
131
- "115": "Identity Verification Status",
132
- "116": "In-game Purchases",
133
- "117": "Income Details",
134
- "118": "Industry Type",
135
- "119": "Institution Names",
136
- "120": "Insurance Policy Number",
137
- "121": "Interest in Children",
138
- "122": "Investment Advisor Details",
139
- "123": "Investment Portfolio",
140
- "124": "Investment Preferences",
141
- "125": "Job Title",
142
- "126": "KYC Documents",
143
- "127": "LPG / Gas Consumer Number",
144
- "128": "Last Name",
145
- "129": "Lead Scoring",
146
- "130": "Leaderboard Rankings",
147
- "131": "Learning Progress",
148
- "132": "Lifestyle Choices",
149
- "133": "Listening History",
150
- "134": "Live Stream Participation",
151
- "135": "Loan Details",
152
- "136": "Location History",
153
- "137": "MAC Address",
154
- "138": "MFA Tokens",
155
- "139": "Marital Status",
156
- "140": "Marriage Certificate Date",
157
- "141": "Marriage Certificate Number",
158
- "142": "Medical History",
159
- "143": "Mental Health Data",
160
- "144": "Middle Name",
161
- "145": "Multiplayer Interactions",
162
- "146": "Mutual Fund Holdings",
163
- "147": "Nationality",
164
- "148": "Network Information",
165
- "149": "Nominee Contact Details",
166
- "150": "Nominee Identifier",
167
- "151": "Nominee Name",
168
- "152": "Nominee Relationship",
169
- "153": "Nominee Share Percentage",
170
- "154": "OAuth Tokens",
171
- "155": "Office Address",
172
- "156": "Operating System",
173
- "157": "Operating System Version",
174
- "158": "Order Details",
175
- "159": "PAN",
176
- "160": "PIN",
177
- "161": "PRAN",
178
- "162": "Packaging Preferences",
179
- "163": "Partner Preferences",
180
- "164": "Passport Number",
181
- "165": "Password (Hashed)",
182
- "166": "Payment Records",
183
- "167": "Performance Reviews",
184
- "168": "Permanent Address",
185
- "169": "Philosophical Beliefs",
186
- "170": "Phone Number",
187
- "171": "Physical Attributes",
188
- "172": "Place of Birth",
189
- "173": "Playlist",
190
- "174": "Policy Modifications",
191
- "175": "Political Opinions",
192
- "176": "Portfolio Holdings",
193
- "177": "Precise Location",
194
- "178": "Preferences",
195
- "179": "Preferred Service Areas",
196
- "180": "Premium Payments",
197
- "181": "Price Sensitivity",
198
- "182": "Professional Development",
199
- "183": "Professional License Numbers",
200
- "184": "Professional Qualifications",
201
- "185": "Profile Photo",
202
- "186": "Promotional Offers Used",
203
- "187": "Purchase History",
204
- "188": "Racial Origin",
205
- "189": "Ration Card Number",
206
- "190": "Recurring Payments",
207
- "191": "Refund History",
208
- "192": "Relationship Status",
209
- "193": "Religious Beliefs",
210
- "194": "Renewal History",
211
- "195": "Rescheduling Patterns",
212
- "196": "Residential Address",
213
- "197": "Return History",
214
- "198": "Risk Assessment",
215
- "199": "Risk Rating",
216
- "200": "Risk Tolerance",
217
- "201": "Route Information",
218
- "202": "Routing Number",
219
- "203": "SSC Document",
220
- "204": "SSN (Social Security Number) (US)",
221
- "205": "Salary",
222
- "206": "Search History",
223
- "207": "Security Questions & Answers",
224
- "208": "Segmentation Data",
225
- "209": "Service Completion Status",
226
- "210": "Service Location",
227
- "211": "Service Usage History",
228
- "212": "Session IDs",
229
- "213": "Sexual Orientation",
230
- "214": "Shared Content",
231
- "215": "Sharing Behavior",
232
- "216": "Shipping Address",
233
- "217": "Shopping Cart Contents",
234
- "218": "Skills Assessment",
235
- "219": "Smoking Habits",
236
- "220": "Social Connections",
237
- "221": "Social Influence Score",
238
- "222": "Social Media Activity",
239
- "223": "Social Media Profiles",
240
- "224": "Special Handling Instructions",
241
- "225": "Standing Instructions",
242
- "226": "Strictly Necessary Cookies",
243
- "227": "Subscription Data",
244
- "228": "Survey Responses",
245
- "229": "Tax Identification Number",
246
- "230": "Tax Records",
247
- "231": "Terms Acceptance",
248
- "232": "Third-party Account ID",
249
- "233": "Time Spent Gaming",
250
- "234": "Tracking Information",
251
- "235": "Trading History",
252
- "236": "Training Records",
253
- "237": "Transaction Records",
254
- "238": "UPI ID",
255
- "239": "Underwriting Information",
256
- "240": "Union Membership",
257
- "241": "Usage Patterns",
258
- "242": "User Agent",
259
- "243": "Username / User ID",
260
- "244": "Vehicle Ownership Details",
261
- "245": "Vehicle Registration Number",
262
- "246": "Vehicle Type",
263
- "247": "Verification Metadata",
264
- "248": "Verified Identity Data",
265
- "249": "Viewing History",
266
- "250": "Virtual Currency",
267
- "251": "Virtual Items Owned",
268
- "252": "Voter ID",
269
- "253": "Watchlist",
270
- "254": "WiFi Connections",
271
- "255": "Wishlist Items",
272
- "256": "Work Email",
273
- "257": "Work Phone Number"
 
 
274
  },
275
  "initializer_range": 0.02,
276
  "intermediate_size": 1536,
@@ -280,7 +282,7 @@
280
  "model_type": "dual_head_bert",
281
  "num_attention_heads": 12,
282
  "num_hidden_layers": 6,
283
- "num_type_labels": 258,
284
  "pad_token_id": 0,
285
  "pii_loss_weight": 1.0,
286
  "position_embedding_type": "absolute",
@@ -327,228 +329,231 @@
327
  "Check-in Data": 37,
328
  "Children Information": 38,
329
  "Churn Prediction Data": 39,
330
- "Claim History": 40,
331
- "Collateral Information": 41,
332
- "Communication Records": 42,
333
- "Consent Records": 43,
334
- "Content Creation Data": 44,
335
- "Continuing Education": 45,
336
- "Cookie ID": 46,
337
- "Courses Completed": 47,
338
- "Coverage Details": 48,
339
- "Credit History": 49,
340
- "Credit Limit": 50,
341
- "Credit Score (CIBIL)": 51,
342
- "Credit Score (Equifax)": 52,
343
- "Credit Score (Experian)": 53,
344
- "Credit Utilization Ratio": 54,
345
- "Criminal History": 55,
346
- "Customer Lifetime Value": 56,
347
- "Customer Support Interactions": 57,
348
- "Date of Birth": 58,
349
- "Default Records": 59,
350
- "Degree Certificate": 60,
351
- "Degree Number": 61,
352
- "Delivery Address": 62,
353
- "Delivery History": 63,
354
- "Delivery Instructions": 64,
355
- "Delivery Preferences": 65,
356
- "Delivery Time Slots": 66,
357
- "Device Brand": 67,
358
- "Device ID": 68,
359
- "Device Model": 69,
360
- "Device-bound Credentials": 70,
361
- "Dietary Preferences": 71,
362
- "Digital Signature": 72,
363
- "Digital Wallet ID": 73,
364
- "Disability Severity / Level": 74,
365
- "Disability Status": 75,
366
- "Disability Type": 76,
367
- "Discount Usage": 77,
368
- "Dividend History": 78,
369
- "Download History": 79,
370
- "Drinking Habits": 80,
371
- "Driver\u2019s License Number": 81,
372
- "EPF Number": 82,
373
- "Email Address": 83,
374
- "Emergency Contact Details": 84,
375
- "Employee ID": 85,
376
- "Employer Name": 86,
377
- "Employment Contract": 87,
378
- "Employment History": 88,
379
- "Ethnic Origin": 89,
380
- "Expense Categories": 90,
381
- "Failed Delivery Attempts": 91,
382
- "Family Information": 92,
383
- "Feedback & Reviews": 93,
384
- "Financial Goals": 94,
385
- "First Name": 95,
386
- "Fraud Alerts": 96,
387
- "Functional Cookies": 97,
388
- "GST Number": 98,
389
- "Game Progress": 99,
390
- "Gaming Device Information": 100,
391
- "Gaming Preferences": 101,
392
- "Gender": 102,
393
- "Genetic Data": 103,
394
- "Graduation Years": 104,
395
- "Graphical Password Data": 105,
396
- "Group Memberships": 106,
397
- "Guarantor Details": 107,
398
- "HSC Document": 108,
399
- "Health Insurance Details": 109,
400
- "Health Records": 110,
401
- "Horoscope Data": 111,
402
- "IBAN": 112,
403
- "IFSC Code": 113,
404
- "IP Address": 114,
405
- "Identity Verification Status": 115,
406
- "In-game Purchases": 116,
407
- "Income Details": 117,
408
- "Industry Type": 118,
409
- "Institution Names": 119,
410
- "Insurance Policy Number": 120,
411
- "Interest in Children": 121,
412
- "Investment Advisor Details": 122,
413
- "Investment Portfolio": 123,
414
- "Investment Preferences": 124,
415
- "Job Title": 125,
416
- "KYC Documents": 126,
417
- "LPG / Gas Consumer Number": 127,
418
- "Last Name": 128,
419
- "Lead Scoring": 129,
420
- "Leaderboard Rankings": 130,
421
- "Learning Progress": 131,
422
- "Lifestyle Choices": 132,
423
- "Listening History": 133,
424
- "Live Stream Participation": 134,
425
- "Loan Details": 135,
426
- "Location History": 136,
427
- "MAC Address": 137,
428
- "MFA Tokens": 138,
429
- "Marital Status": 139,
430
- "Marriage Certificate Date": 140,
431
- "Marriage Certificate Number": 141,
432
- "Medical History": 142,
433
- "Mental Health Data": 143,
434
- "Middle Name": 144,
435
- "Multiplayer Interactions": 145,
436
- "Mutual Fund Holdings": 146,
437
- "Nationality": 147,
438
- "Network Information": 148,
439
- "Nominee Contact Details": 149,
440
- "Nominee Identifier": 150,
441
- "Nominee Name": 151,
442
- "Nominee Relationship": 152,
443
- "Nominee Share Percentage": 153,
444
- "OAuth Tokens": 154,
445
- "Office Address": 155,
446
- "Operating System": 156,
447
- "Operating System Version": 157,
448
- "Order Details": 158,
449
- "PAN": 159,
450
- "PIN": 160,
451
- "PRAN": 161,
452
- "Packaging Preferences": 162,
453
- "Partner Preferences": 163,
454
- "Passport Number": 164,
455
- "Password (Hashed)": 165,
456
- "Payment Records": 166,
457
- "Performance Reviews": 167,
458
- "Permanent Address": 168,
459
- "Philosophical Beliefs": 169,
460
- "Phone Number": 170,
461
- "Physical Attributes": 171,
462
- "Place of Birth": 172,
463
- "Playlist": 173,
464
- "Policy Modifications": 174,
465
- "Political Opinions": 175,
466
- "Portfolio Holdings": 176,
467
- "Precise Location": 177,
468
- "Preferences": 178,
469
- "Preferred Service Areas": 179,
470
- "Premium Payments": 180,
471
- "Price Sensitivity": 181,
472
- "Professional Development": 182,
473
- "Professional License Numbers": 183,
474
- "Professional Qualifications": 184,
475
- "Profile Photo": 185,
476
- "Promotional Offers Used": 186,
477
- "Purchase History": 187,
478
- "Racial Origin": 188,
479
- "Ration Card Number": 189,
480
- "Recurring Payments": 190,
481
- "Refund History": 191,
482
- "Relationship Status": 192,
483
- "Religious Beliefs": 193,
484
- "Renewal History": 194,
485
- "Rescheduling Patterns": 195,
486
- "Residential Address": 196,
487
- "Return History": 197,
488
- "Risk Assessment": 198,
489
- "Risk Rating": 199,
490
- "Risk Tolerance": 200,
491
- "Route Information": 201,
492
- "Routing Number": 202,
493
- "SSC Document": 203,
494
- "SSN (Social Security Number) (US)": 204,
495
- "Salary": 205,
496
- "Search History": 206,
497
- "Security Questions & Answers": 207,
498
- "Segmentation Data": 208,
499
- "Service Completion Status": 209,
500
- "Service Location": 210,
501
- "Service Usage History": 211,
502
- "Session IDs": 212,
503
- "Sexual Orientation": 213,
504
- "Shared Content": 214,
505
- "Sharing Behavior": 215,
506
- "Shipping Address": 216,
507
- "Shopping Cart Contents": 217,
508
- "Skills Assessment": 218,
509
- "Smoking Habits": 219,
510
- "Social Connections": 220,
511
- "Social Influence Score": 221,
512
- "Social Media Activity": 222,
513
- "Social Media Profiles": 223,
514
- "Special Handling Instructions": 224,
515
- "Standing Instructions": 225,
516
- "Strictly Necessary Cookies": 226,
517
- "Subscription Data": 227,
518
- "Survey Responses": 228,
519
- "Tax Identification Number": 229,
520
- "Tax Records": 230,
521
- "Terms Acceptance": 231,
522
- "Third-party Account ID": 232,
523
- "Time Spent Gaming": 233,
524
- "Tracking Information": 234,
525
- "Trading History": 235,
526
- "Training Records": 236,
527
- "Transaction Records": 237,
528
- "UPI ID": 238,
529
- "Underwriting Information": 239,
530
- "Union Membership": 240,
531
- "Usage Patterns": 241,
532
- "User Agent": 242,
533
- "Username / User ID": 243,
534
- "Vehicle Ownership Details": 244,
535
- "Vehicle Registration Number": 245,
536
- "Vehicle Type": 246,
537
- "Verification Metadata": 247,
538
- "Verified Identity Data": 248,
539
- "Viewing History": 249,
540
- "Virtual Currency": 250,
541
- "Virtual Items Owned": 251,
542
- "Voter ID": 252,
543
- "Watchlist": 253,
544
- "WiFi Connections": 254,
545
- "Wishlist Items": 255,
546
- "Work Email": 256,
547
- "Work Phone Number": 257
 
 
548
  },
549
  "type_loss_weight": 1.0,
550
  "type_vocab_size": 2,
551
  "vocab_size": 30522,
 
552
  "auto_map": {
553
  "AutoConfig": "modeling_dual_head.DualHeadConfig",
554
  "AutoModel": "modeling_dual_head.DualHeadBertForPIIClassification"
 
53
  "37": "Check-in Data",
54
  "38": "Children Information",
55
  "39": "Churn Prediction Data",
56
+ "40": "City",
57
+ "41": "Claim History",
58
+ "42": "Collateral Information",
59
+ "43": "Communication Records",
60
+ "44": "Consent Records",
61
+ "45": "Content Creation Data",
62
+ "46": "Continuing Education",
63
+ "47": "Cookie ID",
64
+ "48": "Courses Completed",
65
+ "49": "Coverage Details",
66
+ "50": "Credit History",
67
+ "51": "Credit Limit",
68
+ "52": "Credit Score (CIBIL)",
69
+ "53": "Credit Score (Equifax)",
70
+ "54": "Credit Score (Experian)",
71
+ "55": "Credit Utilization Ratio",
72
+ "56": "Criminal History",
73
+ "57": "Customer Lifetime Value",
74
+ "58": "Customer Support Interactions",
75
+ "59": "Date of Birth",
76
+ "60": "Default Records",
77
+ "61": "Degree Certificate",
78
+ "62": "Degree Number",
79
+ "63": "Delivery Address",
80
+ "64": "Delivery History",
81
+ "65": "Delivery Instructions",
82
+ "66": "Delivery Preferences",
83
+ "67": "Delivery Time Slots",
84
+ "68": "Deposit Amount",
85
+ "69": "Device Brand",
86
+ "70": "Device ID",
87
+ "71": "Device Model",
88
+ "72": "Device-bound Credentials",
89
+ "73": "Dietary Preferences",
90
+ "74": "Digital Signature",
91
+ "75": "Digital Wallet ID",
92
+ "76": "Disability Severity / Level",
93
+ "77": "Disability Status",
94
+ "78": "Disability Type",
95
+ "79": "Discount Usage",
96
+ "80": "Dividend History",
97
+ "81": "Download History",
98
+ "82": "Drinking Habits",
99
+ "83": "Driver\u2019s License Number",
100
+ "84": "EPF Number",
101
+ "85": "Email Address",
102
+ "86": "Emergency Contact Details",
103
+ "87": "Employee ID",
104
+ "88": "Employer Name",
105
+ "89": "Employment Contract",
106
+ "90": "Employment History",
107
+ "91": "Ethnic Origin",
108
+ "92": "Expense Categories",
109
+ "93": "Failed Delivery Attempts",
110
+ "94": "Family Information",
111
+ "95": "Feedback & Reviews",
112
+ "96": "Financial Goals",
113
+ "97": "First Name",
114
+ "98": "Fraud Alerts",
115
+ "99": "Full Name",
116
+ "100": "Functional Cookies",
117
+ "101": "GST Number",
118
+ "102": "Game Progress",
119
+ "103": "Gaming Device Information",
120
+ "104": "Gaming Preferences",
121
+ "105": "Gender",
122
+ "106": "Genetic Data",
123
+ "107": "Graduation Years",
124
+ "108": "Graphical Password Data",
125
+ "109": "Group Memberships",
126
+ "110": "Guarantor Details",
127
+ "111": "HSC Document",
128
+ "112": "Health Insurance Details",
129
+ "113": "Health Records",
130
+ "114": "Horoscope Data",
131
+ "115": "IBAN",
132
+ "116": "IFSC Code",
133
+ "117": "IP Address",
134
+ "118": "Identity Verification Status",
135
+ "119": "In-game Purchases",
136
+ "120": "Income Details",
137
+ "121": "Industry Type",
138
+ "122": "Institution Names",
139
+ "123": "Insurance Policy Number",
140
+ "124": "Interest in Children",
141
+ "125": "Investment Advisor Details",
142
+ "126": "Investment Portfolio",
143
+ "127": "Investment Preferences",
144
+ "128": "Job Title",
145
+ "129": "KYC Documents",
146
+ "130": "LPG / Gas Consumer Number",
147
+ "131": "Last Name",
148
+ "132": "Lead Scoring",
149
+ "133": "Leaderboard Rankings",
150
+ "134": "Learning Progress",
151
+ "135": "Lifestyle Choices",
152
+ "136": "Listening History",
153
+ "137": "Live Stream Participation",
154
+ "138": "Loan Details",
155
+ "139": "Location History",
156
+ "140": "MAC Address",
157
+ "141": "MFA Tokens",
158
+ "142": "Marital Status",
159
+ "143": "Marriage Certificate Date",
160
+ "144": "Marriage Certificate Number",
161
+ "145": "Medical History",
162
+ "146": "Mental Health Data",
163
+ "147": "Middle Name",
164
+ "148": "Multiplayer Interactions",
165
+ "149": "Mutual Fund Holdings",
166
+ "150": "Nationality",
167
+ "151": "Network Information",
168
+ "152": "Nominee Contact Details",
169
+ "153": "Nominee Identifier",
170
+ "154": "Nominee Name",
171
+ "155": "Nominee Relationship",
172
+ "156": "Nominee Share Percentage",
173
+ "157": "OAuth Tokens",
174
+ "158": "Office Address",
175
+ "159": "Operating System",
176
+ "160": "Operating System Version",
177
+ "161": "Order Details",
178
+ "162": "PAN",
179
+ "163": "PIN",
180
+ "164": "PRAN",
181
+ "165": "Packaging Preferences",
182
+ "166": "Partner Preferences",
183
+ "167": "Passport Number",
184
+ "168": "Password (Hashed)",
185
+ "169": "Payment Records",
186
+ "170": "Performance Reviews",
187
+ "171": "Permanent Address",
188
+ "172": "Philosophical Beliefs",
189
+ "173": "Phone Number",
190
+ "174": "Physical Attributes",
191
+ "175": "Place of Birth",
192
+ "176": "Playlist",
193
+ "177": "Policy Modifications",
194
+ "178": "Political Opinions",
195
+ "179": "Portfolio Holdings",
196
+ "180": "Precise Location",
197
+ "181": "Preferences",
198
+ "182": "Preferred Service Areas",
199
+ "183": "Premium Payments",
200
+ "184": "Price Sensitivity",
201
+ "185": "Professional Development",
202
+ "186": "Professional License Numbers",
203
+ "187": "Professional Qualifications",
204
+ "188": "Profile Photo",
205
+ "189": "Promotional Offers Used",
206
+ "190": "Purchase History",
207
+ "191": "Ration Card Number",
208
+ "192": "Recurring Payments",
209
+ "193": "Refund History",
210
+ "194": "Relationship Status",
211
+ "195": "Religious Beliefs",
212
+ "196": "Renewal History",
213
+ "197": "Rescheduling Patterns",
214
+ "198": "Residential Address",
215
+ "199": "Return History",
216
+ "200": "Risk Assessment",
217
+ "201": "Risk Rating",
218
+ "202": "Risk Tolerance",
219
+ "203": "Route Information",
220
+ "204": "Routing Number",
221
+ "205": "SSC Document",
222
+ "206": "SSN (Social Security Number) (US)",
223
+ "207": "Salary",
224
+ "208": "Search History",
225
+ "209": "Security Questions & Answers",
226
+ "210": "Segmentation Data",
227
+ "211": "Service Completion Status",
228
+ "212": "Service Location",
229
+ "213": "Service Usage History",
230
+ "214": "Session IDs",
231
+ "215": "Sexual Orientation",
232
+ "216": "Shared Content",
233
+ "217": "Sharing Behavior",
234
+ "218": "Shipping Address",
235
+ "219": "Shopping Cart Contents",
236
+ "220": "Skills Assessment",
237
+ "221": "Smoking Habits",
238
+ "222": "Social Connections",
239
+ "223": "Social Influence Score",
240
+ "224": "Social Media Activity",
241
+ "225": "Social Media Profiles",
242
+ "226": "Special Handling Instructions",
243
+ "227": "Standing Instructions",
244
+ "228": "Strictly Necessary Cookies",
245
+ "229": "Subscription Data",
246
+ "230": "Survey Responses",
247
+ "231": "Tax Identification Number",
248
+ "232": "Tax Records",
249
+ "233": "Terms Acceptance",
250
+ "234": "Third-party Account ID",
251
+ "235": "Time Spent Gaming",
252
+ "236": "Tracking Information",
253
+ "237": "Trading History",
254
+ "238": "Training Records",
255
+ "239": "Transaction Records",
256
+ "240": "UPI ID",
257
+ "241": "Underwriting Information",
258
+ "242": "Union Membership",
259
+ "243": "Usage Patterns",
260
+ "244": "User Agent",
261
+ "245": "Username / User ID",
262
+ "246": "Vehicle Ownership Details",
263
+ "247": "Vehicle Registration Number",
264
+ "248": "Vehicle Type",
265
+ "249": "Verification Metadata",
266
+ "250": "Verified Identity Data",
267
+ "251": "Viewing History",
268
+ "252": "Virtual Currency",
269
+ "253": "Virtual Items Owned",
270
+ "254": "Voter ID",
271
+ "255": "Watchlist",
272
+ "256": "WiFi Connections",
273
+ "257": "Wishlist Items",
274
+ "258": "Work Email",
275
+ "259": "Work Phone Number"
276
  },
277
  "initializer_range": 0.02,
278
  "intermediate_size": 1536,
 
282
  "model_type": "dual_head_bert",
283
  "num_attention_heads": 12,
284
  "num_hidden_layers": 6,
285
+ "num_type_labels": 260,
286
  "pad_token_id": 0,
287
  "pii_loss_weight": 1.0,
288
  "position_embedding_type": "absolute",
 
329
  "Check-in Data": 37,
330
  "Children Information": 38,
331
  "Churn Prediction Data": 39,
332
+ "City": 40,
333
+ "Claim History": 41,
334
+ "Collateral Information": 42,
335
+ "Communication Records": 43,
336
+ "Consent Records": 44,
337
+ "Content Creation Data": 45,
338
+ "Continuing Education": 46,
339
+ "Cookie ID": 47,
340
+ "Courses Completed": 48,
341
+ "Coverage Details": 49,
342
+ "Credit History": 50,
343
+ "Credit Limit": 51,
344
+ "Credit Score (CIBIL)": 52,
345
+ "Credit Score (Equifax)": 53,
346
+ "Credit Score (Experian)": 54,
347
+ "Credit Utilization Ratio": 55,
348
+ "Criminal History": 56,
349
+ "Customer Lifetime Value": 57,
350
+ "Customer Support Interactions": 58,
351
+ "Date of Birth": 59,
352
+ "Default Records": 60,
353
+ "Degree Certificate": 61,
354
+ "Degree Number": 62,
355
+ "Delivery Address": 63,
356
+ "Delivery History": 64,
357
+ "Delivery Instructions": 65,
358
+ "Delivery Preferences": 66,
359
+ "Delivery Time Slots": 67,
360
+ "Deposit Amount": 68,
361
+ "Device Brand": 69,
362
+ "Device ID": 70,
363
+ "Device Model": 71,
364
+ "Device-bound Credentials": 72,
365
+ "Dietary Preferences": 73,
366
+ "Digital Signature": 74,
367
+ "Digital Wallet ID": 75,
368
+ "Disability Severity / Level": 76,
369
+ "Disability Status": 77,
370
+ "Disability Type": 78,
371
+ "Discount Usage": 79,
372
+ "Dividend History": 80,
373
+ "Download History": 81,
374
+ "Drinking Habits": 82,
375
+ "Driver\u2019s License Number": 83,
376
+ "EPF Number": 84,
377
+ "Email Address": 85,
378
+ "Emergency Contact Details": 86,
379
+ "Employee ID": 87,
380
+ "Employer Name": 88,
381
+ "Employment Contract": 89,
382
+ "Employment History": 90,
383
+ "Ethnic Origin": 91,
384
+ "Expense Categories": 92,
385
+ "Failed Delivery Attempts": 93,
386
+ "Family Information": 94,
387
+ "Feedback & Reviews": 95,
388
+ "Financial Goals": 96,
389
+ "First Name": 97,
390
+ "Fraud Alerts": 98,
391
+ "Full Name": 99,
392
+ "Functional Cookies": 100,
393
+ "GST Number": 101,
394
+ "Game Progress": 102,
395
+ "Gaming Device Information": 103,
396
+ "Gaming Preferences": 104,
397
+ "Gender": 105,
398
+ "Genetic Data": 106,
399
+ "Graduation Years": 107,
400
+ "Graphical Password Data": 108,
401
+ "Group Memberships": 109,
402
+ "Guarantor Details": 110,
403
+ "HSC Document": 111,
404
+ "Health Insurance Details": 112,
405
+ "Health Records": 113,
406
+ "Horoscope Data": 114,
407
+ "IBAN": 115,
408
+ "IFSC Code": 116,
409
+ "IP Address": 117,
410
+ "Identity Verification Status": 118,
411
+ "In-game Purchases": 119,
412
+ "Income Details": 120,
413
+ "Industry Type": 121,
414
+ "Institution Names": 122,
415
+ "Insurance Policy Number": 123,
416
+ "Interest in Children": 124,
417
+ "Investment Advisor Details": 125,
418
+ "Investment Portfolio": 126,
419
+ "Investment Preferences": 127,
420
+ "Job Title": 128,
421
+ "KYC Documents": 129,
422
+ "LPG / Gas Consumer Number": 130,
423
+ "Last Name": 131,
424
+ "Lead Scoring": 132,
425
+ "Leaderboard Rankings": 133,
426
+ "Learning Progress": 134,
427
+ "Lifestyle Choices": 135,
428
+ "Listening History": 136,
429
+ "Live Stream Participation": 137,
430
+ "Loan Details": 138,
431
+ "Location History": 139,
432
+ "MAC Address": 140,
433
+ "MFA Tokens": 141,
434
+ "Marital Status": 142,
435
+ "Marriage Certificate Date": 143,
436
+ "Marriage Certificate Number": 144,
437
+ "Medical History": 145,
438
+ "Mental Health Data": 146,
439
+ "Middle Name": 147,
440
+ "Multiplayer Interactions": 148,
441
+ "Mutual Fund Holdings": 149,
442
+ "Nationality": 150,
443
+ "Network Information": 151,
444
+ "Nominee Contact Details": 152,
445
+ "Nominee Identifier": 153,
446
+ "Nominee Name": 154,
447
+ "Nominee Relationship": 155,
448
+ "Nominee Share Percentage": 156,
449
+ "OAuth Tokens": 157,
450
+ "Office Address": 158,
451
+ "Operating System": 159,
452
+ "Operating System Version": 160,
453
+ "Order Details": 161,
454
+ "PAN": 162,
455
+ "PIN": 163,
456
+ "PRAN": 164,
457
+ "Packaging Preferences": 165,
458
+ "Partner Preferences": 166,
459
+ "Passport Number": 167,
460
+ "Password (Hashed)": 168,
461
+ "Payment Records": 169,
462
+ "Performance Reviews": 170,
463
+ "Permanent Address": 171,
464
+ "Philosophical Beliefs": 172,
465
+ "Phone Number": 173,
466
+ "Physical Attributes": 174,
467
+ "Place of Birth": 175,
468
+ "Playlist": 176,
469
+ "Policy Modifications": 177,
470
+ "Political Opinions": 178,
471
+ "Portfolio Holdings": 179,
472
+ "Precise Location": 180,
473
+ "Preferences": 181,
474
+ "Preferred Service Areas": 182,
475
+ "Premium Payments": 183,
476
+ "Price Sensitivity": 184,
477
+ "Professional Development": 185,
478
+ "Professional License Numbers": 186,
479
+ "Professional Qualifications": 187,
480
+ "Profile Photo": 188,
481
+ "Promotional Offers Used": 189,
482
+ "Purchase History": 190,
483
+ "Ration Card Number": 191,
484
+ "Recurring Payments": 192,
485
+ "Refund History": 193,
486
+ "Relationship Status": 194,
487
+ "Religious Beliefs": 195,
488
+ "Renewal History": 196,
489
+ "Rescheduling Patterns": 197,
490
+ "Residential Address": 198,
491
+ "Return History": 199,
492
+ "Risk Assessment": 200,
493
+ "Risk Rating": 201,
494
+ "Risk Tolerance": 202,
495
+ "Route Information": 203,
496
+ "Routing Number": 204,
497
+ "SSC Document": 205,
498
+ "SSN (Social Security Number) (US)": 206,
499
+ "Salary": 207,
500
+ "Search History": 208,
501
+ "Security Questions & Answers": 209,
502
+ "Segmentation Data": 210,
503
+ "Service Completion Status": 211,
504
+ "Service Location": 212,
505
+ "Service Usage History": 213,
506
+ "Session IDs": 214,
507
+ "Sexual Orientation": 215,
508
+ "Shared Content": 216,
509
+ "Sharing Behavior": 217,
510
+ "Shipping Address": 218,
511
+ "Shopping Cart Contents": 219,
512
+ "Skills Assessment": 220,
513
+ "Smoking Habits": 221,
514
+ "Social Connections": 222,
515
+ "Social Influence Score": 223,
516
+ "Social Media Activity": 224,
517
+ "Social Media Profiles": 225,
518
+ "Special Handling Instructions": 226,
519
+ "Standing Instructions": 227,
520
+ "Strictly Necessary Cookies": 228,
521
+ "Subscription Data": 229,
522
+ "Survey Responses": 230,
523
+ "Tax Identification Number": 231,
524
+ "Tax Records": 232,
525
+ "Terms Acceptance": 233,
526
+ "Third-party Account ID": 234,
527
+ "Time Spent Gaming": 235,
528
+ "Tracking Information": 236,
529
+ "Trading History": 237,
530
+ "Training Records": 238,
531
+ "Transaction Records": 239,
532
+ "UPI ID": 240,
533
+ "Underwriting Information": 241,
534
+ "Union Membership": 242,
535
+ "Usage Patterns": 243,
536
+ "User Agent": 244,
537
+ "Username / User ID": 245,
538
+ "Vehicle Ownership Details": 246,
539
+ "Vehicle Registration Number": 247,
540
+ "Vehicle Type": 248,
541
+ "Verification Metadata": 249,
542
+ "Verified Identity Data": 250,
543
+ "Viewing History": 251,
544
+ "Virtual Currency": 252,
545
+ "Virtual Items Owned": 253,
546
+ "Voter ID": 254,
547
+ "Watchlist": 255,
548
+ "WiFi Connections": 256,
549
+ "Wishlist Items": 257,
550
+ "Work Email": 258,
551
+ "Work Phone Number": 259
552
  },
553
  "type_loss_weight": 1.0,
554
  "type_vocab_size": 2,
555
  "vocab_size": 30522,
556
+ "gate_temperature": 1.0620299577713013,
557
  "auto_map": {
558
  "AutoConfig": "modeling_dual_head.DualHeadConfig",
559
  "AutoModel": "modeling_dual_head.DualHeadBertForPIIClassification"
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ecf2dd040dac31cf8395899ec16f3ac55a8476e46c1a3769f2cff6dae1b0c6b7
3
- size 91265440
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9f0231c63b82306042221284813282bce2d86682c89a1cc31353a34bbb11de1
3
+ size 91268520
modeling_dual_head.py CHANGED
@@ -24,13 +24,19 @@ class DualHeadConfig(PretrainedConfig):
24
  model_type = "dual_head_bert"
25
 
26
  def __init__(self, num_type_labels=258, id2type_label=None, type_label2id=None,
27
- pii_loss_weight=1.0, type_loss_weight=1.0, **kwargs):
28
  super().__init__(**kwargs)
29
  self.num_type_labels = num_type_labels
30
  self.id2type_label = id2type_label or {}
31
  self.type_label2id = type_label2id or {}
32
  self.pii_loss_weight = pii_loss_weight
33
  self.type_loss_weight = type_loss_weight
 
 
 
 
 
 
34
 
35
 
36
  @dataclass
@@ -38,6 +44,7 @@ class DualHeadOutput(ModelOutput):
38
  loss: Optional[torch.Tensor] = None
39
  pii_logits: Optional[torch.Tensor] = None
40
  type_logits: Optional[torch.Tensor] = None
 
41
 
42
 
43
  class DualHeadBertForPIIClassification(PreTrainedModel):
@@ -68,16 +75,20 @@ class DualHeadBertForPIIClassification(PreTrainedModel):
68
  def forward(self, input_ids, attention_mask=None, pii_labels=None, type_labels=None, **kwargs):
69
  out = self.bert(input_ids=input_ids, attention_mask=attention_mask)
70
  pooled = self.dropout(out.pooler_output)
71
- pii_logits = self.pii_head(pooled)
 
72
  type_logits = self.type_head(pooled)
73
 
74
  loss = None
75
  if pii_labels is not None:
76
- loss = self.config.pii_loss_weight * F.cross_entropy(pii_logits, pii_labels)
 
 
77
  if type_labels is not None and (type_labels != -100).any():
78
  type_loss = F.cross_entropy(type_logits, type_labels, ignore_index=-100)
79
  loss = loss + self.config.type_loss_weight * type_loss
80
- return DualHeadOutput(loss=loss, pii_logits=pii_logits, type_logits=type_logits)
 
81
 
82
 
83
  def load_dual_head_model(name, type_labels, pii_loss_weight=1.0, type_loss_weight=1.0):
 
24
  model_type = "dual_head_bert"
25
 
26
  def __init__(self, num_type_labels=258, id2type_label=None, type_label2id=None,
27
+ pii_loss_weight=1.0, type_loss_weight=1.0, gate_temperature=1.0, **kwargs):
28
  super().__init__(**kwargs)
29
  self.num_type_labels = num_type_labels
30
  self.id2type_label = id2type_label or {}
31
  self.type_label2id = type_label2id or {}
32
  self.pii_loss_weight = pii_loss_weight
33
  self.type_loss_weight = type_loss_weight
34
+ # post-hoc temperature scaling (Guo et al. 2017) for the PII gate's confidence, fit by
35
+ # scripts/calibrate_gate.py *after* training on frozen logits -- never touched during
36
+ # training itself (fixed at 1.0 = no-op there). Dividing logits by T before softmax doesn't
37
+ # change argmax, so it recalibrates what "90% confident" means without changing any
38
+ # accuracy/precision/recall number anywhere else in this repo.
39
+ self.gate_temperature = gate_temperature
40
 
41
 
42
  @dataclass
 
44
  loss: Optional[torch.Tensor] = None
45
  pii_logits: Optional[torch.Tensor] = None
46
  type_logits: Optional[torch.Tensor] = None
47
+ pii_logits_raw: Optional[torch.Tensor] = None # pre-temperature-scaling, for calibration fitting
48
 
49
 
50
  class DualHeadBertForPIIClassification(PreTrainedModel):
 
75
  def forward(self, input_ids, attention_mask=None, pii_labels=None, type_labels=None, **kwargs):
76
  out = self.bert(input_ids=input_ids, attention_mask=attention_mask)
77
  pooled = self.dropout(out.pooler_output)
78
+ pii_logits_raw = self.pii_head(pooled)
79
+ pii_logits = pii_logits_raw / self.config.gate_temperature
80
  type_logits = self.type_head(pooled)
81
 
82
  loss = None
83
  if pii_labels is not None:
84
+ # trains on the raw (unscaled) logits -- gate_temperature is a post-hoc, post-training
85
+ # fit and must never affect gradients
86
+ loss = self.config.pii_loss_weight * F.cross_entropy(pii_logits_raw, pii_labels)
87
  if type_labels is not None and (type_labels != -100).any():
88
  type_loss = F.cross_entropy(type_logits, type_labels, ignore_index=-100)
89
  loss = loss + self.config.type_loss_weight * type_loss
90
+ return DualHeadOutput(loss=loss, pii_logits=pii_logits, type_logits=type_logits,
91
+ pii_logits_raw=pii_logits_raw)
92
 
93
 
94
  def load_dual_head_model(name, type_labels, pii_loss_weight=1.0, type_loss_weight=1.0):