Check every de-identified note for leftover PHI on a CPU, and run the same clinical pipelines on Spark 3 and Spark 4
John Snow Labs builds regulatory-grade healthcare AI for clinical and life sciences teams: Medical LLMs, Healthcare NLP, de-identification, OMOP harmonization, and the Patient Journey Intelligence platform, purpose-built for healthcare, validated at billion-record scale, and deployed inside your environment. More than 500 enterprise customers use them, with 80+ public case studies, 30+ peer-reviewed papers and patents, and 50+ industry awards.
Healthcare NLP is the most widely used NLP library in healthcare: 3,000+ pretrained small language models and pipelines for de-identification, entity, relation, and code extraction from clinical text. It is built on open-source Spark NLP, downloaded more than 170 million times, and a new version ships every two to four weeks; the current one is 7.0.1.

For teams that run clinical text at scale, Healthcare NLP now answers two questions. Is any patient information left in the notes we are about to release? And can our clinical pipelines move to the Spark 4 runtimes our platform team has already adopted? The first answer is PHI Guard, the first decision models that ship inside the library. The second is native Spark 4 support next to Spark 3. Around them come HL7 v2 and FHIR de-identification that keeps the message structure, training without TensorFlow, and 173 new and updated models.
PHI Guard checks every de-identified note
A de-identified batch is ready for release. Before it leaves, someone has to decide, note by note, whether a name, a date of birth, or a phone number slipped through masking. Most teams answer that with a reviewer who reads a sample, a second extraction pass whose output someone still has to read, or a frontier LLM that receives every note, including the ones that still hold the PHI it is meant to catch.
Checking a note for leftover PHI is a classification task: one fixed question, asked of every note, with a small set of known answers. PHI Guard models are decision models built for it. A decision model answers a defined question about a document with a fixed set of answers and a probability, and it writes no text. PHI Guard has four questions built in, and Healthcare NLP runs it through a new annotator, DecisionModel.

Where each PHI Guard question runs.
One note from check to release decision
Step 1: the note. Masking replaced the date and missed the rest.
Pt Daniel Okafor, DOB 04/22/1961, seen on [DATE] for knee pain. X-ray normal. Follow up in 6 weeks.
Step 2: the question. PHI Guard asks “Is any PHI left after de-identification?” and accepts two answers, PHI_LEAK and NO_PHI_LEAK. You do not write the question. It is built into the model.
Step 3: the decision. PHI Guard Tiny returns a leak probability of 1.00. In the same call it scores the leak as harmful at 0.996.
Step 4: the action. The note is held back and goes to a reviewer, who knows from the harmful score that a direct identifier is left.
The same note in three versions, at a cutoff of 0.5:

The same note in three versions, scored by PHI Guard Tiny at a cutoff of 0.5.
With the harmful score, a release policy can use more than one threshold. A name, an ID, a contact detail, a date of birth, a street address, or an age over 89 counts as harmful; a city or a clinician name on its own does not. You can hold every leak, or hold the harmful ones and sample the rest.
Seven models that run on CPU
Seven PHI Guard models ship with Healthcare NLP. All of them run on CPU with ONNX in about 1 GB of RAM, so we call them the Tiny models. PHI Guard Tiny is listed in the tables as v0.7 and PHI Guard Tiny Fast as v0.7 Fast; the five v0.6 models answer one question each.

The seven PHI Guard models in Healthcare NLP, all on CPU.
PHI Guard Tiny is the default choice: one model answers all four questions. Leak and harmful gate the release. Raw runs before de-identification and finds the original notes that hold no PHI at all. Richness, from level 0 to 6, shows over time whether a change in the source data or the pipeline moved the amount of PHI left in your output. On internal hard cases, PHI Guard Tiny reaches a leak PR-AUC of 0.986.
A stage at the end of your pipeline
To gate a de-identification pipeline, add a leak stage after it and point it at the masked output:
deid_pipeline = PretrainedPipeline(
"clinical_deidentification_docwise_benchmark_optimized_v2", "en", "clinical/models"
)
phi_guard_leak = DecisionModel.pretrained("phi_guard_3m_v0.7", "en", "clinical/models") \
.setInputCols("masked") \
.setOutputCol("phi_leak") \
.setMode("leak")
guarded_pipeline = PipelineModel(
stages=list(deid_pipeline.model.stages) + [phi_guard_leak]
)
Each document gets PHI_LEAK or NO_PHI_LEAK, with the probability and a status in the metadata. DocumentFiltererByClassifier keeps the documents that pass, and the rest go to review. Send the guard the masked output, not an obfuscated copy: realistic fake values look like real PHI to the model. The DecisionModel notebook runs the whole pipeline on example notes.
A million notes for cents
We put the same leak question to PHI Guard Tiny and to three frontier APIs, on 1,200 de-identified notes from the PHI Guard benchmark: 585 with a leak and 615 clean.

