Home / Insights / Generative AI and LLMs
Generative AI and LLMs
Building HIPAA-Compliant AI: Architecture, Data Handling and Vendor Choices
AI features in healthcare often touch protected health information in places teams do not expect: prompts, logs, embeddings and evaluation sets. This guide maps where PHI flows in an AI system, the architecture and vendor choices that keep it protected, and how de-identification, logging and breach readiness fit in.
TopicsGenerative AI and LLMsArchitecture and ModernizationAI and Machine Learning
Key takeaways
- HIPAA applies to AI systems that create, receive, maintain or transmit protected health information (PHI) for covered entities or their business associates.
- PHI appears in more places in AI systems than teams expect: prompts, retrieved passages, vector indexes, logs, traces, evaluation sets and fine-tuning data.
- Use only vendors and services that will sign a business associate agreement for the specific services you use, and confirm data is not retained or used for training beyond your terms.
- De-identification under HIPAA uses either Safe Harbor (removing 18 identifiers with no actual knowledge of re-identification) or Expert Determination (very small re-identification risk, documented by a qualified expert).
- HHS proposed a major Security Rule update in January 2025; final action has been delayed, but its direction — encryption, asset inventories, stronger risk analysis — is a sensible baseline now.
On this page
- HIPAA in one page for AI teams
- Where PHI flows in an AI system
- Reference architecture
- De-identification options
- Choosing vendors
- Security safeguards that matter most
- The proposed Security Rule update
- Beyond HIPAA
- Worked example: a documentation assistant
- Common pitfalls
- Frequently asked questions
- Sources and methodology
Healthcare organisations want AI for documentation, patient communication, coding, triage support and operations. Many of these uses involve protected health information (PHI). HIPAA does not prohibit AI; it requires that PHI be used and disclosed appropriately and protected with administrative, physical and technical safeguards — wherever it flows.
This guide is for technical teams designing AI features in the US healthcare context. It is not legal advice; involve your privacy officer and counsel. For grounding assistants in approved clinical content, see our guide to RAG in healthcare.
HIPAA in one page for AI teams
- Privacy Rule: governs uses and disclosures of PHI, including the minimum necessary standard and patients’ rights.
- Security Rule: requires administrative, physical and technical safeguards for electronic PHI, based on a documented risk analysis.
- Breach Notification Rule: requires notification of affected individuals without unreasonable delay and within 60 days of discovery, notification to HHS, and media notice for breaches affecting more than 500 residents of a state or jurisdiction.
- Business associates: vendors that handle PHI on your behalf must sign a business associate agreement (BAA) and comply with the Security Rule.
Where PHI flows in an AI system
| Location | Example | Control |
|---|---|---|
| — | — | — |
| User input and prompts | Clinician pastes a note into an assistant | BAA-covered model endpoint; minimum necessary input |
| Retrieved context | Passages from patient records added to a prompt | Access control at retrieval time; scoped queries |
| Embeddings and vector indexes | Chunks of clinical notes stored as vectors | Treat as PHI: encryption, access control, deletion |
| Model outputs | Summaries, drafted letters | Store only where needed; review before release |
| Logs and traces | Full prompts and responses in observability tools | Redaction; BAA-covered logging tools; retention limits |
| Evaluation and test sets | Real cases used to test quality | De-identify, or treat as PHI with restricted access |
| Fine-tuning data | Notes used to adapt a model | Strong justification; de-identify where possible; BAA |
| Caches | Cached responses for speed | Scope by user; encrypt; short expiry |
Map every location before launch; observability tools are the most commonly missed.
Reference architecture
- Identity and access: users authenticate with your identity provider; every request carries the user’s identity and role.
- AI gateway: a single service holds model credentials, enforces policies, redacts where appropriate and logs metadata.
- Retrieval with permissions: searches return only records the user is allowed to see, filtered before content reaches the model.
- BAA-covered model endpoint: a model service covered by a BAA, configured for no training on your data and minimal retention.
- Output checks: validate structure, detect PHI where it should not appear, and route sensitive outputs to human review.
- Storage: encrypted databases and indexes in HIPAA-eligible services, with defined retention.
- Monitoring: security logging, access reviews and alerting on unusual access patterns.
Keep PHI processing inside environments you control or that are covered by BAAs. Never send PHI to consumer AI tools or to APIs not covered by an agreement.
De-identification options
HHS guidance describes two methods for de-identifying PHI under the Privacy Rule:
- Safe Harbor: remove 18 specified identifiers — including names, most geographic subdivisions smaller than a state, dates other than year, contact details, record numbers and full-face photographs — and have no actual knowledge that the remaining information could identify an individual. Free-text notes need careful redaction.
- Expert Determination: a qualified expert applies statistical or scientific methods and documents that the risk of re-identification is very small in the intended context.
De-identified data is no longer PHI, which makes it suitable for many evaluation, analytics and development tasks. Be cautious: free text, rare conditions and linkable data can re-identify people, and language models can reproduce identifiers from training data.
Choosing vendors
| Question | Why it matters |
|---|---|
| — | — |
| Will you sign a BAA covering the exact services we will use? | Some services or features are excluded from BAAs |
| Is our data used to train or improve models? | Must be excluded or explicitly permitted |
| How long are prompts and outputs retained, and where? | Retention and data residency |
| What logging and abuse monitoring involves human review of our data? | May require special configuration |
| What security certifications and audit reports are available? | Evidence for your risk analysis |
| How are incidents notified? | Breach notification timelines |
Record answers in your vendor risk assessment and revisit when services change.
Security safeguards that matter most
- Risk analysis covering the AI components, updated when architecture or vendors change.
- Encryption of PHI in transit and at rest, including indexes, caches and backups.
- Least-privilege access for users, services and AI tools, with regular reviews.
- Audit logs of who accessed what PHI through the AI system.
- Prompt-injection defences: treat retrieved documents and user input as untrusted, and limit what model outputs can trigger.
- Testing: security testing and red teaming of AI features before release.
- Incident response plans that include AI-specific scenarios, such as an assistant revealing another patient’s data.
The proposed Security Rule update
In January 2025 HHS published a proposed rule to strengthen the HIPAA Security Rule, including more specific requirements for risk analysis, asset inventories, encryption and multi-factor authentication. Final action has since been delayed — HHS’s regulatory agenda moved it to long-term actions, with a final rule not expected before mid-2027. Many of its proposals already reflect good practice, so designing AI systems to meet them now reduces future rework.
Beyond HIPAA
- Clinical decision support: software that informs diagnosis or treatment may be regulated by the FDA; see the four non-device criteria in our RAG in healthcare guide.
- Non-discrimination: rules such as Section 1557 of the Affordable Care Act address discrimination in health programmes, including through tools.
- State laws: many states have health privacy and breach laws that add requirements.
- Other countries: health data in other jurisdictions falls under their own laws.
Worked example: a documentation assistant
A hypothetical clinic group wants an assistant that drafts visit summaries from clinicians’ notes for review.
- Scope and risk: the assistant drafts; clinicians review and sign. No autonomous changes to the record. Privacy and clinical leads approve the use case.
- Data flow: notes are sent from the EHR through the AI gateway to a BAA-covered model endpoint configured with no training and minimal retention. Only the current visit’s note and relevant problem list are sent — not the full record.
- Logging: the gateway logs request metadata (user, patient identifier, time, model version, token counts) but stores prompt and response content only in the EHR, where the signed summary belongs.
- Evaluation: a de-identified set of 200 historical notes is used to measure accuracy and omissions, reviewed by clinicians before pilot.
- Access and audit: only clinicians with access to the patient can trigger the assistant, and each use is recorded in the audit log.
- Incident readiness: the incident plan covers wrong-patient summaries and data exposure, with a kill switch to disable the feature.
The design keeps PHI in the EHR and covered services, limits what the model sees and gives the compliance team a clear picture of every data flow.
Common pitfalls
- Sending PHI to a model endpoint not covered by a BAA during prototyping.
- Logging full prompts and responses in tools without BAAs or retention limits.
- Building vector indexes of patient records without access filtering.
- Using real patient data in test sets shared broadly with developers.
- Assuming de-identified free text is safe without review.
- Treating compliance as a one-time sign-off rather than ongoing risk management.
Frequently asked questions
Can we use large language model APIs with PHI?
Yes, if the provider signs a BAA covering the specific service, data handling meets your requirements and your risk analysis supports it. Consumer chat tools are not appropriate for PHI.
Are embeddings PHI?
Treat embeddings derived from PHI as PHI. They can be linked back to source records and, in some cases, reveal content.
Do we need patient consent for AI use?
It depends on the use. Many treatment, payment and operations uses do not require separate authorisation under HIPAA, but other laws and your organisation’s policies may. Ask your privacy officer.
How do we test AI features without exposing PHI?
Use de-identified or synthetic data where possible, and restrict any real-data testing to controlled environments with access logging.
Sources and methodology
Facts in this article were checked against the sources below on 6 November 2026. Directory data (ratings, review counts, rate bands and team sizes) changes over time and is shown as published on the date accessed. Illustrative examples are labelled as such and are not quotes.
- Military Health System (TMA Privacy Office): Guidance on de-identification methods under the HIPAA Privacy Rule — accessed 6 November 2026. Summary of HHS guidance (26 November 2012): Safe Harbor and Expert Determination methods
- Paubox (15 July 2026): HHS pushes final HIPAA Security Rule update to 2027 — accessed 6 November 2026. Proposed rule published 6 January 2025; moved to long-term actions; final rule not expected before July 2027
- American Medical Association: HIPAA security rule and risk analysis — accessed 6 November 2026. Administrative, physical and technical safeguards; risk analysis
- OWASP: Top 10 for LLM Applications 2025 — accessed 6 November 2026. Prompt injection and sensitive information disclosure
Related reading
Continue your research
Building AI features that handle health data?
Share your use case and data flows. We will help you design an architecture, choose vendors and set up controls that your compliance team can review.
