adamrida commited on
Commit
4c52bbf
·
0 Parent(s):

PrivacyBench+ 1.0

Browse files
Files changed (44) hide show
  1. .gitattributes +60 -0
  2. CHANGELOG.md +41 -0
  3. MANIFEST.json +44 -0
  4. NOTICE.md +14 -0
  5. POLICY.md +47 -0
  6. README.md +186 -0
  7. SCHEMA-EXTENSIONS.md +50 -0
  8. SCORECARD.md +59 -0
  9. data/extensions/indirect_identifiers.jsonl +0 -0
  10. data/ground_truth/aaron_pfizer/spans.jsonl +0 -0
  11. data/ground_truth/camille_nike/spans.jsonl +0 -0
  12. data/ground_truth/daniel_lincoln_financial_group/spans.jsonl +0 -0
  13. data/ground_truth/devon_marriott_international/spans.jsonl +0 -0
  14. data/ground_truth/elena_stripe/spans.jsonl +0 -0
  15. data/ground_truth/grace_deere_company/spans.jsonl +0 -0
  16. data/ground_truth/hannah_salesforce/spans.jsonl +0 -0
  17. data/ground_truth/isabella_chipotle/spans.jsonl +0 -0
  18. data/ground_truth/malik_spotify/spans.jsonl +0 -0
  19. data/ground_truth/marcus_boeing/spans.jsonl +0 -0
  20. data/ground_truth/megan_donovan_eli_lilly/spans.jsonl +0 -0
  21. data/ground_truth/morgan_morgan_stanley/spans.jsonl +0 -0
  22. data/ground_truth/nora_caterpillar/spans.jsonl +0 -0
  23. data/ground_truth/priya_charles_schwab/spans.jsonl +0 -0
  24. data/ground_truth/ray_raymond_james/spans.jsonl +0 -0
  25. data/ground_truth/renee_tyson_foods/spans.jsonl +0 -0
  26. data/ground_truth/sofia_netflix/spans.jsonl +0 -0
  27. data/ground_truth/tanya_kroger/spans.jsonl +0 -0
  28. data/ground_truth/victor_delta_air_lines/spans.jsonl +0 -0
  29. data/ground_truth/wells_wells_fargo/spans.jsonl +0 -0
  30. data/ground_truth/yusuf_procter_gamble/spans.jsonl +0 -0
  31. data/human_annotations/daniel_lincoln_financial_group.jsonl +0 -0
  32. data/human_annotations/daniel_lincoln_financial_group_documents.jsonl +0 -0
  33. data/human_annotations/isabella_chipotle.jsonl +0 -0
  34. data/human_annotations/isabella_chipotle_documents.jsonl +0 -0
  35. data/human_annotations/megan_donovan_eli_lilly.jsonl +0 -0
  36. data/human_annotations/megan_donovan_eli_lilly_documents.jsonl +0 -0
  37. data/human_annotations/morgan_morgan_stanley.jsonl +0 -0
  38. data/human_annotations/morgan_morgan_stanley_documents.jsonl +0 -0
  39. data/human_annotations/nora_caterpillar.jsonl +0 -0
  40. data/human_annotations/nora_caterpillar_documents.jsonl +0 -0
  41. data/human_annotations/renee_tyson_foods.jsonl +0 -0
  42. data/human_annotations/renee_tyson_foods_documents.jsonl +0 -0
  43. review/decisions.jsonl.gz +3 -0
  44. score.py +71 -0
