A nurse pastes a discharge summary into a chatbot to get a plain-language version for the patient. A developer copies a few real claims into a test file to check a prompt. A trace tool quietly saves every question and answer from a pilot app. None of these people meant to break a rule. Each one may have just moved protected health information somewhere your HIPAA program cannot see.
That is the core problem with Gen AI in healthcare. The privacy rules have not changed, but the places patient data can end up have multiplied. Prompts, context windows, embeddings, logs, evaluation sets and model outputs are all new homes for PHI, and most compliance programs were designed around databases and file shares.
This article walks through the hard parts we see when health plans, providers and life sciences teams take Gen AI from pilot to production. It is written for architects, data leaders and compliance teams who need to agree on a design. It is not legal advice, and your privacy officer and counsel should make the final calls.
PHI ends up in more places than you think
In a classic application, PHI sits in a few known systems with known controls. In a Gen AI application, the same record can be copied half a dozen times in a single request. It is read from the source, chunked and embedded, stored in a vector index, pasted into a prompt, sent to a model, echoed back in the answer and written to a log on the way.
| Where PHI ends up | What to check |
|---|---|
| Prompts and chat history | Who can read past conversations, and how long they are kept |
| Context sent to the model | Whether the model endpoint and every feature you use are covered by a BAA |
| Vector indexes and embeddings | Encryption, access filters and deletion when the source record changes |
| Application logs and traces | Whether full prompts and answers are written to tools outside your HIPAA scope |
| Evaluation and test sets | Whether real patient cases were copied into a shared workspace or a spreadsheet |
| Model outputs saved to the chart | Who reviews them before they become part of the medical record |
Start every project with a data flow diagram that follows one real request from end to end. Mark each place PHI is stored, even for a few seconds, and each service it passes through. That diagram drives the rest of the work: which vendors need agreements, which logs need controls and what goes into your risk analysis.
No BAA, no PHI
Under HIPAA, a vendor that creates, receives, maintains or transmits PHI for a covered entity is a business associate. You need a business associate agreement before PHI reaches them. HHS has said this applies to cloud providers that store ePHI even when it is encrypted and they hold no key. The conduit exception is narrow and covers services that only pass data along, like an internet provider. A model API that reads your prompt and writes an answer is not a conduit.
Consumer chat tools usually come with no BAA at all, so staff should not paste PHI into them. That needs a clear policy, training and an approved tool people actually want to use, or they will keep using the consumer one.
The enterprise offerings are more subtle. Many cloud and AI vendors will sign a BAA, but it covers a list of eligible services. A model may be covered while a preview feature, a third-party model from a marketplace or a built-in content safety review is not. Read the covered services list against your design, not against the vendor’s marketing page.
Then follow the chain. Your vector database, your observability tool, your labeling vendor and any agent framework that calls a hosted service all touch PHI if your app sends it to them. Each one needs to be inside a BAA, directly with you or through your prime vendor’s subcontractor agreements.
Prompts and logs are records too
Teams often lock down the model endpoint and forget the logging around it. Gen AI frameworks make it easy to capture full prompts and responses for debugging, and observability tools are built to keep them. If those prompts carry patient names, diagnoses or member IDs, your trace store is now a PHI repository.
Treat it like one. Keep traces inside the same cloud account and controls as the rest of your PHI. Limit who can read them. Set retention to what you actually need for support and quality review. Where you don’t need the text, log record IDs and hashes instead. Check what the model vendor keeps as well. Some services hold prompts for a period for abuse monitoring unless you arrange otherwise, and that retention has to be acceptable under your agreement.
Minimum necessary meets the context window
The minimum necessary standard asks you to limit PHI to what is reasonably needed for the purpose. It does not apply to disclosures to a provider for treatment, but it does apply to most payment and operations work, which is where many Gen AI projects start: claims, prior authorization, coding, member service and quality reporting.
Large context windows make the easy choice tempting. Send the whole chart and let the model sort it out. That choice is hard to defend. A prior authorization summary needs the diagnosis, the requested service and the supporting clinical notes. It rarely needs the member’s address, phone number or unrelated history.
Write down the fields each use case needs and why. Build the context from that list in code, and mask identifiers the task doesn’t use before they reach the model. This also tends to improve answers, because the model has less noise to work through.
De-identification is harder with free text
HIPAA gives two ways to de-identify data. Safe Harbor removes a set list of 18 identifiers, including names, most dates, small geographic units, contact details, record numbers and full-face photos, and requires that you have no actual knowledge the rest could identify someone. Expert Determination has a qualified expert assess the risk for a specific use and document the method.
Both are workable for structured data. Clinical notes are another story. Names show up in the middle of sentences. Dates appear as “two days after her surgery”. A rare condition plus a small town plus an age can point to one person. Rule-based and model-based redaction tools both miss things, and a miss rate that looks small on paper means thousands of leaks across millions of notes.
Use automated de-identification as one layer, measure its recall on a labeled sample of your own notes and keep the output under access controls anyway. If the data needs to be truly de-identified for a vendor or a research use, Expert Determination is often the more realistic route for text.
Vendor models and your data
The question every compliance team asks first is whether the vendor will train on your data. A BAA limits what a business associate may do with PHI, and using it to improve a general model sold to other customers is not a purpose most agreements allow. Don’t rely on that reading alone. Get the AI service terms to say plainly that your inputs and outputs are not used for training, and confirm the setting that enforces it in your tenant.
Fine-tuning your own model on PHI raises a different issue. Models can memorize rare details from training data and repeat them later. If you fine-tune on patient records, treat the model itself as something that may contain PHI. Keep it inside your controls, limit who can query it and test it for memorized identifiers before release. For many use cases, retrieval over governed data gets the same result with far less risk.
RAG needs the same access rules as the EHR
Retrieval-augmented generation is the most common pattern for clinical and member-service assistants, and it has a quiet failure mode. Documents go into one vector index, and the permissions that protected them in the source system stay behind. A front-desk user asks a general question and gets back a passage from a behavioral health note they could never open in the EHR.