The same leak question on 1,200 de-identified notes: 585 with a leak, 615 clean.
Every clean note a checker flags is a note a person has to read. Claude Haiku 5.5 catches the most leaks and flags three in four clean notes. Gemini 3.8 Flash flags the fewest clean notes, misses more leaks than PHI Guard Tiny, and costs the most. The cheapest frontier API in the table costs more than 700 times as much as PHI Guard Tiny for the same million notes. The API costs are the charges OpenRouter billed for these notes at list prices on November 26, 2026; the PHI Guard figure is compute time at an illustrative $0.04 per CPU hour, not a John Snow Labs price.
PHI Guard returns one decision per note. It does not locate or remove PHI, and a NO_PHI_LEAK label does not certify that a note is safe to release.
PHI Guard is one family of John Snow Labs Medical Decision Models. PHI Guard Small and Nano answer the same four questions on a GPU, and Medical DM Small and Nano answer clinical questions you write yourself. These four are offered for private deployment on-premises and on AWS, Azure, Databricks, and Snowflake, separately from the library.
Healthcare NLP runs on Spark 4
Cloud providers moved their newest runtimes to Spark 4. Databricks 17, 18.1, 18.2, and 19 all run it, and until now Healthcare NLP ran on Spark 3 only. A team that wanted the current runtime had to choose between the platform upgrade and its clinical pipelines.
Healthcare NLP now runs natively on Spark 4.x next to Spark 3.x, with the same annotators, models, and pipelines on both, the PHI Guard models included. In most setups there is nothing to configure: sparknlp_jsl.start() reads the Spark version of the cluster and loads the matching build.
import sparknlp_jsl spark = sparknlp_jsl.start(secret=SECRET) # the same call on Spark 3.x and Spark 4.x
If you attach the JAR yourself, the build follows the runtime:

The build to attach through spark.jars for each runtime.
The build to attach through spark.jars for each runtime.
Databricks 17 and later report Spark 4.0.0 but already include the upstream fix the spark400 build works around, so they take the regular _2.13 build. Spark 3 workloads keep running unchanged; you move to Spark 4 when your platform is ready.
More de-identification formats and 154 terminology models
The code and parameters for each item are in the Healthcare NLP documentation.
De-identification that keeps the message structure
Hl7v2DeIdentificationis a new annotator for HL7 v2.x messages, from v2.1 to v2.9. It de-identifies the structured fields, keeps every delimiter intact, and with thehl7v2_deidentification_free_textmodel also de-identifies the narrative fieldsOBX-5andNTE-3. A new HL7 v2 De-Identification notebook covers both models.FhirDeIdentificationhandles real-world FHIR exports: free text inside resources, rules by data type at any depth,REMOVE,KEEP, andREMOVE_BASE64actions, one date shift per patient across resources and runs, the HIPAA 90+ age rule, consistent pseudonymous IDs and references, tolerance for values that strict FHIR parsing rejects, parallel processing, audit logs without original values, and traceability tags.CdaDeIdentificationandHl7v2DeIdentificationshare the new rule engine: header-aware tables, year-only dates, age rules, a random date shift range, and free text extraction for annotation.
With HL7 v2 added, Healthcare NLP de-identifies seven input formats: unstructured clinical notes, and structured data in Spark DataFrame tables, CSV and JSON files, relational databases, HL7 v2 messages, FHIR resources and Bundles, and CDA documents.

The input formats Healthcare NLP de-identifies, with a short synthetic sample of each; marked values are the PHI that gets replaced.
Fakes that keep the story of the note
- A name and its possessive form get the same fake, so “Carter” and “Carter’s” stay one person.
- A fake name keeps the nationality and gender of the original, for English text.
- A name gets the same fake within a document and a different one in each other document, with ID-based obfuscation.
- The mappings column can be encrypted with AES-256-GCM, and the same key restores the text through
ReIdentification. - Timestamps keep their time when the date is shifted, random date shifts can go backward as well as forward, and selected date entities such as the date of birth can become year-only.
- The HIPAA restricted ZIP prefixes are configurable, an unusual ZIP value is masked instead of faked, and a state keeps its format (name or two-letter code).
- The faker name and location lists were cleaned and expanded for English, German, Spanish, French, Romanian, and Arabic.

A synthetic HL7 v2 lab result before and after de-identification, and a possessive name.
Training without TensorFlow
Custom training of the classifier, relation extraction, and assertion annotators used to need a graph built with TensorFlow 2.12, which no longer installs on Python 3.12 and later. The library now ships 1,171 ready-made graphs, and fit() selects the smallest one that fits the features and classes of your data. A graph you set yourself still takes priority.

Custom training before and now.
154 terminology models on the 2026 editions
81 updated and 73 new resolvers, mappers, and pipelines cover 16 coding systems, each trained on its latest official edition, from SNOMED CT US Edition 20260901, LOINC 2.83, and ICD-11 2026-01 to RxNorm, NDC, CPT, HCPCS, HPO, HGNC, MeSH, and NCIt. Model names include the edition, such as _20260901, so a pipeline stays pinned to the codes it was built for. ICD-11 is new.
Against five general-purpose LLMs on exact code mapping, the resolvers score highest on all four systems tested, with the widest gaps on SNOMED CT (7.3 points over the best LLM) and RxNorm (9.1 points). A second benchmark, on CPU, times one oncology NER pipeline and five resolver pipelines on 1,000 clinical documents; the full methodology is on the benchmarks page.
Top-1 exact code match, 110 items per coding system, closed book:

