josh-hud commited on
Commit
ae15865
·
verified ·
1 Parent(s): c898981

Add 36% seeded preview of code-pii v2 (8d1b820)

Browse files
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: mixed-permissive
4
+ license_details: >-
5
+ Same terms as josh-hud/code-pii: each record keeps the license of its base file (MIT,
6
+ Apache-2.0, BSD-2/3-Clause, ISC, Unlicense or CC0-1.0, `license` column) as redistributed by
7
+ codeparrot/github-code-clean (Apache-2.0 compilation). Generator code Apache-2.0.
8
+ task_categories:
9
+ - token-classification
10
+ language:
11
+ - code
12
+ - en
13
+ tags:
14
+ - secrets-detection
15
+ - credential-detection
16
+ - pii
17
+ - code
18
+ - synthetic
19
+ - span-labels
20
+ - security
21
+ - preview
22
+ pretty_name: code-pii preview (36% seeded sample of code-pii v2)
23
+ size_categories:
24
+ - 1M<n<10M
25
+ configs:
26
+ - config_name: default
27
+ data_files:
28
+ - split: train
29
+ path: data/*.parquet
30
+ ---
31
+
32
+ # code-pii-preview
33
+
34
+ A **seeded, uniform ~36% sample of [josh-hud/code-pii](https://huggingface.co/datasets/josh-hud/code-pii) v2** (parent commit `8d1b820`), sized for local work: 4.03 GB of zstd Parquet instead of 11.17 GB. Same schema, same labels, same license terms. All documentation (construction, data dictionary, taxonomy, caveats, EDA notebook, generator code, CredData eval set) lives in the parent repo; this card only describes the sample.
35
+
36
+ ## How it was sampled
37
+
38
+ Every record of the parent's 70 JSONL shards was kept iff `blake2b("42:" + id) / 2^64 < 0.36` (`preview_subset.py --frac 0.36 --seed 42`, script in the parent repo). The decision depends only on the record `id`, so the sample is reproducible, order-independent, and uniform across shards; language, label, context and positive/negative proportions therefore match the parent in expectation, and `stats.md` verifies they match in practice to within 0.05 percentage points.
39
+
40
+ ## Contents
41
+
42
+ | path | description |
43
+ |---|---|
44
+ | `data/train-AAAAA-BBBBB.parquet` | 8 files (7 x ~520 MB + 1 x 404 MB), zstd; AAAAA-BBBBB = parent shard range the file was drawn from |
45
+ | `sample.jsonl` | 500 records reservoir-sampled from the last file, same schema |
46
+ | `stats.md` | counts, file list, and label / language / context / value_type comparison against the full v2 set |
47
+
48
+ ## Numbers
49
+
50
+ | | preview | full v2 | ratio |
51
+ |---|---:|---:|---:|
52
+ | records | 1,900,554 | 5,278,400 | 0.360 |
53
+ | files with >=1 secret span | 1,211,296 (63.7%) | 3,365,090 (63.8%) | 0.360 |
54
+ | secret spans | 2,435,889 | 6,765,485 | 0.360 |
55
+ | hard-negative spans | 1,781,952 | 4,947,748 | 0.360 |
56
+ | Parquet bytes | 4,030,406,662 | 11,167,063,550 | 0.361 |
57
+
58
+ Label mix: api_key 43.5%, password 20.9%, token 15.6%, email 10.7%, private_key 9.3% (identical to the parent within 0.03 pp). Language mix: Java 19.2%, JavaScript 11.6%, HTML 10.8%, PHP 8.5%, C 8.0%, Markdown 7.1%, C# 7.1%, Python 6.5%, ... (within 0.05 pp of the parent).
59
+
60
+ ## Schema (unchanged from the parent)
61
+
62
+ `id, source, repo, license, language, path, text, spans[], hard_negatives[]`; each span `{start, end, label, value_type, context, synthetic, value}` with 0-based, end-exclusive **code-point** offsets into `text` (`text[start:end] == value`). `label` in `spans` is one of `api_key`, `password`, `token`, `private_key`, `email`; in `hard_negatives` it is always `not_secret`. Full field documentation: [parent `DATA_DICTIONARY.md`](https://huggingface.co/datasets/josh-hud/code-pii/blob/main/DATA_DICTIONARY.md).
63
+
64
+ ## Loading
65
+
66
+ ```bash
67
+ # whole preview (4.03 GB)
68
+ hf download josh-hud/code-pii-preview --repo-type dataset --local-dir ./code-pii-preview
69
+ # (older CLI: huggingface-cli download josh-hud/code-pii-preview --repo-type dataset --local-dir ./code-pii-preview)
70
+ ```
71
+
72
+ ```python
73
+ from datasets import load_dataset
74
+ ds = load_dataset("josh-hud/code-pii-preview", split="train") # or streaming=True
75
+ rec = ds[0]
76
+ for s in rec["spans"]:
77
+ assert rec["text"][s["start"]:s["end"]] == s["value"]
78
+ ```
79
+
80
+ Validation: `validate.py` (parent repo) run on `train-00063-00069.parquet` re-serialised to JSONL reported 0 offset mismatches across 190,413 records.
81
+
82
+ ## Caveats
83
+
84
+ Everything in the parent's caveats applies (random-line injection artifacts, unscrubbed base corpus, hex-key vs hash negatives distinguished only by variable name, Java/JS/HTML-heavy language mix, secrets + emails only). Because sampling is by record, repositories that appear in several parent files may be partially represented here. Use the parent's `eval_creddata.jsonl` (real CredData lines) for evaluation; do not evaluate on this sample.
data/train-00000-00008.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4216ec43a48fcd6fd2db16b46f0ad03a00ee01f8c12100f6d23051eb96d5f095
3
+ size 515528985
data/train-00009-00017.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38f31ccc49a5de2675346c9ee3a85ccf415e789e035ba0050217e6114f5df945
3
+ size 518233338
data/train-00018-00026.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8af95c1abf6879146056517acb4ceacaac8f2bf0d24e6f9a2604713787a6bd32
3
+ size 520652464
data/train-00027-00035.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5be9cb275e555045960e2a9c63453680d936f120152d189c50a1549bcb5b41d
3
+ size 514197264
data/train-00036-00044.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:801cda17dcf962768c45fae5c982bef61164d924c56a326857710672d538b3a9
3
+ size 519952783
data/train-00045-00053.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff3c1b429e93225f7ae3fc9dcb37ab460126be7a72477ad0006ca5a0148eebae
3
+ size 520842028
data/train-00054-00062.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:396d79aa4ca885ffebea217be727660f636e5014271b0ea38b167974414dfa50
3
+ size 516925983
data/train-00063-00069.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91533bf33394dca831fcce1945c62c8469d8c71fac3c9a95c90f63447e4f592f
3
+ size 404073817
sample.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
stats.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # code-pii-preview: statistics and comparison with the full v2 set
2
+
3
+ Seeded uniform sample (keep probability 0.36, seed 42, decision = blake2b(seed:id) < frac) over all 70 JSONL shards of josh-hud/code-pii v2 (commit 8d1b820).
4
+
5
+ ## Totals
6
+
7
+ | metric | preview | full v2 | preview / full |
8
+ |---|---:|---:|---:|
9
+ | records | 1,900,554 | 5,278,400 | 0.360 |
10
+ | files with >=1 secret span | 1,211,296 | 3,365,090 | 0.360 |
11
+ | files with no secret span | 689,258 | 1,913,310 | 0.360 |
12
+ | secret spans | 2,435,889 | 6,765,485 | 0.360 |
13
+ | hard-negative spans | 1,781,952 | 4,947,748 | 0.360 |
14
+ | JSONL bytes (uncompressed) | 15,088,361,828 | 42,079,749,385 | 0.359 |
15
+ | Parquet files / bytes (zstd) | 8 / 4,030,406,662 (4.03 GB) | 24 / 11,167,063,550 (11.17 GB) | 0.361 |
16
+
17
+ ## Files
18
+ | file | records | bytes |
19
+ |---|---:|---:|
20
+ | data/train-00000-00008.parquet | 244,168 | 515,528,985 |
21
+ | data/train-00009-00017.parquet | 244,593 | 518,233,338 |
22
+ | data/train-00018-00026.parquet | 244,461 | 520,652,464 |
23
+ | data/train-00027-00035.parquet | 243,604 | 514,197,264 |
24
+ | data/train-00036-00044.parquet | 244,822 | 519,952,783 |
25
+ | data/train-00045-00053.parquet | 244,720 | 520,842,028 |
26
+ | data/train-00054-00062.parquet | 243,773 | 516,925,983 |
27
+ | data/train-00063-00069.parquet | 190,413 | 404,073,817 |
28
+
29
+ ## Secret spans by label
30
+
31
+ | label | preview count | preview % | full % | diff (pp) |
32
+ |---|---:|---:|---:|---:|
33
+ | api_key | 1,058,660 | 43.46 | 43.48 | -0.02 |
34
+ | password | 508,976 | 20.89 | 20.86 | +0.03 |
35
+ | token | 380,393 | 15.62 | 15.64 | -0.02 |
36
+ | email | 260,874 | 10.71 | 10.70 | +0.01 |
37
+ | private_key | 226,986 | 9.32 | 9.32 | -0.00 |
38
+
39
+ max absolute difference: 0.03 percentage points
40
+
41
+ ## Records by language
42
+
43
+ | language | preview count | preview % | full % | diff (pp) |
44
+ |---|---:|---:|---:|---:|
45
+ | Java | 365,255 | 19.22 | 19.20 | +0.02 |
46
+ | JavaScript | 220,020 | 11.58 | 11.58 | -0.00 |
47
+ | HTML | 205,869 | 10.83 | 10.79 | +0.05 |
48
+ | PHP | 160,954 | 8.47 | 8.48 | -0.01 |
49
+ | C | 150,900 | 7.94 | 7.93 | +0.01 |
50
+ | Markdown | 135,066 | 7.11 | 7.16 | -0.05 |
51
+ | C# | 134,192 | 7.06 | 7.09 | -0.03 |
52
+ | Python | 123,750 | 6.51 | 6.49 | +0.03 |
53
+ | C++ | 99,856 | 5.25 | 5.24 | +0.02 |
54
+ | Ruby | 87,894 | 4.62 | 4.64 | -0.01 |
55
+ | GO | 51,360 | 2.70 | 2.69 | +0.01 |
56
+ | TypeScript | 42,525 | 2.24 | 2.24 | -0.01 |
57
+ | CSS | 27,731 | 1.46 | 1.46 | -0.00 |
58
+ | Scala | 19,220 | 1.01 | 1.01 | -0.00 |
59
+ | Shell | 18,882 | 0.99 | 0.99 | +0.00 |
60
+ | SQL | 6,998 | 0.37 | 0.37 | -0.00 |
61
+ | Haskell | 6,878 | 0.36 | 0.36 | +0.00 |
62
+ | Makefile | 6,583 | 0.35 | 0.35 | -0.00 |
63
+ | Rust | 6,542 | 0.34 | 0.35 | -0.00 |
64
+ | Lua | 5,214 | 0.27 | 0.28 | -0.00 |
65
+ | Perl | 5,264 | 0.28 | 0.28 | +0.00 |
66
+ | Dockerfile | 3,289 | 0.17 | 0.18 | -0.00 |
67
+ | PowerShell | 3,287 | 0.17 | 0.17 | +0.00 |
68
+ | TeX | 2,960 | 0.16 | 0.15 | +0.00 |
69
+ | CMake | 2,585 | 0.14 | 0.14 | -0.00 |
70
+ | Visual Basic | 2,171 | 0.11 | 0.11 | +0.01 |
71
+ | Batchfile | 1,956 | 0.10 | 0.10 | +0.00 |
72
+ | FORTRAN | 1,299 | 0.07 | 0.07 | -0.00 |
73
+ | Julia | 1,290 | 0.07 | 0.07 | -0.00 |
74
+ | Assembly | 764 | 0.04 | 0.04 | -0.00 |
75
+
76
+ max absolute difference: 0.05 percentage points
77
+
78
+ ## Secret spans by context
79
+
80
+ | context | preview count | preview % | full % | diff (pp) |
81
+ |---|---:|---:|---:|---:|
82
+ | assignment | 1,147,795 | 47.12 | 47.07 | +0.05 |
83
+ | json_key | 271,131 | 11.13 | 11.15 | -0.02 |
84
+ | yaml_key | 251,926 | 10.34 | 10.33 | +0.02 |
85
+ | pem_block | 227,772 | 9.35 | 9.35 | -0.00 |
86
+ | comment | 200,677 | 8.24 | 8.25 | -0.01 |
87
+ | auth_header | 165,945 | 6.81 | 6.83 | -0.02 |
88
+ | url_credential | 76,380 | 3.14 | 3.13 | +0.01 |
89
+ | function_arg | 49,286 | 2.02 | 2.03 | -0.00 |
90
+ | env_assignment | 44,977 | 1.85 | 1.85 | -0.00 |
91
+
92
+ max absolute difference: 0.05 percentage points
93
+
94
+ ## Secret spans by value_type
95
+
96
+ | value_type | preview count | preview % | full % | diff (pp) |
97
+ |---|---:|---:|---:|---:|
98
+ | generic_hex_key | 751,633 | 30.86 | 30.87 | -0.01 |
99
+ | password | 508,976 | 20.89 | 20.86 | +0.03 |
100
+ | email | 260,874 | 10.71 | 10.70 | +0.01 |
101
+ | pem_private_key | 226,986 | 9.32 | 9.32 | -0.00 |
102
+ | generic_hex_token | 67,869 | 2.79 | 2.79 | -0.01 |
103
+ | aws_access_key_id | 50,450 | 2.07 | 2.07 | -0.00 |
104
+ | generic_alnum_token | 45,285 | 1.86 | 1.86 | +0.00 |
105
+ | generic_dashed_token | 38,706 | 1.59 | 1.60 | -0.01 |
106
+ | bearer_token_opaque | 36,094 | 1.48 | 1.48 | -0.00 |
107
+ | jwt | 34,158 | 1.40 | 1.40 | +0.00 |
108
+ | generic_lower_key | 30,459 | 1.25 | 1.25 | -0.00 |
109
+ | generic_base64_secret | 30,309 | 1.24 | 1.25 | -0.00 |
110
+ | generic_hex_key_upper | 30,305 | 1.24 | 1.25 | -0.00 |
111
+ | basic_auth_b64 | 28,263 | 1.16 | 1.16 | +0.00 |
112
+ | github_pat | 26,056 | 1.07 | 1.07 | +0.00 |
113
+ | generic_alnum_key | 25,516 | 1.05 | 1.05 | -0.00 |
114
+ | aws_secret_access_key | 24,622 | 1.01 | 1.01 | +0.00 |
115
+ | digitalocean_pat | 18,997 | 0.78 | 0.78 | -0.00 |
116
+ | slack_token | 17,186 | 0.71 | 0.70 | +0.00 |
117
+ | google_api_key | 16,871 | 0.69 | 0.69 | +0.00 |
118
+ | stripe_secret_key | 16,360 | 0.67 | 0.67 | -0.00 |
119
+ | generic_upper_key | 15,211 | 0.62 | 0.63 | -0.00 |
120
+ | generic_upper_token | 15,250 | 0.63 | 0.63 | -0.00 |
121
+ | mailgun_api_key | 10,790 | 0.44 | 0.44 | -0.00 |
122
+ | generic_hex_dashed_key | 10,800 | 0.44 | 0.44 | -0.00 |
123
+ | twilio_api_key | 10,433 | 0.43 | 0.43 | -0.00 |
124
+ | gitlab_pat | 9,588 | 0.39 | 0.40 | -0.00 |
125
+ | npm_token | 8,664 | 0.36 | 0.36 | -0.00 |
126
+ | hf_token | 8,612 | 0.35 | 0.35 | -0.00 |
127
+ | slack_webhook | 8,574 | 0.35 | 0.35 | -0.00 |
128
+ | discord_bot_token | 8,496 | 0.35 | 0.35 | -0.00 |
129
+ | github_fine_grained_pat | 8,595 | 0.35 | 0.35 | +0.00 |
130
+ | azure_client_secret | 7,810 | 0.32 | 0.32 | +0.00 |
131
+ | openai_api_key | 7,413 | 0.30 | 0.30 | +0.00 |
132
+ | sendgrid_api_key | 7,297 | 0.30 | 0.30 | +0.00 |
133
+ | anthropic_api_key | 7,212 | 0.30 | 0.30 | -0.00 |
134
+ | generic_digit_key | 5,169 | 0.21 | 0.22 | -0.00 |
135
+
136
+ max absolute difference: 0.03 percentage points
137
+
138
+ ## Validation
139
+
140
+ - `validate.py` on the slice `train-00063-00069.parquet` (re-serialised to JSONL): 0 offset mismatches on every span and hard negative; see parent repo for the full validation description.