We use only essential, cookie‑free logs by default. Turn on analytics to help us improve. Read our Privacy Policy.
Back to blog
HIPAAHealthcare AIPrivacy ArchitecturePHIComplianceEnterprise AI

HIPAA-Compliant AI Architecture: What Actually Works in Production

Most 'HIPAA-compliant AI' solutions checked a box. Here's what compliance actually looks like when PHI touches a model — from real healthcare deployments.

March 12, 202612 minMaryna Vyshnyvetska

HIPAA-Compliant AI Architecture: What Actually Works in Production


Most "HIPAA-Compliant AI" Isn't

Here's a pattern we see constantly: a healthcare company deploys an AI system, signs a BAA with their cloud provider, checks the HIPAA box on their vendor questionnaire, and calls it done.

Then we run an audit and find PHI in plaintext logging pipelines, conversation histories stored in standard Elasticsearch clusters, and vector databases with zero tenant isolation. The BAA covers the infrastructure. It doesn't cover what you built on top of it.

HIPAA compliance for AI isn't a checkbox. It's an architecture. And most teams get it wrong not because they're careless, but because HIPAA was written before anyone imagined a large language model processing patient records. The rules don't map cleanly to modern AI systems, so you have to do the mapping yourself — carefully, defensibly, and with audit trails that will survive an OCR investigation.

Here's what that actually looks like.


What HIPAA Actually Requires for AI Systems

HIPAA has three rules that matter for AI deployments: the Security Rule, the Privacy Rule, and the Breach Notification Rule. Most teams know the broad strokes. The AI-specific implications are where things get tricky.

The Security Rule and Model I/O

The Security Rule mandates administrative, physical, and technical safeguards for electronic protected health information (ePHI). When a patient's diagnosis appears in a prompt, that prompt is ePHI. When a model generates a response containing medication history, that response is ePHI. When those prompts and responses get logged — and they always get logged — those logs are ePHI.

This means: encryption at rest and in transit for every model input and output. Access controls on inference endpoints. Integrity controls to detect tampering with model responses. And audit logs for every single interaction where PHI is present.

The Privacy Rule and Training Data

If you're fine-tuning or training on data that contains PHI, the Privacy Rule applies to your training pipeline. You need authorization for the use of that data, or you need a valid exception (treatment, payment, healthcare operations, or a proper de-identification process). "We anonymized it" doesn't count unless you followed the Safe Harbor or Expert Determination method and can prove it.

RAG systems introduce another wrinkle. If your knowledge base contains clinical notes, discharge summaries, or lab results, every retrieval operation is a use or disclosure of PHI. The retrieval results need the same protections as a database query returning patient records.

Breach Notification and AI-Specific Risks

An AI system that leaks PHI in its output — to the wrong user, through a prompt injection attack, or via a cached response — triggers breach notification obligations. You have 60 days to notify affected individuals and HHS. If it affects 500+ people, you're also notifying the media.

The AI-specific risk here is subtle: model outputs aren't always predictable. A model might surface PHI from its context window in ways you didn't anticipate. Prompt injection could extract patient data from a RAG system. A poorly configured multi-tenant deployment could serve one clinic's patient data to another clinic's staff. These aren't theoretical risks. We've seen all of them.


The Architecture That Works

After building and auditing privacy architectures for healthcare organizations, we've converged on a set of patterns that hold up in production and under regulatory scrutiny.

Data Classification Layer

Before any data touches a model, it passes through a classification layer that identifies PHI. This isn't regex pattern matching for Social Security numbers. It's a pipeline that classifies data elements against the 18 HIPAA identifiers and flags anything that qualifies.

What this looks like in practice:

  • Inbound requests hit a classification service before reaching the inference endpoint
  • Each data element gets tagged: PHI, potentially PHI, or non-PHI
  • PHI elements are encrypted, access-controlled, and logged separately
  • Non-PHI elements can flow through standard pipelines

The classification layer is also where de-identification happens if you're routing certain workloads to non-HIPAA-covered services. Strip the PHI, process with the general-purpose model, re-associate on return. This is viable for some use cases but introduces latency and complexity — and the de-identification itself needs to be defensible.

Inference Isolation

Shared tenancy is the enemy of HIPAA compliance in AI systems. When two healthcare organizations share an inference endpoint, you need ironclad guarantees that Organization A's PHI never appears in Organization B's context, cache, or logs.

