Sentedel EDI-PHI v1
Fine-tuned token-classification model for detecting PHI spans in healthcare X12 (EDI) text, especially payer-side 837P-style transactions.
This checkpoint is a derivative of
openai/privacy-filter (Apache 2.0). It is intended for research, benchmarking, and integration experiments—not as a standalone compliance or anonymization guarantee.
Summary
General-purpose PII models often fragment spans across X12 delimiters and qualifiers. EDI-PHI v1 is trained on synthetic but structurally valid EDI so the model learns where identifiers appear in segment structure, not clinical narrative prose.
| Metric | Score (synthetic 837P test set, n=500) |
|---|
| Strict recall (exact boundaries) | 91.0% |
| Relaxed recall (≥50% overlap) | 100.0% |
| Strict F1 | 76.4% |
Base model
- Base:
openai/privacy-filter (~1.5B parameters, MoE token classifier)
- Task:
token-classification with aggregation_strategy="simple"
- Architecture tag:
openai_privacy_filter
Training data (v1)
| Item | Value |
|---|
| Format | Synthetic X12 837P transactions |
| Scale | 5,000 transactions, 110,053 labeled PHI spans |
| Split | 4,200 train / 300 validation / 500 test |
| Labels | S-tag alignment into base model PII categories |
| Training | 3 epochs, lr=3e-4, bf16, dynamic padding |
| Hardware | NVIDIA L4 (24GB) |
| Training time | ~91 minutes |
Evaluation emphasizes strict boundary matching (exact start/end) in addition to relaxed overlap, because overlap-based NER scores can hide residual identifiers in delimited EDI.
Usage
Transformers (Python)
1from transformers import pipeline
2
3classifier = pipeline(
4 "token-classification",
5 model="rrsanjabi/sentedel-edi-phi-v1",
6 aggregation_strategy="simple",
7 device=-1, # CPU; use 0 for CUDA if available
8)
9
10text = """ISA*00* *00* *ZZ*XSDBVFIK *ZZ*NZEKSPLG *240523*7647*^*00501*241535182*0*P*:~
11GS*HC*XSDBVFIK*NZEKSPLG*20240523*7647*1*X*005010X222A1~
12ST*837*0001*005010X222A1~
13NM1*IL*1*JOHNSON*MICHAEL*T***MI*XKW123456789~"""
14
15spans = classifier(text)
16for s in spans:
17 print(s["entity_group"], s["start"], s["end"], s["score"])
Requires a recent
transformers build with
openai_privacy_filter support (see
openai/privacy-filter).
Hosted demo API
1curl -s -X POST "https://rrsanjabi-sentedel-edi-phi-api.hf.space/api/redact" \
2 -H "Content-Type: application/json" \
3 -d '{"text":"Patient Michael Johnson, DOB 19920315, Member ID XKW123456789"}'
Returns redacted, entities, and latency_ms. See the Space README for schema details.
Benchmark context (test set)
On the held-out 500-transaction synthetic test set (13 PHI categories):
- 11,002 labeled PHI elements total
- 11,000 detected under relaxed matching (99.98% element-level recall)
- 91.0% strict boundary recall (exact span boundaries)
Baselines on the same benchmark include GLiNER PII variants and the unfine-tuned OpenAI Privacy Filter. See the blog post for the full table.
Limitations
- Synthetic training/eval only in v1—production EDI varies by trading partner, implementation guide, and envelope quirks.
- Not legal/compliance advice—not a HIPAA “safe harbor” or expert-determination tool by itself.
- English / US-style identifiers in synthetic data; performance on other locales is unknown.
- Redaction policy follows the base model’s label taxonomy; customize via further fine-tuning if your policy differs.
- Do not send real PHI to public demos or third-party hosts without a BAA and security review.
License
Apache 2.0, consistent with the base
openai/privacy-filter license. You are responsible for how you deploy and for evaluating on your own data.
Citation / links