.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ ## 1.0 (November 2026)
4
+
5
+ First release. Changes relative to PrivacyBench v2.5:
6
+
7
+ | | PrivacyBench v2.5 | PrivacyBench+ 1.0 |
8
+ |---|---|---|
9
+ | Records | 24,251 | 24,251 |
10
+ | Labels, human-annotated set | 25,855 | 26,212 |
11
+ | Labels, native set | 130,370 | 144,192 |
12
+ | Spans marked unresolved | 0 | 1,861 |
13
+ | Indirect identifiers | 0 | 1,365 |
14
+
15
+ ### Added
16
+
17
+ - Missing names, including initials and monograms.
18
+ - Missing organizations, email addresses and account numbers.
19
+ - Indirect identifiers, in `data/extensions/indirect_identifiers.jsonl`.
20
+ - A scorer, `score.py`, with a second score that requires indirect identifiers.
21
+
22
+ ### Changed
23
+
24
+ - Organization spans include the legal suffix and exclude attached departments and punctuation.
25
+ - Street-only addresses are extended to the full postal address.
26
+ - Labels with the wrong type are retyped: person and organization homonyms, and given and family names.
27
+
28
+ ### Removed
29
+
30
+ - Organization and name labels on departments, internal tools, public bodies, products and chat slang. Products,
31
+ brands, programmes, tickers and named sites that point to one company are recorded as indirect identifiers.
32
+
33
+ ### Review record
34
+
35
+ 28,548 review decisions: 13,054 made by a human reviewer and 15,494 applied automatically from the labelling policy
36
+ and the human reviewer's precedents. Of the automatic decisions, 13,200 applied a correction, 1,964 declined a
37
+ proposal and 330 left the case unresolved. All decisions are in `review/decisions.jsonl.gz`.
38
+
39
+ ### Source version
40
+
41
+ Based on PrivacyBench v2.5 at revision `a9f3e392`. Later changes to the source dataset are not included.
MANIFEST.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "CHANGELOG.md": "98e3d691e2f70a3efe447d2de7537a8811b034898b853ad9908055f4825611f3",
3
+ "NOTICE.md": "5954fa2ef2c8042c1ad3309af0c3eb6bf41c47f5cde31cd0e63f423e86ab25dd",
4
+ "POLICY.md": "cf2b9beba809a91ad273a9814800d9cb6abe8af385ed766782b012cde6897987",
5
+ "README.md": "bd96c0f992e3076d4525905cc422434442fa9fdc23cbd926092464f19b59f476",
6
+ "SCHEMA-EXTENSIONS.md": "ec3dbf4bc682e10ef3dd24f269d9a9524606d9203116ba336dc31fd610611d2a",
7
+ "SCORECARD.md": "3a3b7f75384951c8e2b8913636cbff24fdffd854bc4859d8b145317c49e7815f",
8
+ "data/extensions/indirect_identifiers.jsonl": "0a6fb22fd76da47ae84124250b8ac50382ac31f8d86112f22110c7fdcdba3927",
9
+ "data/ground_truth/aaron_pfizer/spans.jsonl": "956d98d10356e8fa48249da1858cd21d7a79f24f37bb359341e728760155764b",
10
+ "data/ground_truth/camille_nike/spans.jsonl": "edaf50c8c2ddfe810b19a91bd27462d8065efd02ad5079231524e94171388e92",
11
+ "data/ground_truth/daniel_lincoln_financial_group/spans.jsonl": "5857a53f31fa504a80ff58ede1c867ca84a037e7387de517dcc10e61e56e501c",
12
+ "data/ground_truth/devon_marriott_international/spans.jsonl": "fd5032f4227a754de184322a291eb83f05fd18ce23c549fd2a9970bcee8c1cf0",
13
+ "data/ground_truth/elena_stripe/spans.jsonl": "909b552279a71aee297763211e6d196088345d0d6ada392454d6d0953cbad0c8",
14
+ "data/ground_truth/grace_deere_company/spans.jsonl": "4f1a0e3e4b2ffcaf19cd93c095d0e994aa3d27b39ff013d413aabc3b29cb25ae",
15
+ "data/ground_truth/hannah_salesforce/spans.jsonl": "6892b7b3d390c48700afdb0d9b637d945c65a5773637ff0263d4194138b077af",
16
+ "data/ground_truth/isabella_chipotle/spans.jsonl": "addc16442d06df54550bab5d6f9d307918151bb69f4467bdef20b9616018bcf5",
17
+ "data/ground_truth/malik_spotify/spans.jsonl": "d17f0059fbc02eb9c9b5ddde2e0b0734cea23914b4a052af3badfaf51283299f",
18
+ "data/ground_truth/marcus_boeing/spans.jsonl": "f4c2608c812fe7d1fc9935ac2d951803baa6eb3cb911f1f082ca5de3e308acfd",
19
+ "data/ground_truth/megan_donovan_eli_lilly/spans.jsonl": "6fd5019d8f8be8597a9632df990fc9868e0b162ef727abbdfbe6cc5f4c20beb6",
20
+ "data/ground_truth/morgan_morgan_stanley/spans.jsonl": "514cbf54b4bd928a8e09031ff7b666f6f019930757cd937a51072d68210ad36d",
21
+ "data/ground_truth/nora_caterpillar/spans.jsonl": "a75a2350b4c75ed8aa8bcd85f05770c7f9c2cc3b80a8346a84d0c3df3c3c55a4",
22
+ "data/ground_truth/priya_charles_schwab/spans.jsonl": "2bb2d3a01c7cbb355af7f5b1a65b1b8dfe54aa1b608277f5f5d59b7a96e88653",
23
+ "data/ground_truth/ray_raymond_james/spans.jsonl": "b4eb1082865e61d0796022047e554459dfb22429163a4bd26c81f4e4c41ba8c9",
24
+ "data/ground_truth/renee_tyson_foods/spans.jsonl": "c00ec718547971c9c7d63020e9dcad366da11b407f2bbc8cb4617614ff86081f",
25
+ "data/ground_truth/sofia_netflix/spans.jsonl": "6b80c25667b34a28cb54c2c7e74dc067595ae663c7e5e2a565cbf662b6e11ae2",
26
+ "data/ground_truth/tanya_kroger/spans.jsonl": "70dc52408aa89fea7cc266ae4da9fc725d1737e046f690b3a984fe91bc6e3bab",
27
+ "data/ground_truth/victor_delta_air_lines/spans.jsonl": "32a90896c3c0c7979ac27cf97b5ea9ae8e6754da0b4030c33d9f991fb73fab22",
28
+ "data/ground_truth/wells_wells_fargo/spans.jsonl": "f9387ade8fe3135371332fb01f5e3da49ca35c4dab3d9449a0255217903f2b4c",
29
+ "data/ground_truth/yusuf_procter_gamble/spans.jsonl": "afecd65e5707a4ecf542e2adde36c69df6168937456f69242355797e8886b0a0",
30
+ "data/human_annotations/daniel_lincoln_financial_group.jsonl": "296889c9a24c595ca7b746c965bfdf9ea4907da7f5567c5fc438cdf187adb616",
31
+ "data/human_annotations/daniel_lincoln_financial_group_documents.jsonl": "e59c09d8e1da77bd5760b3abfabc2e484596b44ddca701c25b6737bd20956317",
32
+ "data/human_annotations/isabella_chipotle.jsonl": "408bd1fffb717cb688e0cc4311cd4f794895dbbfbbbf569884bcb0492802d1ce",
33
+ "data/human_annotations/isabella_chipotle_documents.jsonl": "3922206fd8b83ab30ce9eab2686e35e065d960f084c09e2c45a674c6ef0af5b7",
34
+ "data/human_annotations/megan_donovan_eli_lilly.jsonl": "a2ab019a54a11cfefd56037d28b78104a3e32c9fd22f3c1d7b66a2aaebe87ee8",
35
+ "data/human_annotations/megan_donovan_eli_lilly_documents.jsonl": "bc439e438d55118620d531a589ffbea5cbbf9f62414d03229a9c96209c96604d",
36
+ "data/human_annotations/morgan_morgan_stanley.jsonl": "ca2f91a104a348ddaad7f455be772b3755aeb649a4477fcbd877478b1580de37",
37
+ "data/human_annotations/morgan_morgan_stanley_documents.jsonl": "6a88089caff770293f65d42b4171501701004eaa402b44b2f3129a24fd26e1ed",
38
+ "data/human_annotations/nora_caterpillar.jsonl": "f59912ba96fd09ec1993cdd38400fd45fabc79b1cb3eda6bcbe508411bcd5a9d",
39
+ "data/human_annotations/nora_caterpillar_documents.jsonl": "ef3c1de7b00382a9f063facb2b8ba970bbf43dfda2a40b86bf099139935c424d",
40
+ "data/human_annotations/renee_tyson_foods.jsonl": "327859a29e758790ee834662d73aaf66e4d604a4de1ec5f86127a9afb6bdfe31",
41
+ "data/human_annotations/renee_tyson_foods_documents.jsonl": "428a327327a209136046e2fd1256432b8c856d1f87a56cb6e67525d46030c1d0",
42
+ "review/decisions.jsonl.gz": "d18354857796387a26ac016fe9d50e2e0685baf200c31c99e30d154d5616bf0e",
43
+ "score.py": "29b6f85e90e0d1ed902e641852712e6882c5585228f5335db0c920dfe0712235"
44
+ }
NOTICE.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Notice
2
+
3
+ PrivacyBench+
4
+ Copyright 2026 Tracer. Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
5
+ https://creativecommons.org/licenses/by/4.0/
6
+
7
+ This dataset is a modified copy of PrivacyBench v2.5 by TonicAI, licensed under CC BY 4.0.
8
+ https://huggingface.co/datasets/TonicAI/Privacy-Bench
9
+
10
+ Modifications by Tracer: revised and added labels, spans marked unresolved, and an added file of indirect
11
+ identifiers. The text of the records is unchanged. The changes are summarised in `CHANGELOG.md` and listed in
12
+ `review/decisions.jsonl.gz`.
13
+
14
+ PrivacyBench+ is not affiliated with or endorsed by TonicAI.
POLICY.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Labelling policy
2
+
3
+ This policy defines which spans are labelled in PrivacyBench+. Labels are character spans over the unchanged source
4
+ text.
5
+
6
+ ## Principles
7
+
8
+ 1. Direct identifiers of a person are always labelled.
9
+ 2. An organization is labelled when it is the employer, client, customer or counterparty of the people in the text.
10
+ 3. Names that do not identify a specific company or person are not labelled.
11
+ 4. Names that reveal a company without naming it are recorded as indirect identifiers, outside the main labels.
12
+ 5. When the text does not settle a case, the span is marked unresolved and is excluded from scoring.
13
+
14
+ ## Rules by type
15
+
16
+ | Type | Labelled | Not labelled |
17
+ |---|---|---|
18
+ | `NAME_GIVEN`, `NAME_FAMILY` | Given and family names of people, including initials and monograms that stand for a name | Chat slang and common words that match a name |
19
+ | `ORGANIZATION` | Employers, clients, customers and counterparties. The span includes the legal suffix and excludes attached department names and punctuation | Internal tools (for example Slack, Zoom, SAP), public bodies (for example SEC, IRS), generic departments (for example Human Resources), products and brands |
20
+ | `EMAIL_ADDRESS`, `USERNAME`, `URL` | Always | |
21
+ | `PHONE_NUMBER`, `ACCOUNT_NUMBER`, `EMPLOYEE_ID` | Always | |
22
+ | `LOCATION_ADDRESS` | Postal addresses, with every component present in the text: street, city, state or region, postal code and country | A state, region or country mentioned outside an address |
23
+
24
+ Further rules:
25
+
26
+ - A tool name used as an employer or client is labelled as an organization. For example, Salesforce is labelled when
27
+ it is the employer or a client, and is not labelled in "log it in Salesforce".
28
+ - The tool exception applies to the bare name only. An account, username, email address or URL that contains the
29
+ name is still labelled.
30
+ - The type of a label follows its meaning in context. A person named Jordan is a name, not a location.
31
+
32
+ ## Indirect identifiers
33
+
34
+ Products, brands, programmes, tickers and named sites that belong to one company, and standalone cities, sites and
35
+ venues, are recorded in `data/extensions/indirect_identifiers.jsonl`. They are not part of `ground_truth_spans`. See
36
+ [SCHEMA-EXTENSIONS.md](SCHEMA-EXTENSIONS.md).
37
+
38
+ ## Unresolved spans
39
+
40
+ A span is marked unresolved when neither this policy nor the context decides it, for example a bare name in a
41
+ signature that could be a tool or a client. Unresolved spans are listed under `_tracer_review.unknown_targets`. They
42
+ are never treated as negatives: masking them is neither rewarded nor penalised.
43
+
44
+ ## Label scope
45
+
46
+ Chat messages in the human-annotated set carry five types (names, organization, email address, username). Documents
47
+ and the native set carry all ten.
README.md ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - token-classification
7
+ task_ids:
8
+ - named-entity-recognition
9
+ tags:
10
+ - pii
11
+ - privacy
12
+ - redaction
13
+ - anonymization
14
+ - synthetic
15
+ pretty_name: PrivacyBench+
16
+ size_categories:
17
+ - 10K<n<100K
18
+ source_datasets:
19
+ - TonicAI/Privacy-Bench
20
+ configs:
21
+ - config_name: messages
22
+ default: true
23
+ data_files:
24
+ - data/human_annotations/daniel_lincoln_financial_group.jsonl
25
+ - data/human_annotations/isabella_chipotle.jsonl
26
+ - data/human_annotations/megan_donovan_eli_lilly.jsonl
27
+ - data/human_annotations/morgan_morgan_stanley.jsonl
28
+ - data/human_annotations/nora_caterpillar.jsonl
29
+ - data/human_annotations/renee_tyson_foods.jsonl
30
+ - config_name: documents
31
+ data_files: "data/human_annotations/*_documents.jsonl"
32
+ ---
33
+
34
+ # PrivacyBench+
35
+
36
+ PrivacyBench+ is a benchmark for detecting personal and organization identifiers in workplace text. It contains
37
+ 24,251 synthetic chat messages, emails and document pages written for fictional employees of 21 companies, with
38
+ character-level span labels for ten entity types and a separate track for indirect identifiers.
39
+
40
+ It is a modified copy of [PrivacyBench v2.5](https://huggingface.co/datasets/TonicAI/Privacy-Bench) by TonicAI
41
+ (CC BY 4.0). The text is unchanged. The labels were revised against a written [labelling policy](POLICY.md), and
42
+ indirect identifiers were added.
43
+
44
+ - **Maintained by:** [Tracer](https://tracerml.ai)
45
+ - **Language:** English
46
+ - **License:** CC BY 4.0
47
+
48
+ | | PrivacyBench v2.5 | PrivacyBench+ |
49
+ |---|---|---|
50
+ | Records | 24,251 | 24,251 |
51
+ | Labels, human-annotated set (5,854 records, 6 companies) | 25,855 | 26,212 |
52
+ | Labels, native set (18,397 records, 21 companies) | 130,370 | 144,192 |
53
+ | Spans marked unresolved | 0 | 1,861 |
54
+ | Indirect identifiers | 0 | 1,365 |
55
+
56
+ ## Dataset structure
57
+
58
+ | Set | Files | Content |
59
+ |---|---|---|
60
+ | Human-annotated messages (config `messages`) | `data/human_annotations/<company>.jsonl` | 5,198 chat messages, 5 entity types |
61
+ | Human-annotated documents (config `documents`) | `data/human_annotations/<company>_documents.jsonl` | 656 document pages, 10 entity types |
62
+ | Native | `data/ground_truth/<company>/spans.jsonl` | 18,397 chat, email and document records for 21 companies, 10 entity types |
63
+
64
+ ```python
65
+ from datasets import load_dataset
66
+
67
+ messages = load_dataset("Tracer-ML/PrivacyBench-Plus", "messages", split="train")
68
+ documents = load_dataset("Tracer-ML/PrivacyBench-Plus", "documents", split="train")
69
+ ```
70
+
71
+ The native files are JSON Lines with metadata that varies by source format, and are read directly.
72
+
73
+ `data/extensions/indirect_identifiers.jsonl` lists the indirect identifiers for all three sets.
74
+
75
+ ### Fields
76
+
77
+ | Field | Description |
78
+ |---|---|
79
+ | `text` | The message or page text |
80
+ | `meta` | Source metadata (sender, recipients and time for messages; file name, format and page for documents) |
81
+ | `ground_truth_spans` | List of `{start, end, label, text}` with character offsets into `text` |
82
+ | `_tracer_review.unknown_targets` | Present on some records: spans whose status is unresolved |
83
+
84
+ ### Entity types
85
+
86
+ | Set | Types |
87
+ |---|---|
88
+ | Messages | `NAME_GIVEN`, `NAME_FAMILY`, `ORGANIZATION`, `EMAIL_ADDRESS`, `USERNAME` |
89
+ | Documents and native | The five above, plus `LOCATION_ADDRESS`, `ACCOUNT_NUMBER`, `PHONE_NUMBER`, `EMPLOYEE_ID`, `URL` |
90
+
91
+ Indirect identifiers are products, brands, programmes, tickers and sites that point to a single company, and
92
+ standalone places. They are described in [SCHEMA-EXTENSIONS.md](SCHEMA-EXTENSIONS.md).
93
+
94
+ ### Splits
95
+
96
+ The dataset has no fixed splits. The recommended evaluation set is the human-annotated records of two companies,
97
+ `megan_donovan_eli_lilly` and `nora_caterpillar` (1,962 records). The native set has broader coverage and is suited to
98
+ measuring recall.
99
+
100
+ ## Evaluation
101
+
102
+ ```bash
103
+ python score.py data predictions.jsonl
104
+ ```
105
+
106
+ `predictions.jsonl` has one line per record:
107
+
108
+ ```json
109
+ {"id": "<file name>:<line number>", "spans": [{"start": 0, "end": 5}]}
110
+ ```
111
+
112
+ The scorer uses only the Python standard library and evaluates the two recommended companies by default. It reports
113
+ two scores, both computed on masked characters with entity type ignored:
114
+
115
+ - **PII detection:** precision, recall and F1 against the labels. Records with unresolved spans are excluded, and
116
+ indirect identifiers are neutral.
117
+ - **Anonymization grade:** labels and indirect identifiers are both required, on every record. Also reports the share
118
+ of indirect identifiers hidden and the share of records with a required span left visible.
119
+
120
+ ## Results
121
+
122
+ PII detection on the recommended evaluation set. Full results are in [SCORECARD.md](SCORECARD.md).
123
+
124
+ | System | Precision | Recall | F1 |
125
+ |---|---|---|---|
126
+ | GPT-6 Astra (prompted) | 99.4 | 96.9 | 98.1 |
127
+ | [PIIX-560m](https://huggingface.co/Tracer-ML/PIIX-560m) | 96.5 | 97.2 | 96.9 |
128
+ | Fastino GLiNER2.5-base | 89.3 | 83.4 | 86.2 |
129
+ | Perplexity PII-Tracer | 86.1 | 72.9 | 79.0 |
130
+ | OpenAI Privacy Filter | 87.6 | 64.1 | 74.1 |
131
+ | Microsoft Presidio | 52.6 | 83.7 | 64.6 |
132
+
133
+ PIIX-560m is developed by Tracer.
134
+
135
+ ## Dataset creation
136
+
137
+ ### Source data
138
+
139
+ The text comes from PrivacyBench v2.5 and is synthetic. The people are fictional and the companies are real names
140
+ used in fictional scenarios. Record order and text are identical to the source, so labels can be joined to the
141
+ original files by file name and line number. The original documents (emails, PDF, Word and spreadsheet files) and the
142
+ generation tasks are available in the [source dataset](https://huggingface.co/datasets/TonicAI/Privacy-Bench).
143
+
144
+ ### Annotation
145
+
146
+ Labels were revised under the [labelling policy](POLICY.md). Candidate corrections were proposed by automated audits
147
+ and deterministic checks, then accepted or declined in review.
148
+
149
+ | Review decisions | Count |
150
+ |---|---|
151
+ | Made by a human reviewer | 13,054 |
152
+ | Applied automatically from the policy and the human reviewer's precedents, not individually checked by a person | 15,494 |
153
+
154
+ Every decision is recorded with its reason in `review/decisions.jsonl.gz`. The main changes are summarised in
155
+ [CHANGELOG.md](CHANGELOG.md).
156
+
157
+ ## Limitations
158
+
159
+ - The data is synthetic and English only.
160
+ - The revised labels have not been independently re-annotated. Many corrections were applied in groups of identical
161
+ changes.
162
+ - 1,861 spans are marked unresolved and are excluded from scoring.
163
+ - Indirect identifiers are not exhaustive. Job titles, dates and rare events are not covered.
164
+ - Labels on the native set are less complete than on the human-annotated set. Use it for recall.
165
+ - A score on this benchmark does not establish that a system anonymizes real data to a legal standard.
166
+
167
+ ## License and attribution
168
+
169
+ PrivacyBench+ is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
170
+
171
+ It is a modified copy of [PrivacyBench v2.5](https://huggingface.co/datasets/TonicAI/Privacy-Bench) by TonicAI, used
172
+ under CC BY 4.0. Modifications by Tracer: revised and added labels, spans marked unresolved, and an added file of
173
+ indirect identifiers. PrivacyBench+ is not affiliated with or endorsed by TonicAI.
174
+
175
+ ## Citation
176
+
177
+ ```bibtex
178
+ @misc{privacybenchplus2026,
179
+ title = {PrivacyBench+},
180
+ author = {Tracer},
181
+ year = {2026},
182
+ url = {https://huggingface.co/datasets/Tracer-ML/PrivacyBench-Plus}
183
+ }
184
+ ```
185
+
186
+ Please also cite the source dataset, [TonicAI PrivacyBench](https://huggingface.co/datasets/TonicAI/Privacy-Bench).
SCHEMA-EXTENSIONS.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Schema extensions
2
+
3
+ PrivacyBench+ keeps the ten entity types and the `ground_truth_spans` format of PrivacyBench v2.5, so existing
4
+ scorers and saved predictions remain compatible. The extensions below are additive.
5
+
6
+ ## Direct and indirect identifiers
7
+
8
+ Anonymization standards such as ISO/IEC 20889 and ISO/IEC 27559 distinguish two kinds of identifier:
9
+
10
+ - **Direct identifiers** point to a person or account on their own.
11
+ - **Indirect identifiers** name nobody, but narrow down who is involved when combined: an employer, a client, a
12
+ product only one company makes, a site, a city.
13
+
14
+ | Label | Identifier class |
15
+ |---|---|
16
+ | `NAME_GIVEN`, `NAME_FAMILY`, `EMAIL_ADDRESS`, `USERNAME`, `PHONE_NUMBER`, `ACCOUNT_NUMBER`, `EMPLOYEE_ID`, `LOCATION_ADDRESS`, `URL` | Direct |
17
+ | `ORGANIZATION` | Indirect |
18
+
19
+ ## Indirect identifier file
20
+
21
+ `data/extensions/indirect_identifiers.jsonl` has one JSON object per span that is not in `ground_truth_spans` but
22
+ reveals an organization or a place.
23
+
24
+ | Field | Description |
25
+ |---|---|
26
+ | `file`, `line` | Data file and line number of the record |
27
+ | `source_id` | Stable record identifier |
28
+ | `start`, `end`, `text` | Character span in the record text |
29
+ | `kind` | `organization_indicator` (product, brand, drug, aircraft model, programme, ticker, abbreviation, or a named division or site of one company) or `location` (standalone city, site or venue) |
30
+ | `identifier_class` | Always `indirect` |
31
+ | `origin` | `excluded_label` (previously labelled as an organization), `declined_addition` or `declined_address` |
32
+ | `basis`, `reviewer`, `finding_id` | Reason for the entry and review reference |
33
+
34
+ Examples: "737" (Boeing), "SkyBonus" (Delta), "Downy" (Procter & Gamble), "See & Spray" (John Deere), "Mounjaro"
35
+ (Eli Lilly), "Retail Link" (Walmart), "WMT" (Walmart), "Amsterdam", "Denver hub".
36
+
37
+ Generic departments, internal tools, public bodies and chat slang are not indirect identifiers.
38
+
39
+ ## Scores
40
+
41
+ - **PII detection:** the ten entity types in `ground_truth_spans`. Unresolved spans and indirect identifiers are
42
+ neutral: masking them is neither rewarded nor penalised.
43
+ - **Anonymization grade:** the labels and the indirect identifiers are both required. Reports character precision,
44
+ recall and F1 on the combined set, the share of indirect identifiers fully hidden, and the share of records with at
45
+ least one required span left visible.
46
+
47
+ ## Coverage
48
+
49
+ The indirect identifier file covers organization-revealing names and standalone places. Job titles, dates and rare
50
+ events are not covered. Organization roles and sensitive content categories are not annotated in this version.
SCORECARD.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Scorecard
2
+
3
+ Results on the recommended evaluation set: the human-annotated records of `megan_donovan_eli_lilly` and
4
+ `nora_caterpillar`. Scores are computed with `score.py` on masked characters, with entity type ignored.
5
+
6
+ | Column | Definition |
7
+ |---|---|
8
+ | Precision, Recall, F1 | PII detection, on the 1,877 records without unresolved spans |
9
+ | Not fully hidden | Share of labelled spans with at least one character left visible |
10
+ | Anonymization-grade F1 | Labels and indirect identifiers both required, on all 1,962 records (112 indirect identifiers) |
11
+ | Indirect identifiers hidden | Share of indirect identifiers fully masked |
12
+ | Records with a leak | Share of the 1,488 records with something to hide in which a required span is partly visible |
13
+
14
+ The configuration column gives the label set or prompt used for each system. Open models were run with the entity
15
+ types listed; other configurations may give different results.
16
+
17
+ ## Token classifiers and span models
18
+
19
+ | System | Configuration | Precision | Recall | F1 | Not fully hidden % | Anonymization-grade F1 | Indirect identifiers hidden % | Records with a leak % |
20
+ |---|---|---|---|---|---|---|---|---|
21
+ | **PIIX-560m** | default | 96.5 | 97.2 | 96.9 | 4.0 | 96.2 | 4.5 | 13.8 |
22
+ | **PIIX-560m** | `recall=4` | 92.1 | 98.5 | 95.2 | 2.5 | 94.7 | 18.8 | 9.2 |
23
+ | **PIIX-560m** | `recall=8` | 82.0 | 99.4 | 89.8 | 1.3 | 89.6 | 58.0 | 5.3 |
24
+ | Fastino GLiNER2.5-base | 10 benchmark types | 89.3 | 83.4 | 86.2 | 20.6 | 85.9 | 22.3 | 44.8 |
25
+ | Fastino GLiNER2-multi | 10 benchmark types | 85.2 | 84.4 | 84.8 | 18.6 | 83.6 | 48.2 | 42.3 |
26
+ | Fastino GLiNER2.5-multi | 10 short queries | 79.8 | 84.1 | 81.9 | 20.4 | 82.6 | 17.0 | 41.4 |
27
+ | Fastino GLiNER2-large | 10 benchmark types | 78.5 | 85.5 | 81.8 | 12.6 | 81.6 | 42.9 | 29.1 |
28
+ | Perplexity PII-Tracer | native labels | 86.1 | 72.9 | 79.0 | 26.7 | 78.2 | 8.9 | 56.5 |
29
+ | GLiNER multi-PII | 53 published types | 72.8 | 85.8 | 78.7 | 16.7 | 79.7 | 8.0 | 36.0 |
30
+ | Fastino GLiNER2.5-multi | 10 benchmark types | 85.7 | 69.3 | 76.6 | 41.2 | 77.7 | 9.8 | 61.2 |
31
+ | OpenAI Privacy Filter | native labels | 87.6 | 64.1 | 74.1 | 33.7 | 72.2 | 17.0 | 62.6 |
32
+ | Fastino GLiNER2 privacy-filter PII multi | 42 native labels | 70.6 | 75.6 | 73.0 | 23.1 | 73.0 | 42.9 | 45.0 |
33
+ | Fastino GLiNER2 Guardrails PII Multi | 42 native labels | 67.2 | 77.6 | 72.0 | 21.5 | 71.9 | 52.7 | 41.2 |
34
+ | NuMind NuNER Zero | 16 short queries | 61.4 | 79.7 | 69.4 | 25.1 | 71.0 | 31.2 | 22.2 |
35
+ | OpenMed privacy-filter-nemotron | 55 native labels | 66.8 | 72.0 | 69.3 | 30.4 | 68.9 | 1.8 | 59.5 |
36
+ | GLiNER large v2.1 | 16 short queries | 59.7 | 81.6 | 68.9 | 21.5 | 70.2 | 38.4 | 51.1 |
37
+ | Liquid LFM2.5 Encoder 350M PII | 40 native labels | 91.6 | 54.3 | 68.2 | 58.6 | 67.8 | 1.8 | 71.6 |
38
+ | PIIBench DeBERTa base | 82 native labels | 53.1 | 94.5 | 68.0 | 10.4 | 68.7 | 9.8 | 27.1 |
39
+ | Knowledgator GLiNER PII-large v1.0 | 40 published types | 77.3 | 56.7 | 65.4 | 48.3 | 63.1 | 28.6 | 53.4 |
40
+ | Fastino GLiNER2.5-multi | 28 ai4privacy types | 77.4 | 56.3 | 65.2 | 56.3 | 64.7 | 65.2 | 73.3 |
41
+ | Microsoft Presidio 2.2.364 | English, spaCy en_core_web_lg | 52.6 | 83.7 | 64.6 | 16.3 | 65.8 | 43.8 | 44.8 |
42
+ | Fastino GLiNER2.5-base | 28 ai4privacy types | 68.3 | 60.5 | 64.1 | 48.3 | 63.9 | 68.8 | 82.5 |
43
+ | Davlan XLM-R base NER HRL | 4 native labels | 74.8 | 56.1 | 64.1 | 36.3 | 66.2 | 1.8 | 77.8 |
44
+ | NVIDIA GLiNER-PII | 55 native labels | 52.1 | 79.3 | 62.9 | 21.1 | 62.4 | 27.7 | 37.7 |
45
+ | Knowledgator GLiNER bi-large v1.0 | 16 short queries | 46.5 | 95.6 | 62.6 | 10.7 | 64.6 | 93.8 | 33.8 |
46
+ | GLiNER multi v2.1 | 16 short queries | 60.5 | 64.1 | 62.2 | 31.0 | 62.6 | 9.8 | 58.9 |
47
+ | Piiranha | 17 native labels | 75.4 | 49.8 | 60.0 | 59.5 | 61.2 | 1.8 | 69.4 |
48
+ | Fastino GLiNER2-multi | 28 ai4privacy types | 53.6 | 67.3 | 59.7 | 37.8 | 59.5 | 27.7 | 55.3 |
49
+ | Fastino GLiNER2-large | 28 ai4privacy types | 51.1 | 69.7 | 59.0 | 29.1 | 58.8 | 50.9 | 48.6 |
50
+ | Gretel GLiNER bi-large v1.0 | 42 published types | 88.3 | 37.3 | 52.4 | 67.2 | 50.2 | 3.6 | 71.9 |
51
+ | SpanMarker mBERT MultiNERD | 15 native labels | 64.2 | 39.7 | 49.0 | 54.1 | 51.7 | 1.8 | 89.7 |
52
+
53
+ ## Large language models
54
+
55
+ | System | Configuration | Precision | Recall | F1 | Not fully hidden % | Anonymization-grade F1 | Indirect identifiers hidden % | Records with a leak % |
56
+ |---|---|---|---|---|---|---|---|---|
57
+ | GPT-6 Astra | prompted | 99.4 | 96.9 | 98.1 | 6.4 | 97.8 | 0.9 | 22.2 |
58
+ | GPT-6.1 Sol | prompted | 99.3 | 96.8 | 98.1 | 6.6 | 97.7 | 0.9 | 22.4 |
59
+ | DeepSeek V4.1 Flash | span-extraction prompt | 79.3 | 93.4 | 85.7 | 9.0 | 85.6 | 95.5 | 22.2 |
data/extensions/indirect_identifiers.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/aaron_pfizer/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/camille_nike/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/daniel_lincoln_financial_group/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/devon_marriott_international/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/elena_stripe/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/grace_deere_company/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/hannah_salesforce/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/isabella_chipotle/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/malik_spotify/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/marcus_boeing/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/megan_donovan_eli_lilly/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/morgan_morgan_stanley/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/nora_caterpillar/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/priya_charles_schwab/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/ray_raymond_james/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/renee_tyson_foods/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/sofia_netflix/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/tanya_kroger/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/victor_delta_air_lines/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/wells_wells_fargo/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/ground_truth/yusuf_procter_gamble/spans.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/daniel_lincoln_financial_group.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/daniel_lincoln_financial_group_documents.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/isabella_chipotle.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/isabella_chipotle_documents.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/megan_donovan_eli_lilly.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/megan_donovan_eli_lilly_documents.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/morgan_morgan_stanley.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/morgan_morgan_stanley_documents.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/nora_caterpillar.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/nora_caterpillar_documents.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/renee_tyson_foods.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/human_annotations/renee_tyson_foods_documents.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
review/decisions.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d18354857796387a26ac016fe9d50e2e0685baf200c31c99e30d154d5616bf0e
3
+ size 1685260
score.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Score a PII detector on PrivacyBench+. Standard library only.
2
+
3
+ python score.py DATA_DIR predictions.jsonl [--companies a,b] (default: the two suggested test companies)
4
+
5
+ predictions.jsonl: one JSON object per line, {"id": "<file name>:<line number>", "spans": [{"start": 0, "end": 5}, ...]}
6
+ where <file name> is the file under DATA_DIR/human_annotations and <line number> starts at 1. Entity type is ignored:
7
+ the benchmark measures whether sensitive characters are masked.
8
+
9
+ Two scores are printed.
10
+ PII detection labels in ground_truth_spans. Records with unresolved ("unknown") spans are left out.
11
+ Characters of indirect identifiers are neutral (masking them is neither rewarded nor punished).
12
+ Anonymization grade every record; labels and indirect identifiers are both required; unresolved spans are neutral.
13
+ """
14
+ import json, sys
15
+ from collections import Counter, defaultdict
16
+ from pathlib import Path
17
+
18
+ TEST_COMPANIES = ['megan_donovan_eli_lilly', 'nora_caterpillar']
19
+
20
+
21
+ def bits(spans):
22
+ v = 0
23
+ for a, b in spans: v |= ((1 << (b - a)) - 1) << a
24
+ return v
25
+
26
+
27
+ def main():
28
+ data, pred_path = Path(sys.argv[1]), sys.argv[2]
29
+ companies = sys.argv[sys.argv.index('--companies') + 1].split(',') if '--companies' in sys.argv else TEST_COMPANIES
30
+ ind = defaultdict(list)
31
+ for l in (data / 'extensions/indirect_identifiers.jsonl').open():
32
+ t = json.loads(l)
33
+ if t['file'].startswith('human_annotations/'): ind[f"{Path(t['file']).name}:{t['line']}"].append((t['start'], t['end']))
34
+ recs = {}
35
+ for f in sorted((data / 'human_annotations').glob('*.jsonl')):
36
+ if f.stem.removesuffix('_documents') not in companies: continue
37
+ for n, line in enumerate(f.open(), 1):
38
+ r = json.loads(line)
39
+ recs[f'{f.name}:{n}'] = ([(s['start'], s['end']) for s in r['ground_truth_spans']],
40
+ [(u['annotation']['start'], u['annotation']['end']) for u in r.get('_tracer_review', {}).get('unknown_targets', [])])
41
+ pred = {}
42
+ for l in open(pred_path):
43
+ if l.strip(): p = json.loads(l); pred[p['id']] = [(s['start'], s['end']) for s in p['spans']]
44
+ c = Counter()
45
+ for rid, (gold, unknown) in recs.items():
46
+ if rid not in pred: c['missing'] += 1
47
+ q = bits(pred.get(rid, [])); g = bits(gold); targets = ind.get(rid, []); im = bits(targets)
48
+ for a, b in targets:
49
+ m = ((1 << (b - a)) - 1) << a; c['ind'] += 1; c['ind_hidden'] += (m & q) == m
50
+ req = g | im; neutral = bits(unknown) & ~req
51
+ c['a_tp'] += (req & q).bit_count(); c['a_pred'] += (q & ~neutral).bit_count(); c['a_gold'] += req.bit_count()
52
+ need = gold + targets
53
+ c['req_rows'] += bool(need); c['leak_rows'] += any((((1 << (b - a)) - 1) << a) & ~q for a, b in need)
54
+ if unknown: continue
55
+ c['rows'] += 1
56
+ c['tp'] += (g & q).bit_count(); c['pred'] += (q & ~(im & ~g)).bit_count(); c['gold'] += g.bit_count()
57
+ for a, b in gold:
58
+ m = ((1 << (b - a)) - 1) << a; c['spans'] += 1; c['hidden'] += (m & q) == m
59
+ f = lambda a, b: 100 * a / b if b else float('nan')
60
+ out = {'companies': companies, 'records': len(recs), 'records_without_prediction': c['missing'],
61
+ 'pii_detection': {'records_scored': c['rows'], 'precision': f(c['tp'], c['pred']), 'recall': f(c['tp'], c['gold']),
62
+ 'f1': f(2 * c['tp'], c['pred'] + c['gold']), 'spans_not_fully_hidden_pct': 100 - f(c['hidden'], c['spans'])},
63
+ 'anonymization_grade': {'records_scored': len(recs), 'precision': f(c['a_tp'], c['a_pred']), 'recall': f(c['a_tp'], c['a_gold']),
64
+ 'f1': f(2 * c['a_tp'], c['a_pred'] + c['a_gold']), 'indirect_identifiers': c['ind'],
65
+ 'indirect_identifiers_hidden_pct': f(c['ind_hidden'], c['ind']),
66
+ 'records_with_a_leak_pct': f(c['leak_rows'], c['req_rows']), 'records_with_something_to_hide': c['req_rows']}}
67
+ print(json.dumps(out, indent=1))
68
+
69
+
70
+ if __name__ == '__main__':
71
+ main()