Dedicated inference environments per covered entity:

  • Separate compute instances — not just separate API keys on shared infrastructure
  • Isolated model caches — no shared KV cache between tenants
  • Separate logging pipelines — audit trails that can't cross-contaminate
  • Independent scaling — one tenant's load spike doesn't affect another's data isolation

This costs more than multi-tenant deployment. Significantly more. But the alternative is a breach that affects multiple covered entities simultaneously, and that's not a risk profile any healthcare organization should accept.

Audit Trail Architecture

HIPAA requires you to know who accessed what PHI, when, and why. For AI systems, this means logging every inference request that contains PHI, every response that contains PHI, and every retrieval operation that pulls PHI from a knowledge base.

A defensible audit trail includes:

  • Request ID traceable to a specific user and session
  • Timestamp with timezone
  • Classification of PHI elements in the request
  • Classification of PHI elements in the response
  • The access justification (treatment, payment, operations)
  • Retention metadata (when this log entry should be purged)

Store these logs in a dedicated, encrypted, access-controlled system — not your general application logging infrastructure. These logs themselves contain PHI. They need the same protections as the data they're tracking.

BAA Chain Management

This is where most organizations get caught. You have a BAA with AWS. AWS has HIPAA-eligible services. You assume your AI workload is covered.

It's not that simple. A BAA with a cloud provider covers specific listed services. Many AI-specific services — certain managed ML endpoints, serverless inference APIs, newer AI features — may not be on the covered services list. And even when the compute is covered, the model provider's API might not be.

The BAA chain for an AI system typically involves:

  • Cloud infrastructure provider (AWS, Azure, GCP)
  • Model provider (if using a third-party model API)
  • Any SaaS tools in the pipeline (vector databases, monitoring, logging)
  • Data annotation services (if humans are reviewing PHI for training)

Every link in this chain needs BAA coverage. One uncovered link and you have a compliance gap. We've audited systems where the infrastructure had BAA coverage, the model API had BAA coverage, but the vector database running on a third-party managed service did not. That's a violation.

Output Filtering

Model responses can contain PHI even when they shouldn't. A model might reference a patient by name in a summary intended for a different patient's chart. A RAG system might pull in a relevant clinical note that happens to contain another patient's identifiers.

Output filtering requires:

  • Post-inference classification of response content
  • Verification that PHI in the response is authorized for the requesting user
  • Redaction of unauthorized PHI before the response reaches the client
  • Logging of any redaction events for audit purposes

This is computationally expensive. It adds latency. But it's the difference between a system that's compliant by design and one that's compliant by accident.


Common Mistakes We See

From real compliance audits, here are the failures that come up repeatedly:

Using general-purpose AI APIs without BAA coverage. The most common mistake and the most dangerous. If you're sending PHI to an API endpoint that isn't covered by a BAA, you're in violation. Full stop. It doesn't matter that the provider is "trustworthy" or that the data is "only in transit." No BAA, no PHI.

Storing conversation logs with PHI in standard logging infrastructure. Your ELK stack, your Datadog instance, your CloudWatch logs — these are probably not configured for HIPAA compliance. If model inputs and outputs containing PHI flow into these systems, those systems now need to meet HIPAA standards. Most don't.

RAG systems indexing documents with PHI without access controls. We see this constantly: a healthcare organization loads clinical documents into a vector database and gives every user access to the entire index. Patient A's doctor can now retrieve Patient B's records through semantic search, even if the EHR properly restricts direct access. The RAG system becomes a bypass around existing access controls.

Multi-tenant vector databases with inadequate isolation. Namespace separation in a vector database is not the same as tenant isolation. If two tenants share a database instance, similarity search could theoretically surface cross-tenant results depending on the implementation. For PHI workloads, you need physical or cryptographic isolation, not logical separation.

Assuming de-identification is sufficient. HIPAA's Safe Harbor method requires removing 18 specific identifier types. But modern AI can re-identify data that meets Safe Harbor criteria by correlating rare conditions, geographic information, and temporal patterns. "De-identified" data that gets fed into a model capable of re-identification is a compliance risk that many organizations underestimate.


Cloud Provider Reality Check

The major cloud providers all offer HIPAA-eligible services, but the coverage varies significantly for AI-specific workloads.

AWS has the most mature HIPAA story. Amazon Bedrock is on the HIPAA-eligible services list. SageMaker is covered. But not every Bedrock model is automatically covered — you need to verify that the specific model you're using is included and that the model provider has appropriate agreements in place.

Azure covers Azure OpenAI Service under its HIPAA BAA. This is one of the more straightforward paths to using a frontier model with PHI. But the standard OpenAI API (not through Azure) is a different story — verify coverage independently.

