code-pii / stats.md
josh-hud's picture
Release v3 cross-document coreference dataset
80a02b9 verified
|
Raw History Blame Contribute Delete
7.82 kB
# Dataset statistics
Generated from 70 shards of `codeparrot/github-code-clean` (shards 0-69), permissive licenses only.
## Totals
| metric | value |
|---|---:|
| records (files) | 5,278,400 |
| files with >=1 secret span | 3,491,739 (66.2%) |
| files with no secret span (pure negatives; may contain hard negatives) | 1,786,661 (33.8%) |
| secret spans | 7,936,370 |
| hard-negative spans | 4,950,684 |
| clusters | 2,379,311 (records per cluster: 2.22) |
| entities (embedded tables) | 3,914,548 |
| entities in multi-file clusters recurring in >=2 files | 1,167,239 / 2,885,220 (40.5%) |
| secrets owned by a person | 500,980 |
| JSONL bytes | 47,856,733,695 (47.86 GB) |
| Parquet files / bytes (zstd) | 24 / 11,915,030,320 (11.92 GB) |
| base-corpus rows skipped: non-permissive license | 3,136,065 |
| base-corpus rows skipped: size outside [200 B, 200 KB] | 470,285 |
| wall time | 963.5 s with 4 workers |
| throughput (JSONL output) | 49.67 MB/s aggregate, ~12 MB/s per worker |
## Throughput / scaling
- Measured on a 4-vCPU VM with pre-downloaded shards: **50 MB/s** of JSONL output (12 MB/s per worker process; CPU-bound).
- One input shard (~355 MB parquet) yields ~600 MB JSONL (~75k records) in ~30 s per worker; shard download from the Hub measured at ~35 MB/s per stream (~10 s per shard), so download roughly matches processing when run with `--workers 4`.
- Extrapolation: 40 GB JSONL ~= 67 shards -> ~13 min of processing at 50 MB/s (plus ~11 min of downloads if not overlapped; the script overlaps them per worker). On 8 cores expect roughly half. Parquet conversion (zstd) adds ~2x the generation time and shrinks size ~2.3x.
- Full 880-shard corpus (permissive subset) would yield ~598 GB JSONL.
## Clusters (cross-document coreference)
Clusters by kind (`repo` = real multi-file repo, `bundle` = synthetic project of unrelated files, `singleton` = one file):
| cluster_kind | count | % |
|---|---:|---:|
| singleton | 1,161,632 | 48.8 |
| repo | 612,711 | 25.8 |
| bundle | 604,968 | 25.4 |
Records by cluster kind:
| cluster_kind | count | % |
|---|---:|---:|
| bundle | 2,157,603 | 40.9 |
| repo | 1,959,165 | 37.1 |
| singleton | 1,161,632 | 22.0 |
Files per cluster:
| cluster_size | count | % |
|---|---:|---:|
| 1 | 1,161,785 | 48.8 |
| 2 | 562,133 | 23.6 |
| 3 | 249,362 | 10.5 |
| 4 | 135,923 | 5.7 |
| 5 | 94,680 | 4.0 |
| 6 | 65,780 | 2.8 |
| 7 | 44,693 | 1.9 |
| 8 | 64,955 | 2.7 |
## Entities
| entity_type | count | % |
|---|---:|---:|
| api_key | 1,384,896 | 35.4 |
| person | 717,813 | 18.3 |
| password | 674,978 | 17.2 |
| token | 498,684 | 12.7 |
| email | 341,310 | 8.7 |
| private_key | 296,867 | 7.6 |
Documents per entity (all clusters; 1 = no cross-document recurrence):
| n_docs | count | % |
|---|---:|---:|
| 1 | 2,747,309 | 70.2 |
| 2 | 807,464 | 20.6 |
| 3 | 249,818 | 6.4 |
| 4 | 80,686 | 2.1 |
| 5 | 23,140 | 0.6 |
| 6 | 6,131 | 0.2 |
Mentions per entity:
| n_mentions (8 = 8+) | count | % |
|---|---:|---:|
| 1 | 1,990,693 | 50.9 |
| 2 | 933,660 | 23.9 |
| 3 | 457,212 | 11.7 |
| 4 | 247,281 | 6.3 |
| 5 | 147,967 | 3.8 |
| 6 | 66,018 | 1.7 |
| 7 | 33,686 | 0.9 |
| 8 | 38,031 | 1.0 |
Secret spans by surface form type:
| surface_form_type | count | % |
|---|---:|---:|
| literal | 6,509,816 | 82.0 |
| full_name | 435,636 | 5.5 |
| username | 354,633 | 4.5 |
| escaped_literal | 255,658 | 3.2 |
| email | 217,690 | 2.7 |
| first_name | 108,611 | 1.4 |
| last_name | 32,587 | 0.4 |
| handle | 21,739 | 0.3 |
## Secret spans by label
| label | count | % |
|---|---:|---:|
| api_key | 2,939,108 | 37.0 |
| password | 1,424,697 | 18.0 |
| token | 1,045,257 | 13.2 |
| email | 943,133 | 11.9 |
| private_key | 630,969 | 8.0 |
| person_name | 576,834 | 7.3 |
| username | 376,372 | 4.7 |
## Secret spans by value_type
| value_type | count | % |
|---|---:|---:|
| generic_hex_key | 2,087,008 | 26.3 |
| password | 1,424,697 | 18.0 |
| email | 943,133 | 11.9 |
| pem_private_key | 630,969 | 8.0 |
| full_name | 435,636 | 5.5 |
| username | 354,633 | 4.5 |
| generic_hex_token | 180,240 | 2.3 |
| aws_access_key_id | 139,245 | 1.8 |
| generic_alnum_token | 119,300 | 1.5 |
| basic_auth_b64 | 109,577 | 1.4 |
| first_name | 108,611 | 1.4 |
| generic_dashed_token | 102,788 | 1.3 |
| bearer_token_opaque | 95,163 | 1.2 |
| jwt | 91,667 | 1.2 |
| generic_lower_key | 85,773 | 1.1 |
| generic_base64_secret | 85,494 | 1.1 |
| generic_hex_key_upper | 84,085 | 1.1 |
| generic_alnum_key | 68,842 | 0.9 |
| github_pat | 68,772 | 0.9 |
| aws_secret_access_key | 67,916 | 0.9 |
| digitalocean_pat | 50,695 | 0.6 |
| google_api_key | 46,089 | 0.6 |
| slack_token | 45,792 | 0.6 |
| stripe_secret_key | 45,511 | 0.6 |
| generic_upper_key | 42,887 | 0.5 |
| generic_upper_token | 40,271 | 0.5 |
| last_name | 32,587 | 0.4 |
| mailgun_api_key | 30,031 | 0.4 |
| generic_hex_dashed_key | 29,657 | 0.4 |
| twilio_api_key | 28,909 | 0.4 |
| gitlab_pat | 26,254 | 0.3 |
| discord_bot_token | 23,618 | 0.3 |
| npm_token | 22,979 | 0.3 |
| hf_token | 22,879 | 0.3 |
| slack_webhook | 22,810 | 0.3 |
| github_fine_grained_pat | 22,452 | 0.3 |
| handle | 21,739 | 0.3 |
| azure_client_secret | 21,648 | 0.3 |
| sendgrid_api_key | 20,612 | 0.3 |
| anthropic_api_key | 20,539 | 0.3 |
| openai_api_key | 20,256 | 0.3 |
| generic_digit_key | 14,606 | 0.2 |
## Hard-negative spans by value_type
| value_type | count | % |
|---|---:|---:|
| ssh_public_key | 414,055 | 8.4 |
| uuid | 413,392 | 8.4 |
| example_email | 412,768 | 8.3 |
| placeholder_name | 412,687 | 8.3 |
| base64_non_secret | 412,630 | 8.3 |
| sha1_git_sha | 412,551 | 8.3 |
| public_key_pem | 412,511 | 8.3 |
| env_var_reference | 412,495 | 8.3 |
| sha256_hash | 412,328 | 8.3 |
| md5_hash | 411,959 | 8.3 |
| version_or_id | 411,726 | 8.3 |
| placeholder | 411,582 | 8.3 |
## Secret spans by syntactic context
| context | count | % |
|---|---:|---:|
| assignment | 3,567,362 | 44.9 |
| comment | 1,057,198 | 13.3 |
| json_key | 860,567 | 10.8 |
| yaml_key | 810,404 | 10.2 |
| pem_block | 646,725 | 8.1 |
| auth_header | 457,619 | 5.8 |
| url_credential | 277,794 | 3.5 |
| function_arg | 133,346 | 1.7 |
| env_assignment | 125,355 | 1.6 |
## Records by language
| language | count | % |
|---|---:|---:|
| Java | 1,013,525 | 19.2 |
| JavaScript | 611,284 | 11.6 |
| HTML | 569,348 | 10.8 |
| PHP | 447,622 | 8.5 |
| C | 418,772 | 7.9 |
| Markdown | 377,703 | 7.2 |
| C# | 374,456 | 7.1 |
| Python | 342,346 | 6.5 |
| C++ | 276,426 | 5.2 |
| Ruby | 244,789 | 4.6 |
| GO | 142,183 | 2.7 |
| TypeScript | 118,371 | 2.2 |
| CSS | 77,104 | 1.5 |
| Scala | 53,472 | 1.0 |
| Shell | 52,401 | 1.0 |
| SQL | 19,549 | 0.4 |
| Haskell | 19,013 | 0.4 |
| Makefile | 18,329 | 0.3 |
| Rust | 18,294 | 0.3 |
| Lua | 14,602 | 0.3 |
| Perl | 14,562 | 0.3 |
| Dockerfile | 9,249 | 0.2 |
| PowerShell | 8,941 | 0.2 |
| TeX | 8,167 | 0.2 |
| CMake | 7,311 | 0.1 |
| Visual Basic | 5,753 | 0.1 |
| Batchfile | 5,395 | 0.1 |
| FORTRAN | 3,693 | 0.1 |
| Julia | 3,596 | 0.1 |
| Assembly | 2,144 | 0.0 |
## File size distribution (text field, sample of 2 shards)
| bucket | records |
|---|---:|
| <1 KB | 29,976 |
| 1-10 KB | 99,191 |
| 10-100 KB | 21,311 |
| >=100 KB | 858 |
## Validation (2 shards, 151,336 records)
- Offset assertion `text[start:end] == value` on every span and hard negative: **0 failures** (also asserted at generation time for all records).
- Regex scanner (gitleaks-style patterns for 15 value types) finds **100%** of injected spans of those types at the labeled offsets (secrets are not mangled by quoting/escaping/indentation).
- 20 random records eyeballed; see `validate.py --n-eyeball 20`.
## Held-out eval (eval_creddata.jsonl)
- 67,896 real labeled lines from Samsung/CredData (+-3 lines context): 15,753 GroundTruth=T, 48,061 F (hard negatives), 4,082 X (ambiguous/unclear, no span).