Carry access metadata into the index with every chunk: care team, facility, document class and any special category such as substance use disorder records or psychotherapy notes. Filter on it at query time using the signed-in user’s identity. Never ask the model to hide what the user should not see. A prompt instruction is not an access control, and prompt injection can talk a model out of it.
def retrieve_context(user, question, k=8):
# Access comes from the identity provider, never from the prompt text
scope = access_service.scope_for(user.id) # care teams, facilities, document classes
hits = vector_index.search(
vector=embed(question),
top_k=k,
filter={
"care_team_id": {"$in": scope.care_team_ids},
"doc_class": {"$in": scope.doc_classes}, # e.g. no psychotherapy notes
},
)
audit_log.write(
event="genai.retrieve",
user_id=user.id,
purpose=user.session.purpose, # treatment, payment, operations
record_ids=[h.metadata["record_id"] for h in hits],
question_sha256=sha256(question), # traceable without storing the text
)
return [h.text for h in hits]Treat the embeddings themselves as PHI. Research has shown that text can be partly rebuilt from its embeddings, so an index built from clinical notes deserves the same encryption, access limits and deletion process as the notes.
Audit trails that answer real questions
The Security Rule requires audit controls that record and let you examine activity in systems that hold ePHI. For Gen AI, the useful question is specific: who asked what, for what purpose, which records were pulled into the answer and what the system said back.
Log the user, the purpose of use, the record IDs retrieved, the model and prompt version and the output or a reference to it. Store it where your security team already reviews activity, and include it in your regular reviews. When a patient complains or an investigator asks about an access, this is the record you will need. It also makes a breach assessment possible. An impermissible disclosure is presumed to be a breach unless your risk assessment shows a low probability that the data was compromised, and you can’t make that case without knowing what was exposed.
When AI output becomes part of the record
A draft that a clinician edits and signs into the chart becomes part of the medical record. Patients have a right to access that record, and it can be used in care decisions, billing and legal matters. That raises the bar on accuracy and review.
Make it clear in the workflow which parts were drafted by AI and who approved them. Keep a person accountable for anything that goes into the chart or into a decision about coverage. Watch for state laws that add rules on AI in clinical communication and on health data outside HIPAA, which can be stricter than the federal baseline.
A short checklist before go-live
| Before go-live | Evidence to keep |
|---|---|
| Every vendor that touches PHI has a signed BAA | Vendor list mapped to BAAs and covered services |
| Vendor terms rule out training on your data | Contract clause and the setting that enforces it |
| Retrieval enforces the user's access rights | Test results showing a user cannot pull records outside their scope |
| Logs and traces are inside your HIPAA scope | Data flow diagram and retention settings |
| Minimum necessary is applied to model context | Field list per use case, with the reason for each field |
| De-identified data is checked, not assumed | Method used and test results on real samples |
| The AI system is in your risk analysis | Updated risk analysis and the owner of each risk |
Add the AI system to your HIPAA risk analysis like any other system that holds ePHI. Name an owner for each risk and revisit it when the model, the vendor or the data changes.
Where to start
Pick one workflow with a clear purpose of use and a business owner, such as prior authorization summaries or member service replies. Draw the data flow, sign the agreements and build the context filter, permission-aware retrieval and audit log before the first real patient record goes in. Those pieces carry over to every Gen AI project that follows, and they are much cheaper to build first than to retrofit after a pilot has spread.
We help healthcare and life sciences teams build the governed data and controls that let Gen AI run safely on patient data. See our healthcare work, or talk to us about the use case you want to get right.
Get new insights by email.
One email when we publish a new post.
You're subscribed.
We sent a welcome email to . Didn't mean to sign up? Reply to it and we'll unsubscribe you.