Google Cloud covers Vertex AI under its BAA. Similar caveats apply: the specific model and configuration matter.

Anthropic offers a HIPAA-eligible API with BAA for enterprise customers. If you're building on Claude, this is available but requires an enterprise agreement.

The universal caveat: BAA coverage for the infrastructure and API doesn't mean your application is compliant. You still need proper architecture on top of it — all the patterns described above. The BAA covers the provider's responsibilities. Your architecture covers yours.


When to Go On-Premise

There are legitimate scenarios where cloud-based HIPAA compliance isn't sufficient and you need edge AI or local inference:

Real-time clinical decision support where latency matters and network dependencies are unacceptable. An AI system advising during surgery can't depend on a cloud API call completing within 200ms.

Air-gapped environments in research institutions or government healthcare facilities where network connectivity to external services is architecturally prohibited.

Extreme data sensitivity — psychiatric notes, substance abuse records (42 CFR Part 2), HIV status, genetic data — where the organization's risk posture doesn't allow PHI to leave the premises under any circumstances, even with BAA coverage.

Jurisdictional requirements where data sovereignty regulations layer on top of HIPAA. Swiss healthcare data, for example, benefits from Switzerland's data protection framework in addition to any HIPAA requirements for US-connected operations.

On-premise deployment means running your own inference infrastructure. Open-source models (Llama, Mistral) make this feasible. The tradeoff is capability — on-premise models lag behind frontier cloud models. But for many healthcare use cases, a well-fine-tuned smaller model running locally beats a frontier model you can't legally send your data to.

We build custom AI agents for exactly these scenarios — systems that run within your perimeter, process PHI locally, and integrate with your existing clinical workflows.


Getting This Right

HIPAA-compliant AI architecture isn't something you bolt on after deployment. It's a design decision that affects your data pipeline, inference infrastructure, logging, access controls, vendor relationships, and operational procedures.

The organizations that get this right treat compliance as an architectural constraint — like latency or availability — not as a post-hoc audit exercise.

If you're building AI systems that process PHI, or if you're not sure whether your current architecture would survive an OCR audit, that's exactly where we work. We run GDPR and HIPAA compliance assessments, build privacy architectures for regulated industries, and conduct AI safety compliance audits that catch the gaps before a regulator does.


Frequently Asked Questions

Does a BAA with my cloud provider make my AI system HIPAA-compliant?

No. A BAA covers the cloud provider's responsibilities for their eligible services. It doesn't cover your application architecture, your data handling practices, your access controls, or your logging. You need both: provider-level BAA coverage and application-level compliance architecture.

Can I use ChatGPT or Claude directly with patient data?

Not through consumer-facing products. Enterprise versions with BAA agreements are the path — Azure OpenAI Service with a Microsoft BAA, or Anthropic's enterprise API with a BAA. The standard consumer APIs are not HIPAA-covered, and sending PHI to them constitutes a violation.

Is de-identification a viable alternative to full HIPAA architecture?

Sometimes, for specific use cases. But de-identification is harder than most teams think. HIPAA requires either Safe Harbor (removing 18 identifier types) or Expert Determination (a statistician certifying re-identification risk is very small). Modern AI models can re-identify data that passes Safe Harbor criteria. De-identification is a tool, not a substitute for proper architecture.

What happens if our AI system accidentally discloses PHI?

It's a breach. You have 60 days to notify affected individuals, 60 days to notify HHS, and if 500+ individuals are affected, you must notify prominent media outlets. Penalties range from $100 to $50,000 per violation, up to $1.5 million per year per violation category. Architecture that prevents accidental disclosure is significantly cheaper than breach response.

Do RAG systems have special HIPAA considerations?

Yes. A RAG system that indexes documents containing PHI creates a secondary access pathway. Access controls on the RAG retrieval must mirror access controls on the source documents. Semantic search can surface PHI across patient boundaries if the vector database isn't properly isolated. Every retrieval operation involving PHI is a use or disclosure that must be logged and authorized.

Should we run AI models on-premise for HIPAA compliance?

It depends on your risk tolerance and use case. Cloud deployment with proper BAA coverage and architecture is sufficient for most HIPAA workloads. On-premise is necessary when you need air-gapped environments, real-time clinical decision support without network dependencies, or your organizational policy prohibits PHI from leaving the premises regardless of contractual protections.

Need help with AI integration?

Book a free consultation. We'll help you identify real opportunities — not just shiny tools.

Book a Call