Top-1 accuracy, 110 items per coding system, closed book. Shading starts at 75%.
With the two HL7 v2 models, a cancer registry NER model and pipeline, an ICD-11 mental health resolver, five zero-shot NER pipelines, two matchers, and the seven PHI Guard models, Healthcare NLP gains 173 new and updated models.
Faster model downloads and fixes
- Pretrained models download over several connections at once, with progress shown in MB.
Annotation2Trainingkeeps the annotated chunks next to the NER training labels it builds from Generative AI Lab exports.PipelineTracerreports the entities and relations ofPretrainedZeroShotMultiTaskthroughMultiAnnotationSplitter.- Fixes: temporary files after model loading, ONNX GPU preload, batched
ZeroShotNerdecoding, empty inputs inDocumentFiltererByNER, zero-shot multi-task offsets, and FHIR serialization, choice-type paths, rule precedence, nested narrative tables, and placeholder dates.
New blog posts
- PHI Guard decision models check millions of de-identified notes for leftover PHI at a fraction of frontier API cost: PHI Guard and the general Medical Decision Models against four frontier APIs on the same 1,200 de-identified notes, with the leaks each one catches, the clean notes it flags, and its cost per million notes.
- Medical decision models answer clinical questions on a million notes in hours: how Medical DM Small and Nano answer clinical questions you write, with a fixed set of answers and a probability for each, across nine task areas, and what they cost per million notes.
- De-identification doesn’t end at deployment: how to know what is safe to release: how to keep measuring a de-identification pipeline after it goes live, with drift checks on every batch, PHI Guard screening of every output document, and a random audit that bounds the leak rate.
- Clinical de-identification benchmarks 2026: John Snow Labs against OpenAI, Databricks, Presidio, and LLM APIs: on 1,479 expert-annotated PHI chunks, Healthcare NLP reaches 0.96 PHI F1, against 0.91 for Claude Opus 4.8, 0.89 for GPT-5.5, 0.86 for Gemini 3.1 Pro, and 0.71 for Databricks
ai_mask(). - Benchmarking Databricks ai_mask on clinical de-identification: 0.71 PHI F1: the Databricks
ai_mask()function on the same corpus and evaluation code, with recall from 0.35 on contact identifiers to 0.85 on ID numbers. - Why mapping clinical notes to ICD-10, CPT, LOINC, and SNOMED codes takes more than entity recognition: why code mapping depends on assertion status, experiencer, and time, and how Healthcare NLP prepares entities before the Terminology Server maps them.
- High-accuracy clinical term mapping to standard medical terminologies: the resolvers against five general-purpose LLMs on SNOMED CT, RxNorm, ICD-10-CM, and ICD-O, and how the training data behind each resolver is built.
Questions to ask about your own pipelines
- How many de-identified notes leave your environment without a check on the output?
- Does your current leak check send notes to a third party, including the ones that still hold PHI?
- Is your platform team waiting on a Spark 4 runtime that your clinical pipelines do not run on yet?
- Do your HL7 v2 feeds and FHIR exports go through de-identification with their structure intact?
- Does custom model training still depend on a TensorFlow environment you can no longer rebuild?
PHI Guard checks every de-identified note on one CPU thread for about $0.07 per million notes, the same pipelines run on Spark 3 and Spark 4, and all of it runs inside your own infrastructure. To see PHI Guard and the new de-identification options on your own data, talk to our team.
Frequently asked questions
What is PHI Guard? PHI Guard is a family of John Snow Labs decision models that check clinical notes for protected health information. They tell you whether a de-identified note still leaks PHI, whether the leak is harmful, how much PHI a note exposes on a scale from 0 to 6, and whether an original note holds any PHI. Seven of them ship with Healthcare NLP and run on CPU.
What is a decision model? A decision model answers a defined question about a document with a fixed set of answers and a probability, and it writes no text. The probability tells you which answers a person should check.
Does PHI Guard need a GPU, or send notes anywhere? No to both. The seven PHI Guard models in Healthcare NLP run on CPU in about 1 GB of RAM, inside your own Spark pipeline.
Does PHI Guard remove PHI? No. It returns one label per document with a probability. Use it after your de-identification pipeline to decide which documents to release and which to send to review.
Does Healthcare NLP still support Spark 3? Yes. Healthcare NLP runs on Spark 3.x and Spark 4.x, and sparknlp_jsl.start() loads the matching build, so Spark 3 workloads keep running without changes.
Which build do I use on Databricks 17 or later? The regular Spark 4 build (the _2.13 JAR), or let sparknlp_jsl.start() choose it. The spark400 build is only for a plain, unpatched Spark 4.0.0 cluster.
Can I train a relation extraction model without TensorFlow? Yes. The library ships 1,171 training graphs, and fit() selects one that fits your features and classes.





























