Datasets:
Download README.md from josh-hud/code-pii-preview: direct link, hf CLI and curl.
- Browser
- Download file 3.41 kB
-
https://huggingface.co/datasets/josh-hud/code-pii-preview/resolve/main/README.md
- Command line
-
hf download hf://datasets/josh-hud/code-pii-preview/README.md
-
curl -L -o README.md https://huggingface.co/datasets/josh-hud/code-pii-preview/resolve/main/README.md
license: other
license_name: mixed-permissive
license_details: >-
Same terms as josh-hud/code-pii: each record keeps the license of its base
file (MIT, Apache-2.0, BSD-2/3-Clause, ISC, Unlicense or CC0-1.0) as
redistributed by codeparrot/github-code-clean. Generator code Apache-2.0.
task_categories:
- token-classification
language:
- code
- en
tags:
- secrets-detection
- credential-detection
- pii
- code
- synthetic
- span-labels
- coreference
- anonymization
- preview
pretty_name: code-pii preview (36% cluster-preserving sample of code-pii v3)
size_categories:
- 1M<n<10M
configs:
- config_name: default
data_files:
- split: train
path: data/*.parquet
code-pii-preview
A seeded 36% cluster-preserving sample of josh-hud/code-pii v3: 4.28 GB of zstd Parquet instead of 11.92 GB. It has the same schema, labels, entity tables and license terms as the parent.
Sampling
Every complete cluster is retained iff blake2b("42:" + cluster_id) / 2^64 < 0.36. The decision is reproducible and order-independent. It never splits a cross-document entity cluster; all files and the embedded entity table for a retained cluster remain together.
Contents
| path | description |
|---|---|
data/train-AAAAA-BBBBB.parquet |
8 zstd Parquet files; clusters are contiguous and never cross files |
sample.jsonl |
approximately 500 records comprising complete clusters, same schema |
stats.md |
totals, file list and label mix |
Numbers
| metric | preview | full v3 | ratio |
|---|---|---|---|
| records | 1,900,308 | 5,278,400 | 0.360 |
| clusters | 856,252 | 2,379,311 | 0.360 |
| files with >=1 span | 1,256,231 (66.1%) | 3,491,739 (66.2%) | 0.360 |
| labeled spans | 2,853,437 | 7,936,370 | 0.360 |
| hard-negative spans | 1,781,642 | 4,950,684 | 0.360 |
| Parquet bytes | 4,284,943,933 | 11,915,030,320 | 0.360 |
Labels: api_key 37.1%, password 17.9%, token 13.1%, email 11.8%, private_key 8.0%, person_name 7.3%, username 4.7%.
Schema
Each record includes the v2 fields plus cluster_id, cluster_kind, cluster_size, doc_index, and an embedded entities table on doc_index == 0. Each positive span adds entity_id, surface_form_type, and a gold replacement. Spans sharing an entity_id across files are the same entity and must receive consistent replacements. Full field documentation is in the parent data dictionary.
Loading
from datasets import load_dataset
ds = load_dataset("josh-hud/code-pii-preview", split="train") # or streaming=True
rec = ds[0]
for s in rec["spans"]:
assert rec["text"][s["start"]:s["end"]] == s["value"]
The parent generator's validate.py reports zero offset, entity, replacement, ownership, contiguity, collision or format problems on the regenerated v3 data. Use the parent's eval_creddata.jsonl for real-code detection evaluation; use held-out synthetic clusters for coreference and exact anonymization evaluation.
Caveats
All parent caveats apply: injected-line placement artifacts; unlabeled real secrets, emails and names in the base corpus; unrelated files in bundle clusters; literal rather than indirect cross-file recurrence; and a Java/JavaScript/HTML-heavy language mix.